@@ -31,7 +31,6 @@ buildscript {
31
31
dependencies { classpath ' org.netbeans.tools:sigtest-maven-plugin:1.5' }
32
32
}
33
33
34
- plugins { id ' biz.aQute.bnd.builder' version ' 6.4.0' apply false }
35
34
plugins { id ' com.github.sherter.google-java-format' version ' 0.9' apply false }
36
35
plugins { id ' me.champeau.jmh' version ' 0.6.8' apply false }
37
36
plugins { id ' org.sonarqube' version ' 3.5.0.2730' apply false }
@@ -61,8 +60,12 @@ subprojects {
61
60
ext. provides = [] // The provided java packages, e.g. ['org.objectweb.asm']
62
61
ext. requires = [] // The required Gradle projects, e.g. [':asm-test']
63
62
ext. transitiveRequires = { ->
64
- return requires. collect{p ->
65
- project(p). transitiveRequires(). plus(project(p). provides[0 ])}. flatten()
63
+ return requires. collect{project(it)}
64
+ .collect{it. transitiveRequires(). plus(it. provides[0 ])}. flatten() as Set
65
+ }
66
+ ext. transitiveImports = { ->
67
+ return requires. collect{project(it)}
68
+ .collect{it. transitiveImports(). plus(it. provides)}. flatten() as Set
66
69
}
67
70
ext. depends = [] // The external dependencies, e.g. ['junit:junit:4.12']
68
71
// Some external dependencies (such as Jacoco) depend transitively on ASM, and
@@ -136,7 +139,7 @@ project(':benchmarks') {
136
139
dependencies. add(" asm${ version} " , " org.ow2.asm:asm:${ version} @jar" )
137
140
dependencies. add(" asm${ version} " , " org.ow2.asm:asm-tree:${ version} @jar" )
138
141
task " asm${ version} " (type : Copy ) {
139
- from configurations. " asm${ version} " . collect { zipTree(it) }
142
+ from configurations. " asm${ version} " . collect{ zipTree(it)}
140
143
into " ${ buildDir} /asm${ version} "
141
144
duplicatesStrategy = DuplicatesStrategy . INCLUDE // module-info.class
142
145
}
@@ -145,7 +148,7 @@ project(':benchmarks') {
145
148
configurations. create(' input-classes-java8' )
146
149
dependencies. add(' input-classes-java8' , ' io.vavr:vavr:0.10.0@jar' )
147
150
task copyInputClasses(type : Copy ) {
148
- from configurations. ' input-classes-java8' . collect { zipTree(it) }
151
+ from configurations. ' input-classes-java8' . collect{ zipTree(it)}
149
152
into " ${ buildDir} /input-classes-java8"
150
153
}
151
154
classes. dependsOn copyInputClasses
@@ -215,7 +218,7 @@ subprojects {
215
218
// Configure the projects with a non-empty 'provides' property. They must be
216
219
// checked for code coverage and backward compatibility, retrofited to Java 1.5,
217
220
// and packaged with generated module-info classes.
218
- configure(subprojects. findAll { it. provides }) {
221
+ configure(subprojects. findAll{ it. provides}) {
219
222
// Code coverage configuration.
220
223
jacoco. toolVersion = ' 0.8.8'
221
224
jacocoTestReport {
@@ -238,8 +241,9 @@ configure(subprojects.findAll { it.provides }) {
238
241
def retrofitter =
239
242
loader. loadClass(' org.objectweb.asm.tools.Retrofitter' ). newInstance()
240
243
def classes = sourceSets. main. output. classesDirs. singleFile
244
+ def requires = transitiveRequires() as List
241
245
retrofitter. retrofit(classes, " ${ version} " )
242
- retrofitter. verify(classes, " ${ version} " , provides, transitiveRequires() )
246
+ retrofitter. verify(classes, " ${ version} " , provides, requires )
243
247
}
244
248
}
245
249
@@ -281,31 +285,31 @@ configure(subprojects.findAll { it.provides }) {
281
285
}
10000
code>
282
286
}
283
287
284
- // Apply the biz.aQute.bnd plugin to package the project as an OSGi bundle.
285
- // Exclude the asm-test project (the DefaultPackage class prevents it from
286
- // being a proper bundle).
288
+ jar. manifest. attributes(
289
+ ' Implementation-Title' : project. description,
290
+ ' Implementation-Version' : " ${ version} " )
291
+ // Package the project as an OSGi bundle. Exclude the asm-test project (the
292
+ // DefaultPackage class prevents it from being a proper bundle).
287
293
if (name != ' asm-test' ) {
288
- apply plugin : ' biz.aQute.bnd.builder '
294
+ def imports = transitiveImports()
289
295
jar. manifest. attributes(
290
- ' -classpath' : sourceSets. main. output. classesDirs. asPath,
291
- ' -removeheaders' : ' Bnd-LastModified,Build-By,Created-By,Include-Resource,\
292
- Require-Capability,Tool' ,
293
- ' Bundle-License' : ' BSD-3-Clause;link=https://asm.ow2.io/LICENSE.txt' ,
294
296
' Bundle-DocURL' : ' http://asm.ow2.org' ,
297
+ ' Bundle-License' : ' BSD-3-Clause;link=https://asm.ow2.io/LICENSE.txt' ,
298
+ ' Bundle-ManifestVersion' : 2 ,
299
+ ' Bundle-Name' : provides[0 ],
295
300
' Bundle-RequiredExecutionEnvironment' : ' J2SE-1.5' ,
296
301
' Bundle-SymbolicName' : provides[0 ],
297
- ' Export-Package' : provides. collect{" ${ it} ;version=${ version} " }. join(' ,' ),
298
- ' Implementation-Title' : project. description,
299
- ' Implementation-Version' : " ${ version} " ,
300
- ' Module-Requires' :
301
- requires
302
- .collect{" ${ project(it).provides[0]} ;transitive=true" }
303
- .join(' ,' )
304
- )
305
- } else {
306
- jar. manifest. attributes(
307
- ' Implementation-Title' : project. description,
308
- ' Implementation-Version' : " ${ version} " )
302
+ ' Bundle-Version' : " ${ version} " ,
303
+ ' Export-Package' :
304
+ provides. collect{" ${ it} ;version=\" ${ version} \" " }. join(' ,' ) +
305
+ (imports ? " ;uses:=\" ${ imports.join(',')} \" " : " " ))
306
+ if (imports) {
307
+ jar. manifest. attributes(
308
+ ' Import-Package' :
309
+ imports. collect{" ${ it} ;version=\" ${ version} \" " }. join(' ,' ),
310
+ ' Module-Requires' :
311
+ transitiveRequires(). collect{" ${ it} ;transitive=true" }. join(' ,' ))
312
+ }
309
313
}
310
314
311
315
// Apply the SonarQube plugin to monitor the code quality of the project.
0 commit comments