description = 'Conscrypt: OpenJdk UberJAR' ext { buildUberJar = Boolean.parseBoolean(System.getProperty('org.conscrypt.openjdk.buildUberJar', 'false')) uberJarClassifiers = (System.getProperty('org.conscrypt.openjdk.uberJarClassifiers', 'osx-x86_64,linux-x86_64,windows-x86,windows-x86_64')).split(',') classesDir = "${buildDir}/classes" resourcesDir = "${buildDir}/resources" sourcesDir = "${buildDir}/sources" } if (buildUberJar) { apply plugin: 'biz.aQute.bnd.builder' configurations { uberJar } // Point the jar task to the copied classes and resources directories. jar { from classesDir from resourcesDir } sourcesJar { from sourcesDir } // Add the dependencies for the uber jar. uberJarClassifiers.each { uberJarClassifier -> dependencies.uberJar "${group}:conscrypt-openjdk:${version}:${uberJarClassifier}" } /** * Copy the native libraries to the resources directory. */ def copySharedLibs = tasks.register("copySharedLibs", Copy) { dependsOn configurations.uberJar from { configurations.uberJar.collect { zipTree(it) } } include '/META-INF/native/**' into file(resourcesDir) } tasks.named("jar").configure { dependsOn copySharedLibs } /** * Copy the object files to the classes directory. */ def copyClasses = tasks.register("copyClasses", Copy) { dependsOn configurations.uberJar from { configurations.uberJar.collect { zipTree(it) } } exclude '/META-INF/**' into file(classesDir) } tasks.named("jar").configure { dependsOn copyClasses } def copySources = tasks.register("copySources", Copy) { dependsOn ":conscrypt-openjdk:sourcesJar" from { project(":conscrypt-openjdk").sourceSets.main.java } into file(sourcesDir) } tasks.named("sourcesJar").configure { dependsOn copySources } // Note that this assumes that the version of BoringSSL for each // artifact exactly matches the one on the current system. jar.manifest { attributes ('BoringSSL-Version': boringSslVersion, 'Automatic-Module-Name': 'org.conscrypt', 'Bundle-SymbolicName': 'org.conscrypt', '-exportcontents': 'org.conscrypt.*') } apply from: "$rootDir/gradle/publishing.gradle" publishing.publications.maven { artifact sourcesJar artifact javadocJar artifact jar } } else { // Not building an uber jar - disable all tasks. tasks.configureEach { it.enabled = false } }