private void configureBasedOnSingleProperty(final Test test) { String singleTest = getTaskPrefixedProperty(test, "single"); if (singleTest == null) { //configure inputs so that the test task is skipped when there are no source files. //unfortunately, this only applies when 'test.single' is *not* applied //We should fix this distinction, the behavior with 'test.single' or without it should be the same test.getInputs().files(test.getCandidateClassFiles()) .withPropertyName("nonEmptyCandidateClassFiles") .withPathSensitivity(PathSensitivity.RELATIVE) .skipWhenEmpty(); return; } test.prependParallelSafeAction(new Action<Task>() { public void execute(Task task) { test.getLogger().info("Running single tests with pattern: {}", test.getIncludes()); } }); test.setIncludes(WrapUtil.toSet("**/" + singleTest + "*.class")); test.addTestListener(new NoMatchingTestsReporter("Could not find matching test for pattern: " + singleTest)); }
/** * The directory containing the classes to be analyzed. */ @PathSensitive(PathSensitivity.RELATIVE) @InputDirectory @SkipWhenEmpty public File getClassesDir() { return classesDir; }
/** * The classes to be analyzed. */ @SkipWhenEmpty @PathSensitive(PathSensitivity.RELATIVE) @InputFiles public FileCollection getClasses() { return classes; }
/** * Additional class dirs that coverage data should be reported for. */ @Optional @PathSensitive(PathSensitivity.RELATIVE) @InputFiles public FileCollection getAdditionalClassDirs() { return additionalClassDirs; }
/** * Additional source dirs for the classes coverage data is being reported for. */ @Optional @PathSensitive(PathSensitivity.RELATIVE) @InputFiles public FileCollection getAdditionalSourceDirs() { return additionalSourceDirs; }
/** * The directory containing the classes to validate. */ @PathSensitive(PathSensitivity.RELATIVE) @InputDirectory @SkipWhenEmpty public File getClassesDir() { return classesDir; }
/** * Returns the {@code web.xml} file to include in the WAR archive. When {@code null}, no {@code web.xml} file is included in the WAR. * * @return The {@code web.xml} file. */ @InputFile @PathSensitive(PathSensitivity.NONE) @Optional public File getWebXml() { return webXml; }
@InputDirectory @SkipWhenEmpty @PathSensitive(PathSensitivity.NONE) @Optional public File getInputDirectory() { if (!inputDirectory.exists()) { return null; } else { return inputDirectory; } }
/** * {@inheritDoc} */ @Override @PathSensitive(PathSensitivity.RELATIVE) public FileTree getSource() { return super.getSource(); }
/** * The custom rule set files to be used. See the <a href="http://pmd.sourceforge.net/howtomakearuleset.html">official documentation</a> for how to author a rule set file. * * Example: ruleSetFiles = files("config/pmd/myRuleSets.xml") */ @InputFiles @PathSensitive(PathSensitivity.NONE) public FileCollection getRuleSetFiles() { return ruleSetFiles; }
/** * {@inheritDoc} */ @Override @PathSensitive(PathSensitivity.NAME_ONLY) // Java source files are supported, too. Therefore we should care about the names. public FileTree getSource() { return super.getSource(); }
/** * {@inheritDoc} */ @PathSensitive(PathSensitivity.RELATIVE) @Override public FileTree getSource() { return super.getSource(); }
/** * Collection of execution data files to analyze. */ @PathSensitive(PathSensitivity.NONE) @InputFiles public FileCollection getExecutionData() { return executionData; }
/** * Source sets that coverage should be reported for. */ @PathSensitive(PathSensitivity.RELATIVE) @InputFiles public FileCollection getSourceDirectories() { return sourceDirectories; }
/** * Source sets that coverage should be reported for. */ @PathSensitive(PathSensitivity.RELATIVE) @InputFiles public FileCollection getClassDirectories() { return classDirectories; }
/** * Collection of execution data files to merge. */ @PathSensitive(PathSensitivity.RELATIVE) @InputFiles public FileCollection getExecutionData() { return executionData; }
/** * {@inheritDoc} */ @Override @PathSensitive(PathSensitivity.NAME_ONLY) public FileTree getSource() { return super.getSource(); }
/** * Returns the classes files to scan for test classes. * * @return The candidate class files. */ @PathSensitive(PathSensitivity.RELATIVE) @InputFiles public FileTree getCandidateClassFiles() { return getProject().fileTree(getTestClassesDir()).matching(patternSet); }
public static PathSensitivity getPathSensitivity(TaskPropertyActionContext context) { PathSensitive sensitivity = context.getAnnotation(PathSensitive.class); return sensitivity != null ? sensitivity.value() : PathSensitivity.ABSOLUTE; }
@Override public TaskOutputFilePropertyBuilder withPathSensitivity(PathSensitivity sensitivity) { this.snapshotNormalizationStrategy = TaskFilePropertySnapshotNormalizationStrategy.valueOf(sensitivity); return this; }
@Override TaskFilePropertyBuilderInternal withPathSensitivity(PathSensitivity sensitivity);
@Override TaskInputFilePropertyBuilderInternal withPathSensitivity(PathSensitivity sensitivity);
@Override public TaskInputFilePropertyBuilderInternal withPathSensitivity(PathSensitivity sensitivity) { return withSnapshotNormalizationStrategy(TaskFilePropertySnapshotNormalizationStrategy.valueOf(sensitivity)); }
@Optional @InputFile @PathSensitive( PathSensitivity.NONE ) File getCustomCssFile();
@Optional @InputFile @PathSensitive( PathSensitivity.NONE ) File getCustomJsFile();
@InputDirectory @SkipWhenEmpty @PathSensitive( PathSensitivity.NONE ) public File getResults() { return results; }
/** * {@inheritDoc} * * <p>The sources for this task are relatively relocatable even though it produces output that * includes absolute paths. This is a compromise made to ensure that results can be reused * between different builds. The downside is that up-to-date results, or results loaded * from cache can show different absolute paths than would be produced if the task was * executed.</p> */ @Override @PathSensitive(PathSensitivity.RELATIVE) public FileTree getSource() { return super.getSource(); }
/** * Returns the input files registered when this resource is used as task input. * Not typically used directly. * * @return the input files registered when this resource is used as task input */ @PathSensitive(PathSensitivity.NONE) @InputFiles @Optional FileCollection getInputFiles();