Skip to content

Commit

Permalink
Updating JniGen dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gershnik committed Aug 26, 2024
1 parent 9417f59 commit 827d48f
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 96 deletions.
140 changes: 52 additions & 88 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,97 +28,67 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-13
java: '8'
- os: macos-13
java: '11'
- os: macos-13
java: '17'
- os: macos-13
java: '21'
- os: windows-latest
java: '8'
- os: windows-latest
java: '11'
- os: windows-latest
java: '17'
- os: windows-latest
java: '21'
- os: ubuntu-latest
java: '8'
compiler: 'gcc-11|g++-11'
- os: ubuntu-latest
java: '8'
compiler: 'gcc-12|g++-12'
- os: ubuntu-latest
java: '8'
compiler: 'gcc-13|g++-13'
- os: ubuntu-latest
java: '8'
compiler: 'clang-13|clang++-13'
- os: ubuntu-latest
java: '8'
compiler: 'clang-14|clang++-14'
- os: ubuntu-latest
java: '8'
compiler: 'clang-15|clang++-15'
- os: ubuntu-latest
java: '17'
compiler: 'gcc-11|g++-11'
- os: ubuntu-latest
java: '17'
compiler: 'gcc-12|g++-12'
- os: ubuntu-latest
java: '17'
compiler: 'gcc-13|g++-13'
- os: ubuntu-latest
java: '17'
compiler: 'clang-13|clang++-13'
- os: ubuntu-latest
java: '17'
compiler: 'clang-14|clang++-14'
- os: ubuntu-latest
java: '17'
compiler: 'clang-15|clang++-15'
- os: ubuntu-latest
java: '21'
compiler: 'gcc-11|g++-11'
- os: ubuntu-latest
java: '21'
compiler: 'gcc-12|g++-12'
- os: ubuntu-latest
java: '21'
compiler: 'gcc-13|g++-13'
- os: ubuntu-latest
java: '21'
compiler: 'clang-13|clang++-13'
- os: ubuntu-latest
java: '21'
compiler: 'clang-14|clang++-14'
- os: ubuntu-latest
java: '21'
compiler: 'clang-15|clang++-15'
- { os: macos-13, java: '8' }
- { os: macos-13, java: '11' }
- { os: macos-13, java: '17' }
- { os: macos-13, java: '21' }
- { os: windows-latest, java: '8' }
- { os: windows-latest, java: '11' }
- { os: windows-latest, java: '17' }
- { os: windows-latest, java: '21' }
- { os: ubuntu-latest, java: '8', compiler: 'gcc', compiler_version: 11 }
- { os: ubuntu-latest, java: '8', compiler: 'gcc', compiler_version: 12 }
- { os: ubuntu-latest, java: '8', compiler: 'gcc', compiler_version: 13 }
- { os: ubuntu-24.04, java: '8', compiler: 'gcc', compiler_version: 14 }
- { os: ubuntu-latest, java: '8', compiler: 'clang', compiler_version: 13 }
- { os: ubuntu-latest, java: '8', compiler: 'clang', compiler_version: 13 }
- { os: ubuntu-latest, java: '8', compiler: 'clang', compiler_version: 15 }
- { os: ubuntu-latest, java: '8', compiler: 'clang', compiler_version: 16 }
- { os: ubuntu-latest, java: '8', compiler: 'clang', compiler_version: 17 }
- { os: ubuntu-latest, java: '8', compiler: 'clang', compiler_version: 18 }
- { os: ubuntu-latest, java: '17', compiler: 'gcc', compiler_version: 11 }
- { os: ubuntu-latest, java: '17', compiler: 'gcc', compiler_version: 12 }
- { os: ubuntu-latest, java: '17', compiler: 'gcc', compiler_version: 13 }
- { os: ubuntu-24.04, java: '17', compiler: 'gcc', compiler_version: 14 }
- { os: ubuntu-latest, java: '17', compiler: 'clang', compiler_version: 13 }
- { os: ubuntu-latest, java: '17', compiler: 'clang', compiler_version: 14 }
- { os: ubuntu-latest, java: '17', compiler: 'clang', compiler_version: 15 }
- { os: ubuntu-latest, java: '17', compiler: 'clang', compiler_version: 16 }
- { os: ubuntu-latest, java: '17', compiler: 'clang', compiler_version: 17 }
- { os: ubuntu-latest, java: '17', compiler: 'clang', compiler_version: 18 }
- { os: ubuntu-latest, java: '21', compiler: 'gcc', compiler_version: 11 }
- { os: ubuntu-latest, java: '21', compiler: 'gcc', compiler_version: 12 }
- { os: ubuntu-latest, java: '21', compiler: 'gcc', compiler_version: 13 }
- { os: ubuntu-24.04, java: '21', compiler: 'gcc', compiler_version: 14 }
- { os: ubuntu-latest, java: '21', compiler: 'clang', compiler_version: 13 }
- { os: ubuntu-latest, java: '21', compiler: 'clang', compiler_version: 14 }
- { os: ubuntu-latest, java: '21', compiler: 'clang', compiler_version: 15 }
- { os: ubuntu-latest, java: '21', compiler: 'clang', compiler_version: 16 }
- { os: ubuntu-latest, java: '21', compiler: 'clang', compiler_version: 17 }
- { os: ubuntu-latest, java: '21', compiler: 'clang', compiler_version: 18 }

steps:
- uses: actions/checkout@v4

- name: System Setup
shell: bash
run: |
if [[ '${{ matrix.os }}' == 'ubuntu-latest' ]]; then
if [[ '${{ matrix.compiler}}' == 'clang-15|clang++-15' ]]; then
sudo apt-get update
sudo apt-get install -y clang-15 clang++-15
fi
if [[ '${{ matrix.compiler }}' == 'gcc-12|g++-12' ]]; then
sudo apt-get update
sudo apt-get install -y gcc-12 g++-12
if [[ '${{ matrix.os }}' == 'ubuntu-*' ]]; then
if [[ '${{ matrix.compiler }}' == 'clang' ]]; then
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh ${{ matrix.compiler_version }}
sudo apt-get install -y clang-tools-${{ matrix.compiler_version }}
echo "CC=clang-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
fi
if [[ '${{ matrix.compiler }}' == 'gcc-13|g++-13' ]]; then
if [[ '${{ matrix.compiler }}' == 'gcc' ]]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-13 g++-13
sudo apt-get install -y gcc-${{ matrix.compiler_version }} g++-${{ matrix.compiler_version }}
echo "CC=gcc-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
fi
fi
Expand All @@ -132,13 +102,7 @@ jobs:

- name: Configure CMake
shell: bash
run: |
if [[ '${{ matrix.compiler }}' != '' ]]; then
IFS='|' read -ra COMPILER <<< '${{ matrix.compiler }}'
export CC=${COMPILER[0]}
export CXX=${COMPILER[1]}
fi
cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build and Test Native
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion jnigen/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 2 additions & 0 deletions jnigen/kprocessor/test/src/KJniGenTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.hasItem
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Tag
Expand All @@ -36,6 +37,7 @@ import kotlin.io.path.isDirectory
import kotlin.streams.toList


@OptIn(ExperimentalCompilerApi::class)
@KspExperimental
class KJniGenTest {

Expand Down
3 changes: 3 additions & 0 deletions jnigen/kprocessor/test/src/TestUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.tschuchort.compiletesting.symbolProcessorProviders
import org.hamcrest.CoreMatchers.equalTo
import org.hamcrest.CoreMatchers.`is` as Is
import org.hamcrest.MatcherAssert.assertThat
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.junit.jupiter.api.Assertions.assertTrue
import smjni.jnigen.ksp.Provider
import java.nio.file.Files
Expand All @@ -31,6 +32,7 @@ import java.util.stream.Stream
import kotlin.io.path.div
import kotlin.io.path.exists

@OptIn(ExperimentalCompilerApi::class)
@KspExperimental
fun compileFiles(workingDir: Path,
cppPath: Path,
Expand Down Expand Up @@ -79,6 +81,7 @@ fun listFile(path: Path): List<String> {
emptyList()
}

@OptIn(ExperimentalCompilerApi::class)
fun collectOutput(result: KotlinCompilation.Result) : List<String> {
return result.messages.lines().mapNotNull {
if (it.startsWith("i: [ksp] JNIGen:"))
Expand Down
3 changes: 2 additions & 1 deletion jnigen/processor/test/src/JniGenTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Tag
Expand All @@ -33,7 +34,7 @@ import kotlin.io.path.extension
import kotlin.io.path.isDirectory
import kotlin.streams.toList


@OptIn(ExperimentalCompilerApi::class)
class JniGenTest {

@Tag("GENERATOR")
Expand Down
3 changes: 3 additions & 0 deletions jnigen/processor/test/src/TestUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.tschuchort.compiletesting.SourceFile
import org.hamcrest.CoreMatchers.equalTo
import org.hamcrest.CoreMatchers.`is` as Is
import org.hamcrest.MatcherAssert.assertThat
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.junit.jupiter.api.Assertions.assertTrue
import smjni.jnigen.Processor
import java.nio.file.Files
Expand All @@ -27,6 +28,7 @@ import java.util.*
import java.util.stream.Stream
import kotlin.io.path.exists

@OptIn(ExperimentalCompilerApi::class)
fun compileFiles(workingDir: Path,
cppPath: Path,
sources: List<SourceFile>,
Expand Down Expand Up @@ -75,6 +77,7 @@ fun listFile(path: Path): List<String> {
emptyList()
}

@OptIn(ExperimentalCompilerApi::class)
fun collectOutput(result: KotlinCompilation.Result) : List<String> {
return result.messages.lines().mapNotNull {
if (it.startsWith("i: Note: JNIGen:"))
Expand Down
8 changes: 4 additions & 4 deletions jnigen/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
pluginManagement {
plugins {
val gradleExtra = (gradle as ExtensionAware).extra
val kotlinVersion by gradleExtra("1.9.23")
val kotlinVersion by gradleExtra("1.9.24")
val kspVersion by gradleExtra("1.0.20")
val junitVersion by gradleExtra("5.10.2")
val kotlinCompileTestingVersion by gradleExtra("1.5.0")
val hamcrestVersion by gradleExtra("2.2")
val junitVersion by gradleExtra("5.11.0")
val kotlinCompileTestingVersion by gradleExtra("1.6.0")
val hamcrestVersion by gradleExtra("3.0")

id("org.jetbrains.kotlin.jvm") version kotlinVersion
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 827d48f

Please sign in to comment.