1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-05 03:55:58 +01:00

WIP: Working, but slow native image

This commit is contained in:
Paul Schaub 2022-11-24 23:45:28 +01:00
parent f61f7bae15
commit 3737acaa16
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 10 additions and 19 deletions

View file

@ -85,6 +85,14 @@ task(generateGraalReflectionConfig, dependsOn: 'classes', type: JavaExec) {
}
assemble.dependsOn generateGraalReflectionConfig
task(generateGraalResourceConfig, dependsOn: 'classes', type: JavaExec) {
main = 'picocli.codegen.aot.graalvm.ResourceConfigGenerator'
classpath = configurations.generateConfig + sourceSets.main.runtimeClasspath
def outputFile = "${buildDir}/resources/main/META-INF/native-image/${project.group}/${project.name}/resource-config.json"
args = ["--output=$outputFile", 'sop.cli.picocli.SopCLI']
}
assemble.dependsOn generateGraalResourceConfig
/**
jar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
@ -122,15 +130,5 @@ nativeImage {
graalVmHome = graalHome
mainClass = mainClassName
executableName = 'pgpainless-cli'
arguments(
'--no-fallback',
// '--enable-all-security-services',
// '--initialize-at-run-time=com.example.runtime',
'--enable-https',
'--enable-all-security-services',
'--allow-incomplete-classpath',
// '--report-unsupported-elements-at-runtime',
'--initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG$Default,org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV'
)
}
tasks."nativeImage".dependsOn('generateGraalReflectionConfig')

View file

@ -4,14 +4,6 @@
package org.pgpainless.sop;
import java.security.Provider;
import java.security.Security;
import com.sun.crypto.provider.SunJCE;
import org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.implementation.JceImplementationFactory;
import org.pgpainless.util.ArmoredOutputStreamFactory;
import sop.SOP;
import sop.operation.Armor;
@ -26,12 +18,12 @@ import sop.operation.InlineDetach;
import sop.operation.InlineSign;
import sop.operation.InlineVerify;
import sop.operation.Version;
import sun.security.ec.SunEC;
public class SOPImpl implements SOP {
static {
ArmoredOutputStreamFactory.setVersionInfo(null);
/*
ImplementationFactory.setFactoryImplementation(new JceImplementationFactory());
Security.addProvider(new BouncyCastleProvider());
Security.addProvider(new SunJCE());
@ -41,6 +33,7 @@ public class SOPImpl implements SOP {
Provider bcProv = Security.getProvider("BC");
Security.removeProvider("BC");
Security.insertProviderAt(bcProv, 1);
*/
}
@Override