-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
...gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/BomExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ConfigExtension, BomExtension> PATH = ConfigExtension.PATH.append(NAME, BomExtension.class); | ||
|
||
SetProperty<String> getExcludes(); | ||
SetProperty<String> getIncludes(); | ||
|
||
MapProperty<String, String> getProperties(); | ||
|
||
Property<Boolean> getAutoIncludes(); // true | ||
|
||
Property<String> getParent(); | ||
|
||
Property<Boolean> getOverwriteInceptionYear(); | ||
Property<Boolean> getOverwriteUrl(); | ||
Property<Boolean> getOverwriteLicenses(); | ||
Property<Boolean> getOverwriteScm(); | ||
Property<Boolean> getOverwriteOrganization(); | ||
Property<Boolean> getOverwriteDevelopers(); | ||
Property<Boolean> getOverwriteContributors(); | ||
Property<Boolean> getOverwriteIssueManagement(); | ||
Property<Boolean> getOverwriteCiManagement(); | ||
Property<Boolean> getOverwriteMailingLists(); | ||
|
||
static BomExtension createIfMissing(Project project) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
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()); | ||
}); | ||
} | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
...-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/BuildInfoExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ConfigExtension, BuildInfoExtension> PATH = ConfigExtension.PATH.append(NAME, BuildInfoExtension.class); | ||
|
||
Property<Boolean> getClearTime(); | ||
Property<Boolean> getSkipBuildBy(); | ||
Property<Boolean> getSkipBuildDate(); | ||
Property<Boolean> getSkipBuildTime(); | ||
Property<Boolean> getSkipBuildRevision(); | ||
Property<Boolean> getSkipBuildJdk(); | ||
Property<Boolean> getSkipBuildOs(); | ||
Property<Boolean> getSkipBuildCreatedBy(); | ||
Property<String> getBuildBy(); | ||
Property<String> getBuildDate(); | ||
Property<String> getBuildTime(); | ||
Property<String> getBuildRevision(); | ||
Property<String> getBuildJdk(); | ||
Property<String> getBuildOs(); | ||
Property<String> 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()); | ||
}); | ||
} | ||
|
||
} |
80 changes: 80 additions & 0 deletions
80
...adle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/extensions/ClirrExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ConfigExtension, ClirrExtension> PATH = ConfigExtension.PATH.append(NAME, ClirrExtension.class); | ||
|
||
class Difference implements Comparable<Difference> { | ||
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<String> getBaseline(); | ||
Property<File> getFilterFile(); | ||
Property<Predicate<? super Difference>> getFilter(); | ||
Property<Boolean> getFailOnErrors(); | ||
Property<Boolean> getFailOnException(); | ||
Property<Boolean> 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)); | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I really think you should avoid
createIfMissing
. Create plugins which add the extension instead.