private void beforeMethod(MethodInvocation methodInvocation) { if (!LOGGER.isDebugEnabled()) { return; } Object target = methodInvocation.getThis(); Object[] arguments = methodInvocation.getArguments(); Method method = methodInvocation.getMethod(); LOGGER.debug("Entering method {} of class {}, the arguments is {}", method.getName(), target.getClass().getSimpleName(), toString(arguments)); }
@Override public void discardTypesFrom(ClassLoader classLoader) { if (classLoader == leakingLoader) { throw new IllegalStateException("Cannot remove own types from Groovy loader."); } // Remove cached value for every class seen by this ClassLoader that was loaded by the given ClassLoader try { Iterator<?> it = globalClassSetIterator(); while (it.hasNext()) { Object classInfo = it.next(); if (classInfo != null) { Class clazz = (Class) clazzField.get(classInfo); if (clazz.getClassLoader() == classLoader) { removeFromGlobalClassValue.invoke(globalClassValue, clazz); if (LOG.isDebugEnabled()) { LOG.debug("Removed ClassInfo from {} loaded by {}", clazz.getName(), clazz.getClassLoader()); } } } } } catch (Exception e) { throw new GradleException("Could not remove types for ClassLoader " + classLoader + " from the Groovy system " + leakingLoader, e); } }
@Override public void shutdown() { if (leakingLoader == getClass().getClassLoader()) { throw new IllegalStateException("Cannot shut down the main Groovy loader."); } // Remove cached value for every class seen by this ClassLoader try { Iterator<?> it = globalClassSetIterator(); while (it.hasNext()) { Object classInfo = it.next(); if (classInfo != null) { Class clazz = (Class) clazzField.get(classInfo); removeFromGlobalClassValue.invoke(globalClassValue, clazz); if (LOG.isDebugEnabled()) { LOG.debug("Removed ClassInfo from {} loaded by {}", clazz.getName(), clazz.getClassLoader()); } } } } catch (Exception e) { throw new GradleException("Could not shut down the Groovy system for " + leakingLoader, e); } }
protected BuildOperationLogInfo createLogInfo(String taskName, File outputFile, int maximumFailures) { final BuildOperationLogInfo configuration; if (logger.isDebugEnabled()) { // show all operation output when debug is enabled configuration = new BuildOperationLogInfo(taskName, outputFile, Integer.MAX_VALUE); } else { configuration = new BuildOperationLogInfo(taskName, outputFile, maximumFailures); } return configuration; } }
public IsolatedAntBuilder withClasspath(Iterable<File> classpath) { if (LOG.isDebugEnabled()) { LOG.debug("Forking a new isolated ant builder for classpath : {}", classpath); } return new DefaultIsolatedAntBuilder(this, classpath); }
private void afterMethod(MethodInvocation methodInvocation, Object returnValue, Throwable e, long nanoseconds) { if (!LOGGER.isDebugEnabled()) { return; } Object target = methodInvocation.getThis(); Method method = methodInvocation.getMethod(); if (e == null) { LOGGER.debug("Exiting method {} of class {}, total time is {} ms, return {}", method.getName(), target.getClass().getSimpleName(), toString(nanoseconds), returnValue); } else { LOGGER.debug("Exiting method {} of class {}, total time is {} ms, exception is {}", method.getName(), target.getClass().getSimpleName(), toString(nanoseconds), toString(e)); } }
private List<String> wsImportArgumentsFor( Wsdl wsdl ) { File wsdlFile = getProject().file( wsdl.getWsdl() ); List<String> arguments = new ArrayList<>(); if( wsdl.getPackageName() != null ) { arguments.add( "-p" ); arguments.add( wsdl.getPackageName() ); } arguments.add( "-wsdllocation" ); arguments.add( wsdlFile.getName() ); arguments.add( "-s" ); arguments.add( outputDirectory.getAbsolutePath() ); arguments.add( "-extension" ); arguments.add( "-Xnocompile" ); if (wsdl.getExtraArgs() != null) { arguments.addAll(Arrays.asList(wsdl.getExtraArgs().split(" "))); } if( getProject().getLogger().isDebugEnabled() ) { arguments.add( "-Xdebug" ); } else { arguments.add( "-quiet" ); } arguments.add( wsdlFile.getAbsolutePath() ); return arguments; }
public boolean shouldWatch(File directory) { final boolean result = rootSubset.isInRootsOrAncestorOrAnyRoot(directory) || isAncestorOfAnyRoot(directory, allRequestedRoots, true); if (!result && LOG.isDebugEnabled()) { LOG.debug("not watching directory: {} allRequestedRoots: {} roots: {} unfiltered: {}", directory, allRequestedRoots, rootSubset.roots, rootSubset.combinedFileSystemSubset); } return result; }
private void removeCacheEntry(ClassPath key, Cleanup entry, Cleanup.Mode mode) { if (LOG.isDebugEnabled()) { LOG.debug("Removing classloader from cache, classpath = {}", key.getAsURIs()); } lock.lock(); try { cacheEntries.remove(key); cleanups.remove(key); } finally { lock.unlock(); } try { entry.clear(); entry.cleanup(mode); } catch (Exception ex) { LOG.error("Unable to perform cleanup of classloader for classpath: "+key, ex); } }
private LogLevel getLogLevel() { if(logger.isTraceEnabled()) { return LogLevel.TRACE; } else if(logger.isDebugEnabled()) { return LogLevel.DEBUG; } else if(logger.isInfoEnabled()) { return LogLevel.INFO; } else if(logger.isLifecycleEnabled() || logger.isWarnEnabled()) { return LogLevel.WARN; } // QUIET or ERROR return LogLevel.ERROR; }
public void run() { final AtomicLong busy = new AtomicLong(0); Timer totalTimer = Time.startTimer(); final Timer taskTimer = Time.startTimer(); WorkerLease childLease = parentWorkerLease.createChild(); boolean moreTasksToExecute = true; while (moreTasksToExecute) { moreTasksToExecute = taskExecutionPlan.executeWithTask(childLease, new Action<TaskInfo>() { @Override public void execute(TaskInfo task) { final String taskPath = task.getTask().getPath(); LOGGER.info("{} ({}) started.", taskPath, Thread.currentThread()); taskTimer.reset(); processTask(task); long taskDuration = taskTimer.getElapsedMillis(); busy.addAndGet(taskDuration); if (LOGGER.isInfoEnabled()) { LOGGER.info("{} ({}) completed. Took {}.", taskPath, Thread.currentThread(), TimeFormatting.formatDurationVerbose(taskDuration)); } } }); } long total = totalTimer.getElapsedMillis(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Task worker [{}] finished, busy: {}, idle: {}", Thread.currentThread(), TimeFormatting.formatDurationVerbose(busy.get()), TimeFormatting.formatDurationVerbose(total - busy.get())); } }
@TaskAction public void run() { Map<String, String> properties = getProperties(); if (properties.isEmpty()) { LOGGER.warn("Skipping SonarQube analysis: no properties configured, was it skipped in all projects?"); return; } if (LOGGER.isDebugEnabled()) { properties.put("sonar.verbose", "true"); } if (isSkippedWithProperty(properties)) { return; } EmbeddedScanner scanner = EmbeddedScanner.create("ScannerGradle", getPluginVersion() + "/" + getProject().getGradle().getGradleVersion(), LOG_OUTPUT) .addGlobalProperties(properties); scanner.start(); scanner.execute(new HashMap<>()); }
@TaskAction public void run() { Map<String, String> properties = getProperties(); if (properties.isEmpty()) { LOGGER.warn("Skipping SonarQube analysis: no properties configured, was it skipped in all projects?"); return; } if (LOGGER.isDebugEnabled()) { properties.put("sonar.verbose", "true"); } if (isSkippedWithProperty(properties)) { return; } EmbeddedScanner scanner = EmbeddedScanner.create("ScannerGradle", getPluginVersion() + "/" + getProject().getGradle().getGradleVersion(), LOG_OUTPUT) .addGlobalProperties(properties); scanner.start(); scanner.execute(new HashMap<>()); }
@Override public String call() throws Exception { String logLevel = null; Logger logger = getLogger(); if (logger.isTraceEnabled()) { logLevel = "silly"; } else if (logger.isDebugEnabled()) { logLevel = "verbose"; } else if (logger.isInfoEnabled()) { logLevel = "info"; } else if (logger.isWarnEnabled()) { logLevel = "warn"; } else if (logger.isErrorEnabled()) { logLevel = "error"; } return logLevel; }
@Override public String call() throws Exception { String logLevel = null; Logger logger = getLogger(); if (logger.isTraceEnabled()) { logLevel = "silly"; } else if (logger.isDebugEnabled()) { logLevel = "verbose"; } else if (logger.isInfoEnabled()) { logLevel = "info"; } else if (logger.isWarnEnabled()) { logLevel = "warn"; } else if (logger.isErrorEnabled()) { logLevel = "error"; } return logLevel; }
private Task createClassycleTask(final Project project, final ClassycleExtension extension, final SourceSet sourceSet) { final String taskName = sourceSet.getTaskName("classycle", null); final FileCollection classesDirs = sourceSet.getOutput().getClassesDirs(); final File reportFile = getReportingExtension(project).file("classycle_" + sourceSet.getName() + ".txt"); final Task task = project.task(taskName); task.getInputs().files(classesDirs, extension.getDefinitionFile()); task.getOutputs().file(reportFile); task.doLast(new ClassyclePlugin.ClassycleAction(classesDirs, reportFile, extension)); // the classycle task depends on the corresponding classes task final String classesTask = sourceSet.getClassesTaskName(); task.dependsOn(classesTask); if (project.getLogger().isDebugEnabled()) { final StringBuilder sb = new StringBuilder(); for (final File file : classesDirs) { sb.append(file.getAbsolutePath()).append(" "); } project.getLogger() .debug("Created classycle task: " + taskName + ", report file: " + reportFile + ", depends on: " + classesTask + " - sourceSetDirs: " + sb.toString()); } return task; }
public void buildStarted(Gradle gradle) { StartParameter startParameter = gradle.getStartParameter(); logger.info("Starting Build"); if (logger.isDebugEnabled()) { logger.debug("Gradle user home: {}", startParameter.getGradleUserHomeDir()); logger.debug("Current dir: {}", startParameter.getCurrentDir()); logger.debug("Settings file: {}", startParameter.getSettingsFile()); logger.debug("Build file: {}", startParameter.getBuildFile()); } }
private DefaultGosuCompileSpec createSpec() { DefaultGosuCompileSpec spec = new DefaultGosuCompileSpecFactory(_compileOptions).create(); Project project = getProject(); spec.setSource(getSource()); //project.files([ "src/main/gosu" ]) spec.setSourceRoots(getSourceRoots()); spec.setDestinationDir(getDestinationDir()); spec.setClasspath(getClasspath()); //Force gosu-core into the classpath. Normally it's a runtime dependency but compilation requires it. Set<ResolvedArtifact> projectDeps = project.getConfigurations().getByName("runtime").getResolvedConfiguration().getResolvedArtifacts(); File gosuCore = GosuPlugin.getArtifactWithName("gosu-core", projectDeps).getFile(); spec.setGosuClasspath( Collections.singletonList( gosuCore ) ); if(LOGGER.isDebugEnabled()) { LOGGER.debug("Gosu Compiler Spec classpath is:"); for(File file : spec.getClasspath()) { LOGGER.debug(file.getAbsolutePath()); } LOGGER.debug("Gosu Compile Spec gosuClasspath is:"); for(File file : spec.getGosuClasspath()) { LOGGER.debug(file.getAbsolutePath()); } } return spec; }
SpotBugsSpec generateSpec() { SpotBugsSpecBuilder specBuilder = new SpotBugsSpecBuilder(getClasses()) .withPluginsList(getPluginClasspath()) .withSources(getSource()) .withClasspath(getClasspath()) .withDebugging(getLogger().isDebugEnabled()) .withEffort(getEffort()) .withReportLevel(getReportLevel()) .withMaxHeapSize(getMaxHeapSize()) .withVisitors(getVisitors()) .withOmitVisitors(getOmitVisitors()) .withExcludeFilter(getExcludeFilter()) .withIncludeFilter(getIncludeFilter()) .withExcludeBugsFilter(getExcludeBugsFilter()) .withExtraArgs(getExtraArgs()) .configureReports(getReports()); return specBuilder.build(); }
SpotBugsSpec generateSpec() { SpotBugsSpecBuilder specBuilder = new SpotBugsSpecBuilder(getClasses()) .withPluginsList(getPluginClasspath()) .withSources(getAllSource()) .withClasspath(getClasspath()) .withShowProgress(getShowProgress()) .withDebugging(getLogger().isDebugEnabled()) .withEffort(getEffort()) .withReportLevel(getReportLevel()) .withMaxHeapSize(getMaxHeapSize()) .withVisitors(getVisitors()) .withOmitVisitors(getOmitVisitors()) .withExcludeFilter(getExcludeFilter()) .withIncludeFilter(getIncludeFilter()) .withExcludeBugsFilter(getExcludeBugsFilter()) .withExtraArgs(getExtraArgs()) .withJvmArgs(getJvmArgs()) .configureReports(getReports()); return specBuilder.build(); }