Skip to content

Commit fde7666

Browse files
authored
Support stable EA builds (#83)
Support stable EA builds by adding a new `ea,stable,...` aliases.
1 parent afa7f20 commit fde7666

File tree

3 files changed

+40
-14
lines changed

3 files changed

+40
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ This project uses tags and branches for [release management](https://docs.github
66

77

88
## [Unreleased]
9+
### Added
10+
- Java `23` and `24` to the list of Early-Access releases
11+
- New `version: stable` mode for `release: ea` setups
912

1013
## [1.3.4] - 2024-03-21
1114
### Fixed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ It is set by default to `latest`.
5050

5151
___
5252

53-
**WARNING!**
54-
55-
Older versions of the JDK are provided to help developers debug issues in older systems.
56-
**They are not updated with the latest security patches and are not recommended for use in production.**
53+
> [!CAUTION]
54+
> Older versions of the JDK are provided to help developers debug issues in older systems.
55+
> **They are not updated with the latest security patches and are not recommended for use in production.**
5756
5857
___
5958

@@ -111,10 +110,9 @@ steps:
111110
```
112111
___
113112
114-
**WARNING!**
115-
116-
Older versions of the JDK are provided to help developers debug issues in older systems.
117-
**They are not updated with the latest security patches and are not recommended for use in production.**
113+
> [!CAUTION]
114+
> Older versions of the JDK are provided to help developers debug issues in older systems.
115+
> **They are not updated with the latest security patches and are not recommended for use in production.**
118116
119117
___
120118
@@ -133,6 +131,11 @@ steps:
133131
release: N # Replace N with GA, EA, 17, 18, 19, ...
134132
```
135133

134+
> [!NOTE]
135+
> This action supports two `version` update early-access modes for `release: EA` on `jdk.java.net`:
136+
> - `version: latest` updates as early as possible to the latest-and-greatest JDK build (default)
137+
> - `version: stable` updates later in the release cycle, usually then a new JDK build goes GA
138+
136139
### Download and install an Early-Access build of a named OpenJDK project
137140

138141
```yaml

src/ListOpenJavaDevelopmentKits.java

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.net.http.HttpClient;
1010
import java.net.http.HttpRequest;
1111
import java.net.http.HttpResponse;
12+
import java.util.ArrayList;
1213
import java.util.List;
1314
import java.util.StringJoiner;
1415
import java.util.TreeMap;
@@ -31,7 +32,7 @@
3132
*
3233
* <ul>
3334
* <li>{@code RELEASE}: Either a release number or a name of an early-access project
34-
* <li>{@code VERSION}: Either a specific version or `latest`
35+
* <li>{@code VERSION}: Either a specific version or `latest` or `stable`
3536
* <li>{@code OS-NAME}: An operating system name, usually one of: `linux`, `macos`, `windows`
3637
* <li>{@code OS-ARCH}: An operating system architecture, like: `aarch64`, `x64`, or `x64-musl`
3738
* </ul>
@@ -47,6 +48,12 @@ class ListOpenJavaDevelopmentKits {
4748
/** Early-Access Releases, as comma separated names. */
4849
static final String EA = System.getProperty("EA", "24,23,jextract,loom,valhalla");
4950

51+
/** Current "latest" Early-Access Release number. */
52+
static final String EA_LATEST = System.getProperty("EA_LATEST", "24");
53+
54+
/** Current "stable" Early-Access Release number. */
55+
static final String EA_STABLE = System.getProperty("EA_STABLE", "23");
56+
5057
/** Include archived releases flag. */
5158
static final boolean ARCHIVES = Boolean.getBoolean("ARCHIVES");
5259

@@ -137,12 +144,25 @@ static List<String> generateEarlyAccessAliasKeys(String[] components) {
137144
var from = version.indexOf('-');
138145
var till = version.indexOf('+');
139146
var project = from >= 0 && from < till ? version.substring(from + 1, till) : version;
140-
components[0] = project;
147+
if (project.equals("ea")) {
148+
var earlyAccessAliases = new ArrayList<String>();
149+
components[0] = release; // "23", "24", ...
150+
components[1] = "latest";
151+
earlyAccessAliases.add(String.join(",", components));
152+
components[0] = "ea";
153+
if (release.equals(EA_LATEST)) {
154+
components[1] = "latest";
155+
earlyAccessAliases.add(String.join(",", components));
156+
}
157+
if (release.equals(EA_STABLE)) {
158+
components[1] = "stable";
159+
earlyAccessAliases.add(String.join(",", components));
160+
}
161+
return earlyAccessAliases;
162+
}
163+
components[0] = project; // "loom", "valhalla", ...
141164
components[1] = "latest";
142-
var alias = String.join(",", components);
143-
if (!project.equals("ea")) return List.of(alias);
144-
components[0] = release; // 18-latest-...
145-
return List.of(alias, String.join(",", components));
165+
return List.of(String.join(",", components));
146166
} catch (IndexOutOfBoundsException exception) {
147167
System.err.println("Early-Access version without `-` and `+`: " + version);
148168
return List.of();

0 commit comments

Comments
 (0)