>From Michael Blow <[email protected]>:
Michael Blow has uploaded this change for review. (
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19244 )
Change subject: [NO ISSUE][HYR][LIC] Enable license automation plugin to skip
license/notice file content
......................................................................
[NO ISSUE][HYR][LIC] Enable license automation plugin to skip license/notice
file content
Ext-ref: MB-64542
Change-Id: Id51ed3c059795c377151fcbc45af1fea026435c9
---
M
hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
M
hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
2 files changed, 39 insertions(+), 6 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/44/19244/1
diff --git
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
index 5c11106..0b95429 100644
---
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
+++
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
@@ -284,6 +284,9 @@
}
private void rebuildLicenseContentProjectMap() throws IOException {
+ if (skipLicenses) {
+ return;
+ }
int counter = 0;
Map<String, LicensedProjects> licenseMap2 = new
TreeMap<>(WHITESPACE_NORMALIZED_COMPARATOR);
for (LicensedProjects lps : licenseMap.values()) {
@@ -333,6 +336,9 @@
private void buildNoticeProjectMap() throws IOException {
noticeMap = new TreeMap<>(WHITESPACE_NORMALIZED_COMPARATOR);
+ if (skipNotices) {
+ return;
+ }
for (Project p : getProjects()) {
String noticeText = p.getNoticeText();
if (noticeText == null && noticeOverrides.containsKey(p.gav())) {
@@ -374,11 +380,15 @@
}
private void resolveNoticeFiles() throws MojoExecutionException,
IOException {
- resolveArtifactFiles(NOTICE);
+ if (!skipNotices) {
+ resolveArtifactFiles(NOTICE);
+ }
}
private void resolveLicenseFiles() throws MojoExecutionException,
IOException {
- resolveArtifactFiles(LICENSE);
+ if (!skipLicenses) {
+ resolveArtifactFiles(LICENSE);
+ }
}
private void resolveArtifactFiles(final EmbeddedArtifact artifact) throws
MojoExecutionException, IOException {
diff --git
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
index 3b5fde6..5e91807 100644
---
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
+++
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
@@ -131,6 +131,12 @@
@Parameter
protected List<String> extraDependencies = new ArrayList<>();
+ @Parameter
+ protected boolean skipLicenses;
+
+ @Parameter
+ protected boolean skipNotices;
+
private Map<String, MavenProject> projectCache = new HashMap<>();
private Map<String, Model> supplementModels;
@@ -274,8 +280,18 @@
private void addDependencyToLicenseMap(MavenProject depProject,
List<Pair<String, String>> depLicenses,
String depLocation) {
+ LicenseSpec spec = extractLicenseSpec(depProject, depLicenses,
depLocation);
+ addProject(new Project(depProject, depLocation,
depProject.getArtifact().getFile(),
+
Boolean.parseBoolean(String.valueOf(depProject.getContextValue(SHADOWED_KEY)))),
spec, true);
+ }
+
+ private LicenseSpec extractLicenseSpec(MavenProject depProject,
List<Pair<String, String>> depLicenses,
+ String depLocation) {
final String depGav = toGav(depProject);
getLog().debug("adding " + depGav + ", location: " + depLocation);
+ if (skipLicenses) {
+ return new LicenseSpec("DUMMY LICENSE", "DUMMY LICENSE");
+ }
final MutableBoolean usedMetric = new MutableBoolean(false);
if (depLicenses.size() > 1) {
Collections.sort(depLicenses, (o1, o2) -> {
@@ -311,10 +327,7 @@
licenseUrl = fakeLicenseUrl;
}
}
- addProject(
- new Project(depProject, depLocation,
depProject.getArtifact().getFile(),
-
Boolean.parseBoolean(String.valueOf(depProject.getContextValue(SHADOWED_KEY)))),
- new LicenseSpec(licenseUrl, displayName), true);
+ return new LicenseSpec(licenseUrl, displayName);
}
protected void addProject(Project project, LicenseSpec spec, boolean
additive) {
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19244
To unsubscribe, or for help writing mail filters, visit
https://asterix-gerrit.ics.uci.edu/settings
Gerrit-Project: asterixdb
Gerrit-Branch: neo
Gerrit-Change-Id: Id51ed3c059795c377151fcbc45af1fea026435c9
Gerrit-Change-Number: 19244
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Blow <[email protected]>
Gerrit-MessageType: newchange