|
30 | 30 | import java.util.regex.Pattern; |
31 | 31 |
|
32 | 32 | public abstract class TestedVersionUpdaterTask extends DefaultTask { |
| 33 | + /** |
| 34 | + * Identifies pre-release library versions by pattern matching against common pre-release suffixes. |
| 35 | + * <p> |
| 36 | + * A version is considered pre-release if its suffix (following the last '.' or '-') matches |
| 37 | + * one of these case-insensitive patterns: |
| 38 | + * <ul> |
| 39 | + * <li>{@code alpha} followed by optional numbers (e.g., "alpha", "Alpha1", "alpha123")</li> |
| 40 | + * <li>{@code beta} followed by optional numbers (e.g., "beta", "Beta2", "BETA45")</li> |
| 41 | + * <li>{@code rc} followed by optional numbers (e.g., "rc", "RC1", "rc99")</li> |
| 42 | + * <li>{@code cr} followed by optional numbers (e.g., "cr", "CR3", "cr10")</li> |
| 43 | + * <li>{@code m} followed by REQUIRED numbers (e.g., "M1", "m23")</li> |
| 44 | + * <li>{@code ea} followed by optional numbers (e.g., "ea", "ea2", "ea15")</li> |
| 45 | + * <li>{@code b} followed by REQUIRED numbers (e.g., "b0244", "b5")</li> |
| 46 | + * <li>{@code preview} followed by optional numbers (e.g., "preview", "preview1", "preview42")</li> |
| 47 | + * <li>Numeric suffixes separated by '-' (e.g., "-1", "-123")</li> |
| 48 | + * </ul> |
| 49 | + */ |
33 | 50 | private static final Pattern PRE_RELEASE_PATTERN = Pattern.compile( |
34 | 51 | "(?i)^(\\d+(?:\\.\\d+)*)(?:[-.](alpha\\d*|beta\\d*|rc\\d*|cr\\d*|m\\d+|ea\\d*|b\\d+|\\d+|preview)(?:[-.].*)?)?$" |
35 | 52 | ); |
@@ -94,13 +111,13 @@ void run() throws IllegalStateException, IOException { |
94 | 111 | * <p> |
95 | 112 | * Rules applied by this method: |
96 | 113 | * <ul> |
97 | | - * <li>If the newly added version is a full release (no pre-release label, or ending with ".Final"), |
98 | | - * all existing pre-releases of the same base version are removed from {@code testedVersions}.</li> |
99 | | - * <li>If the newly added version is itself a pre-release, no versions are removed.</li> |
100 | | - * <li>If the entry's {@code metadataVersion} is a pre-release of the same base version, |
101 | | - * it is updated to the new full release. The corresponding metadata and test directories are renamed accordingly. |
102 | | - * The {@code gradle.properties} file in the tests directory is updated to refer to the new version.</li> |
103 | | - * <li>Version parsing follows {@link #PRE_RELEASE_PATTERN} and treats ".Final" as a base version.</li> |
| 114 | + * <li>If the newly added version is a full release (no pre-release label, or ending with ".Final"), |
| 115 | + * all existing pre-releases of the same base version are removed from {@code testedVersions}.</li> |
| 116 | + * <li>If the newly added version is itself a pre-release, no versions are removed.</li> |
| 117 | + * <li>If the entry's {@code metadataVersion} is a pre-release of the same base version, |
| 118 | + * it is updated to the new full release. The corresponding metadata and test directories are renamed accordingly. |
| 119 | + * The {@code gradle.properties} file in the tests directory is updated to refer to the new version.</li> |
| 120 | + * <li>Version parsing follows {@link #PRE_RELEASE_PATTERN} and treats ".Final" as a base version.</li> |
104 | 121 | * </ul> |
105 | 122 | */ |
106 | 123 | private MetadataVersionsIndexEntry handlePreReleases(MetadataVersionsIndexEntry entry, String newVersion, Path baseDir) throws IOException { |
@@ -158,13 +175,13 @@ private MetadataVersionsIndexEntry handlePreReleases(MetadataVersionsIndexEntry |
158 | 175 | * <p> |
159 | 176 | * This method performs two operations: |
160 | 177 | * <ol> |
161 | | - * <li>Renames the test directory from {@code oldVersion} to {@code newVersion} under {@code tests/src/<group>/<artifact>/}.</li> |
162 | | - * <li>Updates the {@code gradle.properties} file inside the renamed directory: |
163 | | - * <ul> |
164 | | - * <li>{@code library.version} is set to the new version,</li> |
165 | | - * <li>{@code metadata.dir} is updated to point to the metadata directory for the new version.</li> |
166 | | - * </ul> |
167 | | - * </li> |
| 178 | + * <li>Renames the test directory from {@code oldVersion} to {@code newVersion} under {@code tests/src/<group>/<artifact>/}.</li> |
| 179 | + * <li>Updates the {@code gradle.properties} file inside the renamed directory: |
| 180 | + * <ul> |
| 181 | + * <li>{@code library.version} is set to the new version,</li> |
| 182 | + * <li>{@code metadata.dir} is updated to point to the metadata directory for the new version.</li> |
| 183 | + * </ul> |
| 184 | + * </li> |
168 | 185 | * </ol> |
169 | 186 | */ |
170 | 187 | private void updateTests(Path metadataBaseDir, MetadataVersionsIndexEntry entry, String oldVersion, String newVersion) throws IOException { |
|
0 commit comments