diff --git a/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/BomExtension.java b/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/BomExtension.java new file mode 100644 index 000000000..21c5f9684 --- /dev/null +++ b/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/BomExtension.java @@ -0,0 +1,60 @@ +package org.kordamp.gradle.plugin.base.extensions; + +import org.gradle.api.Project; +import org.gradle.api.plugins.ExtensionAware; +import org.gradle.api.provider.MapProperty; +import org.gradle.api.provider.Property; +import org.gradle.api.provider.SetProperty; +import org.kordamp.gradle.plugin.base.util.ExtensionPath; +import org.kordamp.gradle.plugin.base.util.ExtensionUtil; + +public interface BomExtension extends ExtensionAware { + + String NAME = "bom"; + ExtensionPath PATH = ConfigExtension.PATH.append(NAME, BomExtension.class); + + SetProperty getExcludes(); + SetProperty getIncludes(); + + MapProperty getProperties(); + + Property getAutoIncludes(); // true + + Property getParent(); + + Property getOverwriteInceptionYear(); + Property getOverwriteUrl(); + Property getOverwriteLicenses(); + Property getOverwriteScm(); + Property getOverwriteOrganization(); + Property getOverwriteDevelopers(); + Property getOverwriteContributors(); + Property getOverwriteIssueManagement(); + Property getOverwriteCiManagement(); + Property getOverwriteMailingLists(); + + static BomExtension createIfMissing(Project project) { + return ExtensionUtil.createIfMissing(project, PATH, (ext, root) -> { + ext.getAutoIncludes().convention(root.getAutoIncludes().convention(true)); + + ext.getExcludes().convention(root.getExcludes()); + ext.getIncludes().convention(root.getIncludes()); + + ext.getProperties().convention(root.getProperties()); + + ext.getParent().convention(root.getParent()); + + ext.getOverwriteInceptionYear().convention(root.getOverwriteInceptionYear()); + ext.getOverwriteUrl().convention(root.getOverwriteUrl()); + ext.getOverwriteLicenses().convention(root.getOverwriteLicenses()); + ext.getOverwriteScm().convention(root.getOverwriteScm()); + ext.getOverwriteOrganization().convention(root.getOverwriteOrganization()); + ext.getOverwriteDevelopers().convention(root.getOverwriteDevelopers()); + ext.getOverwriteContributors().convention(root.getOverwriteContributors()); + ext.getOverwriteIssueManagement().convention(root.getOverwriteIssueManagement()); + ext.getOverwriteCiManagement().convention(root.getOverwriteCiManagement()); + ext.getOverwriteMailingLists().convention(root.getOverwriteMailingLists()); + }); + } + +} diff --git a/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/BuildInfoExtension.java b/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/BuildInfoExtension.java new file mode 100644 index 000000000..cde8e383c --- /dev/null +++ b/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/BuildInfoExtension.java @@ -0,0 +1,50 @@ +package org.kordamp.gradle.plugin.base.extensions; + +import org.gradle.api.Project; +import org.gradle.api.plugins.ExtensionAware; +import org.gradle.api.provider.Property; +import org.kordamp.gradle.plugin.base.util.ExtensionPath; +import org.kordamp.gradle.plugin.base.util.ExtensionUtil; + +public interface BuildInfoExtension extends ExtensionAware { + + String NAME = "buildInfo"; + ExtensionPath PATH = ConfigExtension.PATH.append(NAME, BuildInfoExtension.class); + + Property getClearTime(); + Property getSkipBuildBy(); + Property getSkipBuildDate(); + Property getSkipBuildTime(); + Property getSkipBuildRevision(); + Property getSkipBuildJdk(); + Property getSkipBuildOs(); + Property getSkipBuildCreatedBy(); + Property getBuildBy(); + Property getBuildDate(); + Property getBuildTime(); + Property getBuildRevision(); + Property getBuildJdk(); + Property getBuildOs(); + Property getBuildCreatedBy(); + + static BuildInfoExtension createIfMissing(Project project) { + return ExtensionUtil.createIfMissing(project, PATH, (ext, root) -> { + ext.getClearTime().convention(root.getClearTime()); + ext.getSkipBuildBy().convention(root.getSkipBuildBy()); + ext.getSkipBuildDate().convention(root.getSkipBuildDate()); + ext.getSkipBuildTime().convention(root.getSkipBuildTime()); + ext.getSkipBuildRevision().convention(root.getSkipBuildRevision()); + ext.getSkipBuildJdk().convention(root.getSkipBuildJdk()); + ext.getSkipBuildOs().convention(root.getSkipBuildOs()); + ext.getSkipBuildCreatedBy().convention(root.getSkipBuildCreatedBy()); + ext.getBuildBy().convention(root.getBuildBy()); + ext.getBuildDate().convention(root.getBuildDate()); + ext.getBuildTime().convention(root.getBuildTime()); + ext.getBuildRevision().convention(root.getBuildRevision()); + ext.getBuildJdk().convention(root.getBuildJdk()); + ext.getBuildOs().convention(root.getBuildOs()); + ext.getBuildCreatedBy().convention(root.getBuildCreatedBy()); + }); + } + +} diff --git a/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/ClirrExtension.java b/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/ClirrExtension.java new file mode 100644 index 000000000..f50787ece --- /dev/null +++ b/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/ClirrExtension.java @@ -0,0 +1,80 @@ +package org.kordamp.gradle.plugin.base.extensions; + +import org.gradle.api.Project; +import org.gradle.api.plugins.ExtensionAware; +import org.gradle.api.provider.Property; +import org.kordamp.gradle.plugin.base.util.ExtensionPath; +import org.kordamp.gradle.plugin.base.util.ExtensionUtil; + +import java.io.File; +import java.util.Comparator; +import java.util.function.Predicate; + +public interface ClirrExtension extends ExtensionAware { + + String NAME = "clirr"; + ExtensionPath PATH = ConfigExtension.PATH.append(NAME, ClirrExtension.class); + + class Difference implements Comparable { + private String classname; + private String severity; + private String identifier; + private String message; + + public String getClassname() { + return classname; + } + + public void setClassname(String classname) { + this.classname = classname; + } + + public String getSeverity() { + return severity; + } + + public void setSeverity(String severity) { + this.severity = severity; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public int compareTo(Difference o) { + return Comparator.nullsFirst(Comparator.comparing(Difference::getClassname)).compare(this, o); + } + } + + Property getBaseline(); + Property getFilterFile(); + Property> getFilter(); + Property getFailOnErrors(); + Property getFailOnException(); + Property getSemver(); + + static ClirrExtension createIfMissing(Project project) { + return ExtensionUtil.createIfMissing(project, PATH, (ext, root) -> { + ext.getBaseline().convention(root.getBaseline()); + ext.getFilterFile().convention(root.getFilterFile()); + ext.getFilter().convention(root.getFilter()); + ext.getFailOnErrors().convention(root.getFailOnErrors().convention(true)); + ext.getFailOnException().convention(root.getFailOnException().convention(false)); + ext.getSemver().convention(root.getSemver().convention(true)); + }); + } + +} diff --git a/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/ConfigExtension.java b/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/ConfigExtension.java index 07ffa537a..2ce1fdcd3 100644 --- a/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/ConfigExtension.java +++ b/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/ConfigExtension.java @@ -37,6 +37,9 @@ static ConfigExtension createIfMissing(Project project) { }); InfoExtension.createIfMissing(project); + BomExtension.createIfMissing(project); + BuildInfoExtension.createIfMissing(project); + ClirrExtension.createIfMissing(project); return config; }