Skip to content

Commit dacfba8

Browse files
authored
Merge branch 'main' into g/22050416/fix-issue-232
2 parents 79e6247 + 9ada0af commit dacfba8

26 files changed

Lines changed: 223 additions & 120 deletions

File tree

.github/renovate.json5

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313
"matchPackageNames": [
1414
"org.vafer:jdependency",
1515
"org.ow2.asm:asm-commons"
16-
]
17-
}
16+
],
17+
},
18+
{
19+
// AGP version should match the min Gradle version used in tests.
20+
"enabled": false,
21+
"matchPackageNames": [
22+
'com.android.tools.build:gradle',
23+
],
24+
},
1825
]
1926
}

.github/workflows/build.yml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,6 @@ jobs:
3131
- uses: gradle/actions/setup-gradle@v4
3232
- run: ./gradlew build "-PtestGradleVersion=${{ matrix.gradle }}"
3333

34-
# There's no need to run the update task frequently; the start scripts are typically updated with Gradle releases.
35-
update-start-scripts:
36-
runs-on: ubuntu-latest
37-
if: github.event.repository.fork == false && github.ref == 'refs/heads/main'
38-
steps:
39-
- uses: actions/checkout@v4
40-
- uses: actions/setup-java@v4
41-
with:
42-
distribution: 'zulu'
43-
java-version: 21
44-
- uses: gradle/actions/setup-gradle@v4
45-
- run: ./gradlew downloadStartScripts
46-
- uses: peter-evans/create-pull-request@v7
47-
with:
48-
commit-message: |
49-
Update start script templates to the latest
50-
51-
_Auto-generated by `Update Start Scripts` Github workflow._
52-
title: Update start script templates to the latest
53-
body: _Auto-generated by `Update Start Scripts` Github workflow._
54-
branch: actions/update-start-scripts
55-
delete-branch: true
56-
5734
publish-snapshot:
5835
needs: build
5936
runs-on: ubuntu-latest
@@ -67,11 +44,12 @@ jobs:
6744
- uses: gradle/actions/setup-gradle@v4
6845
with:
6946
cache-read-only: true
70-
# TODO: https://github.com/gradle/gradle/issues/22779
71-
- run: ./gradlew publishToMavenCentral --no-configuration-cache
47+
- run: ./gradlew publishToMavenCentral
7248
env:
7349
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
7450
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_PORTAL_PASSWORD }}
51+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
52+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }}
7553
- uses: actions/upload-artifact@v4
7654
with:
7755
path: build/libs
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Update Start Scripts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
# There's no need to run the update task frequently; the start scripts are typically updated with Gradle releases.
9+
- gradle/wrapper/**
10+
workflow_dispatch:
11+
12+
jobs:
13+
update-start-scripts:
14+
runs-on: ubuntu-latest
15+
if: github.event.repository.fork == false
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-java@v4
19+
with:
20+
distribution: 'zulu'
21+
java-version: 21
22+
- uses: gradle/actions/setup-gradle@v4
23+
- run: ./gradlew downloadStartScripts
24+
- uses: peter-evans/create-pull-request@v7
25+
with:
26+
commit-message: |
27+
Update start script templates to the latest
28+
29+
_Auto-generated by `Update Start Scripts` Github workflow._
30+
title: Update start script templates to the latest
31+
body: _Auto-generated by `Update Start Scripts` Github workflow._
32+
branch: actions/update-start-scripts
33+
delete-branch: true

build.gradle.kts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.gradle.api.plugins.JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME
44
import org.gradle.api.plugins.JavaPlugin.JAVADOC_ELEMENTS_CONFIGURATION_NAME
55
import org.gradle.api.plugins.JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME
66
import org.gradle.api.plugins.JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME
7-
import org.gradle.kotlin.dsl.kotlin
7+
import org.jetbrains.kotlin.daemon.common.OSKind
88
import org.jetbrains.kotlin.gradle.dsl.JvmDefaultMode
99
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1010
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
@@ -96,6 +96,16 @@ publishing.publications.withType<MavenPublication>().configureEach {
9696
suppressPomMetadataWarningsFor(SOURCES_ELEMENTS_CONFIGURATION_NAME)
9797
}
9898

99+
val testGradleVersion: String = providers.gradleProperty("testGradleVersion").orNull.let {
100+
val value = if (it == null || it == "current") GradleVersion.current().version else it
101+
logger.info("Using test Gradle version: $value")
102+
value
103+
}
104+
105+
develocity {
106+
buildScan.value("testGradleVersion", testGradleVersion)
107+
}
108+
99109
dependencies {
100110
compileOnly(libs.kotlin.kmp)
101111
api(libs.apache.ant) // Types from Ant are exposed in the public API.
@@ -107,6 +117,7 @@ dependencies {
107117
implementation(libs.plexus.utils)
108118
implementation(libs.plexus.xml)
109119

120+
testPluginClasspath(libs.agp)
110121
testPluginClasspath(libs.foojayResolver)
111122
testPluginClasspath(libs.kotlin.kmp)
112123
testPluginClasspath(libs.pluginPublish)
@@ -167,12 +178,7 @@ testing.suites {
167178
}
168179
targets.configureEach {
169180
testTask {
170-
val testGradleVersion = providers.gradleProperty("testGradleVersion").orNull.let {
171-
if (it == null || it == "current") GradleVersion.current().version else it
172-
}
173-
logger.info("Using test Gradle version: $testGradleVersion")
174181
systemProperty("TEST_GRADLE_VERSION", testGradleVersion)
175-
176182
maxParallelForks = Runtime.getRuntime().availableProcessors()
177183
}
178184
}
@@ -224,6 +230,13 @@ tasks.validatePlugins {
224230
enableStricterValidation = true
225231
}
226232

233+
tasks.whenTaskAdded {
234+
if (name.contains("lint") && this::class.java.name.contains("com.android.build")) {
235+
// Disable lint tasks for Windows due to ExceptionInInitializerError.
236+
enabled = OSKind.current != OSKind.Windows
237+
}
238+
}
239+
227240
tasks.check {
228241
dependsOn(
229242
tasks.withType<Test>(),

docs/changes/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
**Added**
66

77
- Support disabling of string constant remapping. ([#1401](https://github.com/GradleUp/shadow/pull/1401))
8+
- Let `assemble` depend on `shadowJar`. ([#1524](https://github.com/GradleUp/shadow/pull/1524))
9+
- Fail build when inputting AAR files or using Shadow with AGP. ([#1530](https://github.com/GradleUp/shadow/pull/1530))
810

911
**Fixed**
1012

docs/configuration/merging/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Additionally, a [`ResourceTransformer`][ResourceTransformer] can accept a `Closu
6969
import org.apache.tools.zip.ZipOutputStream
7070
import org.gradle.api.file.FileTreeElement
7171

72-
class MyTransformer(var enabled: Boolean = false) : ResourceTransformer {
72+
class MyTransformer(@get:Input var enabled: Boolean = false) : ResourceTransformer {
7373
override fun canTransformResource(element: FileTreeElement): Boolean = true
7474
override fun transform(context: TransformerContext) {}
7575
override fun hasTransformedResource(): Boolean = true
@@ -92,7 +92,7 @@ Additionally, a [`ResourceTransformer`][ResourceTransformer] can accept a `Closu
9292
import org.gradle.api.file.FileTreeElement
9393

9494
class MyTransformer implements ResourceTransformer {
95-
boolean enabled
95+
@Input boolean enabled
9696
@Override boolean canTransformResource(FileTreeElement element) { return true }
9797
@Override void transform(TransformerContext context) {}
9898
@Override boolean hasTransformedResource() { return true }
@@ -116,7 +116,7 @@ An instantiated instance of a [`ResourceTransformer`][ResourceTransformer] can a
116116
import org.apache.tools.zip.ZipOutputStream
117117
import org.gradle.api.file.FileTreeElement
118118

119-
class MyTransformer(val enabled: Boolean) : ResourceTransformer {
119+
class MyTransformer(@get:Input val enabled: Boolean) : ResourceTransformer {
120120
override fun canTransformResource(element: FileTreeElement): Boolean = true
121121
override fun transform(context: TransformerContext) {}
122122
override fun hasTransformedResource(): Boolean = true
@@ -137,7 +137,7 @@ An instantiated instance of a [`ResourceTransformer`][ResourceTransformer] can a
137137
import org.gradle.api.file.FileTreeElement
138138

139139
class MyTransformer implements ResourceTransformer {
140-
final boolean enabled
140+
@Input final boolean enabled
141141
MyTransformer(boolean enabled) { this.enabled = enabled }
142142
@Override boolean canTransformResource(FileTreeElement element) { return true }
143143
@Override void transform(TransformerContext context) {}

docs/publishing/README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ the `archiveClassifier` of the shadowed JAR like the following:
8585
version = "1.0"
8686

8787
dependencies {
88+
val retrofitVersion = "2.12.0"
8889
// This will be bundled in the shadowed JAR and not declared in the POM.
89-
implementation("some:a:1.0")
90-
// This will be excluded
91-
shadow("some:b:1.0")
92-
// This will be excluded
93-
compileOnly("some:c:1.0")
90+
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
91+
// This will be excluded from the shadowed JAR but declared as a runtime dependency in `META-INF/MANIFEST.MF`
92+
// file's `Class-Path` entry, and also in the POM file.
93+
shadow("com.squareup.retrofit2:converter-java8:$retrofitVersion")
94+
// This will be excluded from the shadowed JAR and not declared in the POM or `META-INF/MANIFEST.MF`.
95+
compileOnly("com.squareup.retrofit2:converter-scalars:$retrofitVersion")
9496
}
9597

9698
tasks.shadowJar {
@@ -122,13 +124,14 @@ the `archiveClassifier` of the shadowed JAR like the following:
122124
version = '1.0'
123125

124126
dependencies {
127+
def retrofitVersion = '2.12.0'
125128
// This will be bundled in the shadowed JAR and not declared in the POM.
126-
implementation 'some:a:1.0'
129+
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
127130
// This will be excluded from the shadowed JAR but declared as a runtime dependency in `META-INF/MANIFEST.MF`
128131
// file's `Class-Path` entry, and also in the POM file.
129-
shadow 'some:b:1.0'
132+
shadow "com.squareup.retrofit2:converter-java8:$retrofitVersion"
130133
// This will be excluded from the shadowed JAR and not declared in the POM or `META-INF/MANIFEST.MF`.
131-
compileOnly 'some:c:1.0'
134+
compileOnly "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
132135
}
133136

134137
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ org.jetbrains.dokka.experimental.tryK2.nowarn=true
1616

1717
########## Properties for publishing to Maven Central ##########
1818

19+
mavenCentralAutomaticPublishing=true
20+
mavenCentralPublishing=true
21+
signAllPublications=true
22+
1923
GROUP=com.gradleup.shadow
2024
POM_ARTIFACT_ID=shadow-gradle-plugin
2125
VERSION_NAME=9.0.0-SNAPSHOT
2226

23-
SONATYPE_AUTOMATIC_RELEASE=true
24-
SONATYPE_HOST=CENTRAL_PORTAL
25-
RELEASE_SIGNING_ENABLED=true
26-
2727
POM_NAME=Shadow Gradle Plugin
2828
POM_DESCRIPTION=Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
2929
POM_INCEPTION_YEAR=2024

gradle/libs.versions.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ pluginPublish = "1.3.1"
55

66
[libraries]
77
apache-ant = "org.apache.ant:ant:1.10.15"
8-
apache-commonsIo = "commons-io:commons-io:2.19.0"
8+
apache-commonsIo = "commons-io:commons-io:2.20.0"
99
apache-log4j = "org.apache.logging.log4j:log4j-core:2.25.1"
10-
apache-maven-modelBuilder = "org.apache.maven:maven-model:3.9.10"
10+
apache-maven-modelBuilder = "org.apache.maven:maven-model:3.9.11"
1111
asm = "org.ow2.asm:asm-commons:9.8"
1212
# jdependency should be updated together with ASM, see https://github.com/tcurdt/jdependency/issues/325.
1313
jdependency = "org.vafer:jdependency:2.13"
@@ -21,18 +21,21 @@ moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "mosh
2121
foojayResolver = "org.gradle.toolchains.foojay-resolver-convention:org.gradle.toolchains.foojay-resolver-convention.gradle.plugin:1.0.0"
2222
kotlin-kmp = { module = "org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin", version.ref = "kotlin" }
2323
pluginPublish = { module = "com.gradle.publish:plugin-publish-plugin", version.ref = "pluginPublish" }
24+
# AGP version should match the min Gradle version used in tests.
25+
# https://developer.android.com/build/releases/gradle-plugin#updating-gradle
26+
agp = "com.android.tools.build:gradle:8.8.0"
2427

2528
androidx-gradlePluginLints = "androidx.lint:lint-gradle:1.0.0-alpha05"
2629
# Dummy to get renovate updates, the version is used in rootProject build.gradle with spotless.
27-
ktlint = "com.pinterest.ktlint:ktlint-cli:1.6.0"
30+
ktlint = "com.pinterest.ktlint:ktlint-cli:1.7.1"
2831

29-
junit-bom = "org.junit:junit-bom:5.13.3"
32+
junit-bom = "org.junit:junit-bom:5.13.4"
3033
assertk = "com.willowtreeapps.assertk:assertk:0.28.1"
3134

3235
[plugins]
3336
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
3437
android-lint = "com.android.lint:8.11.1"
3538
jetbrains-dokka = "org.jetbrains.dokka:2.0.0"
36-
mavenPublish = "com.vanniktech.maven.publish:0.33.0"
39+
mavenPublish = "com.vanniktech.maven.publish:0.34.0"
3740
pluginPublish = { id = "com.gradle.plugin-publish", version.ref = "pluginPublish" }
38-
spotless = "com.diffplug.spotless:7.1.0"
41+
spotless = "com.diffplug.spotless:7.2.1"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-rc-2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-rc-3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)