This commit is contained in:
Paul Schaub 2024-12-12 20:37:26 +01:00
parent 0123b0e5fe
commit 811adf7af6
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 16 additions and 90 deletions

View file

@ -17,9 +17,10 @@
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<native.maven.plugin.version>0.10.4</native.maven.plugin.version>
<imageName>bcsop-cli-native</imageName>
<imageName>bcsop</imageName>
<mainClass>org.pgpainless.BcSopCLI</mainClass>
<graal.version>21.0.0</graal.version>
<picocli.version>4.6.3</picocli.version>
</properties>
<dependencies>
@ -59,44 +60,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- annotationProcessorPaths requires maven-compiler-plugin version 3.5 or higher -->
<version>3.11.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>info.picocli</groupId>
<artifactId>picocli-codegen</artifactId>
<version>4.6.3</version>
<version>${picocli.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<!-- Compile -->
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>info.picocli</groupId>
<artifactId>picocli-codegen</artifactId>
<version>4.6.3</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
-->
<!-- Assembly -->
<plugin>
@ -125,6 +99,7 @@
</plugin>
<!-- GraalVM -->
<!-- For this to work, install e.g. 21.0.5-graal using sdkman -->
<plugin>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
@ -143,7 +118,7 @@
</executions>
</plugin>
<!-- Reflections -->
<!-- Manually configure reflections, resources and dynamic proxies -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
@ -160,26 +135,8 @@
<includePluginDependencies>true</includePluginDependencies>
<mainClass>picocli.codegen.aot.graalvm.ReflectionConfigGenerator</mainClass>
<arguments>
<argument>--output=bcsop-cli/target/classes/META-INF/native-image/${project.groupId}/${project.artifactId}/reflect-config.json</argument>
<!--<argument>org.pgpainless.BcSopCLI</argument>-->
<argument>--output=${artifactId}/target/classes/META-INF/native-image/${project.groupId}/${project.artifactId}/reflect-config.json</argument>
<argument>sop.cli.picocli.SopCLI</argument>
<!--
<argument>sop.cli.picocli.commands.ArmorCmd</argument>
<argument>sop.cli.picocli.commands.ChangeKeyPasswordCmd</argument>
<argument>sop.cli.picocli.commands.DearmorCmd</argument>
<argument>sop.cli.picocli.commands.DecryptCmd</argument>
<argument>sop.cli.picocli.commands.EncryptCmd</argument>
<argument>sop.cli.picocli.commands.ExtractCertCmd</argument>
<argument>sop.cli.picocli.commands.GenerateKeyCmd</argument>
<argument>sop.cli.picocli.commands.InlineDetachCmd</argument>
<argument>sop.cli.picocli.commands.InlineSignCmd</argument>
<argument>sop.cli.picocli.commands.InlineVerifyCmd</argument>
<argument>sop.cli.picocli.commands.ListProfilesCmd</argument>
<argument>sop.cli.picocli.commands.RevokeKeyCmd</argument>
<argument>sop.cli.picocli.commands.SignCmd</argument>
<argument>sop.cli.picocli.commands.VerifyCmd</argument>
<argument>sop.cli.picocli.commands.VersionCmd</argument>
-->
</arguments>
</configuration>
</execution>
@ -194,26 +151,8 @@
<includePluginDependencies>true</includePluginDependencies>
<mainClass>picocli.codegen.aot.graalvm.DynamicProxyConfigGenerator</mainClass>
<arguments>
<argument>--output=bcsop-cli/target/classes/META-INF/native-image/${project.groupId}/${project.artifactId}/proxy-config.json</argument>
<!--<argument>org.pgpainless.BcSopCLI</argument>-->
<argument>--output=${artifactId}/target/classes/META-INF/native-image/${project.groupId}/${project.artifactId}/proxy-config.json</argument>
<argument>sop.cli.picocli.SopCLI</argument>
<!--
<argument>sop.cli.picocli.commands.ArmorCmd</argument>
<argument>sop.cli.picocli.commands.ChangeKeyPasswordCmd</argument>
<argument>sop.cli.picocli.commands.DearmorCmd</argument>
<argument>sop.cli.picocli.commands.DecryptCmd</argument>
<argument>sop.cli.picocli.commands.EncryptCmd</argument>
<argument>sop.cli.picocli.commands.ExtractCertCmd</argument>
<argument>sop.cli.picocli.commands.GenerateKeyCmd</argument>
<argument>sop.cli.picocli.commands.InlineDetachCmd</argument>
<argument>sop.cli.picocli.commands.InlineSignCmd</argument>
<argument>sop.cli.picocli.commands.InlineVerifyCmd</argument>
<argument>sop.cli.picocli.commands.ListProfilesCmd</argument>
<argument>sop.cli.picocli.commands.RevokeKeyCmd</argument>
<argument>sop.cli.picocli.commands.SignCmd</argument>
<argument>sop.cli.picocli.commands.VerifyCmd</argument>
<argument>sop.cli.picocli.commands.VersionCmd</argument>
-->
</arguments>
</configuration>
</execution>
@ -228,26 +167,8 @@
<includePluginDependencies>true</includePluginDependencies>
<mainClass>picocli.codegen.aot.graalvm.ResourceConfigGenerator</mainClass>
<arguments>
<argument>--output=bcsop-cli/target/classes/META-INF/native-image/${project.groupId}/${project.artifactId}/resource-config.json</argument>
<!--<argument>org.pgpainless.BcSopCLI</argument>-->
<argument>--output=${artifactId}/target/classes/META-INF/native-image/${project.groupId}/${project.artifactId}/resource-config.json</argument>
<argument>sop.cli.picocli.SopCLI</argument>
<!--
<argument>sop.cli.picocli.commands.ArmorCmd</argument>
<argument>sop.cli.picocli.commands.ChangeKeyPasswordCmd</argument>
<argument>sop.cli.picocli.commands.DearmorCmd</argument>
<argument>sop.cli.picocli.commands.DecryptCmd</argument>
<argument>sop.cli.picocli.commands.EncryptCmd</argument>
<argument>sop.cli.picocli.commands.ExtractCertCmd</argument>
<argument>sop.cli.picocli.commands.GenerateKeyCmd</argument>
<argument>sop.cli.picocli.commands.InlineDetachCmd</argument>
<argument>sop.cli.picocli.commands.InlineSignCmd</argument>
<argument>sop.cli.picocli.commands.InlineVerifyCmd</argument>
<argument>sop.cli.picocli.commands.ListProfilesCmd</argument>
<argument>sop.cli.picocli.commands.RevokeKeyCmd</argument>
<argument>sop.cli.picocli.commands.SignCmd</argument>
<argument>sop.cli.picocli.commands.VerifyCmd</argument>
<argument>sop.cli.picocli.commands.VersionCmd</argument>
-->
</arguments>
</configuration>
</execution>
@ -256,7 +177,7 @@
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli-codegen</artifactId>
<version>4.6.3</version>
<version>${picocli.version}</version>
<type>jar</type>
</dependency>
</dependencies>

View file

@ -6,16 +6,21 @@ import sop.cli.picocli.SOPExceptionExitCodeMapper;
import sop.cli.picocli.SOPExecutionExceptionHandler;
import sop.cli.picocli.SopCLI;
public class BcSopCLI extends SopCLI {
public class BcSopCLI {
public static void main(String[] args) {
SopCLI.EXECUTABLE_NAME = "bc-sop";
SopCLI.EXECUTABLE_NAME = "bcsop";
SopCLI.setSopInstance(new BouncyCastleSOP());
System.exit(run(args));
}
public static int run(String[] args)
{
// Set locale
new CommandLine(new SopCLI.InitLocale())
.setUnmatchedArgumentsAllowed(true)
.parseArgs(args);
CommandLine cmd = new CommandLine(SopCLI.class);
cmd.getSubcommands().get("generate-completion").getCommandSpec().usageMessage().hidden(true);
cmd.setCommandName("bcsop");