Skip to content

Commit b6eb501

Browse files
committed
Clean up build.gradle
1 parent 1e0c0a1 commit b6eb501

File tree

1 file changed

+3
-61
lines changed

1 file changed

+3
-61
lines changed

build.gradle

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ buildscript {
88
}
99

1010
dependencies {
11-
// AGP 9.0.0-alpha13 requires Gradle 9.0 and has a new minSdk API, but builds hang
12-
// Staying with stable AGP 8.9.1 for now
13-
// classpath 'com.android.tools.build:gradle:8.9.1'
1411
classpath 'com.android.tools.build:gradle:9.0.0-alpha13'
1512
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0'
1613
classpath "com.vanniktech:gradle-maven-publish-plugin:0.34.0"
@@ -20,9 +17,6 @@ buildscript {
2017
apply plugin: 'com.android.fused-library'
2118
apply plugin: 'com.vanniktech.maven.publish'
2219

23-
// spec.gradle and jacoco.gradle removed - not compatible with fused library
24-
// Note: Signing plugin applied conditionally to avoid conflicts with fused-library plugin
25-
2620
group = 'io.split.client'
2721

2822
ext {
@@ -45,7 +39,6 @@ def coverageExclusions = [
4539
androidFusedLibrary {
4640
namespace = 'io.split.android.android_client'
4741
minSdk { version = release(19) }
48-
// Note: AGP 9.0.0-alpha13 uses new API: minSdk { version = release(19) }
4942
}
5043

5144
// Workaround: Fused library plugin doesn't include consumer ProGuard files in AAR
@@ -88,40 +81,6 @@ repositories {
8881
mavenCentral()
8982
}
9083

91-
// Task to generate deps.txt with dependency tree
92-
tasks.register('generateDepsFile') {
93-
description = 'Generates deps.txt file with the dependency tree'
94-
group = 'documentation'
95-
96-
doLast {
97-
def depsFile = file("${projectDir}/deps.txt")
98-
def output = new StringBuilder()
99-
100-
output.append("------------------------------------------------------------\n")
101-
output.append("Project '${project.path}'\n")
102-
output.append("------------------------------------------------------------\n\n")
103-
104-
// For fused library, get dependencies from the included modules
105-
output.append("Fused Library Dependencies (from included modules)\n")
106-
output.append("=".repeat(60) + "\n\n")
107-
108-
// Get dependencies from main
109-
def mainProject = project(':main')
110-
def config = mainProject.configurations.findByName('releaseRuntimeClasspath')
111-
112-
if (config != null) {
113-
output.append("releaseRuntimeClasspath - Runtime classpath of compilation 'release' (target (androidJvm)).\n")
114-
config.resolvedConfiguration.firstLevelModuleDependencies.each { dep ->
115-
output.append("+--- ${dep.moduleGroup}:${dep.moduleName}:${dep.moduleVersion}\n")
116-
printDependencyTree(dep, output, "| ", true)
117-
}
118-
}
119-
120-
depsFile.text = output.toString()
121-
println "Generated deps.txt at ${depsFile.absolutePath}"
122-
}
123-
}
124-
12584
void printDependencyTree(dependency, output, prefix, isLast) {
12685
dependency.children.eachWithIndex { child, index ->
12786
def isLastChild = (index == dependency.children.size() - 1)
@@ -167,21 +126,15 @@ def splitPOM = {
167126
}
168127
}
169128

170-
// Note: sourcesJar and javadocJar tasks removed - fused library has no source sets
171-
// Tests are now in submodules
172-
173129
// Configure maven publish plugin - similar to old build.gradle but adapted for fused library
174130
// The plugin should auto-detect Android Fused Library, but we configure coordinates and POM
175131
mavenPublishing {
176132
coordinates("io.split.client", "android-client", splitVersion)
177133
pom(splitPOM)
178134
publishToMavenCentral(false)
179-
// Note: Plugin auto-detects AndroidFusedLibrary
180-
// For AGP 9.0.0-alpha9+, fusedLibraryComponent already includes sources,
181-
// but the plugin might still add emptySourcesJar, causing a conflict
182135
}
183136

184-
// Manual GPG signing task - Gradle signing plugin doesn't work with fused library
137+
// GPG signing task
185138
tasks.register('signArtifacts') {
186139
description = 'Signs all Maven artifacts with GPG'
187140
group = 'publishing'
@@ -220,7 +173,7 @@ tasks.register('signArtifacts') {
220173
def artifactsToSign = []
221174
artifactDir.eachFile { file ->
222175
def name = file.name
223-
// Sign .aar, .jar, .pom, and .module files, but skip already signed .asc files
176+
// Sign .aar, .jar, .pom, and .module files
224177
if ((name.endsWith('.aar') || name.endsWith('.jar') || name.endsWith('.pom') || name.endsWith('.module')) && !name.endsWith('.asc')) {
225178
artifactsToSign << file
226179
}
@@ -293,8 +246,6 @@ tasks.register('signArtifacts') {
293246
println "Signing: ${artifact.name}"
294247

295248
try {
296-
// Use ProcessBuilder for GPG execution (avoids Gradle exec issues)
297-
// Note: Using default GPG keyring (GPG 2.1+ ignores --keyring option)
298249
def cmd = [
299250
gpgCommand,
300251
'--batch',
@@ -376,21 +327,13 @@ afterEvaluate {
376327
}
377328
}
378329

379-
// Workaround: For AGP 9.0.0-alpha9+, fusedLibraryComponent already includes sources
380-
// The maven publish plugin should not add emptySourcesJar for AGP >= alpha9,
381-
// but if it does, we need to prevent the duplicate. The issue is that the plugin
382-
// condition checks CURRENT_AGP_VERSION < AndroidPluginVersion(9, 0, 0).alpha(9),
383-
// but for AGP 9.0.0-alpha13, this should be false, so withJavaSourcesJar shouldn't be called.
384-
// However, if emptySourcesJar is still being created, we'll suppress publication of duplicate artifacts.
385330
afterEvaluate {
386331
// Check if we have both merged sources and empty sources
387332
def emptySourcesJarTask = tasks.findByName("emptySourcesJar")
388333
if (emptySourcesJarTask != null) {
389-
// The plugin shouldn't have created this for AGP >= alpha9, but if it did,
390-
// we need to ensure only one sources artifact is published
334+
// Ensure only one sources artifact is published
391335
publishing.publications.withType(MavenPublication) { publication ->
392336
if (publication.name == "maven") {
393-
// Suppress the emptySourcesJar from being published
394337
// Keep only the sources from fusedLibraryComponent
395338
publication.artifacts.removeAll { artifact ->
396339
// Remove artifacts that match the emptySourcesJar task output
@@ -400,7 +343,6 @@ afterEvaluate {
400343
def emptySourcesFile = emptySourcesJarTask.archiveFile.get().asFile
401344
artifactFile == emptySourcesFile
402345
} else {
403-
// If we can't determine the file, check by classifier and if it's not from component
404346
artifact.classifier == "sources" && artifact.extension == "jar" &&
405347
!publication.artifacts.any {
406348
it != artifact && it.classifier == "sources" &&

0 commit comments

Comments
 (0)