From 51658086a5cc0bcefefd8204adc740793834af1a Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Sat, 1 Oct 2022 00:04:51 +0200 Subject: [PATCH] Replace version references during release --- ReleaseProcess.md | 5 +- gson/src/main/java/com/google/gson/Gson.java | 5 +- pom.xml | 67 ++++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/ReleaseProcess.md b/ReleaseProcess.md index 6e2b923d24..eaa0e7c542 100644 --- a/ReleaseProcess.md +++ b/ReleaseProcess.md @@ -6,7 +6,6 @@ The following is a step-by-step procedure for releasing a new version of Google- 1. Ensure all changelists are code-reviewed and have +1 1. `cd gson` to the parent directory; ensure there are no open files and all changes are committed. 1. Run `mvn release:clean` -1. Do a dry run: `mvn release:prepare -DdryRun=true` 1. Start the release: `mvn release:prepare` - Answer questions: usually the defaults are fine. Try to follow [Semantic Versioning](https://semver.org/) when choosing the release version number. - This will do a full build, change version from `-SNAPSHOT` to the released version, commit and create the tags. It will then change the version to `-SNAPSHOT` for the next release. @@ -18,9 +17,13 @@ The following is a step-by-step procedure for releasing a new version of Google- 1. Update version references in (version might be referenced multiple times): - [`README.md`](README.md) - [`UserGuide.md`](UserGuide.md) + + Note: When using the Maven Release Plugin as described above, these version references should have been replaced automatically, but verify this manually nonetheless to be on the safe side. 1. Optional: Create a post on the [Gson Discussion Forum](https://groups.google.com/group/google-gson). 1. Optional: Update the release version in [Wikipedia](https://en.wikipedia.org/wiki/Gson) and update the current "stable" release. +Important: When aborting a release / rolling back release preparations, make sure to also revert all changes to files which were done during the release (e.g. automatic replacement of version references). + ## Configuring a machine for deployment to Sonatype Repository This section was borrowed heavily from [Doclava release process](https://code.google.com/archive/p/doclava/wikis/ProcessRelease.wiki). diff --git a/gson/src/main/java/com/google/gson/Gson.java b/gson/src/main/java/com/google/gson/Gson.java index c3262a6fe0..afab5fae78 100644 --- a/gson/src/main/java/com/google/gson/Gson.java +++ b/gson/src/main/java/com/google/gson/Gson.java @@ -1019,6 +1019,7 @@ public T fromJson(String json, Type typeOfT) throws JsonSyntaxException { * * @see #fromJson(Reader, TypeToken) * @see #fromJson(String, Class) + * @since $next-version$ */ public T fromJson(String json, TypeToken typeOfT) throws JsonSyntaxException { if (json == null) { @@ -1111,6 +1112,7 @@ public T fromJson(Reader json, Type typeOfT) throws JsonIOException, JsonSyn * * @see #fromJson(String, TypeToken) * @see #fromJson(Reader, Class) + * @since $next-version$ */ public T fromJson(Reader json, TypeToken typeOfT) throws JsonIOException, JsonSyntaxException { JsonReader jsonReader = newJsonReader(json); @@ -1194,6 +1196,7 @@ public T fromJson(JsonReader reader, Type typeOfT) throws JsonIOException, J * * @see #fromJson(Reader, TypeToken) * @see #fromJson(JsonReader, Type) + * @since $next-version$ */ public T fromJson(JsonReader reader, TypeToken typeOfT) throws JsonIOException, JsonSyntaxException { boolean isEmpty = true; @@ -1299,10 +1302,10 @@ public T fromJson(JsonElement json, Type typeOfT) throws JsonSyntaxException * @return an object of type T from the JSON. Returns {@code null} if {@code json} is {@code null} * or if {@code json} is empty. * @throws JsonSyntaxException if json is not a valid representation for an object of type typeOfT - * @since 1.3 * * @see #fromJson(Reader, TypeToken) * @see #fromJson(JsonElement, Class) + * @since $next-version$ */ public T fromJson(JsonElement json, TypeToken typeOfT) throws JsonSyntaxException { if (json == null) { diff --git a/pom.xml b/pom.xml index b732767647..7e70d1e620 100644 --- a/pom.xml +++ b/pom.xml @@ -136,8 +136,75 @@ false release + + + package -DskipTests antrun:run@replace-version-placeholders antrun:run@replace-old-version-references antrun:run@git-add-changed + + maven-antrun-plugin + 3.1.0 + + + + replace-version-placeholders + + run + + + + false + + + + + + + + replace-old-version-references + + run + + + + + + + + + + + + + + + false + + + + + git-add-changed + + run + + + + + + + + + + + + com.github.siom79.japicmp