GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — android-client/build.gradle at master · splitio/android-client Expand file tree/ Copy pathbuild.gradleMore file actions 486 lines (411 loc) · 17.6 KB / Copy pathbuild.gradleFile metadata and controls486 lines (411 loc) · 17.6 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 buildscript { repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:9.0.0-rc02' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.2.10' classpath "com.vanniktech:gradle-maven-publish-plugin:0.34.0" } } apply plugin: 'com.android.fused-library' apply plugin: 'com.vanniktech.maven.publish' if (rootProject.name == 'android-client') { apply from: "$projectDir/gradle/jacoco-root.gradle" } else { logger.lifecycle("Skipping android-client root JaCoCo config in nested build: ${rootProject.name}") } ext { splitVersion = '5.5.3' jacocoVersion = '0.8.8' } group = 'io.split.client' version = splitVersion // Centralize repositories and coordinates for all subprojects allprojects { repositories { google() mavenCentral() } } // The SonarQube Gradle plugin is NOT yet compatible with AGP 9.0 // Using CLI scanner wrapper as workaround until plugin is updated // Sonar task that wraps the CLI scanner (uses sonar-project.properties) tasks.register('sonar') { group = 'verification' description = 'Run SonarQube analysis (uses sonar-scanner CLI for AGP 9.0 compatibility)' dependsOn 'jacocoRootReport' doLast { def sonarToken = System.getProperty('sonar.token') ?: project.findProperty('sonar.token') def sonarHost = System.getProperty('sonar.host.url') ?: project.findProperty('sonar.host.url') ?: 'https://sonarcloud.io' def sonarOrg = System.getProperty('sonar.organization') ?: project.findProperty('sonar.organization') if (!sonarToken) { throw new GradleException('SonarQube token required') } // Find sonar-scanner def scannerPath = ['sonar-scanner', '/opt/homebrew/bin/sonar-scanner', '/usr/local/bin/sonar-scanner'] .find { path -> try { def proc = new ProcessBuilder(path, '--version').redirectErrorStream(true).start() return proc.waitFor() == 0 } catch (Exception e) { return false } } if (!scannerPath) { throw new GradleException('sonar-scanner not found. Install with: brew install sonar-scanner') } println "Running sonar-scanner..." def cmd = [scannerPath, "-Dsonar.token=${sonarToken}", "-Dsonar.host.url=${sonarHost}"] if (sonarOrg) cmd.add("-Dsonar.organization=${sonarOrg}") cmd.add("-Dsonar.projectVersion=${splitVersion}") def proc = new ProcessBuilder(cmd).directory(projectDir).inheritIO().start() if (proc.waitFor() != 0) { throw new GradleException("sonar-scanner failed") } } } androidFusedLibrary { namespace = 'io.split.android.android_client' minSdk { version = release(19) } } tasks.configureEach { task -> if (task.name == 'packageLintJar' || task.name.contains('LintJar') || task.name.contains('LintModel')) { task.enabled = false } } // Manually copy the merged consumer proguard file into the AAR afterEvaluate { tasks.named('bundle').configure { doLast { def aarFile = file("${buildDir}/outputs/aar/android-client.aar") def proguardFile = file("${buildDir}/intermediates/merged_consumer_proguard_file/release/mergeReleaseConsumerProguardFiles/proguard.txt") if (aarFile.exists() && proguardFile.exists()) { // Create temp directory to extract AAR def tempDir = file("${buildDir}/tmp/aar-repack") tempDir.deleteDir() tempDir.mkdirs() // Extract AAR copy { from zipTree(aarFile) into tempDir } // Copy proguard.txt copy { from proguardFile into tempDir } // Remove lint.jar if it exists (we don't have custom lint rules) def lintJar = new File(tempDir, 'lint.jar') if (lintJar.exists()) { lintJar.delete() println "Removed empty lint.jar from AAR" } // Repack AAR ant.zip(destfile: aarFile, basedir: tempDir) println "Added consumer ProGuard rules to ${aarFile.name}" } } } } repositories { google() mavenCentral() } dependencies { def resolveProjectPath = { String moduleName -> def nestedPath = (project.path != ':') ? "${project.path}:${moduleName}" : null def candidates = [":${moduleName}", nestedPath].findAll { it != null } return candidates.find { findProject(it) != null } } ['main', 'logger', 'events', 'events-domain', 'api', 'http-api', 'http', 'fallback', 'backoff', 'tracker', 'submitter', 'streaming', 'streaming-support', 'executor'].each { moduleName -> def resolvedPath = resolveProjectPath(moduleName) if (resolvedPath != null) { include project(resolvedPath) } else { logger.lifecycle("Skipping fused include for '${moduleName}' because no matching project path was found.") } } } def javadocSourceProjects = providers.provider { def includeConfig = configurations.findByName("include") if (includeConfig == null) { return [] } includeConfig.allDependencies .withType(org.gradle.api.artifacts.ProjectDependency) .collect { dep -> def projectPath = null if (dep.metaClass.hasProperty(dep, 'dependencyProject')) { projectPath = dep.dependencyProject?.path } else if (dep.metaClass.hasProperty(dep, 'dependencyProjectPath')) { projectPath = dep.dependencyProjectPath } else if (dep.metaClass.hasProperty(dep, 'path')) { projectPath = dep.path } return projectPath ? project(projectPath) : null } .findAll { it != null } } def javadocSourceDirsProvider = providers.provider { files(javadocSourceProjects.get().collect { sourceProject -> def androidExtension = sourceProject.extensions.findByName("android") def sourceDirs = androidExtension?.sourceSets?.main?.java?.srcDirs ?: [] return sourceDirs.findAll { it.exists() } }) } def sourcesJarTask = tasks.register('sourcesJar', Jar) { archiveBaseName = 'android-client' archiveVersion = splitVersion archiveClassifier = 'sources' destinationDirectory = layout.buildDirectory.dir('libs') from(javadocSourceDirsProvider) } tasks.register('javadocJar', Jar) { archiveBaseName = 'android-client' archiveVersion = splitVersion archiveClassifier = 'javadoc' destinationDirectory = layout.buildDirectory.dir('libs') def javadocDir = layout.buildDirectory.dir('intermediates/java_doc_dir/release') from(javadocDir) doFirst { if (!javadocDir.get().asFile.exists()) { throw new GradleException("Javadoc directory not found: ${javadocDir.get().asFile}") } } } afterEvaluate { def agpJavadocTask = tasks.findByName('javaDocRelease') ?: tasks.findByName('javaDocJar') ?: tasks.findByName('javaDoc') if (agpJavadocTask != null) { tasks.named('javadocJar').configure { dependsOn agpJavadocTask } } } def splitPOM = { name = 'Split Android SDK' description = 'Official Split Android SDK' url = 'https://github.com/splitio/android-client' licenses { license { name = 'The Apache License, Version 2.0' url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { id = 'sdks' email = '[email protected]' } } scm { connection = 'scm:git:[email protected]:splitio/android-client.git' developerConnection = 'scm:[email protected]:splitio/android-client.git' url = 'https://github.com/splitio/android-client' } } mavenPublishing { coordinates("io.split.client", "android-client", splitVersion) pom(splitPOM) publishToMavenCentral(false) } // GPG signing task tasks.register('signArtifacts') { description = 'Signs all Maven artifacts with GPG' group = 'publishing' doLast { def groupPath = project.group.toString().replace('.', '/') def artifactId = 'android-client' def versionStr = project.version.toString() def artifactDir = file("${buildDir}/publishing/mavenCentral/${groupPath}/${artifactId}/${versionStr}") println "Signing artifacts in: ${artifactDir}" if (!artifactDir.exists()) { println "WARNING: Artifact directory does not exist: ${artifactDir}" println "Skipping signing. Run publishAllPublicationsToMavenCentralRepository first." return } def keyId = project.findProperty('signing.keyId') def password = project.findProperty('signing.password') if (!keyId) { throw new GradleException("signing.keyId property is not set in gradle.properties") } if (!password) { throw new GradleException("signing.password property is not set in gradle.properties") } println "Using GPG key ID: ${keyId}" println "Using default GPG keyring" def artifactsToSign = [] artifactDir.eachFile { file -> def name = file.name // Sign .aar, .jar, .pom, and .module files if ((name.endsWith('.aar') || name.endsWith('.jar') || name.endsWith('.pom') || name.endsWith('.module')) && !name.endsWith('.asc')) { artifactsToSign << file } } if (artifactsToSign.isEmpty()) { println "WARNING: No artifacts found to sign in ${artifactDir}" return } println "Found ${artifactsToSign.size()} artifact(s) to sign:" artifactsToSign.each { println " - ${it.name}" } def gpgCommand = null def gpgPaths = [ '/opt/homebrew/bin/gpg', // macOS Homebrew on Apple Silicon - try first '/usr/local/bin/gpg', '/usr/bin/gpg', '/opt/local/bin/gpg' // MacPorts ] for (path in gpgPaths) { def gpgFile = new File(path) if (gpgFile.exists() && gpgFile.canExecute()) { gpgCommand = path println "Found GPG at: ${gpgCommand}" break } } if (gpgCommand == null) { try { def process = new ProcessBuilder(['gpg', '--version']) .redirectErrorStream(true) .start() def exitCode = process.waitFor() if (exitCode == 0) { gpgCommand = 'gpg' println "Found GPG in PATH" } } catch (Exception e) { // GPG not in PATH } } if (gpgCommand == null) { throw new GradleException("GPG is not installed or not found in common locations.\n" + "Please install GPG:\n" + " macOS: brew install gnupg\n" + " Linux: apt-get install gnupg or yum install gnupg\n" + "Searched in: ${gpgPaths.join(', ')}\n" + "If GPG is installed elsewhere, you can configure the path in the task.") } println "Using GPG: ${gpgCommand}" artifactsToSign.each { artifact -> def ascFile = new File(artifact.parentFile, "${artifact.name}.asc") // Skip if already signed if (ascFile.exists()) { println "Signature already exists for ${artifact.name}, skipping" return } println "Signing: ${artifact.name}" try { def cmd = [ gpgCommand, '--batch', '--yes', '--no-tty', '--passphrase', password, '--pinentry-mode', 'loopback', '--local-user', keyId, '--detach-sign', '--armor', artifact.absolutePath ] // Set GPG_TTY to avoid agent issues def processEnv = new ProcessBuilder().environment() processEnv.put('GPG_TTY', '') def process = new ProcessBuilder(cmd) .redirectErrorStream(true) .start() def exitCode = process.waitFor() if (exitCode != 0) { def output = process.inputStream.text throw new GradleException("Failed to sign ${artifact.name}. Exit code: ${exitCode}\nOutput: ${output}") } // Verify the signature was created if (!ascFile.exists()) { throw new GradleException("Signature file was not created for ${artifact.name}") } println " ✓ Created signature: ${ascFile.name}" // Verify the signature def verifyCmd = [ gpgCommand, '--verify', ascFile.absolutePath, artifact.absolutePath ] def verifyProcess = new ProcessBuilder(verifyCmd) .redirectErrorStream(true) .start() def verifyExitCode = verifyProcess.waitFor() if (verifyExitCode == 0) { println " ✓ Signature verified successfully" } else { println " ⚠ Warning: Could not verify signature" } } catch (Exception e) { throw new GradleException("Failed to sign artifact ${artifact.name}: ${e.message}", e) } } println "Successfully signed ${artifactsToSign.size()} artifact(s)" } } // Make signArtifacts run after artifacts are published but before upload afterEvaluate { def signTask = tasks.findByName('signArtifacts') def publishTask = tasks.findByName('publishAllPublicationsToMavenCentralRepository') if (signTask && publishTask) { // signArtifacts depends on publishing (so artifacts exist) signTask.dependsOn(publishTask) // Make publish task finalize with signing publishTask.finalizedBy(signTask) println "Configured signArtifacts task to run after publishAllPublicationsToMavenCentralRepository" } } afterEvaluate { // Disable Gradle Module Metadata (.module file) to avoid variant ambiguity tasks.configureEach { task -> // Match tasks related to module metadata generation if (task.name.startsWith('generateMetadataFileFor') || task.name == 'generateModuleMetadata' || task.class.name.endsWith('GenerateModuleMetadata')) { task.enabled = false } } // Remove empty lint.jar from publication to prevent consumer lint crashes // The fused library plugin generates an empty lint.jar without proper Lint-Registry-v2 manifest // This causes lint to crash when consumers use checkDependencies: true publishing.publications.withType(MavenPublication) { publication -> if (publication.name == "maven") { publication.artifact(tasks.named('javadocJar')) publication.artifact(tasks.named('sourcesJar')) publication.artifacts.removeAll { artifact -> artifact.file?.name?.endsWith('lint.jar') ?: false } } } } // Remove duplicate sources JAR artifact before publishing // The vanniktech plugin adds emptySourcesJar while AGP 9.0 also provides one from fusedLibraryComponent // We want to keep the AGP one (merged_sources_jar) which has actual sources // This must be done at task execution time because artifacts are resolved lazily gradle.taskGraph.whenReady { graph -> graph.allTasks.findAll { it.name.startsWith('publishMavenPublication') }.each { publishTask -> publishTask.doFirst { def pub = publication if (pub.name == "maven") { def sourcesJarFile = tasks.named('sourcesJar').get().archiveFile.get().asFile def sourcesArtifacts = pub.artifacts.findAll { it.classifier == "sources" && it.extension == "jar" } sourcesArtifacts.findAll { it.file != null && it.file != sourcesJarFile }.each { artifact -> pub.artifacts.remove(artifact) println "Removed duplicate sources artifact: ${artifact.file?.absolutePath}" } def javadocJarFile = tasks.named('javadocJar').get().archiveFile.get().asFile def javadocArtifacts = pub.artifacts.findAll { it.classifier == "javadoc" && it.extension == "jar" } javadocArtifacts.findAll { it.file != null && it.file != javadocJarFile }.each { artifact -> pub.artifacts.remove(artifact) println "Removed duplicate javadoc artifact: ${artifact.file?.absolutePath}" } } } } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |