Skip to content
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

Enforce compatibility with JDK 8 when compiling on later JDKs #1909

Merged
merged 9 commits into from
Aug 23, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up JDK 8
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8
java-version: 11

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
with:
name: maestro-cli

- name: Set up JDK 8
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: zulu
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
java-version: 11

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
Expand Down
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
alias(libs.plugins.kotlin.jvm)
Expand All @@ -12,6 +14,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named("compileKotlin", KotlinCompilationTask::class.java) {
compilerOptions {
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

detekt {
buildUponDefaultConfig = true
allRules = false
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
# https://blog.gradle.org/best-practices-naming-version-catalog-entries

[versions]
androidPlugin = "4.2.1"
androidPlugin = "7.4.2"
androidxEspresso = "3.6.1"
androidxTestJunit = "1.2.1"
androidxUiautomator = "2.3.0"
apkParser = "2.6.10"
appdirs = "1.2.1"
axml = "2.1.2"
commons-codec = "1.17.0"
commons-lang3 = "3.14.0"
commons-lang3 = "3.13.0" # 3.14.0 causes weird crashes during dexing
commons-io = "2.16.1"
dadb = "1.2.7"
detekt = "1.19.0"
Expand All @@ -33,7 +33,7 @@ jackson = "2.17.1"
jansi = "2.4.1"
jarchivelib = "1.2.0"
junit = "5.10.2"
kotlin = "1.8.0"
kotlin = "1.8.22"
kotlinResult = "1.1.18"
ktor = "2.3.6"
mozillaRhino = "1.7.14"
Expand Down
7 changes: 7 additions & 0 deletions maestro-cli/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jreleaser.model.Active.ALWAYS
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jreleaser.model.Stereotype
import java.util.Properties

Expand Down Expand Up @@ -65,6 +66,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named("compileKotlin", KotlinCompilationTask::class.java) {
compilerOptions {
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

tasks.create("createProperties") {
dependsOn("processResources")

Expand Down
3 changes: 0 additions & 3 deletions maestro-cli/src/main/java/maestro/cli/runner/FileWatcher.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package maestro.cli.runner

import com.sun.nio.file.SensitivityWatchEventModifier
import java.io.File
import java.nio.file.FileSystems
import java.nio.file.Path
import java.nio.file.StandardWatchEventKinds
Expand All @@ -27,7 +25,6 @@ class FileWatcher {
StandardWatchEventKinds.ENTRY_DELETE,
StandardWatchEventKinds.ENTRY_MODIFY,
),
SensitivityWatchEventModifier.HIGH,
)
watchKeys.add(watchKey)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import maestro.debuglog.IOSDriverLogger
import maestro.drivers.AndroidDriver
import maestro.drivers.IOSDriver
import org.slf4j.LoggerFactory
import sun.misc.Signal
import sun.misc.SignalHandler
import util.XCRunnerCLIUtils
import xcuitest.XCTestClient
import xcuitest.XCTestDriverClient
Expand All @@ -44,7 +42,6 @@ import java.util.UUID
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import kotlin.concurrent.thread
import kotlin.system.exitProcess

object MaestroSessionManager {
private const val defaultHost = "localhost"
Expand Down Expand Up @@ -101,7 +98,6 @@ object MaestroSessionManager {
session.close()
}
})
Signal.handle(CustomSignalHandler.suspendSignal, CustomSignalHandler())

return block(session)
}
Expand Down Expand Up @@ -354,16 +350,4 @@ object MaestroSessionManager {
maestro.close()
}
}

private class CustomSignalHandler() : SignalHandler {
override fun handle(signal: Signal) {
when (signal) {
suspendSignal -> exitProcess(0)
}
}

companion object {
val suspendSignal = Signal("TSTP")
}
}
}
8 changes: 8 additions & 0 deletions maestro-client/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("maven-publish")
alias(libs.plugins.kotlin.jvm)
Expand Down Expand Up @@ -92,6 +94,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named("compileKotlin", KotlinCompilationTask) {
compilerOptions {
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

plugins.withId("com.vanniktech.maven.publish") {
mavenPublish {
sonatypeHost = "S01"
Expand Down
8 changes: 8 additions & 0 deletions maestro-ios-driver/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("maven-publish")
alias(libs.plugins.kotlin.jvm)
Expand Down Expand Up @@ -26,6 +28,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named("compileKotlin", KotlinCompilationTask) {
compilerOptions {
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

plugins.withId("com.vanniktech.maven.publish") {
mavenPublish {
sonatypeHost = "S01"
Expand Down
8 changes: 8 additions & 0 deletions maestro-ios/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("maven-publish")
alias(libs.plugins.kotlin.jvm)
Expand Down Expand Up @@ -35,6 +37,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named("compileKotlin", KotlinCompilationTask) {
compilerOptions {
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

plugins.withId("com.vanniktech.maven.publish") {
mavenPublish {
sonatypeHost = "S01"
Expand Down
8 changes: 8 additions & 0 deletions maestro-orchestra-models/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("maven-publish")
alias(libs.plugins.kotlin.jvm)
Expand All @@ -15,6 +17,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named("compileKotlin", KotlinCompilationTask) {
compilerOptions {
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

dependencies {
implementation(project(path: ":maestro-client"))

Expand Down
9 changes: 9 additions & 0 deletions maestro-orchestra/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
id("maven-publish")
alias(libs.plugins.kotlin.jvm)
Expand Down Expand Up @@ -26,6 +29,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named("compileKotlin", KotlinCompilationTask) {
compilerOptions {
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

plugins.withId("com.vanniktech.maven.publish") {
mavenPublish {
sonatypeHost = "S01"
Expand Down
8 changes: 8 additions & 0 deletions maestro-studio/server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("maven-publish")
id("application")
Expand Down Expand Up @@ -35,6 +37,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named("compileKotlin", KotlinCompilationTask) {
compilerOptions {
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

dependencies {
implementation(project(":maestro-orchestra"))
implementation(project(":maestro-client"))
Expand Down
5 changes: 3 additions & 2 deletions maestro-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
Expand All @@ -10,9 +11,9 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType(KotlinJvmCompile).configureEach {
tasks.named("compileKotlin", KotlinCompilationTask) {
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

Expand Down
8 changes: 8 additions & 0 deletions maestro-utils/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("maven-publish")
alias(libs.plugins.kotlin.jvm)
Expand All @@ -17,6 +19,12 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named("compileKotlin", KotlinCompilationTask) {
compilerOptions {
freeCompilerArgs.addAll("-Xjdk-release=1.8")
}
}

plugins.withId("com.vanniktech.maven.publish") {
mavenPublish {
sonatypeHost = "S01"
Expand Down