use of org.apache.hyracks.maven.license.project.LicensedProjects in project asterixdb by apache.
the class GenerateFileMojo method resolveLicenseContent.
private void resolveLicenseContent() throws IOException {
Set<LicenseSpec> licenseSpecs = new HashSet<>();
for (LicensedProjects licensedProjects : licenseMap.values()) {
licenseSpecs.add(licensedProjects.getLicense());
}
licenseSpecs.addAll(urlToLicenseMap.values());
for (LicenseSpec license : licenseSpecs) {
resolveLicenseContent(license, true);
}
}
use of org.apache.hyracks.maven.license.project.LicensedProjects in project asterixdb by apache.
the class SourcePointerResolver method collectSourcePointers.
private void collectSourcePointers() throws ProjectBuildingException, IOException {
try (StubArtifactRepository stubRepo = new StubArtifactRepository()) {
DefaultRepositoryRequest rr = new DefaultRepositoryRequest();
rr.setLocalRepository(stubRepo);
ArtifactRepository central = getCentralRepository();
rr.setRemoteRepositories(Collections.singletonList(central));
ArtifactResolutionRequest request = new ArtifactResolutionRequest(rr);
for (LicensedProjects lp : mojo.getLicenseMap().values()) {
if (lp.getLicense().getDisplayName() != null && lp.getLicense().getDisplayName().toLowerCase().contains("cddl")) {
ensureCDDLSourcesPointer(lp.getProjects(), central, request);
}
}
}
}
use of org.apache.hyracks.maven.license.project.LicensedProjects in project asterixdb by apache.
the class LicenseMojo method addProject.
protected void addProject(Project project, LicenseSpec spec, boolean additive) {
String licenseUrl = spec.getUrl();
LicenseSpec license = urlToLicenseMap.get(licenseUrl);
if (license == null) {
license = spec;
urlToLicenseMap.put(licenseUrl, license);
for (String alias : license.getAliasUrls()) {
if (!urlToLicenseMap.containsKey(alias)) {
urlToLicenseMap.put(alias, license);
}
}
} else if (license.getDisplayName() == null && spec.getDisplayName() != null) {
getLog().info("Propagating license name from " + project.gav() + ": " + spec.getDisplayName());
license.setDisplayName(spec.getDisplayName());
}
licenseUrl = license.getUrl();
LicensedProjects entry = licenseMap.get(licenseUrl);
if (entry == null) {
entry = new LicensedProjects(license);
licenseMap.put(licenseUrl, entry);
}
if (additive || entry.getProjects().contains(project)) {
entry.addProject(project);
}
}
use of org.apache.hyracks.maven.license.project.LicensedProjects in project asterixdb by apache.
the class GenerateFileMojo method rebuildLicenseContentProjectMap.
private void rebuildLicenseContentProjectMap() throws IOException {
int counter = 0;
Map<String, LicensedProjects> licenseMap2 = new TreeMap<>(WHITESPACE_NORMALIZED_COMPARATOR);
for (LicensedProjects lps : licenseMap.values()) {
for (Project p : lps.getProjects()) {
String licenseText = p.getLicenseText();
if (licenseText == null) {
getLog().warn("Using license other than from within artifact: " + p.gav());
licenseText = resolveLicenseContent(lps.getLicense(), false);
}
LicenseSpec spec = lps.getLicense();
if (spec.getDisplayName() == null) {
LicenseSpec canonicalLicense = urlToLicenseMap.get(spec.getUrl());
if (canonicalLicense != null) {
spec.setDisplayName(canonicalLicense.getDisplayName());
}
}
if (!licenseMap2.containsKey(licenseText)) {
if (!licenseText.equals(lps.getLicense().getContent())) {
spec = new LicenseSpec(new ArrayList<>(), licenseText, null, spec.getDisplayName(), spec.getMetric(), spec.getUrl() + (counter++));
}
licenseMap2.put(licenseText, new LicensedProjects(spec));
}
final LicensedProjects lp2 = licenseMap2.get(licenseText);
if (lp2.getLicense().getDisplayName() == null) {
lp2.getLicense().setDisplayName(lps.getLicense().getDisplayName());
}
lp2.addProject(p);
}
}
licenseMap = licenseMap2;
}
use of org.apache.hyracks.maven.license.project.LicensedProjects in project asterixdb by apache.
the class GenerateFileMojo method combineCommonGavs.
private void combineCommonGavs() {
for (LicensedProjects licensedProjects : licenseMap.values()) {
Map<String, Project> projectMap = new HashMap<>();
for (Iterator<Project> iter = licensedProjects.getProjects().iterator(); iter.hasNext(); ) {
Project project = iter.next();
if (projectMap.containsKey(project.gav())) {
Project first = projectMap.get(project.gav());
first.setLocation(first.getLocation() + "," + project.getLocation());
iter.remove();
} else {
projectMap.put(project.gav(), project);
}
}
}
}
Aggregations