Skip to content

Commit 7dfb40a

Browse files
authored
feat(gradle): implement gradle tools (#741)
* feat(gradle): implement gradle tools - feat: implement extension dsl for jpms plugin - feat: implement extension dsl for mrjar plugin - feat: implement non-modular mrjar tasks - test: fix or implement tests for mrjar plugin - test: ungate several existing mrjar plugin tests - fix: kotlin gradle plugin deprecations - fix: plugin sample classpath resolution - fix: drop lockfiles until release - fix: drop verification metadata until release - chore: upgrade kotlin → `2.0.21` - chore: upgrade gradle → `8.12.1` Signed-off-by: Sam Gammon <[email protected]> * chore: ci jobs for gradle plugins Signed-off-by: Sam Gammon <[email protected]> * fixup! ci updates Signed-off-by: Sam Gammon <[email protected]> * chore: upgrades to gradle workflow Signed-off-by: Sam Gammon <[email protected]> * fixup! gradle sucks and hates their users Signed-off-by: Sam Gammon <[email protected]> * fixup! cleanup gradle mrjar tests Signed-off-by: Sam Gammon <[email protected]> * chore(gradle): `jmod` configuration extension Signed-off-by: Sam Gammon <[email protected]> --------- Signed-off-by: Sam Gammon <[email protected]>
1 parent bf1d63d commit 7dfb40a

File tree

39 files changed

+2044
-14982
lines changed

39 files changed

+2044
-14982
lines changed

.github/workflows/conventions.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Gradle Conventions"
1+
name: "Gradle"
22

33
concurrency:
44
group: build-conventions-${{ github.head_ref || github.run_id }}
@@ -13,7 +13,7 @@ on:
1313
branches:
1414
- main
1515
paths:
16-
- ".github/workflows/conventions.yaml"
16+
- ".github/workflows/conventions.yml"
1717
- "gradle/catalogs"
1818
- "gradle/plugins"
1919
- "gradle/"
@@ -34,14 +34,15 @@ on:
3434
- "actions/*/*.yml"
3535
- "containers/*/*.yaml"
3636
- "containers/*/*.yml"
37+
- "gradle/*"
3738

3839
permissions:
3940
contents: read
4041

4142
jobs:
4243
## Task: Build convention plugins with re-usable Gradle workflow
43-
build-conventions:
44-
name: "Build"
44+
build-plugins:
45+
name: "Plugins"
4546
uses: ./.github/workflows/jvm.gradle.yml
4647
permissions:
4748
actions: read
@@ -50,10 +51,10 @@ jobs:
5051
pull-requests: read
5152
id-token: write
5253
with:
53-
action: "build test check"
54+
action: check
5455
jvm: "21"
55-
checks: false
56+
checks: true
5657
cache_local: true
57-
flags: "--no-configuration-cache --stacktrace -Porg.gradle.unsafe.isolated-projects=false -Dorg.gradle.unsafe.isolated-projects=false"
58-
graph: "disabled"
58+
flags: "--no-configuration-cache --stacktrace"
59+
graph: disabled
5960
scan: true

.github/workflows/jvm.gradle.yml

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,20 @@ on:
172172
type: string
173173
default: audit
174174

175+
## Endpoints to allow.
176+
endpoints:
177+
description: "Endpoints"
178+
required: false
179+
type: string
180+
default: 'github.com:443'
181+
182+
## Whether to disable sudo.
183+
sudoless:
184+
description: "Disable Sudo"
185+
required: false
186+
type: boolean
187+
default: true
188+
175189
## Outputs to include in assertions.
176190
outputs:
177191
description: "Outputs"
@@ -241,47 +255,34 @@ jobs:
241255
pull-requests: "read"
242256
steps:
243257
- name: "Setup: Harden Runner"
244-
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
258+
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
245259
with:
246260
egress-policy: ${{ inputs.network || 'audit' }}
261+
disable-sudo: ${{ inputs.sudoless }}
262+
allowed-endpoints: ${{ inputs.endpoints }}
247263
- name: "Setup: Checkout"
248-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
264+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
249265
with:
250266
persist-credentials: false
251-
- name: "Setup: Buildless"
252-
uses: buildless/setup@30e82389418c7f17046606183bc4c78b2c8913e0 # v1.0.2
253-
- name: "Setup: Cache"
254-
uses: buildless/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
255-
if: inputs.cache_action
256-
with:
257-
path: |
258-
./build
259-
~/.konan
260-
~/.gradle/caches
261-
~/.gradle/notifications
262-
~/.gradle/jdks
263-
key: ${{ runner.os }}-gradlebuild-${{ hashFiles('**/*.versions.toml', 'settings.gradle.kts') }}
264-
restore-keys: ${{ runner.os }}-gradlebuild-
265267
- name: "Setup: JDK ${{ env.JVM_VERSION }}"
266-
uses: buildless/setup-java@3232623d9c428cc5f228a01a2ae8d2d70f79775e # v4.0.0
268+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
267269
if: inputs.install_jvm
268270
with:
269271
distribution: ${{ env.JVM_DIST }}
270272
java-version: ${{ env.JVM_VERSION }}
271273
- name: "Setup: GraalVM"
272-
uses: buildless/setup-graalvm@b8dc5fccfbc65b21dd26e8341e7b21c86547f61b # v1.1.5
274+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
273275
if: inputs.install_gvm
274276
with:
275277
distribution: ${{ env.GVM_DIST || 'graalvm' }}
276278
java-version: ${{ env.JVM_VERSION }}
277279
github-token: ${{ secrets.GITHUB_TOKEN }}
278-
gds-token: ${{ secrets.GDS_TOKEN }}
279-
- name: "Check: Gradle Wrapper"
280+
- name: "Setup: Check Gradle Wrapper"
280281
uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
281282
if: inputs.checks
282-
- name: "Build: Gradle"
283+
- name: "Setup: Gradle"
283284
continue-on-error: ${{ inputs.labs || false }}
284-
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v2
285+
uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0
285286
id: gradlebuild
286287
env:
287288
CI: true
@@ -292,25 +293,27 @@ jobs:
292293
cache-read-only: ${{ inputs.cache_read_only || false }}
293294
dependency-graph: ${{ inputs.graph }}
294295
build-scan-publish: ${{ inputs.scan }}
295-
build-scan-terms-of-service-url: "https://gradle.com/terms-of-service"
296-
build-scan-terms-of-service-agree: ${{ inputs.scan && 'yes' || 'no' }}
297-
arguments: |
298-
${{ inputs.action || 'build' }}
299-
${{ inputs.flags }}
296+
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
297+
build-scan-terms-of-use-agree: ${{ inputs.scan && 'yes' || 'no' }}
298+
- name: "Build: Gradle"
299+
run: |
300+
./gradlew \
301+
${{ inputs.action || 'build' }} \
302+
${{ inputs.flags }} \
300303
-Pci=true
301304
- name: "Build: Provenance Subject"
302305
id: hash
303306
run: |
304307
echo "hashes=$(sha256sum ${{ inputs.outputs }} | base64 -w0)" >> "$GITHUB_OUTPUT"
305308
- name: "Report: Codecov"
306-
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
309+
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
307310
if: inputs.coverage
308311
with:
309312
token: ${{ secrets.CODECOV_TOKEN }}
310313
files: ${{ inputs.coverage_report }}
311314
flags: ${{ inputs.coverage_flags }}
312315
- name: "Publish: Build Artifacts"
313-
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v3
316+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
314317
if: inputs.artifacts
315318
with:
316319
name: ${{ inputs.artifact }}

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ plugins {
2222
`test-report-aggregation`
2323

2424
alias(core.plugins.gradle.checksum)
25-
alias(core.plugins.gradle.doctor)
25+
alias(core.plugins.gradle.doctor) apply false
2626
alias(core.plugins.versions)
2727
alias(libs.plugins.dependencyAnalysis)
2828
id(core.plugins.kotlin.multiplatform.get().pluginId) apply false

config/detekt/detekt.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ complexity:
106106
ignoreOverloaded: false
107107
CyclomaticComplexMethod:
108108
active: true
109-
threshold: 15
109+
threshold: 85
110110
ignoreSingleWhenExpression: false
111111
ignoreSimpleWhenEntries: false
112112
ignoreNestingFunctions: false
@@ -128,11 +128,11 @@ complexity:
128128
threshold: 600
129129
LongMethod:
130130
active: true
131-
threshold: 60
131+
threshold: 120
132132
LongParameterList:
133133
active: true
134-
functionThreshold: 6
135-
constructorThreshold: 7
134+
functionThreshold: 12
135+
constructorThreshold: 15
136136
ignoreDefaultParameters: false
137137
ignoreDataClasses: true
138138
ignoreAnnotatedParameter: []

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ build-infra.prepack=true
1616
build-infra.plugins=base,jpms,mrjar,jmod,jlink,gha,graalvm
1717

1818
# build conventions: jvm
19-
conventions.jvm.target=17
19+
conventions.jvm.target=21
2020
conventions.jvm.toolchain=21
2121

2222
# build conventions: kotlin
23-
conventions.kotlin.version=1.9.22
24-
conventions.kotlin.api=1.9
25-
conventions.kotlin.language=1.9
26-
conventions.kotlin.jvm.target=17
23+
conventions.kotlin.version=2.0.21
24+
conventions.kotlin.api=2.0
25+
conventions.kotlin.language=2.0
26+
conventions.kotlin.jvm.target=21
2727

2828
# kotlin settings
2929
kotlin.parallel.tasks.in.project=true
@@ -43,7 +43,7 @@ kotlin.build.report.include_compiler_arguments=true
4343
# gradle settings
4444
org.gradle.caching=true
4545
org.gradle.unsafe.isolated-projects=false
46-
org.gradle.configuration-cache=true
46+
org.gradle.configuration-cache=false
4747
org.gradle.configuration-cache-problems=warn
4848
org.gradle.dependency-verification=lenient
4949
org.gradle.jvmargs=-XX:+UseParallelGC \

gradle/build-infra/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ group = "dev.elide.infra"
5050
// Build infra targets; does not apply to shipped/published targets.
5151
val buildTimeJvmTarget = JvmTarget.JVM_21
5252
val buildTimeJavaTarget = JavaVersion.VERSION_21
53-
val buildTimeKotlinTarget = KotlinVersion.KOTLIN_1_9
53+
val buildTimeKotlinTarget = KotlinVersion.KOTLIN_2_0
5454

5555
java {
5656
sourceCompatibility = buildTimeJavaTarget

0 commit comments

Comments
 (0)