Skip to content

Commit 7dbccc6

Browse files
brunoborgesCopilot
andauthored
Rename jdkFile input to jdk-file with deprecated alias (#1083)
* Rename jdkFile input to jdk-file with deprecated alias Add a standardized `jdk-file` input to match the lowercase-dash naming used by every other action input. The camelCase `jdkFile` input is kept as a deprecated alias: it still works, but emits a deprecation warning and may be removed in a future release. `jdk-file` takes precedence when both are provided. Updates docs and the local-file e2e workflow (one case intentionally keeps using the deprecated alias for coverage) and regenerates the dist bundles. Fixes #1077 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * docs: keep jdkFile in switching-to-v2 guide The switching-to-v2 migration guide uses actions/setup-java@v2, which only supports the camelCase jdkFile input. Keep the new jdk-file spelling in current-version docs only. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 8a3e815 commit 7dbccc6

8 files changed

Lines changed: 44 additions & 15 deletions

File tree

.github/workflows/e2e-local-file.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
id: setup-java
4848
with:
4949
distribution: 'jdkfile'
50-
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
50+
jdk-file: ${{ runner.temp }}/${{ env.LocalFilename }}
5151
java-version: '11.0.0-ea'
5252
architecture: x64
5353
- name: Verify Java version
@@ -88,7 +88,7 @@ jobs:
8888
id: setup-java
8989
with:
9090
distribution: 'jdkfile'
91-
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
91+
jdk-file: ${{ runner.temp }}/${{ env.LocalFilename }}
9292
java-version: '11.0.0-ea'
9393
architecture: x64
9494
- name: Verify Java version
@@ -129,6 +129,7 @@ jobs:
129129
id: setup-java
130130
with:
131131
distribution: 'jdkfile'
132+
# Intentionally uses the deprecated `jdkFile` alias to keep it covered.
132133
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
133134
java-version: '11.0.0-ea'
134135
architecture: x64

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ For more details, see the full release notes on the [releases page](https://git
4141

4242
- `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: Derived from the runner machine.
4343

44-
- `jdkFile`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM. Note: `distribution` must be set to 'jdkfile' (case-sensitive; all lowercase) when using this option.
44+
- `jdk-file`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM. Note: `distribution` must be set to 'jdkfile' (case-sensitive; all lowercase) when using this option. (The camelCase `jdkFile` input is still accepted as a deprecated alias and may be removed in a future release.)
4545

4646
- `check-latest`: Setting this option makes the action to check for the latest available version for the version spec.
4747

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ inputs:
1919
architecture:
2020
description: "The architecture of the package (defaults to the action runner's architecture)"
2121
required: false
22-
jdkFile:
22+
jdk-file:
2323
description: 'Path to where the compressed JDK is located'
2424
required: false
25+
jdkFile:
26+
description: 'Deprecated alias for `jdk-file`. Path to where the compressed JDK is located. Use `jdk-file` instead; this alias may be removed in a future release.'
27+
required: false
28+
deprecationMessage: 'The `jdkFile` input is deprecated. Use `jdk-file` instead.'
2529
check-latest:
2630
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec'
2731
required: false

dist/cleanup/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95834,7 +95834,8 @@ const INPUT_JAVA_VERSION_FILE = 'java-version-file';
9583495834
const INPUT_ARCHITECTURE = 'architecture';
9583595835
const INPUT_JAVA_PACKAGE = 'java-package';
9583695836
const INPUT_DISTRIBUTION = 'distribution';
95837-
const INPUT_JDK_FILE = 'jdkFile';
95837+
const INPUT_JDK_FILE = 'jdk-file';
95838+
const INPUT_JDK_FILE_DEPRECATED = 'jdkFile';
9583895839
const INPUT_CHECK_LATEST = 'check-latest';
9583995840
const INPUT_SET_DEFAULT = 'set-default';
9584095841
const INPUT_VERIFY_SIGNATURE = 'verify-signature';

dist/setup/index.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73279,7 +73279,8 @@ const INPUT_JAVA_VERSION_FILE = 'java-version-file';
7327973279
const INPUT_ARCHITECTURE = 'architecture';
7328073280
const INPUT_JAVA_PACKAGE = 'java-package';
7328173281
const INPUT_DISTRIBUTION = 'distribution';
73282-
const INPUT_JDK_FILE = 'jdkFile';
73282+
const INPUT_JDK_FILE = 'jdk-file';
73283+
const INPUT_JDK_FILE_DEPRECATED = 'jdkFile';
7328373284
const INPUT_CHECK_LATEST = 'check-latest';
7328473285
const INPUT_SET_DEFAULT = 'set-default';
7328573286
const INPUT_VERIFY_SIGNATURE = 'verify-signature';
@@ -133513,7 +133514,7 @@ async function run() {
133513133514
const versionFile = getInput(INPUT_JAVA_VERSION_FILE);
133514133515
const architecture = getInput(INPUT_ARCHITECTURE);
133515133516
const packageType = getInput(INPUT_JAVA_PACKAGE);
133516-
const jdkFile = getInput(INPUT_JDK_FILE);
133517+
const jdkFile = getJdkFileInput();
133517133518
const cache = getInput(INPUT_CACHE);
133518133519
const cacheDependencyPath = getInput(INPUT_CACHE_DEPENDENCY_PATH);
133519133520
const checkLatest = util_getBooleanInput(INPUT_CHECK_LATEST, false);
@@ -133591,6 +133592,14 @@ async function run() {
133591133592
}
133592133593
}
133593133594
run();
133595+
function getJdkFileInput() {
133596+
const jdkFile = getInput(INPUT_JDK_FILE);
133597+
const deprecatedJdkFile = getInput(INPUT_JDK_FILE_DEPRECATED);
133598+
if (deprecatedJdkFile) {
133599+
warning(`The '${INPUT_JDK_FILE_DEPRECATED}' input is deprecated and may be removed in a future release. Please use '${INPUT_JDK_FILE}' instead.`);
133600+
}
133601+
return jdkFile || deprecatedJdkFile;
133602+
}
133594133603
async function installVersion(version, options, toolchainId = 0) {
133595133604
const { distributionName, jdkFile, architecture, packageType, checkLatest, setDefault, verifySignature, verifySignaturePublicKey, toolchainIds } = options;
133596133605
const installerOptions = {

docs/advanced-usage.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ In this example, `JAVA_HOME` and `java` on `PATH` point to Java 17, while Java 2
330330
If your use-case requires a custom distribution or a version that is not provided by setup-java, you can download it manually and setup-java will take care of the installation and caching on the VM:
331331

332332
> [!NOTE]
333-
> This approach also lets you use builds that setup-java does not provide directly, such as **Early Access (EA)** or other unreleased JDK builds (for example, an upcoming feature release or a Loom/Valhalla preview build). Download the desired archive in a prior step and point `jdkFile` at it; setup-java will extract, install, and cache it just like a supported distribution. When targeting multiple architectures, select the correct binary per architecture in your workflow (for example, with a build matrix).
333+
> This approach also lets you use builds that setup-java does not provide directly, such as **Early Access (EA)** or other unreleased JDK builds (for example, an upcoming feature release or a Loom/Valhalla preview build). Download the desired archive in a prior step and point `jdk-file` at it; setup-java will extract, install, and cache it just like a supported distribution. When targeting multiple architectures, select the correct binary per architecture in your workflow (for example, with a build matrix).
334334

335335
```yaml
336336
steps:
@@ -340,7 +340,7 @@ steps:
340340
- uses: actions/setup-java@v5
341341
with:
342342
distribution: 'jdkfile'
343-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
343+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
344344
java-version: '11.0.0'
345345
architecture: x64
346346
@@ -357,7 +357,7 @@ steps:
357357
- uses: actions/setup-java@v5
358358
with:
359359
distribution: 'jdkfile'
360-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
360+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
361361
java-version: '25.0.0-ea.36'
362362
architecture: x64
363363

@@ -383,7 +383,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is
383383
- uses: actions/setup-java@v5
384384
with:
385385
distribution: 'jdkfile'
386-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
386+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
387387
java-version: {{ steps.fetch_latest_jdk.outputs.java_version }}
388388
architecture: x64
389389
- run: java --version
@@ -708,7 +708,7 @@ The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combi
708708
- uses: actions/setup-java@v5
709709
with:
710710
distribution: 'jdkfile'
711-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
711+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
712712
java-version: '1.6'
713713
architecture: x64
714714
```
@@ -725,7 +725,7 @@ Each JDK provider will receive a default `vendor` using the `distribution` input
725725
- uses: actions/setup-java@v5
726726
with:
727727
distribution: 'jdkfile'
728-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
728+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
729729
java-version: '1.6'
730730
architecture: x64
731731
mvn-toolchain-vendor: 'Oracle'

src/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ export const INPUT_JAVA_VERSION_FILE = 'java-version-file';
44
export const INPUT_ARCHITECTURE = 'architecture';
55
export const INPUT_JAVA_PACKAGE = 'java-package';
66
export const INPUT_DISTRIBUTION = 'distribution';
7-
export const INPUT_JDK_FILE = 'jdkFile';
7+
export const INPUT_JDK_FILE = 'jdk-file';
8+
export const INPUT_JDK_FILE_DEPRECATED = 'jdkFile';
89
export const INPUT_CHECK_LATEST = 'check-latest';
910
export const INPUT_SET_DEFAULT = 'set-default';
1011
export const INPUT_VERIFY_SIGNATURE = 'verify-signature';

src/setup-java.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async function run() {
2222
const versionFile = core.getInput(constants.INPUT_JAVA_VERSION_FILE);
2323
const architecture = core.getInput(constants.INPUT_ARCHITECTURE);
2424
const packageType = core.getInput(constants.INPUT_JAVA_PACKAGE);
25-
const jdkFile = core.getInput(constants.INPUT_JDK_FILE);
25+
const jdkFile = getJdkFileInput();
2626
const cache = core.getInput(constants.INPUT_CACHE);
2727
const cacheDependencyPath = core.getInput(
2828
constants.INPUT_CACHE_DEPENDENCY_PATH
@@ -134,6 +134,19 @@ async function run() {
134134

135135
run();
136136

137+
function getJdkFileInput(): string {
138+
const jdkFile = core.getInput(constants.INPUT_JDK_FILE);
139+
const deprecatedJdkFile = core.getInput(constants.INPUT_JDK_FILE_DEPRECATED);
140+
141+
if (deprecatedJdkFile) {
142+
core.warning(
143+
`The '${constants.INPUT_JDK_FILE_DEPRECATED}' input is deprecated and may be removed in a future release. Please use '${constants.INPUT_JDK_FILE}' instead.`
144+
);
145+
}
146+
147+
return jdkFile || deprecatedJdkFile;
148+
}
149+
137150
async function installVersion(
138151
version: string,
139152
options: installerInputsOptions,

0 commit comments

Comments
 (0)