plugins { id "base" id "signing" id "com.diffplug.spotless" version "6.20.0" id "io.github.gradle-nexus.publish-plugin" version "1.3.0" } allprojects { version = "0.56.1" group = "org.signal" } subprojects { if (JavaVersion.current().isJava8Compatible()) { allprojects { tasks.withType(Javadoc) { options.encoding = 'UTF-8' options.addStringOption('Xdoclint:none', '-quiet') } } } allprojects { tasks.withType(JavaCompile) { options.encoding = 'UTF-8' options.compilerArgs += ["-Xlint:deprecation", "-Xlint:fallthrough", "-Xlint:unchecked"] } tasks.withType(AbstractArchiveTask) { preserveFileTimestamps = false reproducibleFileOrder = true } } apply plugin: "com.diffplug.spotless" spotless { java { target('**/*.java') targetExclude('**/Native.java', '**/NativeTesting.java') importOrder() removeUnusedImports() googleJavaFormat() formatAnnotations() licenseHeaderFile rootProject.file('license_header.txt') } } } task makeJniLibrariesDesktop(type:Exec) { group 'Rust' description 'Build the JNI libraries' def debugLevelLogsFlag = hasProperty('debugLevelLogs') ? ['--debug-level-logs'] : [] // Explicitly specify 'bash' for Windows compatibility. commandLine 'bash', './build_jni.sh', *debugLevelLogsFlag, 'desktop' } task makeJniLibrariesServer(type:Exec) { group 'Rust' description 'Build the JNI libraries' def debugLevelLogsFlag = hasProperty('debugLevelLogs') ? ['--debug-level-logs'] : [] def target = project.hasProperty('crossCompileServer') ? 'server-all' : 'server' commandLine 'bash', './build_jni.sh', *debugLevelLogsFlag, target } task cargoClean(type:Exec) { group 'Rust' commandLine 'cargo', 'clean' } task cleanJni(type: Delete) { description 'Clean JNI libs' delete fileTree('./android/src/main/jniLibs') { include '**/*.so' } delete fileTree('./client/src/main/resources') { include '**/*.so' include '**/*.dylib' include '**/*.dll' } delete fileTree('./server/src/main/resources') { include '**/*.so' include '**/*.dylib' include '**/*.dll' } } clean.dependsOn([cargoClean, cleanJni]) // PUBLISHING ext.setUpSigningKey = { signingExt -> def signingKeyId = findProperty("signingKeyId") def signingKey = findProperty("signingKey") def signingPassword = findProperty("signingPassword") if (signingKeyId && signingKey && signingPassword) { signingExt.useInMemoryPgpKeys(signingKeyId.trim(), signingKey.trim(), signingPassword.trim()) } } nexusPublishing { repositories { sonatype { username = project.findProperty('sonatypeUsername') ?: "" password = project.findProperty('sonatypePassword') ?: "" } } } def isReleaseBuild() { return version.contains("SNAPSHOT") == false }