Add a mvnd.rawStreams property (#719)

This commit is contained in:
Guillaume Nodet
2022-12-16 11:33:59 +01:00
committed by GitHub
parent 39ee2b6014
commit 55236739f8
4 changed files with 18 additions and 12 deletions

View File

@@ -297,6 +297,11 @@ public class DefaultClient implements Client {
return DefaultResult.success(argv); return DefaultResult.success(argv);
} }
// Raw streams
if (Environment.MVND_RAW_STREAMS.removeCommandLineOption(args) != null) {
args.add("-D" + Environment.MVND_RAW_STREAMS.getProperty());
}
Optional<String> threads = Optional.ofNullable(Environment.MVND_THREADS.removeCommandLineOption(args)); Optional<String> threads = Optional.ofNullable(Environment.MVND_THREADS.removeCommandLineOption(args));
Environment.MVND_THREADS.addCommandLineOption(args, threads.orElseGet(parameters::threads)); Environment.MVND_THREADS.addCommandLineOption(args, threads.orElseGet(parameters::threads));

View File

@@ -285,7 +285,12 @@ public enum Environment {
* This pattern will be evaluated against the full path of the dependencies, so it is usually desirable to * This pattern will be evaluated against the full path of the dependencies, so it is usually desirable to
* start with <code>'glob:**&#47;'</code> to support any location of the local repository. * start with <code>'glob:**&#47;'</code> to support any location of the local repository.
*/ */
MVND_PLUGIN_REALM_EVICT_PATTERN("mvnd.pluginRealmEvictPattern", null, "", OptionType.STRING, Flags.OPTIONAL); MVND_PLUGIN_REALM_EVICT_PATTERN("mvnd.pluginRealmEvictPattern", null, "", OptionType.STRING, Flags.OPTIONAL),
/**
* Whether or not decorate output and error streams
**/
MVND_RAW_STREAMS("mvnd.rawStreams", null, Boolean.FALSE, OptionType.VOID, Flags.OPTIONAL, "mvnd:--raw-streams"),
;
static Properties properties; static Properties properties;

View File

@@ -139,8 +139,6 @@ public class DaemonMavenCli {
public static final String STYLE_COLOR_PROPERTY = "style.color"; public static final String STYLE_COLOR_PROPERTY = "style.color";
public static final String RESUME = "r";
public static final String RAW_STREAMS = "raw-streams"; public static final String RAW_STREAMS = "raw-streams";
private final Slf4jLoggerManager plexusLoggerManager; private final Slf4jLoggerManager plexusLoggerManager;
@@ -304,14 +302,9 @@ public class DaemonMavenCli {
private CLIManager newCLIManager() { private CLIManager newCLIManager() {
CLIManager cliManager = new CLIManager(); CLIManager cliManager = new CLIManager();
cliManager.options.addOption(Option.builder(RESUME)
.longOpt("resume")
.desc("Resume reactor from "
+ "the last failed project, using the resume.properties file in the build directory")
.build());
cliManager.options.addOption(Option.builder() cliManager.options.addOption(Option.builder()
.longOpt(RAW_STREAMS) .longOpt(RAW_STREAMS)
.desc("Do not decorate output and " + "error streams") .desc("Do not decorate output and error streams")
.build()); .build());
return cliManager; return cliManager;
} }
@@ -399,7 +392,10 @@ public class DaemonMavenCli {
// Ignore // Ignore
// //
} }
} else if (!cliRequest.commandLine.hasOption(RAW_STREAMS)) { } else if (!Environment.MVND_RAW_STREAMS
.asOptional()
.map(Boolean::parseBoolean)
.orElse(Boolean.FALSE)) {
ch.qos.logback.classic.Logger stdout = ch.qos.logback.classic.Logger stdout =
(ch.qos.logback.classic.Logger) slf4jLoggerFactory.getLogger("stdout"); (ch.qos.logback.classic.Logger) slf4jLoggerFactory.getLogger("stdout");
ch.qos.logback.classic.Logger stderr = ch.qos.logback.classic.Logger stderr =

View File

@@ -217,8 +217,8 @@ _mvnd()
_get_comp_words_by_ref -n : cur prev _get_comp_words_by_ref -n : cur prev
local mvnd_opts="-1" local mvnd_opts="-1"
local mvnd_long_opts="--color|--completion|--purge|--serial|--status|--stop" local mvnd_long_opts="--color|--completion|--purge|--raw-streams|--serial|--status|--stop"
local mvnd_properties="-Djava.home|-Djdk.java.options|-Dmaven.multiModuleProjectDirectory|-Dmaven.repo.local|-Dmaven.settings|-Dmvnd.buildTime|-Dmvnd.builder|-Dmvnd.daemonStorage|-Dmvnd.debug|-Dmvnd.debug.address|-Dmvnd.duplicateDaemonGracePeriod|-Dmvnd.enableAssertions|-Dmvnd.expirationCheckDelay|-Dmvnd.home|-Dmvnd.idleTimeout|-Dmvnd.jvmArgs|-Dmvnd.keepAlive|-Dmvnd.logPurgePeriod|-Dmvnd.logback|-Dmvnd.maxHeapSize|-Dmvnd.maxLostKeepAlive|-Dmvnd.minHeapSize|-Dmvnd.minThreads|-Dmvnd.noBuffering|-Dmvnd.noDaemon|-Dmvnd.pluginRealmEvictPattern|-Dmvnd.propertiesPath|-Dmvnd.registry|-Dmvnd.rollingWindowSize|-Dmvnd.serial|-Dmvnd.socketFamily|-Dmvnd.threadStackSize|-Dmvnd.threads|-Dstyle.color|-Duser.dir|-Duser.home" local mvnd_properties="-Djava.home|-Djdk.java.options|-Dmaven.multiModuleProjectDirectory|-Dmaven.repo.local|-Dmaven.settings|-Dmvnd.buildTime|-Dmvnd.builder|-Dmvnd.daemonStorage|-Dmvnd.debug|-Dmvnd.debug.address|-Dmvnd.duplicateDaemonGracePeriod|-Dmvnd.enableAssertions|-Dmvnd.expirationCheckDelay|-Dmvnd.home|-Dmvnd.idleTimeout|-Dmvnd.jvmArgs|-Dmvnd.keepAlive|-Dmvnd.logPurgePeriod|-Dmvnd.logback|-Dmvnd.maxHeapSize|-Dmvnd.maxLostKeepAlive|-Dmvnd.minHeapSize|-Dmvnd.minThreads|-Dmvnd.noBuffering|-Dmvnd.noDaemon|-Dmvnd.pluginRealmEvictPattern|-Dmvnd.propertiesPath|-Dmvnd.rawStreams|-Dmvnd.registry|-Dmvnd.rollingWindowSize|-Dmvnd.serial|-Dmvnd.socketFamily|-Dmvnd.threadStackSize|-Dmvnd.threads|-Dstyle.color|-Duser.dir|-Duser.home"
local opts="-am|-amd|-B|-C|-c|-cpu|-D|-e|-emp|-ep|-f|-fae|-ff|-fn|-gs|-h|-l|-N|-npr|-npu|-nsu|-o|-P|-pl|-q|-rf|-s|-T|-t|-U|-up|-V|-v|-X|${mvnd_opts}" local opts="-am|-amd|-B|-C|-c|-cpu|-D|-e|-emp|-ep|-f|-fae|-ff|-fn|-gs|-h|-l|-N|-npr|-npu|-nsu|-o|-P|-pl|-q|-rf|-s|-T|-t|-U|-up|-V|-v|-X|${mvnd_opts}"
local long_opts="--also-make|--also-make-dependents|--batch-mode|--strict-checksums|--lax-checksums|--check-plugin-updates|--define|--errors|--encrypt-master-password|--encrypt-password|--file|--fail-at-end|--fail-fast|--fail-never|--global-settings|--help|--log-file|--non-recursive|--no-plugin-registry|--no-plugin-updates|--no-snapshot-updates|--offline|--activate-profiles|--projects|--quiet|--resume-from|--settings|--threads|--toolchains|--update-snapshots|--update-plugins|--show-version|--version|--debug|${mvnd_long_opts}" local long_opts="--also-make|--also-make-dependents|--batch-mode|--strict-checksums|--lax-checksums|--check-plugin-updates|--define|--errors|--encrypt-master-password|--encrypt-password|--file|--fail-at-end|--fail-fast|--fail-never|--global-settings|--help|--log-file|--non-recursive|--no-plugin-registry|--no-plugin-updates|--no-snapshot-updates|--offline|--activate-profiles|--projects|--quiet|--resume-from|--settings|--threads|--toolchains|--update-snapshots|--update-plugins|--show-version|--version|--debug|${mvnd_long_opts}"