Skip to content

Commit

Permalink
add hash to POM
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jul 15, 2024
1 parent 6f5e548 commit bc95e7f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions core/src/main/java/lucee/runtime/mvn/POM.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.xml.sax.SAXException;

import lucee.print;
import lucee.commons.digest.HashUtil;
import lucee.commons.io.log.Log;
import lucee.commons.io.res.Resource;
import lucee.commons.lang.ExceptionUtil;
Expand Down Expand Up @@ -310,6 +311,21 @@ public Resource getPath() {
return local(localDirectory, "pom");
}

private StringBuilder _hash(StringBuilder sb) throws IOException {
List<POM> deps = getDependencies();
if (deps != null) {
for (POM p: deps) {
p._hash(sb);
}
}
sb.append(groupId).append(';').append(artifactId).append(';').append(version);
return sb;
}

public String hash() throws IOException {
return HashUtil.create64BitHashAsString(_hash(new StringBuilder()));
}

Resource getArtifact(String type) {
return local(localDirectory, type);
}
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/lucee/runtime/mvn/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public static void main(String[] args) throws Exception {

print.e("--- path ---");
print.e(pom.getPath());
print.e("--- hash ---");
print.e(pom.hash());

print.e("--- artifact ---");
print.e(pom.getArtifact());
Expand Down Expand Up @@ -118,7 +120,7 @@ public static void main(String[] args) throws Exception {

// print.e(maven.getDependencies(groupId, artifactId, version, true, false, true));

// break;
break;
}
}

Expand Down

0 comments on commit bc95e7f

Please sign in to comment.