-
Notifications
You must be signed in to change notification settings - Fork 10
Add support for build artifacts locking using lockBuild
parameter
#85
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
Conversation
c7b5c83
to
53ed213
Compare
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 really good!
Added some comment and have a closer look later.
private MavenSession mavenSession; | ||
|
||
@Parameter(property = "dependencyLock.alsoLockBuild") | ||
private boolean alsoLockBuild; |
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 think lockBuild
would be enough? And maybe it should be moved to LockMojo.java ?
I think that the check goal should check the build lock if it exists in the lock file.
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.
src/main/java/se/vandmo/dependencylock/maven/mojos/CheckMojo.java
Outdated
Show resolved
Hide resolved
src/main/resources/se/vandmo/dependencylock/maven/pom/pom-with-plugins.ftlx
Show resolved
Hide resolved
…ion and withIntegrity
…e level of the lock (and have the build check logic be done only if build intel is provided in lock file)
alsoLockBuild
parameterlockBuild
parameter
…ly artifacts shared between plugins
…ontents of the file at once)
I believe this is pretty much ready to be reviewed. I recon there are a few classes for which unit testing could be helpful (specifically thinking of lock file formatting / parsing logic which may be tricky to maintain and where errors are quickly made), but would rather have feedbacks first to see if this is the right implementation target. |
I have had a closer look now. I think the code looks good but I am unsure about the new structure of the dependency-lock.json. I like the idea but it would break the build if somebody manages to do a lock with a new version of the plugin. It is opt-in in a way since lockBuild needs to be set but maybe it should be an additional flag. Is the lock file a lot smaller then it would be if it would behave as the pom lock file? The XML schema would need to be updated as well (https://vandmo.github.io/dependency-lock-maven-plugin/maven-v4_0_0_ext.xsd and https://vandmo.github.io/dependency-lock-maven-plugin/dependencylock.xsd) There are some tests that should problaby be added that I noticed, but those could be done separately from this MR. I can write them myself unless you really want to :)
|
Will add a test for the support of "extension". One question I have though: the mentioned xsd needs to be altered from what I see (or a newer version generated), would there be any objection to having it included in the build process ? I see three ways of implementing this:
What would be your preference here ? |
I think it would be great if there could be a build step that commits the file in the gh-pages branch. |
Added:
This means that this PR will depend on #86 being merged to be fully operational in terms of XSD compliance I can propose to do the automatic publishing to gh-pages but I'd rather do it in a separate PR as it involves a lot more discussion (notably because it requires adding rights for the process to contribute to github branches) |
I am pondering wheter it is a good idea to make the JSON lock file incompatible with older versions of the plugin.
Am I missing something? |
I believe you're not missing anything indeed. The "space gain" is not even guaranteed to be a huge one IMHO. My only question here would be: is it reasonable to expect different versions of the plugin being used ? (e.g. locking with a new version and checking with an old version) Rolling back this is a one liner so do tell me if you'd rather keep it "backward compatible" (in the same manner as for the POM it turns out). |
Fixed the JSON format change in 0f7b954. WDYT ? |
Yeah, lets go with this version. It is consistent with how the pom is as well and if an artifact gets locked with different checksums for some reason then the check would fail for one of those. Probably very low risk of that happening though, somebody would need to edit the lock file manually I guess. |
By all means, do "Squash and Merge" ! The initial commits separation was to ease the review process and the refactoring logic, it loses any interests to keep as is "on master". |
Could you change back to the initial structure of the JSON lock file? It could be worth having a Maybe it could be worth having an option to use the new format even if the build is not locked, but that is also a separate thing. |
This reverts commit 0f7b954.
…riminate when reading)
Rolled back to the former proposal (e.g. "dependencies" field using "artifact" indirection) and added version field (used it as way to identify the file format). Regarding the POM situation there are two options:
Not too sure about either options TBH. What would be your take here ? |
Looks really good! I merged it and will create separate issues for remaining things we have talked about. Would be good to get the version in to the the XML somehow before creating a release. |
Objective: locking plugins (and their dependencies) as well as extensions being used in a maven project.
This involved several refactorings:
Fixes #84
Depends upon #86 (which basically updates the XSD)