summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.iplog
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.iplog')
-rw-r--r--org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java29
-rw-r--r--org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java42
2 files changed, 59 insertions, 12 deletions
diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
index a9fdb81581..8ddb6bdd1e 100644
--- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
+++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
@@ -116,6 +116,9 @@ public class IpLogGenerator {
/** Projects indexed by their ID string, e.g. {@code technology.jgit}. */
private final Map<String, Project> projects = new TreeMap<String, Project>();
+ /** Projects indexed by their ID string, e.g. {@code technology.jgit}. */
+ private final Map<String, Project> consumedProjects = new TreeMap<String, Project>();
+
/** Known committers, indexed by their foundation ID. */
private final Map<String, Committer> committersById = new HashMap<String, Committer>();
@@ -223,6 +226,9 @@ public class IpLogGenerator {
p.setVersion(version);
projects.put(p.getName(), p);
}
+ for (Project p : meta.getConsumedProjects()) {
+ consumedProjects.put(p.getName(), p);
+ }
cqs.addAll(meta.getCQs());
}
@@ -480,8 +486,19 @@ public class IpLogGenerator {
root.appendChild(createProject(project));
licenses.addAll(project.getLicenses());
}
+
+ if (!consumedProjects.isEmpty())
+ appendBlankLine(root);
+ for (Project project : sort(consumedProjects, Project.COMPARATOR)) {
+ root.appendChild(createConsumes(project));
+ licenses.addAll(project.getLicenses());
+ }
+
for (RevCommit c : sort(commits))
root.appendChild(createCommitMeta(c));
+
+ if (licenses.size() > 1)
+ appendBlankLine(root);
for (String name : sort(licenses))
root.appendChild(createLicense(name));
@@ -509,11 +526,21 @@ public class IpLogGenerator {
private Element createProject(Project p) {
Element project = createElement("project");
+ populateProjectType(p, project);
+ return project;
+ }
+
+ private Element createConsumes(Project p) {
+ Element project = createElement("consumes");
+ populateProjectType(p, project);
+ return project;
+ }
+
+ private void populateProjectType(Project p, Element project) {
required(project, "id", p.getID());
required(project, "name", p.getName());
optional(project, "comments", p.getComments());
optional(project, "version", p.getVersion());
- return project;
}
private Element createCommitMeta(RevCommit c) {
diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java
index 8d73b02fd5..16a1593523 100644
--- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java
+++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java
@@ -73,8 +73,12 @@ public class IpLogMeta {
private static final String S_CQ = "CQ";
+ private static final String S_CONSUMES = "consumes";
+
private static final String K_NAME = "name";
+ private static final String K_VERSION = "version";
+
private static final String K_COMMENTS = "comments";
private static final String K_SKIP_COMMIT = "skipCommit";
@@ -89,31 +93,29 @@ public class IpLogMeta {
private List<Project> projects = new ArrayList<Project>();
+ private List<Project> consumedProjects = new ArrayList<Project>();
+
private Set<CQ> cqs = new HashSet<CQ>();
List<Project> getProjects() {
return projects;
}
+ List<Project> getConsumedProjects() {
+ return consumedProjects;
+ }
+
Set<CQ> getCQs() {
return cqs;
}
void loadFrom(Config cfg) {
projects.clear();
+ consumedProjects.clear();
cqs.clear();
- for (String id : cfg.getSubsections(S_PROJECT)) {
- String name = cfg.getString(S_PROJECT, id, K_NAME);
- Project project = new Project(id, name);
- project.setComments(cfg.getString(S_PROJECT, id, K_COMMENTS));
-
- for (String c : cfg.getStringList(S_PROJECT, id, K_SKIP_COMMIT))
- project.addSkipCommit(ObjectId.fromString(c));
- for (String license : cfg.getStringList(S_PROJECT, id, K_LICENSE))
- project.addLicense(license);
- projects.add(project);
- }
+ projects.addAll(parseProjects(cfg, S_PROJECT));
+ consumedProjects.addAll(parseProjects(cfg, S_CONSUMES));
for (String id : cfg.getSubsections(S_CQ)) {
CQ cq = new CQ(Long.parseLong(id));
@@ -126,6 +128,24 @@ public class IpLogMeta {
}
}
+ private List<Project> parseProjects(final Config cfg,
+ final String sectionName) {
+ final List<Project> dst = new ArrayList<Project>();
+ for (String id : cfg.getSubsections(sectionName)) {
+ String name = cfg.getString(sectionName, id, K_NAME);
+ Project project = new Project(id, name);
+ project.setVersion(cfg.getString(sectionName, id, K_VERSION));
+ project.setComments(cfg.getString(sectionName, id, K_COMMENTS));
+
+ for (String c : cfg.getStringList(sectionName, id, K_SKIP_COMMIT))
+ project.addSkipCommit(ObjectId.fromString(c));
+ for (String license : cfg.getStringList(sectionName, id, K_LICENSE))
+ project.addLicense(license);
+ dst.add(project);
+ }
+ return dst;
+ }
+
/**
* Query the Eclipse Foundation's IPzilla database for CQ records.
* <p>