Skip to content

Commit

Permalink
update for K2
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed May 26, 2024
1 parent f1ae7ec commit 6515c10
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 17 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand Down Expand Up @@ -30,6 +31,8 @@ allprojects {
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = CompileOptions.jvmTarget
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
kotlin.code.style=official
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.enableCInteropCommonization=true

org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx4096M"
org.gradle.caching=true
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
32 changes: 22 additions & 10 deletions sekret-lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6515c10

Please sign in to comment.