Skip to content
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

#558: Fix auto dependency update for released versions #559

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion doc/changes/changes_4.2.1.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Project Keeper 4.2.1, released 2024-??-??

Code name:
Code name: Bugfixes for validation and `update-dependencies`

## Summary

This release contains many bugfixes for the new modes `update-dependencies` and `verify-release`.

## Features

* #523: Added validation steps for changes file
Expand All @@ -16,9 +18,16 @@ Code name:
* #548: Skip release build when preconditions are not fulfilled
* #540: Improved speed of validating mentioned issues in changes file
* #553: Reduced diff in `pom.xml` for mode `update-dependencies`
* #558: Fixed `update-dependencies` running with a released version

## Dependency Updates

### Project Keeper Shared Model Classes

#### Test Dependency Updates

* Updated `nl.jqno.equalsverifier:equalsverifier:3.15.8` to `3.16`

### Project Keeper Core

#### Compile Dependency Updates
Expand All @@ -32,6 +41,7 @@ Code name:
#### Test Dependency Updates

* Updated `com.exasol:project-keeper-shared-test-setup:4.2.0` to `4.2.1`
* Updated `nl.jqno.equalsverifier:equalsverifier:3.15.8` to `3.16`

### Project Keeper Command Line Interface

Expand Down
3 changes: 2 additions & 1 deletion parent-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<!-- Upgrading to 6.8.0.202311291450-r causes java.lang.NoClassDefFoundError: org/eclipse/jgit/internal/JGitText in ShutdownHook-->
<!-- Will be fixed in jgit 6.10.0, see https://github.com/eclipse-jgit/jgit/issues/36 -->
<version>6.7.0.202309050840-r</version>
</dependency>
<dependency>
Expand Down Expand Up @@ -230,7 +231,7 @@
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.15.8</version>
<version>3.16</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ void testUpgradeDependencies() throws VerificationException, IOException {

updateReleaseDate("0.1.0", "2023-01-01");
verifier.verify(true);
createGitTag("0.1.0");

verifier.executeGoal("project-keeper:update-dependencies");
verifier.verify(true);
Expand Down Expand Up @@ -170,6 +171,16 @@ void testUpgradeDependencies() throws VerificationException, IOException {
* #709: Fixed vulnerability CVE-2017-10355 in dependency `xerces:xercesImpl:jar:2.12.2:test`"""))));
}

private void createGitTag(final String tagName) {
try (Git git = Git.open(projectDir.toFile())) {
git.add().addFilepattern(".").call();
git.commit().setMessage("Release " + tagName).call();
git.tag().setName(tagName).call();
} catch (GitAPIException | IOException exception) {
throw new IllegalStateException("Failed to create Git tag " + tagName, exception);
}
}

private void setVulnerabilityInfo(final String... vulnerabilityInfoJson) {
final String jsonlContent = Arrays.stream(vulnerabilityInfoJson) //
.map(this::removeLineBreaks) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ private ValidationPhase phase2AnalyzeSources(final ValidationPhase.Provision pro
.build();
final List<Validator> validators = List.of( //
projectFilesValidator, //
new VersionIncrementValidator(projectVersion, projectDir), //
new ReadmeFileValidator(this.projectDir, projectName, this.repoName, analyzedSources),
new ChangesFileValidator(projectVersion, projectName, this.projectDir, analyzedSources),
new DependenciesValidator(analyzedSources, this.projectDir, brokenLinkReplacer),
Expand All @@ -169,6 +168,7 @@ private boolean hasSourceOfType(final List<Source> sources, final SourceType typ
*/
private ValidationPhase phase3Changelog(final ValidationPhase.Provision provision) {
final List<Validator> validators = List.of(
new VersionIncrementValidator(provision.projectVersion(), projectDir), //
new LatestChangesFileValidator(this.projectDir, provision.projectVersion()),
new ChangelogFileValidator(this.projectDir));
return new ValidationPhase(provision, validators);
Expand Down Expand Up @@ -327,7 +327,9 @@ private interface PhaseResultHandler {
*/
private Provision getValidationProvision() {
Provision provision = null;
for (final PhaseValidator phaseValidator : getValidationPhases()) {
final List<PhaseValidator> phases = List.of(this::phase0LicenseFile, this::phase1BuildFiles,
this::phase2AnalyzeSources);
for (final PhaseValidator phaseValidator : phases) {
final ValidationPhase phase = phaseValidator.apply(provision);
provision = phase.provision();
final List<ValidationFinding> findings = runValidation(phase.validators());
Expand Down
Loading