Skip to content

Commit

Permalink
Fix main and update things (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers authored May 9, 2024
1 parent d44f1ac commit c26169d
Show file tree
Hide file tree
Showing 16 changed files with 109 additions and 147 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
build:
name: ${{ matrix.job }} / AGP ${{ matrix.agp }}
# Use macOS for emulator hardware acceleration
runs-on: 'macOS-latest'
runs-on: 'ubuntu-latest'
timeout-minutes: 30
strategy:
fail-fast: false # We want to see all results
matrix:
agp: ['8.1.2', '8.2.0-beta06', '8.3.0-alpha07']
agp: ['8.4.0', '8.5.0-alpha08']
job: ['instrumentation', 'plugin']
env:
DEP_OVERRIDE_agp: ${{ matrix.agp }}
Expand All @@ -34,30 +34,29 @@ jobs:
uses: actions/checkout@v4

- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v3

- name: Install JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '20'
java-version: '21'

- name: Spot check
run: ./gradlew spotlessCheck

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Test plugin
id: gradle
if: matrix.job == 'plugin'
uses: gradle/gradle-build-action@v2
with:
arguments: -p keeper-gradle-plugin check
run: ./gradlew -p keeper-gradle-plugin check

- name: Assemble instrumentation tests
id: gradle-assemble-instrumentation
if: matrix.job == 'instrumentation'
uses: gradle/gradle-build-action@v2
with:
arguments: :sample:minifyExternalStagingWithR8 validateL8 --stacktrace
run: ./gradlew :sample:minifyExternalStagingWithR8 validateL8 --stacktrace

# TODO AVD caching disabled due to https://github.com/ReactiveCircus/android-emulator-runner/issues/278
# - name: AVD cache
Expand Down Expand Up @@ -130,14 +129,10 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '20'
java-version: '21'

# Just here to restore cache
- name: Gradle prep
id: gradle
uses: gradle/gradle-build-action@v2
with:
arguments: help
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Upload snapshot (main only)
env:
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins {

subprojects {
pluginManager.withPlugin("java") {
configure<JavaPluginExtension> { toolchain { languageVersion.set(JavaLanguageVersion.of(20)) } }
configure<JavaPluginExtension> { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } }

tasks.withType<JavaCompile>().configureEach { options.release.set(11) }
}
Expand Down Expand Up @@ -74,7 +74,7 @@ spotless {
endWithNewline()
licenseHeaderFile(
"spotless/copyright.kt",
"(import|plugins|buildscript|dependencies|dependencyResolutionManagement|pluginManagement|rootProject)"
"(import|plugins|buildscript|dependencies|dependencyResolutionManagement|pluginManagement|rootProject)",
)
}
java {
Expand Down
28 changes: 14 additions & 14 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
[versions]
agp = "8.1.2"
androidx-test = "1.6.0-alpha04"
kotlin = "1.9.10"
gjf = "1.18.1"
ktfmt = "0.46"
agp = "8.4.0"
androidx-test = "1.6.0-alpha07"
kotlin = "1.9.23"
gjf = "1.22.0"
ktfmt = "0.49"

[plugins]
agp-library = { id = "com.android.library", version.ref = "agp" }
binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.13.2" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.25.3" }
spotless = { id = "com.diffplug.spotless", version = "6.22.0" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.28.0" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }

[libraries]
androidx-annotation = "androidx.annotation:annotation:1.7.0"
androidx-test-orchestrator = "androidx.test:orchestrator:1.5.0-alpha01"
androidx-test-rules = { module = "androidx.test:rules", version = "1.6.0-alpha01" }
androidx-annotation = "androidx.annotation:annotation:1.7.1"
androidx-test-orchestrator = "androidx.test:orchestrator:1.5.0-alpha04"
androidx-test-rules = { module = "androidx.test:rules", version = "1.6.0-alpha04" }
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test" }
androidx-test-truth = "androidx.test.ext:junit:1.1.5"
agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
desugarJdkLibs = "com.android.tools:desugar_jdk_libs:2.0.3"
desugarJdkLibs = "com.android.tools:desugar_jdk_libs:2.0.4"
javapoet = "com.squareup:javapoet:1.13.0"
junit = "junit:junit:4.13.2"
kgp = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kgp-api = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-api", version.ref = "kotlin" }
kotlinpoet = "com.squareup:kotlinpoet:1.14.2"
okio = "com.squareup.okio:okio:3.6.0"
truth = "com.google.truth:truth:1.1.5"
kotlinpoet = "com.squareup:kotlinpoet:1.16.0"
okio = "com.squareup.okio:okio:3.9.0"
truth = "com.google.truth:truth:1.4.2"
zipflinger = { module = "com.android:zipflinger", version.ref = "agp" }

renovateTrigger-gjf = { module = "com.google.googlejavaformat:google-java-format", version.ref = "gjf" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
8 changes: 4 additions & 4 deletions keeper-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version libs.versions.kotlin.get()
`java-gradle-plugin`
id("org.jetbrains.dokka") version "1.8.20"
id("org.jetbrains.dokka") version "1.9.20"
alias(libs.plugins.mavenPublish)
alias(libs.plugins.binaryCompatibilityValidator)
id("org.jetbrains.kotlin.plugin.sam.with.receiver") version libs.versions.kotlin.get()
Expand All @@ -35,8 +35,8 @@ tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17) // Match AGP's requirement
// Because Gradle's Kotlin handling is stupid, this falls out of date quickly
apiVersion.set(KotlinVersion.KOTLIN_1_8)
languageVersion.set(KotlinVersion.KOTLIN_1_8)
apiVersion.set(KotlinVersion.KOTLIN_1_9)
languageVersion.set(KotlinVersion.KOTLIN_1_9)
// freeCompilerArgs.add(listOf("-progressive"))
// We use class SAM conversions because lambdas compiled into invokedynamic are not
// Serializable, which causes accidental headaches with Gradle configuration caching. It's
Expand Down Expand Up @@ -65,7 +65,7 @@ sourceSets {
getByName("test").resources.srcDirs(project.layout.buildDirectory.dir("pluginUnderTestMetadata"))
}

java { toolchain { languageVersion.set(JavaLanguageVersion.of(20)) } }
java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } }

tasks.withType<JavaCompile>().configureEach { options.release.set(17) }

Expand Down
Binary file modified keeper-gradle-plugin/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions keeper-gradle-plugin/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ constructor(private val execOps: ExecOperations) : DefaultTask() {
"--lib" to androidTestJar.get().asFile.takeIf { it.exists() }?.absolutePath,
"--target" to appTargetJar.get().asFile.absolutePath,
"--source" to androidTestSourceJar.get().asFile.absolutePath,
"--output" to outputProguardRules.get().asFile.absolutePath
"--output" to outputProguardRules.get().asFile.absolutePath,
)
.map { if (it.second != null) listOf(it.first, it.second) else listOf() }
.reduce { acc, any -> acc + any }
Expand All @@ -136,7 +136,7 @@ constructor(private val execOps: ExecOperations) : DefaultTask() {
enableAssertions: Property<Boolean>,
extensionJvmArgs: ListProperty<String>,
traceReferencesArgs: ListProperty<String>,
r8Configuration: Configuration
r8Configuration: Configuration,
): InferAndroidTestKeepRules.() -> Unit = {
if (automaticallyAddR8Repo.get()) {
// This is the maven repo where r8 tagged releases are hosted. Only the r8 artifact is
Expand Down
Loading

0 comments on commit c26169d

Please sign in to comment.