Skip to content
Merged
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
7 changes: 6 additions & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ jobs:
steps:
- name: Checkout DeepLinkDispatch
uses: actions/checkout@v6
- name: Set up JDK 22

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

25 did not work with robolectric and it was not worth to figure it out.

uses: actions/setup-java@v5
with:
distribution: 'corretto'
java-version: '22'
- name: Build/Test DeepLinkDispatch
run: ./gradlew assemble check javadoc lintKotlin
run: ./gradlew assemble check javadoc lintKotlin
5 changes: 5 additions & 0 deletions .github/workflows/deploy_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
steps:
- name: Checkout DeepLinkDispatch
uses: actions/checkout@v6
- name: Set up JDK 22
uses: actions/setup-java@v5
with:
distribution: 'corretto'
java-version: '22'
- name: Update gradle.properties
uses: DamianReeves/write-file-action@master
with:
Expand Down
47 changes: 47 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,53 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
}
}

// Apply consistent JVM toolchain and target to all subprojects
subprojects {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of crazy how hard it is just to set a standard version for the whole project 😂

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, but better to have it spread out everywhere...

afterEvaluate {
def toolchainVersion = rootProject.ext.jvmToolchainVersion
def targetVersion = rootProject.ext.jvmTargetVersion

// For Kotlin projects (both pure JVM and Android)
if (plugins.hasPlugin('org.jetbrains.kotlin.jvm') || plugins.hasPlugin('kotlin') ||
plugins.hasPlugin('kotlin-android') || plugins.hasPlugin('org.jetbrains.kotlin.android')) {
kotlin {
jvmToolchain(toolchainVersion)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.@Companion.fromTarget(targetVersion.toString())
}
}
}
// For Java-only projects (without Kotlin)
else if (plugins.hasPlugin('java') && !plugins.hasPlugin('kotlin-dsl')) {
java {
toolchain {
languageVersion = JavaLanguageVersion.of(toolchainVersion)
}
}
}

// For Android projects, also set compileOptions
if (plugins.hasPlugin('com.android.library') || plugins.hasPlugin('com.android.application')) {
android {
compileOptions {
sourceCompatibility = JavaVersion.toVersion(targetVersion)
targetCompatibility = JavaVersion.toVersion(targetVersion)
}
}
}

// For pure Java projects
if (plugins.hasPlugin('java') && !plugins.hasPlugin('kotlin-dsl')) {
java {
sourceCompatibility = JavaVersion.toVersion(targetVersion)
targetCompatibility = JavaVersion.toVersion(targetVersion)
}
}
}
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
Expand Down
10 changes: 0 additions & 10 deletions deeplinkdispatch-base/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'org.jmailen.kotlinter'

apply plugin: 'checkstyle'
apply from: '../publishing.gradle'

kotlin {
jvmToolchain(11)
}

dependencies {
implementation deps.okio
implementation deps.jsr305
Expand All @@ -19,10 +13,6 @@ dependencies {
testImplementation deps.assertJ
}

kotlin.compilerOptions {
jvmTarget = JvmTarget.JVM_11
}

checkstyle {
configFile = rootProject.file('checkstyle.xml')
showViolations = true
Expand Down
12 changes: 9 additions & 3 deletions deeplinkdispatch-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ apply(from = "$rootDir/dependencies.gradle")
apply(from = "$rootDir/publishing.gradle")

val deps: Map<String, Any> by project
val jvmToolchainVersion: Int by rootProject.extra
val jvmTargetVersion: Int by rootProject.extra

repositories {
google()
Expand All @@ -17,13 +19,17 @@ plugins {
`java-gradle-plugin`
}

// JVM toolchain and target - uses central versions from dependencies.gradle
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
toolchain {
languageVersion.set(JavaLanguageVersion.of(jvmToolchainVersion))
}
sourceCompatibility = JavaVersion.toVersion(jvmTargetVersion)
targetCompatibility = JavaVersion.toVersion(jvmTargetVersion)
}

kotlin.compilerOptions {
jvmTarget = JvmTarget.JVM_11
jvmTarget = JvmTarget.fromTarget(jvmTargetVersion.toString())
}

gradlePlugin {
Expand Down
4 changes: 0 additions & 4 deletions deeplinkdispatch-processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ apply plugin: 'org.jmailen.kotlinter'
apply plugin: 'checkstyle'
apply from: '../publishing.gradle'

kotlin {
jvmToolchain(11)
}

dependencies {
implementation project(':deeplinkdispatch-base')
implementation deps.jsr305
Expand Down
4 changes: 0 additions & 4 deletions deeplinkdispatch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,3 @@ android {
unitTests.returnDefaultValues = true
}
}

kotlin {
jvmToolchain(11)
}
4 changes: 4 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ ext.androidConfig = [
targetSdkVersion : 35
]

// Central JVM configuration for all modules
ext.jvmToolchainVersion = 22 // JDK used for compilation
ext.jvmTargetVersion = 11 // Bytecode target (compatibility)

ext.versions = versions

ext.deps = [
Expand Down
4 changes: 0 additions & 4 deletions sample-benchmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ android {
}
}

kotlin {
jvmToolchain(11)
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

Expand Down
6 changes: 0 additions & 6 deletions sample-benchmarkable-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ android {
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

dependencies {
implementation project(':deeplinkdispatch')
annotationProcessor project(':deeplinkdispatch-processor')
Expand Down
4 changes: 0 additions & 4 deletions sample-kapt-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ android {
}
}

kotlin {
jvmToolchain(11)
}

dependencies {
implementation project(':deeplinkdispatch')
kapt project(':deeplinkdispatch-processor')
Expand Down
9 changes: 0 additions & 9 deletions sample-ksp-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ android {
namespace = "com.airbnb.deeplinkdispatch.sampleksplibrary"
compileSdk androidConfig.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = '11'
}

defaultConfig {
minSdk = androidConfig.minSdkVersion
targetSdk = androidConfig.compileSdkVersion
Expand Down
4 changes: 0 additions & 4 deletions sample-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ android {
}
}

kotlin {
jvmToolchain(11)
}

dependencies {
implementation project(':deeplinkdispatch')
annotationProcessor project(':deeplinkdispatch-processor')
Expand Down
4 changes: 0 additions & 4 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ android {
}
}

kotlin {
jvmToolchain(17)
}

dependencies {
implementation project(':deeplinkdispatch')
ksp project(':deeplinkdispatch-processor')
Expand Down