Skip to content

Commit

Permalink
Merge pull request lawrence-lee#5 from gamerson/bndtools32RC3
Browse files Browse the repository at this point in the history
bnd 3.2 RC3
  • Loading branch information
gamerson committed May 17, 2016
2 parents e8b22f1 + 9f254dc commit 55f4100
Show file tree
Hide file tree
Showing 19 changed files with 181 additions and 146 deletions.
Binary file modified .gradle-wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions .gradle-wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 30 13:27:43 CST 2015
#Mon May 16 09:48:42 CDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
4 changes: 2 additions & 2 deletions build/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
-releaserepo:

# Main p2 feature
p2_main = \
p2 = \
com.liferay.blade.api,\
com.liferay.blade.cli,\
com.liferay.blade.eclipse.provider,\
com.liferay.blade.gradle,\
com.liferay.blade.upgrade.liferay70

-dependson: ${p2_main}
-dependson: ${p2}
169 changes: 84 additions & 85 deletions build/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ configure(rootProject) {
}

import org.apache.tools.ant.filters.ReplaceTokens

import aQute.bnd.osgi.Jar

/*
* Copy the bundle outputs of the specified projects into a directory
*/
void copyProjectBundles(String[] projs, String dstDir) {
def targetDir = file(dstDir)
if ((!targetDir.exists() && !targetDir.mkdirs()) || !targetDir.isDirectory()) {
throw new GradleException("Could not create directory $targetDir")
throw new GradleException("Could not create directory ${targetDir}")
}
projs.each {
def proj = rootProject.findProject(it)
if (proj == null) {
throw new GradleException("Could not find project " + it)
throw new GradleException("Could not find project ${it}")
}

proj.bnd.project.getSubBuilders()*.getBsn().each { bsn ->
Expand All @@ -58,14 +58,14 @@ ext.bnd_verbose = logger.isEnabled(LogLevel.INFO)
void generateP2Repository(String title, String antTarget, String metadataRepository, String categoryDefinition) {
def javaArgs = []
if (bnd_verbose) {
javaArgs += "-consoleLog"
javaArgs += '-consoleLog'
}
javaArgs += "-application"
javaArgs += '-application'
javaArgs += bnd_eclipseAntRunner
javaArgs += "-data"
javaArgs += '-data'
javaArgs += buildDir
javaArgs += "-buildfile"
javaArgs += "p2.xml"
javaArgs += '-buildfile'
javaArgs += 'p2.xml'
javaArgs += antTarget

def result = javaexec {
Expand All @@ -74,91 +74,94 @@ void generateP2Repository(String title, String antTarget, String metadataReposit
args = javaArgs
}
if (result.exitValue != 0) {
throw new GradleException("Could not publish features and bundles - $title")
throw new GradleException("Could not publish features and bundles - ${title}")
}

javaArgs = []
if (bnd_verbose) {
javaArgs += "-consoleLog"
javaArgs += '-consoleLog'
}
javaArgs += "-application"
javaArgs += '-application'
javaArgs += bnd_eclipseCategoryPublisher
javaArgs += "-data"
javaArgs += '-data'
javaArgs += buildDir
javaArgs += "-metadataRepository"
javaArgs += "file:$buildDir/$metadataRepository"
javaArgs += "-categoryDefinition"
javaArgs += "file:$buildDir/$categoryDefinition"
javaArgs += "-compress"
javaArgs += '-metadataRepository'
javaArgs += "file://${buildDir}/${metadataRepository}"
javaArgs += '-categoryDefinition'
javaArgs += "file://${buildDir}/${categoryDefinition}"
javaArgs += '-compress'

result = javaexec {
classpath = files(bnd_eclipseJar)
main = bnd_eclipseJarMain
args = javaArgs
}
if (result.exitValue != 0) {
throw new GradleException("Could not categorise repository - $title")
throw new GradleException("Could not categorise repository - ${title}")
}

/* Clean up the files Eclipse leaves behind */
fileTree("$bnd_eclipseDirectory").include("configuration/*.log").each {
fileTree(bnd_eclipseDirectory).include('configuration/*.log').each {
it.delete()
}

delete(file("$bnd_eclipseDirectory/configuration/org.eclipse.core.runtime"))
delete(file("$bnd_eclipseDirectory/configuration/org.eclipse.equinox.app" ))
delete(file("$bnd_eclipseDirectory/configuration/org.eclipse.osgi" ))
delete(file("$bnd_eclipseDirectory/p2" ))
delete(file("${bnd_eclipseDirectory}/configuration/org.eclipse.core.runtime"))
delete(file("${bnd_eclipseDirectory}/configuration/org.eclipse.equinox.app" ))
delete(file("${bnd_eclipseDirectory}/configuration/org.eclipse.osgi" ))
delete(file("${bnd_eclipseDirectory}/p2" ))
}


/*
* Setup tasks (p2 features)
*/
task p2FeaturesTree(type: Copy) {
def generateFeatureXmlTokens() {
def masterVersion = String.format('%s.%s-%tY%<tm%<td-%<tH%<tM%<tS-g%.7s',
bnd('base-version'),
bnd('base-version-qualifier'),
new Date(),
bnd('Git-SHA'))
def bundleVersion = String.format('%s.%s',bnd('base-version'),bnd('tstamp'))
from 'feature'
into "$buildDir/features"
filter(ReplaceTokens, tokens: [
'master-version' : masterVersion,
'bundle-version' : bundleVersion
])
include '**/category.xml'
include '**/feature.xml'
}

task p2FeatureMain(type: Zip) {
dependsOn p2FeaturesTree
destinationDir = file("$buildDir/features/main")
archiveName = "com.liferay.blade.tools.feature.jar"
from "$buildDir/features/main/com.liferay.blade.tools"
include "feature.xml"

}

task p2Features {
dependsOn p2FeatureMain
def tokens = ['master-version' : masterVersion, 'base-version' : bnd('base-version')]
def plugins = fileTree("${buildDir}/plugins").getFiles()
plugins.each {
new Jar(it).withCloseable { jar ->
tokens["${jar.getBsn()}-version"] = jar.getVersion()
}
}
tokens
}


task p2PluginsMain(type: Copy) {
/*
* Setup tasks (p2 plugins)
*/
task p2Plugins(type: Copy) {
dependsOn buildNeeded
from zipTree("$buildDir/${project.name}.main.jar")
into "$buildDir/plugins/main"
include "*.jar"
from zipTree("${buildDir}/${project.name}.main.jar")
into "${buildDir}/plugins"
include '*.jar'

doLast {
copyProjectBundles(bnd('p2_main', '').split(/\s*,\s*/), "$buildDir/plugins/main")
copyProjectBundles(bnd('p2', '').split(/\s*,\s*/), "${buildDir}/plugins")
}
}

task p2Plugins {
dependsOn p2PluginsMain
/*
* Setup tasks (p2 features)
*/
task p2FeatureTree(type: Copy) {
dependsOn p2Plugins
from 'feature'
into "${buildDir}/features"
doFirst {
filter(ReplaceTokens, tokens: generateFeatureXmlTokens() )
}
include '**/category.xml'
include '**/feature.xml'
inputs.files file("${buildDir}/plugins")
}

task p2Feature(type: Zip) {
dependsOn p2FeatureTree
destinationDir = file("${buildDir}/features")
archiveName = 'com.liferay.blade.tools.jar'
from "${buildDir}/features/com.liferay.blade.tools"
include 'feature.xml'
}

/*
Expand All @@ -167,70 +170,66 @@ task p2Plugins {
task p2 {
description 'Generate the p2 repositories.'
group 'release'
dependsOn p2Features, p2Plugins
dependsOn p2Plugins, p2Feature

inputs.files file('p2.xml'),
fileTree(buildDir)
.include('p2/**')
.include('features/main/category.xml')
.include('features/category.xml')
outputs.dir "${buildDir}/p2"

doLast {
generateP2Repository("Main", "p2Main", "p2", "features/main/category.xml")
delete("$buildDir/features")
delete("$buildDir/plugins")
generateP2Repository('Blade', 'p2Blade', 'p2', 'features/category.xml')
//delete("${buildDir}/features")
//delete("${buildDir}/plugins")
}
}


task('index') {
task index {
description 'Index the p2 repositories.'
dependsOn p2
group 'release'

/* indexer */
def repoindexJar = file('../cnf/cache/org.osgi.impl.bundle.repoindex.cli.jar')
def repoindexJar = bnd.project.getBundle('org.osgi.impl.bundle.repoindex.cli', 'latest', null, ['strategy':'highest']).getFile()

/* Bundles to index. */
def p2_index_main_bundles = fileTree("$buildDir/p2/plugins") {
def p2_index_bundles = fileTree("${buildDir}/p2/plugins") {
include '**/*.jar'
}

inputs.files p2_index_main_bundles
inputs.files p2_index_bundles

/* Index files */
def p2_index_main = new File("$buildDir/p2/index.xml.gz")
def p2_index = new File("${buildDir}/p2/index.xml.gz")

outputs.files p2_index_main
outputs.files p2_index

doLast {
/* p2 main */
def bundlesToIndex = p2_index_main_bundles*.absolutePath
/* p2 */
def bundlesToIndex = p2_index_bundles*.absolutePath
javaexec {
main = '-jar' // first arg must be the jar
args repoindexJar
args '-r', p2_index_main
args '-d', "$buildDir/p2"
args '-r', p2_index
args '-d', "${buildDir}/p2"
args '-n', 'Blade'
args bundlesToIndex
}.assertNormalExitValue()
logger.info "Generated index ${p2_index_main}."
logger.info 'Generated index {}.', p2_index
}
}


/*
* Setup tasks (distribution)
*/
task distZipMain(type: Zip) {
task dist(type: Zip) {
description 'Create distribution archives containing p2 repository (including R5 index).'
group 'release'
dependsOn index
destinationDir = file(buildDir)
archiveName = "blade-tools-latest.zip"
from "$buildDir/p2"
include "**"
}

task dist {
description 'Create distribution archives containing p2 repositories (including R5 indexes).'
group 'release'
dependsOn index, distZipMain
archiveName = 'blade-tools-latest.zip'
from "${buildDir}/p2"
include '**'
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,42 @@
id="biz.aQute.remote.api"
download-size="0"
install-size="0"
version="0.0.0"
version="@biz.aQute.remote.api-version@"
unpack="false"/>

<plugin
id="com.liferay.blade.api"
download-size="0"
install-size="0"
version="0.0.0"
version="@com.liferay.blade.api-version@"
unpack="false"/>

<plugin
id="com.liferay.blade.gradle.model"
download-size="0"
install-size="0"
version="0.0.0"
version="@com.liferay.blade.gradle.model-version@"
unpack="false"/>

<plugin
id="com.liferay.blade.gradle.plugin"
download-size="0"
install-size="0"
version="0.0.0"
version="@com.liferay.blade.gradle.plugin-version@"
unpack="false"/>

<plugin
id="com.liferay.blade.eclipse.provider"
download-size="0"
install-size="0"
version="0.0.0"
version="@com.liferay.blade.eclipse.provider-version@"
unpack="false"/>

<plugin
id="com.liferay.blade.upgrade.liferay70"
download-size="0"
install-size="0"
version="0.0.0"
version="@com.liferay.blade.upgrade.liferay70-version@"
unpack="false"/>

</feature>
4 changes: 2 additions & 2 deletions build/main.bnd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Only extra bundles that are needed for the main feature are mentioned here
-resourceonly: true
Include-Resource: \
${repo;biz.aQute.remote.api;3.1.0},\
${repo;biz.aQute.repository;3.1.0}
${repo;biz.aQute.remote.api;3.2.0}
7 changes: 3 additions & 4 deletions build/p2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
</target>

<!-- Called by the Eclipse embedded ANT application -->
<target name="p2Main" depends="init">
<target name="p2Blade" depends="init">
<p2.publish.featuresAndBundles
source="${workspacedir}"
repository="file:${target}/p2"
append="false"
repositoryname="Blade"
compress="true">
<features dir="${target}/features/main" includes="*.jar"/>
<bundles dir="${target}/plugins/main" includes="*.jar"/>
<features dir="${target}/features" includes="*.jar"/>
<bundles dir="${target}/plugins" includes="*.jar"/>
</p2.publish.featuresAndBundles>
</target>

</project>
2 changes: 1 addition & 1 deletion cnf/build.bnd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
base-version: 1.0.0
base-version: 1.1.0
base-version-qualifier: DEV

Git-Descriptor: ${system-allow-fail;git describe --dirty --always}
Expand Down
Loading

0 comments on commit 55f4100

Please sign in to comment.