Skip to content

Commit

Permalink
Resolves mojohaus#880: add information on property updates to the cha…
Browse files Browse the repository at this point in the history
…nge recorder

Release notes:
- new version and new namespace for the change recorder
- change recorder also records property changes
  • Loading branch information
jarmoniuk committed Jan 4, 2023
1 parent 901aac0 commit 120d680
Show file tree
Hide file tree
Showing 57 changed files with 858 additions and 390 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.codehaus.mojo.versions.api.change;

/*
* Copyright MojoHaus and Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

/**
* Represents a change of an item's version.
*
* @author Slawomir Jaranowski
* @since 2.14.0
*/
public interface DependencyVersionChange extends VersionChange {
/**
* @return a groupId of changed item
* @since 2.14.0
*/
String getGroupId();

/**
* @return an ArtifactId of change item
* @since 2.14.0
*/
String getArtifactId();

/**
* @return an old version of changed item
* @since 2.14.0
*/
String getOldVersion();

/**
* @return a new version of changed item
* @since 2.14.0
*/
String getNewVersion();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.codehaus.mojo.versions.api.change;

/*
* Copyright MojoHaus and Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

/**
* Represents a change of a property value.
*
* @author Andrzej Jarmoniuk
* @since 2.15.0
*/
public interface PropertyVersionChange extends VersionChange {

/**
* @return the property that has changed
*/
String getProperty();

/**
* @return the old value of the property
*/
String getOldValue();

/**
* @return the new value of the property
*/
String getNewValue();
}
Original file line number Diff line number Diff line change
@@ -1,50 +1,24 @@
package org.codehaus.mojo.versions.api.change;

/*
* Copyright MojoHaus and Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
* Represents a change of an item's version.
*
* @author Slawomir Jaranowski
* @since 2.14.0
* Base class for version changes
*/
public interface VersionChange {
/**
* @return a groupId of changed item
* @since 2.14.0
*/
String getGroupId();

/**
* @return an ArtifactId of change item
* @since 2.14.0
*/
String getArtifactId();

/**
* @return an old version of changed item
* @since 2.14.0
*/
String getOldVersion();

/**
* @return a new version of changed item
* @since 2.14.0
*/
String getNewVersion();
}
public interface VersionChange {}
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,6 @@
* @since 2.14.0
*/
public interface ChangeRecord {
/**
* Describe where version item is updated.
*/
enum ChangeKind {
DEPENDENCY("dependency-update"),
DEPENDENCY_MANAGEMENT("dependency-management-update"),
PARENT("parent-update"),
PLUGIN("plugin-update"),
PLUGIN_MANAGEMENT("plugin-management-update"),
PROPERTY("property-update");

private final String label;

ChangeKind(String label) {
this.label = label;
}

public String getLabel() {
return label;
}
}

/**
* @return a version item change kind
* @since 2.14.0
*/
ChangeKind getKind();

/**
* @return a details about changed item
* @since 2.14.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.codehaus.mojo.versions.api.recording;

/*
* Copyright MojoHaus and Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

/**
* Represents a change record of an item's version.
*
* @author Slawomir Jaranowski
* @since 2.14.0
*/
public interface DependencyChangeRecord extends ChangeRecord {
/**
* Describe where version item is updated.
*/
enum ChangeKind {
DEPENDENCY("dependency-update"),
DEPENDENCY_MANAGEMENT("dependency-management-update"),
PARENT("parent-update"),
PLUGIN("plugin-update"),
PLUGIN_MANAGEMENT("plugin-management-update"),
PROPERTY("property-update");

private final String label;

ChangeKind(String label) {
this.label = label;
}

public String getLabel() {
return label;
}
}

/**
* @return a version item change kind
* @since 2.14.0
*/
ChangeKind getKind();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.Arrays;
import java.util.List;

import org.codehaus.mojo.versions.api.change.VersionChange;
import org.codehaus.mojo.versions.api.change.DependencyVersionChange;

/**
* Created by IntelliJ IDEA.
Expand All @@ -44,7 +44,7 @@ public CompositeVersionChanger(List<VersionChanger> composites) {
this.composites = new ArrayList<>(composites);
}

public void apply(VersionChange versionChange) throws XMLStreamException {
public void apply(DependencyVersionChange versionChange) throws XMLStreamException {
for (VersionChanger delegate : composites) {
delegate.apply(versionChange);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

import java.util.Objects;

import org.codehaus.mojo.versions.api.change.VersionChange;
import org.codehaus.mojo.versions.api.change.DependencyVersionChange;

/**
* Represents a change of an artifact's version.
*
* @author Stephen Connolly
* @since 15-Sep-2010 14:48:10
*/
public final class DefaultVersionChange implements VersionChange {
public final class DefaultDependencyVersionChange implements DependencyVersionChange {
private final String groupId;

private final String artifactId;
Expand All @@ -38,7 +38,7 @@ public final class DefaultVersionChange implements VersionChange {

private final String newVersion;

public DefaultVersionChange(String groupId, String artifactId, String oldVersion, String newVersion) {
public DefaultDependencyVersionChange(String groupId, String artifactId, String oldVersion, String newVersion) {
this.groupId = groupId;
this.artifactId = artifactId;
this.oldVersion = oldVersion;
Expand Down Expand Up @@ -69,7 +69,7 @@ public boolean equals(Object o) {
return false;
}

DefaultVersionChange versionChange = (DefaultVersionChange) o;
DefaultDependencyVersionChange versionChange = (DefaultDependencyVersionChange) o;

if (!Objects.equals(artifactId, versionChange.artifactId)) {
return false;
Expand All @@ -92,6 +92,7 @@ public int hashCode() {
}

public String toString() {
return "DefaultVersionChange(" + groupId + ':' + artifactId + ":" + oldVersion + "-->" + newVersion + ')';
return "DefaultDependencyVersionChange(" + groupId + ':' + artifactId + ":" + oldVersion + "-->" + newVersion
+ ')';
}
}
Loading

0 comments on commit 120d680

Please sign in to comment.