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} 10 11if (buildUberJar) { 12 configurations { 13 uberJar 14 } 15 16 // Point the jar task to the copied classes and resources directories. 17 jar { 18 from classesDir 19 from resourcesDir 20 } 21 22 // Add the dependencies for the uber jar. 23 uberJarClassifiers.each { uberJarClassifier -> 24 dependencies.uberJar "${group}:conscrypt-openjdk:${version}:${uberJarClassifier}" 25 } 26 27 /** 28 * Copy the native libraries to the resources directory. 29 */ 30 task copySharedLibs(type: Copy, dependsOn: configurations.uberJar) { 31 from { 32 configurations.uberJar.collect { 33 zipTree(it) 34 } 35 } 36 include '/META-INF/native/**' 37 into file(resourcesDir) 38 } 39 jar.dependsOn copySharedLibs 40 41 /** 42 * Copy the object files to the classes directory. 43 */ 44 task copyClasses(type: Copy, dependsOn: configurations.uberJar) { 45 from { 46 configurations.uberJar.collect { 47 zipTree(it) 48 } 49 } 50 exclude '/META-INF/**' 51 into file(classesDir) 52 } 53 jar.dependsOn copyClasses 54 55 // Append the BoringSSL-Version to the manifest. Note that this assumes that the 56 // version of BoringSSL for each artifact exactly matches the one on the 57 // current system. 58 jar.manifest { 59 attributes 'BoringSSL-Version': boringSslVersion 60 } 61} else { 62 // Not building an uber jar - disable all tasks. 63 tasks.collect { 64 it.enabled = false 65 } 66} 67 68