Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to runner architecture #376

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7388782
Default architecture param to os.arch()
cap10morgan Aug 29, 2022
b090764
Map temurin arch names to node os.arch() names
cap10morgan Aug 29, 2022
7e83eb1
Simplify osArchToDistributionArch switch statement
cap10morgan Aug 30, 2022
148d9af
Format my code w/ prettier
cap10morgan Aug 30, 2022
a115f58
Commit build artifact
cap10morgan Aug 31, 2022
cca7653
Move os.arch() defaulter to JavaBase constructor
cap10morgan Aug 31, 2022
e169777
Refactor arch mapping to distributionArchitecture method
cap10morgan Aug 31, 2022
c22bb80
Add tests for os.arch() default behavior
cap10morgan Aug 31, 2022
46869be
Commit build artifact
cap10morgan Aug 31, 2022
f21b8ec
Move distributionArchitecture method to base class
cap10morgan Sep 13, 2022
0b04eaf
Map OS arch to distro arch for other distros
cap10morgan Sep 13, 2022
7284eee
Run format
cap10morgan Sep 13, 2022
43c9a22
Run build
cap10morgan Sep 13, 2022
36a2b11
Merge branch 'main' into feature/default-to-runner-architecture
cap10morgan Sep 19, 2022
f83416a
Default architecture to x86 in test
cap10morgan Sep 19, 2022
c041f7c
Add arch default tests to all distros
cap10morgan Sep 20, 2022
06bcb9d
Fix microsoft installer test on non-macOS platforms
cap10morgan Sep 21, 2022
da28779
Merge branch 'main' into feature/default-to-runner-architecture
cap10morgan Sep 23, 2022
da9079a
Run npm format
cap10morgan Sep 23, 2022
df9446d
Remove default architecture value
cap10morgan Oct 5, 2022
2f647ea
Use blank string for architecture default value
cap10morgan Oct 5, 2022
a1a9075
Revert "Use blank string for architecture default value"
cap10morgan Oct 6, 2022
2dec309
Merge branch 'main' into feature/default-to-runner-architecture
cap10morgan Oct 6, 2022
04e13d1
Use double quotes in architecture description
cap10morgan Oct 7, 2022
7f90be4
Merge branch 'main' into feature/default-to-runner-architecture
cap10morgan Oct 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/distributions/temurin/installer.ts
Expand Up @@ -20,6 +20,7 @@ export class TemurinDistribution extends JavaBase {
private readonly jvmImpl: TemurinImplementation
) {
super(`Temurin-${jvmImpl}`, installerOptions);
installerOptions.architecture = this.osArchToDistributionArch(installerOptions.architecture);
}

protected async findPackageForDownload(version: string): Promise<JavaDownloadRelease> {
Expand Down Expand Up @@ -152,4 +153,15 @@ export class TemurinDistribution extends JavaBase {
return process.platform;
}
}

private osArchToDistributionArch(osArch: string): string {
let dArch;
switch (osArch) {
case 'amd64': dArch = 'x64'; break;
case 'ia32': dArch = 'x32'; break;
case 'arm64': dArch = 'aarch64'; break;
default: dArch = osArch;
}
return dArch;
}
cap10morgan marked this conversation as resolved.
Show resolved Hide resolved
}
3 changes: 2 additions & 1 deletion src/setup-java.ts
Expand Up @@ -6,12 +6,13 @@ import { restore } from './cache';
import * as path from 'path';
import { getJavaDistribution } from './distributions/distribution-factory';
import { JavaInstallerOptions } from './distributions/base-models';
import * as os from 'os';

async function run() {
try {
const version = core.getInput(constants.INPUT_JAVA_VERSION, { required: true });
const distributionName = core.getInput(constants.INPUT_DISTRIBUTION, { required: true });
const architecture = core.getInput(constants.INPUT_ARCHITECTURE);
const architecture = core.getInput(constants.INPUT_ARCHITECTURE) || os.arch();
const packageType = core.getInput(constants.INPUT_JAVA_PACKAGE);
const jdkFile = core.getInput(constants.INPUT_JDK_FILE);
const cache = core.getInput(constants.INPUT_CACHE);
Expand Down