2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 16:27:11 -07:00

More operation options cleanups

This commit is contained in:
Erik C. Thauvin 2024-08-03 09:51:09 -07:00
parent 91640e68ce
commit 1d615a501c
Signed by: erik
GPG key ID: 776702A6A2DA330E
7 changed files with 73 additions and 105 deletions

View file

@ -85,14 +85,4 @@ public class JlinkOperation extends AbstractToolProviderOperation<JlinkOperation
public List<String> fileOptions() {
return fileOptions_;
}
/**
* List available plugins.
*
* @return this operation instance
*/
public JlinkOperation listPlugins() {
toolArgs("--list-plugins");
return this;
}
}

View file

@ -15,7 +15,7 @@ import java.util.List;
* @since 2.0.2
*/
public class JlinkOptions extends HashMap<String, String> {
/**ranran
/**
* All Modules Path.
*/
@SuppressWarnings("unused")
@ -50,16 +50,12 @@ public class JlinkOptions extends HashMap<String, String> {
}
/**
* Compression to use in compressing resources.
* <p>
* Where {@link ZipCompression#ZIP_0 ZIP_0} provides no compression and {@link ZipCompression#ZIP_9 ZIP_9} provides
* the best compression.
* <p>Default is {@link ZipCompression#ZIP_6 ZIP_6}
* Enable compression of resources.
*
* @param compression the {@link ZipCompression compression} level
* @param compression the {@link CompressionLevel compression} level
* @return this map of options
*/
public JlinkOptions compress(ZipCompression compression) {
public JlinkOptions compress(CompressionLevel compression) {
put("--compress", compression.level);
return this;
}
@ -106,21 +102,6 @@ public class JlinkOptions extends HashMap<String, String> {
return this;
}
/**
* Exclude include header files.
*
* @param noHeaderFiles {@code true} to exclude header files, {@code false} otherwise
* @return this map of options
*/
public JlinkOptions noHeaderFiles(boolean noHeaderFiles) {
if (noHeaderFiles) {
put("--no-header-files");
} else {
remove("--no-header-files");
}
return this;
}
/**
* Add a launcher command of the given name for the module and the main class.
*
@ -159,6 +140,21 @@ public class JlinkOptions extends HashMap<String, String> {
return this;
}
/**
* Exclude include header files.
*
* @param noHeaderFiles {@code true} to exclude header files, {@code false} otherwise
* @return this map of options
*/
public JlinkOptions noHeaderFiles(boolean noHeaderFiles) {
if (noHeaderFiles) {
put("--no-header-files");
} else {
remove("--no-header-files");
}
return this;
}
/**
* Exclude man pages.
*
@ -174,16 +170,6 @@ public class JlinkOptions extends HashMap<String, String> {
return this;
}
/**
* Associates {@code null} with the specified key in this map. If the map previously contained a mapping for the
* key, the old value is replaced.
*
* @param key key with which the specified value is to be associated
*/
public void put(String key) {
put(key, null);
}
/**
* Location of output path.
*
@ -195,6 +181,16 @@ public class JlinkOptions extends HashMap<String, String> {
return this;
}
/**
* Associates {@code null} with the specified key in this map. If the map previously contained a mapping for the
* key, the old value is replaced.
*
* @param key key with which the specified value is to be associated
*/
public void put(String key) {
put(key, null);
}
/**
* Suggest providers that implement the given service types from the module path.
*
@ -222,7 +218,7 @@ public class JlinkOptions extends HashMap<String, String> {
}
/**
* Strip the native commands.
* Strip native commands.
*
* @param stripNativeCommands {@code true} to strip, {@code false} otherwise
* @return this map of options
@ -286,4 +282,27 @@ public class JlinkOptions extends HashMap<String, String> {
}
}
/**
* Resources compression levels.
*/
public enum CompressionLevel {
/**
* Level 0: No compression
*/
NO_COMPRESSION("0"),
/**
* Level 1: Constant string sharing
*/
CONSTANT_STRING_SHARING("1"),
/**
* Level 2: ZIP
*/
ZIP("2");
public final String level;
CompressionLevel(String level) {
this.level = level;
}
}
}

View file

@ -38,21 +38,6 @@ public class JmodOptions extends HashMap<String, String> {
return this;
}
/**
* Compression to use when creating the JMOD archive.
* <p>
* Where {@link ZipCompression#ZIP_0 ZIP_0} provides no compression and {@link ZipCompression#ZIP_9 ZIP_9} provides the
* best compression.
* <p>Default is {@link ZipCompression#ZIP_6 ZIP_6}
*
* @param compression the {@link ZipCompression compression} level
* @return this map of options
*/
public JmodOptions compress(ZipCompression compression) {
put("--compress", compression.level);
return this;
}
/**
* Location of user-editable config files
*
@ -135,16 +120,6 @@ public class JmodOptions extends HashMap<String, String> {
return this;
}
/**
* Associates {@code null} with the specified key in this map. If the map previously contained a mapping for the
* key, the old value is replaced.
*
* @param key key with which the specified value is to be associated
*/
public void put(String key) {
put(key, null);
}
/**
* Compute and record hashes to tie a packaged module with modules matching the given regular expression pattern and
* depending upon it directly or indirectly. The hashes are recorded in the JMOD file being created, or a JMOD file
@ -235,6 +210,16 @@ public class JmodOptions extends HashMap<String, String> {
return this;
}
/**
* Associates {@code null} with the specified key in this map. If the map previously contained a mapping for the
* key, the old value is replaced.
*
* @param key key with which the specified value is to be associated
*/
public void put(String key) {
put(key, null);
}
/**
* Target platform.
*

View file

@ -1,30 +0,0 @@
/**
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.operations;
/**
* The zip compression levels for jlink and jmod.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 2.0.2
*/
public enum ZipCompression {
ZIP_0("zip-0"),
ZIP_1("zip-1"),
ZIP_2("zip-2"),
ZIP_3("zip-3"),
ZIP_4("zip-4"),
ZIP_5("zip-5"),
ZIP_6("zip-6"),
ZIP_7("zip-7"),
ZIP_8("zip-8"),
ZIP_9("zip-9");
public final String level;
ZipCompression(String level) {
this.level = level;
}
}