8000 Update BND plugin to 6.0.0 (#2440) · mockito/mockito@d4180a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit d4180a2

Browse files
authored
Update BND plugin to 6.0.0 (#2440)
We use the new bundle extension for bnd configuration. We also update the verifyOSGi task to use the new output property to enable up-to-date builds. Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
1 parent 7032574 commit d4180a2

File tree

4 files changed

+42
-42
lines changed

4 files changed

+42
-42
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ plugins {
2323
id 'com.diffplug.gradle.spotless' version '4.5.1'
2424
id 'eclipse'
2525
id 'com.github.ben-manes.versions' version '0.39.0'
26-
id 'biz.aQute.bnd.builder' version '5.3.0'
26+
id 'biz.aQute.bnd.builder' version '6.0.0'
2727
id 'ru.vyarus.animalsniffer' version '1.5.2'
2828
}
2929

gradle/dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ libraries.objenesis = 'org.objenesis:objenesis:3.2'
3030

3131
libraries.osgi = 'org.osgi:osgi.core:8.0.0'
3232
libraries.equinox = 'org.eclipse.platform:org.eclipse.osgi:3.17.0'
33-
libraries.bndGradle = 'biz.aQute.bnd:biz.aQute.bnd.gradle:5.3.0'
33+
libraries.bndGradle = 'biz.aQute.bnd:biz.aQute.bnd.gradle:6.0.0'
3434

3535
libraries.groovy = 'org.codehaus.groovy:groovy:3.0.9'
3636

gradle/mockito-core/osgi.gradle

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@ apply plugin: 'biz.aQute.bnd.builder'
22

33
jar {
44
classpath = project.configurations.compileClasspath
5-
bnd(
6-
'Bundle-Name': 'Mockito Mock Library for Java. Core bundle requires Byte Buddy and Objenesis.',
7-
'Bundle-SymbolicName': 'org.mockito.mockito-core',
8-
'Bundle-Version': "\${version_cleanup;${project.version}}",
9-
'-versionpolicy': '[${version;==;${@}},${version;+;${@}})',
10-
'Export-Package': "org.mockito.internal.*;status=INTERNAL;mandatory:=status;version=${version},org.mockito.*;version=${version}",
11-
'Import-Package': [
12-
'net.bytebuddy.*;version="[1.6.0,2.0)"',
13-
'junit.*;resolution:=optional',
14-
'org.junit.*;resolution:=optional',
15-
'org.hamcrest;resolution:=optional',
16-
'org.objenesis;version="[3.1,4.0)"',
17-
'org.opentest4j.*;resolution:=optional',
18-
'org.mockito.*'
19-
].join(','),
20-
'-removeheaders': 'Private-Package',
21-
'Automatic-Module-Name': 'org.mockito',
22-
'-noextraheaders': 'true'
23-
)
5+
bundle {
6+
bnd(
7+
'Bundle-Name': 'Mockito Mock Library for Java. Core bundle requires Byte Buddy and Objenesis.',
8+
'Bundle-SymbolicName': 'org.mockito.mockito-core',
9+
'Bundle-Version': "\${version_cleanup;${project.version}}",
10+
'-versionpolicy': '[${version;==;${@}},${version;+;${@}})',
11+
'Export-Package': "org.mockito.internal.*;status=INTERNAL;mandatory:=status;version=${version},org.mockito.*;version=${version}",
12+
'Import-Package': [
13+
'net.bytebuddy.*;version="[1.6.0,2.0)"',
14+
'junit.*;resolution:=optional',
15+
'org.junit.*;resolution:=optional',
16+
'org.hamcrest;resolution:=optional',
17+
'org.objenesis;version="[3.1,4.0)"',
18+
'org.opentest4j.*;resolution:=optional',
19+
'org.mockito.*'
20+
].join(','),
21+
'-removeheaders': 'Private-Package',
22+
'Automatic-Module-Name': 'org.mockito',
23+
'-noextraheaders': 'true'
24+
)
25+
}
2426
}
Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import aQute.bnd.gradle.BundleTaskConvention
2-
import aQute.bnd.gradle.FileSetRepositoryConvention
31
import aQute.bnd.gradle.Resolve
42

53
description = "Mockito JUnit 5 support"
@@ -21,26 +19,26 @@ tasks.withType(Test) {
2119

2220
jar {
2321
classpath = project.configurations.runtimeClasspath
24-
bnd(
25-
'Bundle-Name': 'Mockito Extension Library for JUnit 5.',
26-
'Bundle-SymbolicName': 'org.mockito.junit-jupiter',
27-
'Bundle-Version': "\${version_cleanup;${project.version}}",
28-
'-versionpolicy': '[${version;==;${@}},${version;+;${@}})',
29-
'Export-Package': "org.mockito.junit.jupiter.*;version=${version}",
30-
'-removeheaders': 'Private-Package',
31-
'Automatic-Module-Name': 'org.mockito.junit.jupiter',
32-
'-noextraheaders': 'true',
33-
'-export-apiguardian': 'org.mockito.internal.*'
34-
)
22+
bundle {
23+
bnd(
24+
'Bundle-Name': 'Mockito Extension Library for JUnit 5.',
25+
'Bundle-SymbolicName': 'org.mockito.junit-jupiter',
26+
'Bundle-Version': "\${version_cleanup;${project.version}}",
27+
'-versionpolicy': '[${version;==;${@}},${version;+;${@}})',
28+
'Export-Package': "org.mockito.junit.jupiter.*;version=${version}",
29+
'-removeheaders': 'Private-Package',
30+
'Automatic-Module-Name': 'org.mockito.junit.jupiter',
31+
'-noextraheaders': 'true',
32+
'-export-apiguardian': 'org.mockito.internal.*'
33+
)
34+
}
3535
}
3636

37-
def osgiPropertiesFile = file("$buildDir/verifyOSGiProperties.bndrun")
38-
3937
// Bnd's Resolve task uses a properties file for its configuration. This
4038
// task writes out the properties necessary for it to verify the OSGi
4139
// metadata.
42-
tasks.register('osgiProperties', WriteProperties) {
43-
outputFile = osgiPropertiesFile
40+
def osgiProperties = tasks.register('osgiProperties', WriteProperties) {
41+
outputFile = layout.getBuildDirectory().file("verifyOSGiProperties.bndrun")
4442
property('-standalone', true)
4543
property('-runee', "JavaSE-${targetCompatibility}")
4644
property('-runrequires', 'osgi.identity;filter:="(osgi.identity=org.mockito.junit-jupiter)"')
@@ -49,12 +47,12 @@ tasks.register('osgiProperties', WriteProperties) {
4947
// Bnd's Resolve task is what verifies that a jar can be used in OSGi and
5048
// that its metadata is valid. If the metadata is invalid this task will
5149
// fail.
52-
tasks.register('verifyOSGi', Resolve) {
53-
dependsOn(osgiProperties)
54-
setBndrun(osgiPropertiesFile)
50+
def verifyOSGi = tasks.register('verifyOSGi', Resolve) {
51+
getBndrun().fileProvider(osgiProperties.map { it.outputFile })
52+
getOutputBndrun().set(layout.getBuildDirectory().file("resolvedOSGiProperties.bndrun"))
5553
reportOptional = false
5654
}
5755

58-
tasks.check {
56+
tasks.named('check') {
5957
dependsOn(verifyOSGi)
6058
}

0 commit comments

Comments
 (0)
0