use of org.gradle.api.logging.LogLevel in project gradle by gradle.
the class SetupTab method createLogLevelPanel.
/**
* Creates a panel that has a combo box to select a log level
*/
private Component createLogLevelPanel() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
logLevelComboBox = new JComboBox(getLogLevelWrappers());
panel.add(Utility.addLeftJustifiedComponent(new JLabel("Log Level")));
panel.add(Utility.addLeftJustifiedComponent(logLevelComboBox));
//initialize our value
String logLevelName = settingsNode.getValueOfChild(LOG_LEVEL, null);
LogLevel logLevel = gradlePluginLord.getLogLevel();
if (logLevelName != null) {
try {
logLevel = LogLevel.valueOf(logLevelName);
} catch (IllegalArgumentException e) {
//this may happen if the enum changes. We don't want this to stop the whole UI
logger.error("Converting log level text to log level enum '" + logLevelName + "'", e);
}
}
gradlePluginLord.setLogLevel(logLevel);
setLogLevelComboBoxSetting(logLevel);
logLevelComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
LogLevelWrapper wrapper = (LogLevelWrapper) logLevelComboBox.getSelectedItem();
if (wrapper != null) {
gradlePluginLord.setLogLevel(wrapper.logLevel);
settingsNode.setValueOfChild(LOG_LEVEL, wrapper.logLevel.name());
}
}
});
return panel;
}
use of org.gradle.api.logging.LogLevel in project gradle by gradle.
the class SetupTab method getLogLevelWrappers.
/**
* This creates an array of wrapper objects suitable for passing to the constructor of the log level combo box.
*/
private Vector<LogLevelWrapper> getLogLevelWrappers() {
Collection<LogLevel> collection = new LoggingCommandLineConverter().getLogLevels();
Vector<LogLevelWrapper> wrappers = new Vector<LogLevelWrapper>();
Iterator<LogLevel> iterator = collection.iterator();
while (iterator.hasNext()) {
LogLevel level = iterator.next();
wrappers.add(new LogLevelWrapper(level));
}
Collections.sort(wrappers, new Comparator<LogLevelWrapper>() {
public int compare(LogLevelWrapper o1, LogLevelWrapper o2) {
return o1.toString().compareToIgnoreCase(o2.toString());
}
});
return wrappers;
}
use of org.gradle.api.logging.LogLevel in project gradle by gradle.
the class DaemonMessageSerializer method create.
public static Serializer<Message> create() {
BaseSerializerFactory factory = new BaseSerializerFactory();
Serializer<LogLevel> logLevelSerializer = factory.getSerializerFor(LogLevel.class);
Serializer<Throwable> throwableSerializer = factory.getSerializerFor(Throwable.class);
DefaultSerializerRegistry registry = new DefaultSerializerRegistry();
registry.register(BuildEvent.class, new BuildEventSerializer());
registry.register(Failure.class, new FailureSerializer(throwableSerializer));
// Input events
registry.register(ForwardInput.class, new ForwardInputSerializer());
registry.register(CloseInput.class, new CloseInputSerializer());
// Output events
registry.register(LogEvent.class, new LogEventSerializer(logLevelSerializer, throwableSerializer));
registry.register(StyledTextOutputEvent.class, new StyledTextOutputEventSerializer(logLevelSerializer, new ListSerializer<StyledTextOutputEvent.Span>(new SpanSerializer(factory.getSerializerFor(StyledTextOutput.Style.class)))));
registry.register(ProgressStartEvent.class, new ProgressStartEventSerializer());
registry.register(ProgressCompleteEvent.class, new ProgressCompleteEventSerializer());
registry.register(ProgressEvent.class, new ProgressEventSerializer());
registry.register(LogLevelChangeEvent.class, new LogLevelChangeEventSerializer(logLevelSerializer));
registry.register(OutputMessage.class, new OutputMessageSerializer(registry.build(OutputEvent.class)));
// Default for everything else
registry.useJavaSerialization(Message.class);
return registry.build(Message.class);
}
use of org.gradle.api.logging.LogLevel in project gradle by gradle.
the class ProviderConnection method configure.
public void configure(ProviderConnectionParameters parameters) {
LogLevel providerLogLevel = parameters.getVerboseLogging() ? LogLevel.DEBUG : LogLevel.INFO;
LOGGER.debug("Configuring logging to level: {}", providerLogLevel);
LoggingManagerInternal loggingManager = loggingServices.newInstance(LoggingManagerInternal.class);
loggingManager.setLevelInternal(providerLogLevel);
loggingManager.start();
}
use of org.gradle.api.logging.LogLevel in project webpieces by deanhiller.
the class TemplateCompilerTask method compileImpl.
public void compileImpl(TemplateCompileOptions options) throws IOException {
File buildDir = getProject().getBuildDir();
//need to make customizable...
File groovySrcGen = new File(buildDir, "groovysrc");
System.out.println("groovy src directory=" + groovySrcGen);
Charset encoding = Charset.forName(options.getEncoding());
TemplateCompileConfig config = new TemplateCompileConfig(false);
config.setFileEncoding(encoding);
config.setPluginClient(true);
config.setGroovySrcWriteDirectory(groovySrcGen);
System.out.println("custom tags=" + options.getCustomTags());
config.setCustomTagsFromPlugin(options.getCustomTags());
LogLevel logLevel = getProject().getGradle().getStartParameter().getLogLevel();
File destinationDir = getDestinationDir();
System.out.println("destDir=" + destinationDir);
File routeIdFile = new File(destinationDir, ProdTemplateModule.ROUTE_META_FILE);
if (routeIdFile.exists())
routeIdFile.delete();
routeIdFile.createNewFile();
System.out.println("routeId.txt file=" + routeIdFile.getAbsolutePath());
FileCollection srcCollection = getSource();
Set<File> files = srcCollection.getFiles();
File firstFile = files.iterator().next();
File baseDir = findBase(firstFile);
try (FileOutputStream routeOut = new FileOutputStream(routeIdFile);
OutputStreamWriter write = new OutputStreamWriter(routeOut, encoding.name());
BufferedWriter bufWrite = new BufferedWriter(write)) {
Injector injector = Guice.createInjector(new StubModule(), new DevTemplateModule(config, new PluginCompileCallback(destinationDir, bufWrite)));
HtmlToJavaClassCompiler compiler = injector.getInstance(HtmlToJavaClassCompiler.class);
GroovyClassLoader cl = new GroovyClassLoader();
for (File f : files) {
System.out.println("file=" + f);
String fullName = findFullName(baseDir, f);
System.out.println("name=" + fullName);
String source = readSource(f);
compiler.compile(cl, fullName, source);
}
}
setDidWork(true);
}
Aggregations