Skip to content

Commit 44fbb85

Browse files
committed
Exclude unused libraries from 'com.android.tools:sdk-common'
1 parent 3296153 commit 44fbb85

4 files changed

Lines changed: 34 additions & 14 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.github.composegears.valkyrie
2+
3+
import org.gradle.api.artifacts.Configuration
4+
import org.gradle.kotlin.dsl.exclude
5+
6+
/**
7+
* Exclude not used libraries from `com.android.tools:sdk-common:x.x.x` artifact
8+
*/
9+
fun Configuration.excludeAndroidBuildTools() {
10+
exclude(group = "com.android.tools.analytics-library")
11+
exclude(group = "com.android.tools.build", module = "aapt2-proto")
12+
exclude(group = "com.android.tools.ddms")
13+
exclude(group = "com.android.tools.layoutlib")
14+
exclude(group = "com.android.tools", module = "sdklib")
15+
exclude(group = "com.google.code.gson")
16+
exclude(group = "com.google.guava")
17+
exclude(group = "com.google.protobuf")
18+
exclude(group = "org.apache.commons")
19+
exclude(group = "org.bouncycastle")
20+
exclude(group = "org.glassfish.jaxb")
21+
exclude(group = "net.java.dev.jna")
22+
exclude(group = "net.sf.kxml")
23+
}

tools/gradle-plugin/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
- Add nested pack aware validation that correctly handles `useFlatPackage` mode - when enabled, duplicates are detected
1212
across all nested packs since they write to the same output folder
1313

14+
### Changed
15+
16+
- Reduce gradle plugin size from 46mb to 10mb
17+
1418
### Removed
1519

1620
- Remove support for `androidx.compose.desktop.ui.tooling.preview.Preview` and corresponding `previewAnnotationType`

tools/gradle-plugin/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import io.github.composegears.valkyrie.excludeAndroidBuildTools
12
import java.nio.file.Paths
23
import java.util.Properties
34
import kotlin.io.path.exists
@@ -89,6 +90,10 @@ tasks.pluginUnderTestMetadata {
8990
pluginClasspath.from(testPluginClasspath)
9091
}
9192

93+
configurations.getByName("implementation") {
94+
excludeAndroidBuildTools()
95+
}
96+
9297
dependencies {
9398
compileOnly(gradlePluginVersions.agp.api)
9499
compileOnly(libs.kotlin.gradle.plugin)

tools/idea-plugin/build.gradle.kts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import io.github.composegears.valkyrie.excludeAndroidBuildTools
12
import org.jetbrains.changelog.Changelog
23
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
34
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel
@@ -34,20 +35,7 @@ configurations.getByName("implementation") {
3435
exclude(group = "androidx.annotation")
3536
exclude(group = "androidx.lifecycle")
3637

37-
// Android Build Tools
38-
exclude(group = "com.android.tools.analytics-library")
39-
exclude(group = "com.android.tools.build", module = "aapt2-proto")
40-
exclude(group = "com.android.tools.ddms")
41-
exclude(group = "com.android.tools.layoutlib")
42-
exclude(group = "com.android.tools", module = "sdklib")
43-
exclude(group = "com.google.code.gson")
44-
exclude(group = "com.google.guava")
45-
exclude(group = "com.google.protobuf")
46-
exclude(group = "org.apache.commons")
47-
exclude(group = "org.bouncycastle")
48-
exclude(group = "org.glassfish.jaxb")
49-
exclude(group = "net.java.dev.jna")
50-
exclude(group = "net.sf.kxml")
38+
excludeAndroidBuildTools()
5139
}
5240

5341
dependencies {

0 commit comments

Comments
 (0)