@Override public TaskInputs source(final Object... paths) { DeprecationLogger.nagUserOfDiscontinuedMethod("TaskInputs.source(Object...)", "Please use TaskInputs.files(Object...).skipWhenEmpty() instead."); taskMutator.mutate("TaskInputs.source(Object...)", new Runnable() { @Override public void run() { addSpec(paths, true); } }); return this; }
@Override public TaskInputs source(final Object path) { DeprecationLogger.nagUserOfDiscontinuedMethod("TaskInputs.source(Object)", "Please use TaskInputs.file(Object).skipWhenEmpty() instead."); taskMutator.mutate("TaskInputs.source(Object)", new Runnable() { @Override public void run() { addSpec(path, true); } }); return this; }
@Override public TaskInputs sourceDir(final Object path) { DeprecationLogger.nagUserOfDiscontinuedMethod("TaskInputs.sourceDir(Object)", "Please use TaskInputs.dir(Object).skipWhenEmpty() instead."); taskMutator.mutate("TaskInputs.sourceDir(Object)", new Runnable() { @Override public void run() { addSpec(resolver.resolveFilesAsTree(path), true); } }); return this; }
public TaskInputs property(final String name, final Object value) { taskMutator.mutate("TaskInputs.property(String, Object)", new Runnable() { public void run() { properties.put(name, value); } }); return this; }
public TaskInputs properties(final Map<String, ?> newProps) { taskMutator.mutate("TaskInputs.properties(Map)", new Runnable() { public void run() { properties.putAll(newProps); } }); return this; }
public TaskInputs files(final Object... paths) { taskMutator.mutate("TaskInputs.files(Object...)", new Runnable() { public void run() { inputFiles.from(paths); } }); return this; }
public TaskInputs file(final Object path) { taskMutator.mutate("TaskInputs.file(Object)", new Runnable() { public void run() { inputFiles.from(path); } }); return this; }
public TaskInputs dir(final Object dirPath) { taskMutator.mutate("TaskInputs.dir(Object)", new Runnable() { public void run() { inputFiles.from(resolver.resolveFilesAsTree(dirPath)); } }); return this; }
public TaskInputs source(final Object... paths) { taskMutator.mutate("TaskInputs.source(Object...)", new Runnable() { public void run() { sourceFiles.from(paths); } }); return this; }
public TaskInputs source(final Object path) { taskMutator.mutate("TaskInputs.source(Object)", new Runnable() { public void run() { sourceFiles.from(path); } }); return this; }
public TaskInputs sourceDir(final Object path) { taskMutator.mutate("TaskInputs.sourceDir(Object)", new Runnable() { public void run() { sourceFiles.from(resolver.resolveFilesAsTree(path)); } }); return this; }
public TaskInputs sourceDir(Object path) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskInputs.sourceDir(Object)"); sourceFiles.from(resolver.resolveFilesAsTree(path)); return this; }
public GeneratePomFileTask() { super(); setGroup(PublishingPlugin.PUBLISH_TASK_GROUP); final Project project = getProject(); buildUtil = new BuildUtil(project); final TaskInputs inputs = getInputs(); inputs.property("groupId", project.getGroup()); inputs.property("artifactId", project.getName()); inputs.property("version", project.getVersion()); inputs.property("name", buildUtil.getLongName()); inputs.property("description", project.getDescription()); inputs.property("url", buildUtil.getExtraPropertyValue(ExtProp.Website)); inputs.property("authorName", buildUtil.getExtraPropertyValue(ExtProp.AuthorName)); inputs.property("orgName", buildUtil.getExtraPropertyValue(ExtProp.OrgName)); inputs.property("orgUrl", buildUtil.getExtraPropertyValue(ExtProp.OrgUrl)); inputs.property("github", buildUtil.getExtraPropertyValue(ExtProp.Github)); getOutputs().file(pomFile); doLast(new Closure<Void>(this) { @Override @SuppressWarnings({"ResultOfMethodCallIgnored", "MethodDoesntCallSuperMethod"}) public Void call() { pomFile.getParentFile().mkdirs(); PomXml pomXml = createPom(); try { writePomXml(pomXml); } catch (JAXBException e) { throw new GradleException("error creating pom", e); } return null; } }); }
public DefaultTaskInputPropertySpec(TaskInputs taskInputs, String taskName, boolean skipWhenEmpty, FileResolver resolver, Object paths) { this.taskInputs = taskInputs; this.files = new TaskPropertyFileCollection(taskName, "input", this, resolver, paths); this.skipWhenEmpty = skipWhenEmpty; }
private TaskInputs getTaskInputs(String method) { DeprecationLogger.nagUserOfDiscontinuedMethod("chaining of the " + method, String.format("Please use the %s method on TaskInputs directly instead.", method)); return taskInputs; }
@Override public TaskInputs property(String name, Object value) { return getTaskInputs("property(String, Object)").property(name, value); }
@Override @Deprecated public TaskInputs source(Object... paths) { return getTaskInputs("source(Object...)").source(paths); }
@Override @Deprecated public TaskInputs source(Object path) { return getTaskInputs("source(Object)").source(path); }
@Override @Deprecated public TaskInputs sourceDir(Object path) { return getTaskInputs("sourceDir(Object)").sourceDir(path); }
@Inject public TaskInputs getInputs() { // Decoration takes care of the implementation throw new UnsupportedOperationException(); }
protected TaskInputs createTaskInputs() { return new DefaultTaskInputs(project.getFileResolver(), taskInternal, get(TaskMutator.class)); }
public TaskInputs files(Object... paths) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskInputs.files(Object...)"); inputFiles.from(paths); return this; }
public TaskInputs file(Object path) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskInputs.file(Object)"); files(path); return this; }
public TaskInputs dir(Object dirPath) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskInputs.dir(Object)"); inputFiles.from(resolver.resolveFilesAsTree(dirPath)); return this; }
public TaskInputs source(Object... paths) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskInputs.source(Object...)"); sourceFiles.from(paths); return this; }
public TaskInputs source(Object path) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskInputs.source(Object)"); sourceFiles.from(path); return this; }
public TaskInputs property(String name, Object value) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskInputs.property(String, Object)"); properties.put(name, value); return this; }
public TaskInputs getInputs() { return inputs; }
protected TaskInputs createTaskInputs() { return new DefaultTaskInputs(project.getFileResolver(), taskInternal, get(TaskStatusNagger.class)); }
@Override @SuppressWarnings("MethodDoesntCallSuperMethod") public void configureFor(@Nonnull final DependencyConfig pDepConfig) { final Project project = getProject(); final String longName = getBuildUtil().getLongName(); setDescription( longName + ": Assembles the SonarQube plugin for dependency configuration '" + pDepConfig.getName() + "'"); // Inputs for up-to-date checking TaskInputs inputs = getInputs(); inputs.property(BuildUtil.GROUP_ID, project.getGroup()); inputs.property(BuildUtil.VERSION, project.getVersion()); inputs.property("name", longName); inputs.property("description", project.getDescription()); inputs.property("authorName", getBuildUtil().getExtraPropertyValue(ExtProp.AuthorName)); inputs.property("sqPluginKey", getBuildUtil().getExtraPropertyValue(ExtProp.SqPluginKey)); inputs.property("sqPackage", getBuildUtil().getExtraPropertyValue(ExtProp.SqPackage)); inputs.property("gitHash", getBuildUtil().getExtraPropertyValue(ExtProp.GitHash)); inputs.property("orgUrl", getBuildUtil().getExtraPropertyValue(ExtProp.OrgUrl)); inputs.property("issueTrackerUrl", getBuildUtil().getExtraPropertyValue(ExtProp.IssueTrackerUrl)); inputs.property("website", getBuildUtil().getExtraPropertyValue(ExtProp.Website)); // archive name setArchiveName( "sonar-" + inputs.getProperties().get("sqPluginKey") + "-" + inputs.getProperties().get(BuildUtil.VERSION) + (pDepConfig.isDefaultConfig() ? "" : ("-csp" + pDepConfig.getSonarQubeMinCsPluginVersion())) + ".jar"); // Task Dependencies final Jar jarTask = (Jar) getBuildUtil().getTask(TaskNames.jar, pDepConfig); dependsOn(jarTask); final Task sqClassesTask = getBuildUtil().getTask(TaskNames.sonarqubeClasses, pDepConfig); dependsOn(sqClassesTask); // Configuration of JAR file contents intoFrom("META-INF", "LICENSE"); final JavaCompile compileTask = (JavaCompile) getBuildUtil().getTask(TaskNames.compileSonarqubeJava, pDepConfig); from(compileTask.getDestinationDir()); into(inputs.getProperties().get("sqPackage"), new Closure<Void>(this) { @Override public Void call(final Object... pArgs) { CopySpec spec = (CopySpec) getDelegate(); final SourceSet sqSourceSet = getBuildUtil().getSourceSet(BuildUtil.SONARQUBE_SOURCE_SET_NAME); spec.from(new File(sqSourceSet.getOutput().getResourcesDir(), "sonarqube.xml")); filterVersion(spec, inputs.getProperties().get(BuildUtil.VERSION).toString()); return null; } }); final Set<File> pubLibs = CreateJarEclipseTask.getPublishedDependencyLibs(this, pDepConfig); intoFrom("META-INF/lib", jarTask.getArchivePath()); intoFrom("META-INF/lib", pubLibs); // Manifest setManifestAttributes(getManifest().getAttributes(), inputs, pDepConfig, pubLibs); }
private void setManifestAttributes(@Nonnull final Attributes pAttributes, @Nonnull final TaskInputs pInputs, @Nonnull final DependencyConfig pDepConfig, @Nonnull final Set<File> pPubLibs) { final String baseCsVersion = pDepConfig.getCheckstyleBaseVersion(); final Map<String, Object> inputProps = pInputs.getProperties(); final Jar jarTask = (Jar) getBuildUtil().getTask(TaskNames.jar, pDepConfig); pAttributes.clear(); pAttributes.put("Plugin-Name", inputProps.get("name")); pAttributes.put("Plugin-Base", "checkstyle"); pAttributes.put("Plugin-Key", inputProps.get("sqPluginKey")); pAttributes.put("Implementation-Build", inputProps.get("gitHash")); pAttributes.put("Plugin-Description", inputProps.get("description") + " (based on Checkstyle " + baseCsVersion + ")"); pAttributes.put("Plugin-Version", inputProps.get(BuildUtil.VERSION)); pAttributes.put("Plugin-Organization", inputProps.get("authorName")); pAttributes.put("Plugin-OrganizationUrl", inputProps.get("orgUrl")); pAttributes.put("Plugin-SourcesUrl", "https://github.com/checkstyle-addons/checkstyle-addons"); pAttributes.put("Plugin-IssueTrackerUrl", inputProps.get("issueTrackerUrl")); pAttributes.put("Plugin-Class", "com.thomasjensen.checkstyle.addons.sonarqube.CheckstyleExtensionPlugin"); pAttributes.put("Plugin-RequirePlugins", "java:" + pDepConfig.getSonarQubeMinJavaPluginVersion() // + ",checkstyle:" + pDepConfig.getSonarQubeMinCsPluginVersion()); pAttributes.put("Plugin-Dependencies", "META-INF/lib/" + jarTask.getArchiveName() // + (pPubLibs.size() > 0 ? " " : "") // + CreateJarEclipseTask.flattenPrefixLibs("META-INF/lib/", pPubLibs, ' ')); pAttributes.put("Plugin-License", "GPLv3"); pAttributes.put("Plugin-Homepage", inputProps.get("website")); //attrs.put("Plugin-TermsConditionsUrl", ""); // TODO use same SonarQube version in manifest and compile dependencies pAttributes.put("Sonar-Version", pDepConfig.getSonarQubeMinPlatformVersion()); pAttributes.putAll(CreateJarTask.mfAttrStd(getProject())); pAttributes.remove("Website"); doFirst(new Closure<Void>(this) { @Override @SuppressWarnings("MethodDoesntCallSuperMethod") public Void call() { final DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); // required by SonarQube pAttributes.put("Plugin-BuildDate", sdf.format(getBuildUtil().getExtraPropertyValue(ExtProp.BuildTimestamp))); return null; } }); }
/** * <p>Returns the inputs of this task.</p> * * @return The inputs. Never returns null. */ TaskInputs getInputs();