use of com.thomasjensen.checkstyle.addons.build.BuildUtil in project checkstyle-addons by checkstyle-addons.
the class SiteCopyAllChecksConfigAction method buildReplacements.
public static Map<String, Object> buildReplacements(@Nonnull final Project pProject) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZZZ");
Date buildTimestamp = new BuildUtil(pProject).getBuildConfig().getBuildTimestamp().get();
Map<String, String> replacements = new HashMap<>();
replacements.put("buildTimestamp", sdf.format(buildTimestamp));
replacements.put("version", "v" + pProject.getVersion());
Map<String, Object> result = new HashMap<>();
result.put("tokens", replacements);
return result;
}
use of com.thomasjensen.checkstyle.addons.build.BuildUtil in project checkstyle-addons by checkstyle-addons.
the class AbstractTaskConfigAction method execute.
@Override
public final void execute(@Nonnull final T pTask) {
Objects.requireNonNull(pTask);
if (pTask.getLogger().isInfoEnabled()) {
String msg = "Configuring task '" + pTask.getPath() + "'";
if (depConfig != null) {
msg += " for depConfig '" + depConfig.getName() + "'" + getExtraLogInfo(pTask);
}
pTask.getLogger().info(msg);
}
project = pTask.getProject();
buildUtil = new BuildUtil(pTask.getProject());
configureTaskFor(pTask, depConfig);
}
use of com.thomasjensen.checkstyle.addons.build.BuildUtil in project checkstyle-addons by checkstyle-addons.
the class JarConfigAction method mfAttrStd.
/**
* Build a little map with standard manifest attributes.
*
* @param pProject Gradle project
* @return the map
*/
public static Map<String, String> mfAttrStd(final Project pProject) {
final BuildConfigExtension buildConfig = new BuildUtil(pProject).getBuildConfig();
Map<String, String> result = new HashMap<>();
result.put("Manifest-Version", "1.0");
result.put("Website", buildConfig.getWebsite().get());
result.put("Created-By", GradleVersion.current().toString());
result.put("Built-By", System.getProperty("user.name"));
result.put("Build-Jdk", Jvm.current().toString());
return result;
}
use of com.thomasjensen.checkstyle.addons.build.BuildUtil in project checkstyle-addons by checkstyle-addons.
the class VersionFileTask method writeVersionFile.
@TaskAction
public void writeVersionFile() {
final BuildConfigExtension buildConfig = new BuildUtil(getProject()).getBuildConfig();
List<String> lines = new ArrayList<>();
lines.add("# " + buildConfig.getLongName().get() + " version information");
lines.add("# " + buildConfig.getBuildTimestamp().get());
lines.add("version=" + getProject().getVersion());
try {
Files.write(getVersionFile().get().toPath(), lines, StandardCharsets.US_ASCII);
} catch (IOException e) {
throw new GradleException("Failed to create file: " + getVersionFile().get().getAbsolutePath(), e);
}
}
use of com.thomasjensen.checkstyle.addons.build.BuildUtil in project checkstyle-addons by checkstyle-addons.
the class JavadocConfigAction method configureJavadocTask.
/**
* These configurations are also applied to the standard 'javadoc' task, plus they are applied to ours.
*
* @param pJavadocTask the task to configure
* @param pDepConfig dependency config
*/
public void configureJavadocTask(@Nonnull Javadoc pJavadocTask, @Nonnull final DependencyConfig pDepConfig) {
// can't use fields here
final Project project = pJavadocTask.getProject();
final BuildUtil buildUtil = new BuildUtil(project);
final StandardJavadocDocletOptions options = (StandardJavadocDocletOptions) pJavadocTask.getOptions();
options.setEncoding(StandardCharsets.UTF_8.toString());
options.setDocEncoding(StandardCharsets.UTF_8.toString());
options.setCharSet(StandardCharsets.UTF_8.toString());
options.setAuthor(false);
options.setUse(true);
options.setNoDeprecated(true);
options.setSplitIndex(false);
options.setLinks(pDepConfig.getJavadocLinks());
options.setHeader(buildUtil.getBuildConfig().getLongName().get());
options.setWindowTitle(buildUtil.getBuildConfig().getLongName().get());
pJavadocTask.setTitle(buildUtil.getBuildConfig().getLongName().get() + " v" + project.getVersion());
pJavadocTask.setSource(buildUtil.getSourceSet(SourceSet.MAIN_SOURCE_SET_NAME).getAllJava().plus(buildUtil.getSourceSet(BuildUtil.SONARQUBE_SOURCE_SET_NAME).getAllJava()));
pJavadocTask.setClasspath(new ClasspathBuilder(project).buildJavadocClasspath(pDepConfig));
// javadoc does not inherit the proxy settings (https://issues.gradle.org/browse/GRADLE-1228)
if (System.getProperty("http.proxyHost") != null) {
options.jFlags("-DproxyHost=" + System.getProperty("http.proxyHost"), "-DproxyPort=" + System.getProperty("http.proxyPort"), "-DproxyUser=" + System.getProperty("http.proxyUser"), "-DproxyPassword=" + System.getProperty("http.proxyPassword"));
}
}
Aggregations