• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1description = 'Conscrypt: OpenJdk UberJAR'
2
3ext {
4    buildUberJar = Boolean.parseBoolean(System.getProperty('org.conscrypt.openjdk.buildUberJar', 'false'))
5    uberJarClassifiers = (System.getProperty('org.conscrypt.openjdk.uberJarClassifiers',
6            'osx-x86_64,linux-x86_64,windows-x86,windows-x86_64')).split(',')
7    classesDir = "${buildDir}/classes"
8    resourcesDir = "${buildDir}/resources"
9    sourcesDir = "${buildDir}/sources"
10}
11
12if (buildUberJar) {
13    apply plugin: 'biz.aQute.bnd.builder'
14
15    configurations {
16        uberJar
17    }
18
19    // Point the jar task to the copied classes and resources directories.
20    jar {
21        from classesDir
22        from resourcesDir
23    }
24
25    sourcesJar {
26        from sourcesDir
27    }
28
29    // Add the dependencies for the uber jar.
30    uberJarClassifiers.each { uberJarClassifier ->
31        dependencies.uberJar "${group}:conscrypt-openjdk:${version}:${uberJarClassifier}"
32    }
33
34    /**
35     * Copy the native libraries to the resources directory.
36     */
37    task copySharedLibs(type: Copy, dependsOn: configurations.uberJar) {
38        from {
39            configurations.uberJar.collect {
40                zipTree(it)
41            }
42        }
43        include '/META-INF/native/**'
44        into file(resourcesDir)
45    }
46    jar.dependsOn copySharedLibs
47
48    /**
49     * Copy the object files to the classes directory.
50     */
51    task copyClasses(type: Copy, dependsOn: configurations.uberJar) {
52        from {
53            configurations.uberJar.collect {
54                zipTree(it)
55            }
56        }
57        exclude '/META-INF/**'
58        into file(classesDir)
59    }
60    jar.dependsOn copyClasses
61
62    task copySources(type: Copy, dependsOn: ":conscrypt-openjdk:sourcesJar") {
63        from {
64            project(":conscrypt-openjdk").sourceSets.main.java
65        }
66        into file(sourcesDir)
67    }
68    sourcesJar.dependsOn copySources
69
70    // Note that this assumes that the version of BoringSSL for each
71    // artifact exactly matches the one on the current system.
72    jar.manifest {
73        attributes ('BoringSSL-Version': boringSslVersion,
74                    'Automatic-Module-Name': 'org.conscrypt',
75                    'Bundle-SymbolicName': 'org.conscrypt',
76                    '-exportcontents': 'org.conscrypt.*')
77    }
78
79    apply from: "$rootDir/gradle/publishing.gradle"
80    publishing.publications.maven {
81        artifact sourcesJar
82        artifact javadocJar
83        artifact jar
84    }
85} else {
86    // Not building an uber jar - disable all tasks.
87    tasks.collect {
88        it.enabled = false
89    }
90}
91