Skip to content

Commit

Permalink
gradle: Use bnd version of build for biz.aQute.junit version in test
Browse files Browse the repository at this point in the history
This is necessary for next to use the associated version of
biz.aQute.junit for the version of bnd being built.

Signed-off-by: BJ Hargrave <[email protected]>
  • Loading branch information
bjhargrave committed Mar 4, 2019
1 parent 72b1081 commit 1aee879
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
6 changes: 5 additions & 1 deletion biz.aQute.bnd.gradle/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Set javac settings from JDT prefs
-include: ${workspace}/cnf/includes/jdt.bnd
# Include the gradle.properties to get the value of bnd_plugin which is used
# for the bnd_version for the test cases.
-include: ${workspace}/cnf/includes/jdt.bnd, ${workspace}/gradle.properties

-dependson: biz.aQute.bnd.embedded-repo

Expand All @@ -22,6 +24,8 @@ Bundle-Description: The bnd gradle plugin.

pluginClasspath: ${p-buildpath;\\${pathseparator}}

bnd_version: ${replace;${bnd_plugin};.*:(.*);$1}

-includeresource: \
OSGI-OPT/src=src, \
resources, \
Expand Down
1 change: 1 addition & 0 deletions biz.aQute.bnd.gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ if (JavaVersion.current().isJava9Compatible()) {

tasks.named('test') {
dependsOn 'jar'
systemProperty 'bnd_version', bnd('bnd_version')
File source = project.file('testresources')
File target = new File(project.buildDir, 'testresources')
doFirst { // copy test resources into build dir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class TestTestOSGiTask extends Specification {

File buildDir = new File('generated')
File testResources = new File(buildDir, 'testresources')
String bnd_version = System.properties['bnd_version']

def "Bnd TestOSGi Task Basic Test"() {
given:
Expand All @@ -23,7 +24,7 @@ class TestTestOSGiTask extends Specification {
when:
def result = TestHelper.getGradleRunner()
.withProjectDir(testProjectDir)
.withArguments('--stacktrace', '--debug', 'build')
.withArguments("-Pbnd_version=${bnd_version}", '--stacktrace', '--debug', 'build')
.withPluginClasspath()
.forwardOutput()
.build()
Expand Down Expand Up @@ -96,7 +97,7 @@ class TestTestOSGiTask extends Specification {
when:
def result = TestHelper.getGradleRunner()
.withProjectDir(testProjectDir)
.withArguments('--stacktrace', '--debug', 'build')
.withArguments("-Pbnd_version=${bnd_version}", '--stacktrace', '--debug', 'build')
.withPluginClasspath()
.forwardOutput()
.build()
Expand Down Expand Up @@ -145,7 +146,7 @@ class TestTestOSGiTask extends Specification {
when:
def result = TestHelper.getGradleRunner()
.withProjectDir(testProjectDir)
.withArguments('--stacktrace', '--debug', 'build')
.withArguments("-Pbnd_version=${bnd_version}", '--stacktrace', '--debug', 'build')
.withPluginClasspath()
.forwardOutput()
.build()
Expand Down Expand Up @@ -192,7 +193,7 @@ class TestTestOSGiTask extends Specification {
when:
def result = TestHelper.getGradleRunner()
.withProjectDir(testProjectDir)
.withArguments('--stacktrace', '--debug', '--continue', 'build')
.withArguments("-Pbnd_version=${bnd_version}", '--stacktrace', '--debug', '--continue', 'build')
.withPluginClasspath()
.forwardOutput()
.buildAndFail()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories {
}

dependencies {
compile 'biz.aQute.bnd:biz.aQute.junit:+'
compile "biz.aQute.bnd:biz.aQute.junit:${bnd_version}"
runtime 'org.eclipse.platform:org.eclipse.osgi:3.13.0'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ configurations {
}

dependencies {
compile 'biz.aQute.bnd:biz.aQute.junit:+'
compile "biz.aQute.bnd:biz.aQute.junit:${bnd_version}"
framework 'org.eclipse.platform:org.eclipse.osgi:3.13.0'
}

Expand Down
4 changes: 2 additions & 2 deletions biz.aQute.bnd.gradle/testresources/testosgitask3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ configurations {
}

dependencies {
compile 'biz.aQute.bnd:biz.aQute.junit:+'
bundles 'biz.aQute.bnd:biz.aQute.junit:+'
compile "biz.aQute.bnd:biz.aQute.junit:${bnd_version}"
bundles "biz.aQute.bnd:biz.aQute.junit:${bnd_version}"
bundles 'org.eclipse.platform:org.eclipse.osgi:3.13.0'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories {
}

dependencies {
compile 'biz.aQute.bnd:biz.aQute.junit:+'
compile "biz.aQute.bnd:biz.aQute.junit:${bnd_version}"
runtime 'org.eclipse.platform:org.eclipse.osgi:3.13.0'
}

Expand Down

0 comments on commit 1aee879

Please sign in to comment.