You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2022/12/19 10:21:32 UTC
[logging-log4j2] 26/33: LOG4J2-3628 Disallow SNAPSHOT versions in releaser by default.
This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch mvn-site-simplified
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 555137ba4f66e455f5fbc65ca53fd632ff47f1b1
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Mon Nov 28 20:37:32 2022 +0100
LOG4J2-3628 Disallow SNAPSHOT versions in releaser by default.
---
.../internal/util/changelog/releaser/ChangelogReleaser.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/log4j-internal-util/src/main/java/org/apache/logging/log4j/internal/util/changelog/releaser/ChangelogReleaser.java b/log4j-internal-util/src/main/java/org/apache/logging/log4j/internal/util/changelog/releaser/ChangelogReleaser.java
index 5ea85e4b5f..00e906ae2d 100644
--- a/log4j-internal-util/src/main/java/org/apache/logging/log4j/internal/util/changelog/releaser/ChangelogReleaser.java
+++ b/log4j-internal-util/src/main/java/org/apache/logging/log4j/internal/util/changelog/releaser/ChangelogReleaser.java
@@ -20,6 +20,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.LocalDate;
+import java.util.Locale;
import org.apache.logging.log4j.internal.util.AsciiDocUtils;
import org.apache.logging.log4j.internal.util.PomUtils;
@@ -31,6 +32,10 @@ import static org.apache.logging.log4j.internal.util.changelog.ChangelogFiles.re
public final class ChangelogReleaser {
+ private static final boolean SNAPSHOTS_ALLOWED = !"false".equals(System
+ .getProperty("log4j.changelog.releaser.snapshotsAllowed", "false")
+ .toLowerCase(Locale.US));
+
private ChangelogReleaser() {}
public static void main(final String[] mainArgs) throws Exception {
@@ -41,6 +46,10 @@ public final class ChangelogReleaser {
// Read the release date and version.
final String releaseDate = BASIC_ISO_DATE.format(LocalDate.now());
final String releaseVersion = PomUtils.readRootPomVersion(args.projectRootDirectory);
+ if (releaseVersion.endsWith("-SNAPSHOT") && !SNAPSHOTS_ALLOWED) {
+ final String message = String.format("SNAPSHOT versions are not allowed: `%s`", releaseVersion);
+ throw new IllegalStateException(message);
+ }
final int releaseVersionMajor = PomUtils.versionMajor(releaseVersion);
System.out.format(
"using `%s` and `%s` for release date and version, respectively%n",