From 6515c105e44451b432faffbdda18d356d906d1c7 Mon Sep 17 00:00:00 2001 From: DatLag Date: Sun, 26 May 2024 16:56:27 +0200 Subject: [PATCH] update for K2 --- .github/workflows/build.yml | 77 +++++++++++++++++++++++++++++++++++++ .gitignore | 2 + build.gradle.kts | 5 ++- gradle.properties | 5 ++- gradle/libs.versions.toml | 6 +-- sample/build.gradle.kts | 2 +- sekret-lib/build.gradle.kts | 32 ++++++++++----- settings.gradle.kts | 2 +- 8 files changed, 114 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f2de3e5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,77 @@ +name: Test Build + +on: + workflow_dispatch: + +jobs: + build-gradle: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew :sekret-gradle-plugin:build + + build-compiler: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew :sekret-compiler-plugin:build + + build-library: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew :sekret-lib:build + + build-annotations: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew :sekret-annotations:build \ No newline at end of file diff --git a/.gitignore b/.gitignore index cb51ac4..8d66837 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ sample/resources/* # Created by https://www.toptal.com/developers/gitignore/api/windows,linux,macos,intellij,intellij+iml,intellij+all,android,androidstudio,maven,gradle,java,kotlin,netbeans,visualstudiocode # Edit at https://www.toptal.com/developers/gitignore?templates=windows,linux,macos,intellij,intellij+iml,intellij+all,android,androidstudio,maven,gradle,java,kotlin,netbeans,visualstudiocode +.kotlin + ### Android ### # Built application files *.apk diff --git a/build.gradle.kts b/build.gradle.kts index 07b7a18..0365c73 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -30,6 +31,8 @@ allprojects { } tasks.withType { - kotlinOptions.jvmTarget = CompileOptions.jvmTarget + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 8aa580c..cae3e34 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,5 @@ kotlin.code.style=official -kotlin.mpp.enableCInteropCommonization=true \ No newline at end of file +kotlin.mpp.enableCInteropCommonization=true + +org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx4096M" +org.gradle.caching=true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8fa3c66..ca9e114 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,12 +2,12 @@ lib = "2.0.0-alpha-04" android = "8.1.2" auto-service = "1.1.1" -kotlin = "1.9.23" -kotlinpoet = "1.16.0" +kotlin = "2.0.0" +kotlinpoet = "1.17.0" publish = "0.28.0" kase-change = "1.4.1" osdetector = "1.7.3" -ksp = "1.9.23-1.0.20" +ksp = "2.0.0-1.0.21" [libraries] auto-service = { group = "com.google.auto.service", name = "auto-service", version.ref = "auto-service" } diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 15ad7ca..08d1c70 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.plugin.PLUGIN_CLASSPATH_CONFIGURATION_NAME plugins { kotlin("jvm") id("dev.datlag.sekret") version "1.2.2-SNAPSHOT" - id("org.jetbrains.compose") version "1.6.2" + id("org.jetbrains.compose") version "1.6.10" alias(libs.plugins.ksp) } diff --git a/sekret-lib/build.gradle.kts b/sekret-lib/build.gradle.kts index 033a49e..2593c92 100644 --- a/sekret-lib/build.gradle.kts +++ b/sekret-lib/build.gradle.kts @@ -36,16 +36,28 @@ kotlin { } jniTargets.forEach { target -> - target.compilations["main"].cinterops.create("sekret") { - val javaHome = System.getenv("JAVA_HOME") ?: System.getProperty("java.home") - packageName = "dev.datlag.sekret" - - includeDirs( - Callable { File(javaHome, "include") }, - Callable { File(javaHome, "include/darwin") }, - Callable { File(javaHome, "include/linux") }, - Callable { File(javaHome, "include/win32") } - ) + target.compilations.getByName("main") { + cinterops { + val sekret by creating { + val javaDefaultHome = System.getProperty("java.home") + val javaEnvHome = System.getenv("JAVA_HOME") + + packageName("dev.datlag.sekret") + + includeDirs.allHeaders( + File(javaDefaultHome, "include"), + File(javaDefaultHome, "include/darwin"), + File(javaDefaultHome, "include/linux"), + File(javaDefaultHome, "include/win32") + ) + includeDirs.allHeaders( + File(javaEnvHome, "include"), + File(javaEnvHome, "include/darwin"), + File(javaEnvHome, "include/linux"), + File(javaEnvHome, "include/win32") + ) + } + } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index dcc211f..26578f9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,7 +5,7 @@ include(":sekret-lib") include(":sekret-annotations") include(":sekret-compiler-plugin") include(":sekret-ksp") -include(":sample", ":sample:sekret") +// include(":sample", ":sample:sekret") pluginManagement { repositories {