Skip to content

Commit 077ed05

Browse files
authored
Update rewrite versions at build time (#5931)
* Update rewrite versions at build time This change changes add-transfer-manager-dependency.yml and upgrade-sdk-dependencies.yml to velocity templates so that the version number can be set at build time when buliding the v2-migration module. This moves this version update process out of the buildspecs so that we don't have to rely on them to have been run for builds to work correctly. * Move version to a property
1 parent b2fe89e commit 077ed05

File tree

6 files changed

+405
-387
lines changed

6 files changed

+405
-387
lines changed

buildspecs/update-master-from-release.yml

-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ phases:
4040
mvn versions:set -DnewVersion=$NEW_VERSION_SNAPSHOT -DgenerateBackupPoms=false -DprocessAllModules=true || { echo "Failed to update POMs to next snapshot version"; exit 1; }
4141
sed -i -E "s/(<version>).+(<\/version>)/\1$RELEASE_VERSION\2/" README.md
4242
sed -i -E "s/(<awsjavasdk.previous.version>).+(<\/awsjavasdk.previous.version>)/\1$RELEASE_VERSION\2/" pom.xml
43-
sed -i -E "s/(newVersion: ).+/\1$RELEASE_VERSION/" v2-migration/src/main/resources/META-INF/rewrite/upgrade-sdk-dependencies.yml
44-
sed -i -E "s/(version: ).+/\1$RELEASE_VERSION/" v2-migration/src/main/resources/META-INF/rewrite/upgrade-sdk-dependencies.yml
45-
sed -i -E "s/(version: ).+/\1$RELEASE_VERSION/" v2-migration/src/main/resources/META-INF/rewrite/add-transfer-manager-dependency.yml
4643
4744
git commit -am "Update to next snapshot version: $NEW_VERSION_SNAPSHOT"
4845
fi

core/sdk-core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
<plugin>
267267
<groupId>com.nativelibs4java</groupId>
268268
<artifactId>maven-velocity-plugin</artifactId>
269-
<version>0.9</version>
269+
<version>${maven-velocity-plugin.version}</version>
270270
<executions>
271271
<execution>
272272
<phase>generate-sources</phase>

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
<!-- Whenever we update maven-wrapper-plugin version, we need to run mvn wrapper:wrapper to update the Maven Wrapper files(mvnw, .maven and mvnw.cmd) -->
170170
<maven-wrapper-plugin.version>3.2.0</maven-wrapper-plugin.version>
171171
<ant.version>1.10.14</ant.version>
172+
<maven-velocity-plugin.version>0.9</maven-velocity-plugin.version>
172173

173174
<!-- These properties are used by Step functions for its dependencies -->
174175
<json-path.version>2.4.0</json-path.version>

v2-migration/pom.xml

+20
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,26 @@
287287

288288
<build>
289289
<plugins>
290+
<plugin>
291+
<groupId>com.nativelibs4java</groupId>
292+
<artifactId>maven-velocity-plugin</artifactId>
293+
<version>${maven-velocity-plugin.version}</version>
294+
<executions>
295+
<execution>
296+
<phase>generate-sources</phase>
297+
<goals>
298+
<goal>generate</goal>
299+
</goals>
300+
</execution>
301+
</executions>
302+
<configuration>
303+
<velocitySources>src/main/resources/recipe-vm-templates</velocitySources>
304+
<resourcesOutputDirectory>${project.build.directory}/classes/META-INF/rewrite</resourcesOutputDirectory>
305+
<properties>
306+
<sdkVersion>${awsjavasdk.previous.version}</sdkVersion>
307+
</properties>
308+
</configuration>
309+
</plugin>
290310
<plugin>
291311
<groupId>org.apache.maven.plugins</groupId>
292312
<artifactId>maven-dependency-plugin</artifactId>

v2-migration/src/main/resources/META-INF/rewrite/add-transfer-manager-dependency.yml renamed to v2-migration/src/main/resources/recipe-vm-templates/add-transfer-manager-dependency.yml.vm

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ recipeList:
2424
- org.openrewrite.java.dependencies.AddDependency:
2525
groupId: software.amazon.awssdk
2626
artifactId: s3-transfer-manager
27-
version: 2.30.38
28-
onlyIfUsing: com.amazonaws.services.s3.transfer.TransferManager
27+
version: ${sdkVersion}
28+
onlyIfUsing: com.amazonaws.services.s3.transfer.TransferManager

0 commit comments

Comments
 (0)