Skip to content

Commit

Permalink
fix(core): ensure that special resourceUris can also be overridden
Browse files Browse the repository at this point in the history
Rename `Dependency.mergeDependencies` to `Dependency.override` 🤖
  • Loading branch information
cmark committed Oct 12, 2023
1 parent 8be0b68 commit 6a2cd0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public String toString() {
*/
public boolean dependOnSameResource(Dependency other) {
if (other == null) return false;
return getUri().getResourceUri().withoutPath().equals(other.getUri().getResourceUri().withoutPath())
return getUri().getResourceUri().withoutPath().withoutSpecialResourceIdPart().equals(other.getUri().getResourceUri().withoutSpecialResourceIdPart().withoutPath())
&& Objects.equals(getScope(), other.getScope());
}

Expand Down Expand Up @@ -225,7 +225,7 @@ public static Optional<Dependency> find(List<Dependency> dependencies, Dependenc
* @param overrides
* @return
*/
public static List<Dependency> mergeDependencies(List<Dependency> dependencies, List<Dependency> overrides) {
public static List<Dependency> override(List<Dependency> dependencies, List<Dependency> overrides) {
if (CompareUtils.isEmpty(overrides)) {
return dependencies;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void alterDependenciesBasedOnBranchMetadata(List<R> results) {
if (branchToOverrideResourceMetadataWith != null && branchToOverrideResourceMetadataWith.metadata() != null) {
List<Map<String, Object>> branchScopedDependenciesJson = (List<Map<String, Object>>) branchToOverrideResourceMetadataWith.metadata().get(ResourceDocument.BranchMetadata.DEPENDENCIES);
List<Dependency> branchScopedDependencies = context().service(ObjectMapper.class).convertValue(branchScopedDependenciesJson, new TypeReference<List<Dependency>>() {});
tres.setDependencies(Dependency.mergeDependencies(tres.getDependencies(), branchScopedDependencies));
tres.setDependencies(Dependency.override(tres.getDependencies(), branchScopedDependencies));
}
}
}
Expand Down

0 comments on commit 6a2cd0f

Please sign in to comment.