-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
525 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Publish package to GitHub Packages | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@064a97fb0b4cef86a65f09898c572382f3af10e0 | ||
- name: Publish package | ||
uses: gradle/gradle-build-action@bde650d6f1426615a60165575bc9cdad3e54d975 | ||
with: | ||
arguments: publishAllPublicationsToGitHubPackagesRepository | ||
env: | ||
USERNAME: ${{ github.actor }} | ||
TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'liberica' | ||
- name: Build with Gradle | ||
uses: gradle/gradle-build-action@bde650d6f1426615a60165575bc9cdad3e54d975 | ||
with: | ||
arguments: check assemble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Ignore Gradle project-specific cache directory | ||
.gradle | ||
|
||
# Ignore Gradle build output directory | ||
build | ||
/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
[![](https://jitpack.io/v/cmdjulian/kirc.svg)](https://jitpack.io/#cmdjulian/bouncy-castle-graalvm) | ||
|
||
# bouncy-castle-graalvm | ||
GraalVM feature to contribute BouncyCastle into native image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import org.jetbrains.kotlinx.publisher.apache2 | ||
import org.jetbrains.kotlinx.publisher.developer | ||
import org.jetbrains.kotlinx.publisher.githubRepo | ||
|
||
plugins { | ||
id("org.jetbrains.kotlin.jvm") version "1.8.22" | ||
kotlin("libs.publisher") version "0.0.61-dev-34" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("org.graalvm.nativeimage:svm:23.0.0") | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(11)) | ||
} | ||
} | ||
|
||
kotlinPublications { | ||
defaultGroup.set("com.github.cmdjulian") | ||
fairDokkaJars.set(false) | ||
|
||
pom { | ||
inceptionYear.set("2023") | ||
licenses { | ||
apache2() | ||
} | ||
githubRepo("cmdjulian", "bouncy-castle-graalvm") | ||
developers { | ||
developer("cmdjulian", "Julian Goede", "[email protected]") | ||
} | ||
} | ||
|
||
localRepositories { | ||
defaultLocalMavenRepository() | ||
} | ||
|
||
publication { | ||
publicationName.set("graal-bouncy-castle") | ||
description.set("kirc core components") | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
bouncy-castle/src/main/kotlin/de/cmdjulian/graal/bouncycastle/BouncyCastleFeature.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package de.cmdjulian.graal.bouncycastle | ||
|
||
import org.graalvm.nativeimage.hosted.Feature | ||
import org.graalvm.nativeimage.hosted.Feature.AfterRegistrationAccess | ||
import org.graalvm.nativeimage.hosted.RuntimeClassInitialization | ||
import java.security.Provider | ||
import java.security.Security | ||
|
||
@Suppress("unused") | ||
class BouncyCastleFeature : Feature { | ||
override fun afterRegistration(access: AfterRegistrationAccess?) { | ||
val clazz = try { | ||
Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider") | ||
} catch (e: Exception) { | ||
return println( | ||
if (e is ClassNotFoundException) { | ||
"bouncy castle not present -> not loading it" | ||
} else { | ||
"unknown exception when loading bouncy castle: ${e.message}" | ||
}, | ||
) | ||
} | ||
|
||
val bc = clazz.getConstructor().newInstance() as Provider | ||
|
||
Security.addProvider(bc) | ||
|
||
RuntimeClassInitialization.initializeAtBuildTime("org.bouncycastle") | ||
RuntimeClassInitialization.initializeAtRunTime(Class.forName("org.bouncycastle.jcajce.provider.drbg.DRBG\$Default")) | ||
RuntimeClassInitialization.initializeAtRunTime(Class.forName("org.bouncycastle.jcajce.provider.drbg.DRBG\$NonceAndIV")) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
bouncy-castle/src/main/resources/META-INF/native-image/native-image.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Args = --features=de.cmdjulian.graal.bouncycastle.BouncyCastleFeature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# This file was generated by the Gradle 'init' task. | ||
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties | ||
|
||
org.gradle.parallel=true | ||
org.gradle.caching=true | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.