Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ describe('installer tests', () => {
return;
});

it('Uses 1.x version of Java installed in cache', async () => {
const JavaDir: string = path.join(toolDir, 'jdk', '8.0.181', 'x64');
await io.mkdirP(JavaDir);
fs.writeFileSync(`${JavaDir}.complete`, 'hello');
// This will throw if it doesn't find it in the cache
await installer.getJava(
'1.8',
'x64',
'path shouldnt matter, found in cache',
'jdk'
);
return;
});

it('Doesnt use version of Java that was only partially installed in cache', async () => {
const JavaDir: string = path.join(toolDir, 'jdk', '251.0.0', 'x64');
await io.mkdirP(JavaDir);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export async function getJava(
jdkFile: string,
javaPackage: string
): Promise<void> {
version = normalizeVersion(version);

let toolPath = tc.find(javaPackage, version);

if (toolPath) {
Expand Down Expand Up @@ -190,7 +192,6 @@ function getDownloadInfo(
version: string,
javaPackage: string
): {version: string; url: string} {
version = normalizeVersion(version);
let extension = '';
if (IS_WINDOWS) {
extension = `-win_x64.zip`;
Expand Down