Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ jobs:
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: 8
# JDK 8 is only for the smoke test below; the last one listed (17) runs Gradle
java-version: |
8
17
cache: 'gradle'

- name: Setup Gradle
Expand All @@ -37,6 +40,9 @@ jobs:
- name: Run Tests
run: ./gradlew test

- name: Run Java 8 compatibility smoke test
run: ./gradlew java8SmokeTest -Porg.gradle.java.installations.fromEnv=JAVA_HOME_8_X64

- name: Generate code coverage report
run: ./gradlew jacocoTestReport

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: 8
java-version: 17

- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v6
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v7

- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v6
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'

- name: Build with Gradle
Expand Down
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Java client for the Crowdin API v2 and Crowdin Enterprise API v2, distributed via JitPack (`com.github.crowdin:crowdin-api-client-java`).

Two pins are load-bearing: write Java 8 code (`sourceCompatibility = 8` — no `var`, no `List.of`, no streams-`toList()`), and leave the Gradle wrapper at 7.6.4 (the build uses Gradle-7-only Jacoco APIs; CI validates the wrapper).
Two pins are load-bearing: write Java 8 code (`options.release = 8` — no `var`, no `List.of`, no streams-`toList()`), and build with JDK 17+ (Gradle 9 requires it to run; CI and `jitpack.yml` use 17). Keep `version 'x.y.z'` in `build.gradle` in that exact form — the release bump matches it by regex.

## Layout

Expand All @@ -17,6 +17,7 @@ Two pins are load-bearing: write Java 8 code (`sourceCompatibility = 8` — no `
- Build + test (what CI runs): `./gradlew build`
- Tests only: `./gradlew test`; one class: `./gradlew test --tests "com.crowdin.client.labels.LabelsApiTest"`
- Coverage: `./gradlew jacocoTestReport`
- Java 8 smoke test (runs the built jar on a JDK 8, which must be installed): `./gradlew java8SmokeTest`

There is no linter or formatter — match the style of neighboring files by hand.

Expand Down
57 changes: 49 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,21 @@ task myJavadocs(type: Javadoc) {
source = sourceSets.main.allJava
}

sourceCompatibility = 8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// Gradle 9 runs on JDK 17+; compile the library against the Java 8 API, not just Java 8 bytecode
compileJava {
options.release = 8
}

// lombok.var is rejected by javadoc newer than 9 unless the source level is 8
tasks.withType(Javadoc).configureEach {
options.source = '8'
}

version '1.38.0'

repositories {
Expand All @@ -41,6 +55,33 @@ test {
useJUnitPlatform()
}

// Runs the built jar on a real Java 8 runtime (Gradle itself needs JDK 17+); needs a JDK 8 installed
sourceSets {
java8Smoke
}

configurations {
java8SmokeImplementation.extendsFrom implementation
}

dependencies {
java8SmokeImplementation files(tasks.named('jar'))
}

compileJava8SmokeJava {
options.release = 8
}

tasks.register('java8SmokeTest', JavaExec) {
group = 'verification'
description = 'Runs the built library on a Java 8 runtime.'
classpath = sourceSets.java8Smoke.runtimeClasspath
mainClass = 'com.crowdin.client.smoke.Java8SmokeTest'
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
}
}

jar {
manifest {
attributes('Implementation-Title': project.name,
Expand All @@ -49,20 +90,20 @@ jar {
}

wrapper {
gradleVersion = '7.6.4'
gradleVersion = '9.8.2'
}

jacoco {
toolVersion = "0.8.5"
reportsDir = file("$buildDir/reports")
toolVersion = "0.8.16"
reportsDirectory = layout.buildDirectory.dir("reports")
}

jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
xml.destination file("${buildDir}/coverage.xml")
xml.required = true
csv.required = false
xml.outputLocation = layout.buildDirectory.file("coverage.xml")
}

getExecutionData().setFrom("$buildDir/jacoco/test.exec")
getExecutionData().setFrom(layout.buildDirectory.file("jacoco/test.exec"))
}
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,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading