Skip to content

Commit

Permalink
Add "quiet" parameter
Browse files Browse the repository at this point in the history
Closes #103
  • Loading branch information
luontola committed Jan 11, 2017
1 parent 4bb6440 commit 6907b5d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 5 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Retrolambda takes Java 8 classes and backports lambda expressions and
some other language features to work on Java 7, 6 or 5.
Web site: https://github.com/orfjackal/retrolambda
Copyright (c) 2013-2016 Esko Luontola and other Retrolambda contributors
Copyright (c) 2013-2017 Esko Luontola and other Retrolambda contributors
This software is released under the Apache License 2.0.
The license text is at http://www.apache.org/licenses/LICENSE-2.0
Expand Down Expand Up @@ -136,6 +136,10 @@ Configurable system properties:
Alternative to retrolambda.includedFiles for avoiding the command line
length limit. The file must list one file per line with UTF-8 encoding.
retrolambda.quiet
Reduces the amount of logging.
Disabled by default. Enable by setting to "true"
If the Java agent is used, then Retrolambda will use it to capture the
lambda classes generated by Java. Otherwise Retrolambda will hook into
Java's internal lambda dumping API, which is more susceptible to suddenly
Expand Down Expand Up @@ -226,6 +230,8 @@ Version History

### Upcoming

- Added an option to reduce the amount of logging
([Issue #103](https://github.com/orfjackal/retrolambda/issues/103))
- Removes `java/lang/invoke/LambdaForm$Hidden` annotations from the generated
lambda classes to avoid issues with ProGuard
([Pull request #118](https://github.com/orfjackal/retrolambda/pull/118))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2013-2015 Esko Luontola <www.orfjackal.net>
// Copyright © 2013-2017 Esko Luontola and other Retrolambda contributors
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

Expand Down Expand Up @@ -78,6 +78,14 @@ abstract class ProcessClassesMojo extends AbstractMojo {
@Parameter(defaultValue = "false", property = "retrolambdaDefaultMethods", required = true)
public boolean defaultMethods;

/**
* Reduces the amount of logging.
*
* @since 2.4.0
*/
@Parameter(defaultValue = "false", property = "retrolambdaQuiet", required = true)
public boolean quiet;

/**
* Forces Retrolambda to run in a separate process. The default is not to fork,
* in which case Maven has to run under Java 8, or this plugin will fall back
Expand Down Expand Up @@ -128,6 +136,7 @@ private void processClassesInCurrentProcess() throws MojoExecutionException {
Properties p = new Properties();
p.setProperty(SystemPropertiesConfig.BYTECODE_VERSION, "" + targetBytecodeVersions.get(target));
p.setProperty(SystemPropertiesConfig.DEFAULT_METHODS, "" + defaultMethods);
p.setProperty(SystemPropertiesConfig.QUIET, "" + quiet);
p.setProperty(SystemPropertiesConfig.INPUT_DIR, getInputDir().getAbsolutePath());
p.setProperty(SystemPropertiesConfig.OUTPUT_DIR, getOutputDir().getAbsolutePath());
p.setProperty(SystemPropertiesConfig.CLASSPATH, getClasspath());
Expand Down Expand Up @@ -159,6 +168,7 @@ private void processClassesInForkedProcess() throws MojoExecutionException {
attribute("failonerror", "true")),
element("arg", attribute("value", "-Dretrolambda.bytecodeVersion=" + targetBytecodeVersions.get(target))),
element("arg", attribute("value", "-Dretrolambda.defaultMethods=" + defaultMethods)),
element("arg", attribute("value", "-Dretrolambda.quiet=" + quiet)),
element("arg", attribute("value", "-Dretrolambda.inputDir=" + getInputDir().getAbsolutePath())),
element("arg", attribute("value", "-Dretrolambda.outputDir=" + getOutputDir().getAbsolutePath())),
element("arg", attribute("value", "-Dretrolambda.classpathFile=" + classpathFile)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2013-2015 Esko Luontola <www.orfjackal.net>
// Copyright © 2013-2017 Esko Luontola and other Retrolambda contributors
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

Expand All @@ -20,4 +20,6 @@ public interface Config {
List<Path> getClasspath();

List<Path> getIncludedFiles();

boolean isQuiet();
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public static void run(Config config) throws Throwable {
Path outputDir = config.getOutputDir();
List<Path> classpath = config.getClasspath();
List<Path> includedFiles = config.getIncludedFiles();
if (config.isQuiet()) {
Log.WARN();
} else {
Log.INFO();
}
Log.info("Bytecode version: " + bytecodeVersion + " (" + Bytecode.getJavaVersion(bytecodeVersion) + ")");
Log.info("Default methods: " + defaultMethodsEnabled);
Log.info("Input directory: " + inputDir);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2013-2016 Esko Luontola and other Retrolambda contributors
// Copyright © 2013-2017 Esko Luontola and other Retrolambda contributors
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

Expand All @@ -22,6 +22,7 @@ public class SystemPropertiesConfig implements Config {
public static final String CLASSPATH_FILE = CLASSPATH + "File";
public static final String INCLUDED_FILES = PREFIX + "includedFiles";
public static final String INCLUDED_FILES_FILE = INCLUDED_FILES + "File";
public static final String QUIET = PREFIX + "quiet";

private static final List<String> requiredProperties = new ArrayList<>();
private static final Map<String, String> alternativeProperties = new HashMap<>();
Expand Down Expand Up @@ -199,6 +200,21 @@ public List<Path> getIncludedFiles() {
}


// quiet

static {
optionalParameterHelp(QUIET,
"Reduces the amount of logging.",
"Disabled by default. Enable by setting to \"true\"");

}

@Override
public boolean isQuiet() {
return Boolean.parseBoolean(p.getProperty(QUIET, "false"));
}


// help

public String getHelp() {
Expand All @@ -212,7 +228,7 @@ public String getHelp() {
"some other language features to work on Java 7, 6 or 5.\n" +
"Web site: https://github.com/orfjackal/retrolambda\n" +
"\n" +
"Copyright (c) 2013-2016 Esko Luontola and other Retrolambda contributors\n" +
"Copyright (c) 2013-2017 Esko Luontola and other Retrolambda contributors\n" +
"This software is released under the Apache License 2.0.\n" +
"The license text is at http://www.apache.org/licenses/LICENSE-2.0\n" +
"\n" +
Expand Down

0 comments on commit 6907b5d

Please sign in to comment.