Repository navigation
Upgrade to Gradle 8.14.6 with Java 11–24 support #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dccec4d
a694e73
1398d75
bd3fd30
78fd4a7
32c6b93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Gradle and Java compatibility | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| compatibility: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| java: ['11', '14', '15', '24'] | ||
| name: Java ${{ matrix.java }} / Gradle 8.14.6 | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| submodules: recursive | ||
| - uses: actions/setup-java@v6 | ||
| with: | ||
| distribution: zulu | ||
| java-version: ${{ matrix.java }} | ||
| - uses: gradle/actions/setup-gradle@v6 | ||
| - run: ./gradlew build compileSamplesKotlin dokka --console=plain | ||
| - run: ./template/gradlew -p template --include-build "$PWD" tasks --all --console=plain |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,6 @@ misc/ | |
|
|
||
| # Ignore Gradle build output directory | ||
| build | ||
|
|
||
| # Kotlin compiler cache | ||
| .kotlin | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| import java.net.URI | ||
| import java.net.URL | ||
| import org.jetbrains.dokka.gradle.DokkaTask | ||
| import org.jetbrains.dokka.gradle.formats.DokkaFormatPlugin | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
| import org.jetbrains.kotlin.gradle.dsl.KotlinVersion | ||
|
|
||
| plugins { | ||
| kotlin("jvm") version "1.3.72" | ||
| kotlin("jvm") version "2.4.21" | ||
| `java-gradle-plugin` | ||
| id("org.jetbrains.dokka") version "0.9.18" | ||
| id("org.jetbrains.dokka") version "2.2.0" | ||
| } | ||
|
|
||
| gradlePlugin { | ||
|
|
@@ -40,8 +41,9 @@ sourceSets { | |
| } | ||
|
|
||
| dependencies { | ||
| implementation(kotlin("stdlib-jdk8", "1.3.72")) | ||
| implementation(kotlin("reflect", "1.3.72")) | ||
| // Use the host Gradle's Kotlin runtime, including 2.0.21 on Gradle 8.14. | ||
| implementation(kotlin("stdlib", embeddedKotlinVersion)) | ||
| implementation(kotlin("reflect", embeddedKotlinVersion)) | ||
| implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7") | ||
| implementation(gradleApi()) | ||
| implementation(gradleKotlinDsl()) | ||
|
|
@@ -61,46 +63,66 @@ dependencies { | |
| implementation("commons-codec:commons-codec:1.14") | ||
|
|
||
| "samplesImplementation"(sourceSets["main"].output) | ||
| testImplementation(gradleTestKit()) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to add a blank line before the |
||
| testImplementation(kotlin("test-junit", embeddedKotlinVersion)) | ||
| } | ||
|
|
||
| tasks { | ||
| withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach { | ||
| kotlinOptions.jvmTarget = "1.8" | ||
| kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" | ||
| // Keep the plugin usable on Java 11–16 with Gradle 8.14 as well as modern Gradle. | ||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_11 | ||
| targetCompatibility = JavaVersion.VERSION_11 | ||
| } | ||
|
|
||
| kotlin { | ||
| compilerOptions { | ||
| jvmTarget.set(JvmTarget.JVM_11) | ||
| // Gradle 8.14's Kotlin DSL compiler must be able to read our metadata. | ||
| languageVersion.set(KotlinVersion.KOTLIN_2_0) | ||
| apiVersion.set(KotlinVersion.KOTLIN_2_0) | ||
| } | ||
| } | ||
|
|
||
| val dokka by getting(DokkaTask::class) { | ||
| outputFormat = "gfm" | ||
| outputDirectory = "docs" | ||
| tasks.withType<JavaCompile>().configureEach { | ||
| options.release.set(11) | ||
| } | ||
|
|
||
| // configuration { | ||
| noStdlibLink = false | ||
| noJdkLink = false | ||
| jdkVersion = 9 | ||
| //platform = "JVM" | ||
| // Dokka v2 ships HTML/Javadoc formats; retain the existing Markdown output too. | ||
| abstract class DokkaGfmPlugin : DokkaFormatPlugin("gfm") | ||
| apply<DokkaGfmPlugin>() | ||
|
|
||
| includes = listOf("src/docs/markdown/packages.md") | ||
| samples = listOf("src/samples/kotlin/tasks.kt") | ||
| dependencies { | ||
| add("dokkaGfmPlugin", "org.jetbrains.dokka:gfm-plugin:2.2.0") | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit, but I’d rather have one of the following:
|
||
|
|
||
| externalDocumentationLink { | ||
| url = URL("https://docs.gradle.org/current/javadoc/") | ||
| dokka { | ||
| dokkaPublications.named("gfm") { | ||
| outputDirectory.set(layout.buildDirectory.dir("dokka/gfm")) | ||
| } | ||
| dokkaSourceSets.named("main") { | ||
| jdkVersion.set(11) | ||
| includes.from("src/docs/markdown/packages.md") | ||
| samples.from("src/samples/kotlin/tasks.kt") | ||
| externalDocumentationLinks.register("gradle") { | ||
| url.set(URI("https://docs.gradle.org/current/javadoc/")) | ||
| packageListUrl.set(URI("https://docs.gradle.org/current/javadoc/element-list")) | ||
| } | ||
|
|
||
| externalDocumentationLink { | ||
| url = URL("https://velocity.apache.org/engine/2.2/apidocs/") | ||
| externalDocumentationLinks.register("velocity") { | ||
| url.set(URI("https://velocity.apache.org/engine/2.2/apidocs/")) | ||
| } | ||
|
|
||
| packageOptions/*perPackageOption*/ { | ||
| prefix = "com.turn.ttorrent" | ||
| suppress = true | ||
| perPackageOption { | ||
| matchingRegex.set("com\\.turn\\.ttorrent.*") | ||
| suppress.set(true) | ||
| } | ||
|
|
||
| linkMapping { | ||
| // replace \ with / since only unix paths are allowed | ||
| dir = project.file("src/main/kotlin").absolutePath.replace('\\', '/') | ||
| url = "https://github.com/Myaamori/SubKt/blob/$version/src/main/kotlin" | ||
| suffix = "#L" | ||
| sourceLink { | ||
| localDirectory.set(file("src/main/kotlin")) | ||
| remoteUrl.set(URI("https://github.com/Myaamori/SubKt/blob/$version/src/main/kotlin")) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may wanna update this URL to point to
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way: all new |
||
| remoteLineSuffix.set("#L") | ||
| } | ||
| // } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.register("dokka") { | ||
| group = "documentation" | ||
| description = "Generates Markdown API documentation." | ||
| dependsOn("dokkaGeneratePublicationGfm") | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| org.gradle.warning.mode=all | ||
| org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip | ||
| distributionSha256Sum=7988ed071b2a07900e2ec715fca15c6ab72bce6db433af301fa7fa7e9407bd24 | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.6-bin.zip | ||
| networkTimeout=10000 | ||
| validateDistributionUrl=true | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to maintainers: README will need to be updated (in several places) upon release.