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

View file

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