Skip to content

Commit 20e1674

Browse files
brunoborgesCopilot
andcommitted
Deprecate legacy Adopt distributions in v4
Preserve the existing Adopt installers while warning users to migrate before the distributions are removed in setup-java v6. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 0132de5 commit 20e1674

6 files changed

Lines changed: 98 additions & 6 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ Currently, the following distributions are supported:
100100
|-|-|-|-|
101101
| `temurin` | Eclipse Temurin | [Link](https://adoptium.net/) | [Link](https://adoptium.net/about.html)
102102
| `zulu` | Azul Zulu OpenJDK | [Link](https://www.azul.com/downloads/zulu-community/?package=jdk) | [Link](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
103-
| `adopt` or `adopt-hotspot` | AdoptOpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
104-
| `adopt-openj9` | AdoptOpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
103+
| `adopt` or `adopt-hotspot` (deprecated; use `temurin`) | AdoptOpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
104+
| `adopt-openj9` (deprecated; use `semeru`) | AdoptOpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
105105
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
106106
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
107107
| `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/)
@@ -114,7 +114,7 @@ Currently, the following distributions are supported:
114114

115115
**NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.
116116

117-
**NOTE:** AdoptOpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` and `adopt-openj9`, to `temurin` and `semeru` respectively, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
117+
**NOTE:** The legacy AdoptOpenJDK distributions are deprecated and will be removed in setup-java v6. Migrate `adopt` and `adopt-hotspot` to `temurin`, and `adopt-openj9` to `semeru`, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
118118

119119
**NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
120120

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import * as core from '@actions/core';
2+
import {
3+
AdoptDistribution,
4+
AdoptImplementation
5+
} from '../../src/distributions/adopt/installer';
6+
import {JavaInstallerOptions} from '../../src/distributions/base-models';
7+
import {getJavaDistribution} from '../../src/distributions/distribution-factory';
8+
9+
describe('getJavaDistribution', () => {
10+
const installerOptions: JavaInstallerOptions = {
11+
version: '11',
12+
architecture: 'x64',
13+
packageType: 'jdk',
14+
checkLatest: false
15+
};
16+
17+
afterEach(() => {
18+
jest.restoreAllMocks();
19+
});
20+
21+
it.each([
22+
['adopt', AdoptImplementation.Hotspot, 'temurin'],
23+
['adopt-hotspot', AdoptImplementation.Hotspot, 'temurin'],
24+
['adopt-openj9', AdoptImplementation.OpenJ9, 'semeru']
25+
])(
26+
'warns that %s is deprecated while preserving its installer',
27+
(
28+
distributionName: string,
29+
implementation: AdoptImplementation,
30+
replacement: string
31+
) => {
32+
const warningSpy = jest
33+
.spyOn(core, 'warning')
34+
.mockImplementation(() => {});
35+
36+
const distribution = getJavaDistribution(
37+
distributionName,
38+
installerOptions
39+
);
40+
41+
expect(distribution).toBeInstanceOf(AdoptDistribution);
42+
if (!(distribution instanceof AdoptDistribution)) {
43+
throw new Error(`Expected an Adopt installer for ${distributionName}`);
44+
}
45+
expect(distribution['jvmImpl']).toBe(implementation);
46+
expect(warningSpy).toHaveBeenCalledWith(
47+
`The '${distributionName}' legacy AdoptOpenJDK distribution is deprecated and will be removed in setup-java v6. Please migrate to the '${replacement}' distribution.`
48+
);
49+
}
50+
);
51+
});

‎action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
java-version-file:
99
description: 'The path to the `.java-version` file. See examples of supported syntax in README file'
1010
distribution:
11-
description: 'Java distribution. See the list of supported distributions in README file'
11+
description: 'Java distribution. See the list of supported distributions in README file. Legacy AdoptOpenJDK values (adopt, adopt-hotspot, adopt-openj9) are deprecated and will be removed in setup-java v6.'
1212
required: true
1313
java-package:
1414
description: 'The package type (jdk, jre, jdk+fx, jre+fx)'

‎dist/setup/index.js‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134594,12 +134594,36 @@ exports.CorrettoDistribution = CorrettoDistribution;
134594134594
/***/ }),
134595134595

134596134596
/***/ 10924:
134597-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
134597+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
134598134598

134599134599
"use strict";
134600134600

134601+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
134602+
if (k2 === undefined) k2 = k;
134603+
var desc = Object.getOwnPropertyDescriptor(m, k);
134604+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
134605+
desc = { enumerable: true, get: function() { return m[k]; } };
134606+
}
134607+
Object.defineProperty(o, k2, desc);
134608+
}) : (function(o, m, k, k2) {
134609+
if (k2 === undefined) k2 = k;
134610+
o[k2] = m[k];
134611+
}));
134612+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
134613+
Object.defineProperty(o, "default", { enumerable: true, value: v });
134614+
}) : function(o, v) {
134615+
o["default"] = v;
134616+
});
134617+
var __importStar = (this && this.__importStar) || function (mod) {
134618+
if (mod && mod.__esModule) return mod;
134619+
var result = {};
134620+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
134621+
__setModuleDefault(result, mod);
134622+
return result;
134623+
};
134601134624
Object.defineProperty(exports, "__esModule", ({ value: true }));
134602134625
exports.getJavaDistribution = void 0;
134626+
const core = __importStar(__nccwpck_require__(42186));
134603134627
const installer_1 = __nccwpck_require__(19917);
134604134628
const installer_2 = __nccwpck_require__(82005);
134605134629
const installer_3 = __nccwpck_require__(68766);
@@ -134637,8 +134661,10 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
134637134661
return new installer_1.LocalDistribution(installerOptions, jdkFile);
134638134662
case JavaDistribution.Adopt:
134639134663
case JavaDistribution.AdoptHotspot:
134664+
warnIfAdoptDistributionIsDeprecated(distributionName, 'temurin');
134640134665
return new installer_3.AdoptDistribution(installerOptions, installer_3.AdoptImplementation.Hotspot);
134641134666
case JavaDistribution.AdoptOpenJ9:
134667+
warnIfAdoptDistributionIsDeprecated(distributionName, 'semeru');
134642134668
return new installer_3.AdoptDistribution(installerOptions, installer_3.AdoptImplementation.OpenJ9);
134643134669
case JavaDistribution.Temurin:
134644134670
return new installer_4.TemurinDistribution(installerOptions, installer_4.TemurinImplementation.Hotspot);
@@ -134667,6 +134693,9 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
134667134693
}
134668134694
}
134669134695
exports.getJavaDistribution = getJavaDistribution;
134696+
function warnIfAdoptDistributionIsDeprecated(distributionName, replacement) {
134697+
core.warning(`The '${distributionName}' legacy AdoptOpenJDK distribution is deprecated and will be removed in setup-java v6. Please migrate to the '${replacement}' distribution.`);
134698+
}
134670134699

134671134700

134672134701
/***/ }),

‎docs/advanced-usage.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ steps:
4040
```
4141
4242
### Adopt
43-
**NOTE:** Adopt OpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` to `temurin` to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
43+
**NOTE:** The legacy `adopt`, `adopt-hotspot`, and `adopt-openj9` distributions are deprecated and will be removed in setup-java v6. Migrate `adopt` and `adopt-hotspot` to `temurin`, and `adopt-openj9` to `semeru`, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
4444

4545
```yaml
4646
steps:

‎src/distributions/distribution-factory.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as core from '@actions/core';
12
import {JavaBase} from './base-installer';
23
import {JavaInstallerOptions} from './base-models';
34
import {LocalDistribution} from './local/installer';
@@ -42,11 +43,13 @@ export function getJavaDistribution(
4243
return new LocalDistribution(installerOptions, jdkFile);
4344
case JavaDistribution.Adopt:
4445
case JavaDistribution.AdoptHotspot:
46+
warnIfAdoptDistributionIsDeprecated(distributionName, 'temurin');
4547
return new AdoptDistribution(
4648
installerOptions,
4749
AdoptImplementation.Hotspot
4850
);
4951
case JavaDistribution.AdoptOpenJ9:
52+
warnIfAdoptDistributionIsDeprecated(distributionName, 'semeru');
5053
return new AdoptDistribution(
5154
installerOptions,
5255
AdoptImplementation.OpenJ9
@@ -80,3 +83,12 @@ export function getJavaDistribution(
8083
return null;
8184
}
8285
}
86+
87+
function warnIfAdoptDistributionIsDeprecated(
88+
distributionName: string,
89+
replacement: string
90+
): void {
91+
core.warning(
92+
`The '${distributionName}' legacy AdoptOpenJDK distribution is deprecated and will be removed in setup-java v6. Please migrate to the '${replacement}' distribution.`
93+
);
94+
}

0 commit comments

Comments
 (0)