-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Upgrade dependencies liquibase to 4.29.1 and liquibase-mongodb to 4.28.0 #42308
Conversation
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.
This looks really good thanks. I added a minor nitpick for the future but it's no biggie, we can merge as is.
If you end up fixing it, please amend the commit in which this thing was introduced (for instance using git commit --fixup <sha>
and then git rebase -i <sha before the first commit> --autosquash
).
@@ -19,6 +20,8 @@ | |||
/** | |||
*/ | |||
public final class ServiceUtil { | |||
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; |
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.
I'm not going to block the PR for this but this is not really an improvement. It's already a constant and now to figure out the charset you have to look out for the constant.
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.
fixed
4507e7c
to
8da35f6
Compare
I fixed a small error, I've overlooked. |
} | ||
} catch (Exception ex) { | ||
// close() really shouldn't declare that exception, see also https://github.com/liquibase/liquibase/pull/2576 | ||
throw new AssertionError(ex); |
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.
Sorry I missed this but I think we need something better here.
Because the exception is caught globally not only for the close() now and it could happen in the code that is in the try. So I would rather have an IllegalStateException with a proper message and the cause.
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.
I changed the exception accordingly
This comment has been minimized.
This comment has been minimized.
/cc @aloubyansky for the core improvements |
return pathStream | ||
.map(p -> p.subpath(0, p.getNameCount())) | ||
.filter(p -> p.toString().endsWith(resourceCoordinates.extension())) | ||
.toList(); |
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.
These paths, theoretically, might not be usable outside the method they are collected in.
They will work as long as the path tree is backed by a regular directory or an archive who's FileSystem remains open.
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.
replaced with filtered pathTree.walk
.toList(); | ||
} | ||
|
||
public record ArtifactCoordinates(String groupId, String artifactId) { |
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.
Let's avoid introducing this API. We already have a few variations around and this record does not represent complete coordinates. Consider https://github.com/quarkusio/quarkus/blob/main/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/maven/dependency/ArtifactCoordsPattern.java
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.
Thanks for the pointer. Done.
} | ||
} | ||
|
||
public record ResourceCoordinates(String basePath, String extension) { |
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.
This also looks questionable to me. It seems to be an attempt to introduce a generic way of locating content but the way it works remains pretty specific. Have you considered https://github.com/quarkusio/quarkus/blob/main/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathFilter.java?
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.
Thanks for the pointer. Done.
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.
Looks better to me, thanks @gcw-it
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd", | ||
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd", | ||
"liquibase.build.properties")); | ||
var dependencies = curateOutcome.getApplicationModel().getDependencies(); |
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.
AFAICS, there are two places where the new ofDependencyResources
method is used.
Just to clarify, are all dependencies instead of only the runtime ones scanned on purpose in both cases?
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.
You're right, we could reduce the scope to the runtime dependencies. I'll take care of that.
resource.produce(NativeImageResourceBuildItem.ofDependencyResources( | ||
dependencies, LIQUIBASE_MONGODB_ARTIFACT, LIQUIBASE_MONGODB_CHANGELOG_FILTER)); | ||
resource.produce(NativeImageResourceBuildItem.ofDependencyResources( | ||
dependencies, LIQUIBASE_MONGODB_ARTIFACT, LIQUIBASE_MONGODB_PARSER_FILTER)); |
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.
It seems like it could have been somewhat simplified by combining all the filters applied to the same set of of artifacts into one. I mean PathFilter.forIncludes(List.of(...))
could have been used instead, which would result in two calls to resource.produce(NativeImageResourceBuildItem.ofDependencyResources(
here and one in the other place.
Then, personally, it doesn't seem like the new NativeImageResourceBuildItem.ofDependencyResources()
offers a lot of benefit, since essentially, it wraps a one-liner ArtifactResourceResolver.of(dependencies, artifactCoordinates).resourceList(resourceFilter)
and by that, from the caller's perspective, it takes the responsibility of filtering resources off of the ArtifactResourceResolver
. I'll leave that decision to you though.
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.
I'll combine the resource filters. That was something I thought about during the modification and then promptly forgot about it. Thanks for the reminder.
I introduced the NativeImageResourceBuildItem.ofDependencyResources
convenience method, to be on the same abstraction level as ServiceProviderBuildItem allProvidersOfDependency
. It's where I would look first, to determine which capabilities are offered. In my opinion using the ArtifactResourceResolver
is a bit more obscure.
I would keep the method, but since you have the better domain knowledge, I will remove it, if you think it's cleaner to use the ArtifactResourceResolver
directly. What do you think?
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.
Sure, feel free to keep the method. Thanks.
*/ | ||
public static Collection<ServiceProviderBuildItem> allProvidersOfDependency( | ||
Collection<ResolvedDependency> dependencies, | ||
ArtifactCoords artifactCoordinates) { |
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.
BTW, you could take a similar approach here by adding a method that takes ArtifactCoordsPattern
and have a single call when it's called one per coords. That could be more efficient.
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.
Or accept a List of ArtifactCoords, I think patterns would make more sense though, since that's how they are treated anyway.
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.
Do you mean using a wildcard pattern, or rather a list of ArtifactCoordsPattern
to include multiple dependencies?
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.
Not a list of ArtifactCoordsPattern
s. It should be either a single ArtifactCoordsPattern
or a Collection<ArtifactCoords>
from which a pattern instance will be created.
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.
If you go with the Collection<ArtifactCoords>
then I suppose you could keep the current method, in case there are callers that pass in a single 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.
Sorry, if I don't follow you completely, but how would I build an ArtifactCoordsPattern
for multiple artifacts?
Using a wildcard pattern for the group- and/or artifact-id could lead to including unwanted resources. Am I misunderstanding anything here?
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.
I thought of ArtifactCoordsPattern. toPatterns(Collection 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.
I see. I misunderstood your earlier comment
Not a list of
ArtifactCoordsPattern
s
That's why I disregarded this method.
Thanks for the support. I'll have a go at it.
|
Status for workflow
|
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.
Thanks for your efforts @gcw-it
And merged, thanks a lot! |
@aloubyansky @gsmet Happy to help. |
The liquibase dependencies are upgraded to their latest versions.
To create an easier upgrade path for future version upgrades, a utility class to define resources limited to a single dependency is introduced. The functionality added in PR #41928 is extracted to a helper class, to be used in selected build steps. An option is added to
NativeImageResourceBuildItem
andServiceProviderBuildItem
to make use of this new capability.There is some possible overlap with
NativeImageResourceDirectoryBuildItem
andNativeImageResourcePatternsBuildItem
, but the new feature offers to reduce the scope to a single dependency instead of the whole classpath.This is desirable in view of Liquibases's decision to put
.property
files in the root of their.jar
. This could lead to possible conflicts, when using e.g.NativeImageResourcePatternsBuildItem
to include those resources., should other dependency providers choose to go down a similar road, and put their resources in the same namespace.Furthermore it enables an extension to include all SPIs defined in
META-INF/services
of a specific dependency.