-
-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the new artifacts hashing algorithm #1280
base: master
Are you sure you want to change the base?
Conversation
4bf9b05
to
1526bbe
Compare
375945f
to
c0b40e3
Compare
c0b40e3
to
26571a7
Compare
@@ -57,17 +57,30 @@ def unpack_coordinates(coords): | |||
def _is_version_number(part): | |||
return part[0].isdigit() | |||
|
|||
def _unpack_if_necssary(coords): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo error
@@ -45,7 +45,7 @@ public void shouldRenderAggregatingJarsAsJarWithNullShasum() { | |||
Set.of(), | |||
new TreeMap<>()); | |||
|
|||
Map<String, Object> rendered = new V2LockFile(repos, Set.of(aggregator), Set.of()).render(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please name -1
as a constant.
import java.util.TreeSet; | ||
import java.util.stream.Collectors; | ||
|
||
public class ArtifactsHash { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: final, javadoc
for (DependencyInfo info : infos) { | ||
StringBuilder line = new StringBuilder(); | ||
line.append(info.getCoordinates().toString()) | ||
.append(" | ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: name this separator
// utility class | ||
} | ||
|
||
public static int calculateArtifactsHash(Collection<DependencyInfo> infos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this format/spec need to be versioned?
} | ||
|
||
groupId = Objects.requireNonNull(parts[0]); | ||
artifactId = Objects.requireNonNull(parts[1]); | ||
|
||
boolean isGradle = | ||
coordinates.contains("@") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can non-gradle coordinates contain @
?
} | ||
|
||
groupId = Objects.requireNonNull(parts[0]); | ||
artifactId = Objects.requireNonNull(parts[1]); | ||
|
||
boolean isGradle = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document this constructor formally on what formats are accepted. It's getting a bit harder to understand this code, and AFAIUC, we are trying to use this to canonicalize the format, so some documentation will be useful.
artifacts = _get_artifacts(lock_file_contents) | ||
|
||
for artifact in artifacts: | ||
line = "%s | %s | " % (to_external_form(artifact["coordinates"]), artifact["sha256"] if artifact["sha256"] else "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want to mention that the format should also be updated in tandem with ArtifactsHash.java.
Also please update the PR description with more details on why this is happening. |
No description provided.