Skip to content

Commit

Permalink
Merge branch 'vnext'
Browse files Browse the repository at this point in the history
  • Loading branch information
gershnik committed Apr 2, 2023
2 parents 9b83650 + 4488612 commit e123de6
Show file tree
Hide file tree
Showing 29 changed files with 113 additions and 17,927 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ env:

jobs:
build:
runs-on: ubuntu-latest #${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'adopt'
java-version: |
8
17
distribution: 'temurin'

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
Expand Down
6 changes: 4 additions & 2 deletions jnigen/annotations/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ javadoc {

task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier "sources"
archiveClassifier.convention("sources")
archiveClassifier.set("sources")
}

task javadocJar(type: Jar) {
from javadoc
classifier 'javadoc'
archiveClassifier.convention('javadoc')
archiveClassifier.set('javadoc')
}

apply from: '../publishing.gradle'
Expand Down
4 changes: 2 additions & 2 deletions jnigen/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
limitations under the License.
*/
buildscript {
ext.kotlin_version = '1.7.21'
ext.kotlin_version = '1.8.0'
ext.junit_version = '5.8.2'

repositories {
Expand Down Expand Up @@ -71,7 +71,7 @@ allprojects {
project.ext.vcsUrl = 'https://github.com/gershnik/SimpleJNI.git'
project.ext.issueTrackerUrl = 'https://github.com/gershnik/SimpleJNI/issues'

project.ext.kotlinJvmTarget = "1.8"
project.ext.kotlinJvmTarget = 8
}

task bundleCpp(type: Zip, group: 'publishing') {
Expand Down
2 changes: 1 addition & 1 deletion jnigen/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
27 changes: 16 additions & 11 deletions jnigen/kprocessor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ project.ext.libraryDescription = "KSP annotation processor that generates Simple


dependencies {
implementation "com.google.devtools.ksp:symbol-processing-api:$kotlin_version-1.0.8"
implementation "com.google.devtools.ksp:symbol-processing-api:$kotlin_version-1.0.9"

testImplementation('com.github.tschuchortdev:kotlin-compile-testing:1.4.9')
testImplementation('com.github.tschuchortdev:kotlin-compile-testing-ksp:1.4.9')
testImplementation('com.github.tschuchortdev:kotlin-compile-testing:1.5.0')
testImplementation('com.github.tschuchortdev:kotlin-compile-testing-ksp:1.5.0')
testImplementation "org.jetbrains.kotlin:kotlin-test-junit5:$kotlin_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testImplementation "org.hamcrest:hamcrest:2.2"
Expand All @@ -46,17 +46,20 @@ sourceSets {

targetCompatibility = JavaVersion.VERSION_1_8

compileKotlin {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
kotlin {
jvmToolchain(kotlinJvmTarget)
}

test {
useJUnitPlatform()
outputs.upToDateWhen {false}
systemProperty('test.data.location', new File(rootProject.projectDir, "test_data"))
systemProperty('test.working.dir', new File(buildDir, "test-output"))
//testLogging.showStandardStreams = true
testLogging.showExceptions = true
testLogging.showStackTraces = true
testLogging.showCauses = true
testLogging.exceptionFormat = "full"
}

task generateTestData(type: Test) {
Expand All @@ -73,8 +76,8 @@ task generateTestData(type: Test) {
environment('JNIGEN_ENABLE_TEST_GENERATION', 'true')

reports {
html.enabled false
junitXml.enabled = false
html.required = false
junitXml.required = false
}
}

Expand All @@ -95,12 +98,14 @@ javadoc {

task sourceJar(type: Jar) {
from sourceSets.main.allJava, sourceSets.main.kotlin
classifier "sources"
archiveClassifier.convention('sources')
archiveClassifier.set('sources')
}

task javadocJar(type: Jar) {
from javadoc
classifier 'javadoc'
archiveClassifier.convention('javadoc')
archiveClassifier.set('javadoc')
}

apply from: '../publishing.gradle'
3 changes: 1 addition & 2 deletions jnigen/kprocessor/test/src/KJniGenTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.google.devtools.ksp.KspExperimental
import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import org.hamcrest.CoreMatchers.equalTo
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.hasItem
import org.junit.jupiter.api.Assertions.assertEquals
Expand Down Expand Up @@ -88,7 +87,7 @@ class KJniGenTest {
listPath(expectedDir)
.filter {setOf("h", "cpp", "txt").contains(it.extension) }
.forEach {
assertFileContent(cppPath/it.fileName, Files.readString(it))
assertFileContent(cppPath/it.fileName, it.toFile().readLines())
}
listPath(cppPath)
.filter {setOf("h", "cpp", "txt").contains(it.extension) }
Expand Down
4 changes: 2 additions & 2 deletions jnigen/kprocessor/test/src/TestUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ fun compileFiles(workingDir: Path,
}.compile()
}

fun assertFileContent(path: Path, content: String) {
fun assertFileContent(path: Path, content: List<String>) {
assertTrue(Files.exists(path))
assertThat(Files.readString(path), Is(equalTo(content)))
assertThat(path.toFile().readLines(), Is(equalTo(content)))
}

fun loadArguments(argsPath: Path) : Map<String, String> {
Expand Down
43 changes: 16 additions & 27 deletions jnigen/processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ project.ext.libraryDescription = "Annotation processor that generates SimpleJNI

targetCompatibility = JavaVersion.VERSION_1_8

kotlin {
jvmToolchain(kotlinJvmTarget)
}


dependencies {
compileOnly files("${System.properties['java.home']}/../lib/tools.jar")

Expand All @@ -50,34 +55,16 @@ sourceSets {
test.resources.srcDirs = ['test/res']
}

if (JavaVersion.current() >= JavaVersion.VERSION_16) {
test {
jvmArgs(
"--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
)
}
}

compileKotlin {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}

test {
useJUnitPlatform()
outputs.upToDateWhen {false}
systemProperty('test.data.location', new File(rootProject.projectDir, "test_data"))
systemProperty('test.working.dir', new File(buildDir, "test-output"))
//testLogging.showStandardStreams = true
testLogging.showExceptions = true
testLogging.showStackTraces = true
testLogging.showCauses = true
testLogging.exceptionFormat = "full"
}

task generateTestData(type: Test) {
Expand All @@ -94,8 +81,8 @@ task generateTestData(type: Test) {
environment('JNIGEN_ENABLE_TEST_GENERATION', 'true')

reports {
html.enabled false
junitXml.enabled = false
html.required = false
junitXml.required = false
}
}

Expand All @@ -118,12 +105,14 @@ javadoc {

task sourceJar(type: Jar) {
from sourceSets.main.allJava, sourceSets.main.kotlin
classifier "sources"
archiveClassifier.convention("sources")
archiveClassifier.set("sources")
}

task javadocJar(type: Jar) {
from javadoc
classifier 'javadoc'
archiveClassifier.convention('javadoc')
archiveClassifier.set('javadoc')
}

apply from: '../publishing.gradle'
Expand Down
8 changes: 5 additions & 3 deletions jnigen/processor/src/smjni/jnigen/Runner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package smjni.jnigen
import java.nio.file.Files
import java.nio.file.Paths
import java.util.*
import kotlin.collections.ArrayList
import com.sun.tools.javac.Main as Javac
import javax.tools.JavaCompiler
import javax.tools.ToolProvider

object Runner {

Expand All @@ -48,7 +48,9 @@ object Runner {

javacArgs += files

Javac.main(javacArgs.toTypedArray())
val compiler: JavaCompiler = ToolProvider.getSystemJavaCompiler()

compiler.run(null, null, null, *(javacArgs.toTypedArray()))
} catch (ex: Exception) {
throw RuntimeException(ex)
}
Expand Down
3 changes: 1 addition & 2 deletions jnigen/processor/test/src/JniGenTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import org.hamcrest.CoreMatchers.equalTo
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers
import org.junit.jupiter.api.Assertions
Expand Down Expand Up @@ -84,7 +83,7 @@ class JniGenTest {
listPath(expectedDir)
.filter {setOf("h", "cpp", "txt").contains(it.extension) }
.forEach {
assertFileContent(cppPath/it.fileName, Files.readString(it))
assertFileContent(cppPath/it.fileName, it.toFile().readLines())
}
listPath(cppPath)
.filter {setOf("h", "cpp", "txt").contains(it.extension) }
Expand Down
4 changes: 2 additions & 2 deletions jnigen/processor/test/src/TestUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ fun compileFiles(workingDir: Path,
}.compile()
}

fun assertFileContent(path: Path, content: String) {
fun assertFileContent(path: Path, content: List<String>) {
assertTrue(Files.exists(path))
assertThat(Files.readString(path), Is(equalTo(content)))
assertThat(path.toFile().readLines(), Is(equalTo(content)))
}

fun loadArguments(argsPath: Path) : Map<String, String> {
Expand Down
8 changes: 4 additions & 4 deletions samples/android/java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ dependencies {
//JNI code generator
annotationProcessor("io.github.gershnik:smjni-jnigen-processor:${gradle.ext.jniGenVersion}")

implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}


Expand Down
2 changes: 1 addition & 1 deletion samples/android/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.android.tools.build:gradle:7.4.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions samples/android/java/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Nov 30 19:18:56 PST 2022
#Sat Apr 01 03:05:06 PDT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
14 changes: 7 additions & 7 deletions samples/android/kotlin-kapt/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ dependencies {
kapt("io.github.gershnik:smjni-jnigen-processor:${gradle.ext.jniGenVersion}")

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

android {
Expand Down Expand Up @@ -58,8 +58,8 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
kotlin {
jvmToolchain(8)
}
externalNativeBuild {
cmake {
Expand All @@ -79,7 +79,7 @@ kapt {
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
tasks.withType(org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask).all {
outputs.upToDateWhen {

def jniGenOutputList = file("${jniGenProps.generatedPath}/${jniGenProps.outputListName}")
Expand Down
4 changes: 2 additions & 2 deletions samples/android/kotlin-kapt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.3.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20"
classpath "com.android.tools.build:gradle:7.4.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Nov 30 19:18:56 PST 2022
#Sat Apr 01 02:06:58 PDT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Loading

0 comments on commit e123de6

Please sign in to comment.