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

Allow not to create subdirectory for jdk extraction #14847

Merged
Merged
Show file tree
Hide file tree
Changes from 8 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
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
"loc.input.label.azureCommonVirtualFile": "Common virtual path",
"loc.input.help.azureCommonVirtualFile": "Path to the JDK inside the Azure storage container.",
"loc.input.label.jdkDestinationDirectory": "Destination directory",
"loc.input.help.jdkDestinationDirectory": "On Linux and Windows, this is used as the destination directory for JDK installation. On macOS, this directory is used as a temporary folder for extracting .dmg's since macOS doesn't support installing of JDK to specific directory.",
"loc.input.help.jdkDestinationDirectory": "On Linux and Windows, this is used as the destination directory for JDK installation. On macOS, this directory is used as a temporary folder for extracting of .dmg's since macOS doesn't support installing of JDK to specific directory.",
DaniilShmelev marked this conversation as resolved.
Show resolved Hide resolved
"loc.input.label.cleanDestinationDirectory": "Clean destination directory",
"loc.input.help.cleanDestinationDirectory": "Select this option to clean the destination directory before JDK is extracted into it.",
"loc.input.label.createExtractDirectory": "Create directory for extracting",
"loc.input.help.createExtractDirectory": "By default, task is creating a directory similar to this JAVA_HOME_8_X64_OpenJDK_zip for extracting JDK. This option allows to disable creation of this folder, in this case, JDK will be located in the root of jdkDestinationDirectory",
"loc.messages.DownloadFromAzureBlobStorage": "Downloading artifacts from Azure blob storage, Container Name: %s",
"loc.messages.SuccessFullyFetchedItemList": "Successfully fetched list of items",
"loc.messages.StorageAccountDoesNotExist": "Failed to get azure storage account with name %s.",
Expand Down
10 changes: 8 additions & 2 deletions Tasks/JavaToolInstallerV0/javatoolinstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,15 @@ async function installJDK(sourceFile: string, fileExtension: string, archiveExtr
jdkDirectory = await installPkg(sourceFile, extendedJavaHome, versionSpec);
}
else {
const createExtractDirectory: boolean = taskLib.getBoolInput('createExtractDirectory', false);
let extractionDirectory: string = "";
if (createExtractDirectory) {
const extractDirectoryName: string = `${extendedJavaHome}_${JavaFilesExtractor.getStrippedName(sourceFile)}_${fileExtension.substr(1)}`;
extractionDirectory = path.join(archiveExtractLocation, extractDirectoryName);
} else {
extractionDirectory = path.join(archiveExtractLocation);
}
// unpack the archive, set `JAVA_HOME` and save it for further processing
const extractDirectoryName: string = `${extendedJavaHome}_${JavaFilesExtractor.getStrippedName(sourceFile)}_${fileExtension.substr(1)}`;
const extractionDirectory: string = path.join(archiveExtractLocation, extractDirectoryName);
await unpackArchive(extractionDirectory, sourceFile, fileExtension, cleanDestinationDirectory);
jdkDirectory = JavaFilesExtractor.setJavaHome(extractionDirectory);
}
Expand Down
13 changes: 11 additions & 2 deletions Tasks/JavaToolInstallerV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 186,
"Patch": 1
"Minor": 188,
"Patch": 0
},
"satisfies": [
"Java",
Expand Down Expand Up @@ -125,6 +125,15 @@
"defaultValue": "true",
"visibleRule": "jdkSourceOption != PreInstalled",
"helpMarkDown": "Select this option to clean the destination directory before JDK is extracted into it."
},
{
"name": "createExtractDirectory",
"type": "boolean",
"label": "Create directory for extracting",
"required": false,
"defaultValue": true,
"visibleRule": "jdkSourceOption != PreInstalled",
"helpMarkDown": "By default, task is creating a directory similar to this JAVA_HOME_8_X64_OpenJDK_zip for extracting JDK. This option allows to disable creation of this folder, in this case, JDK will be located in the root of jdkDestinationDirectory"
}
],
"dataSourceBindings": [
Expand Down
13 changes: 11 additions & 2 deletions Tasks/JavaToolInstallerV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 186,
"Patch": 1
"Minor": 188,
"Patch": 0
},
"satisfies": [
"Java",
Expand Down Expand Up @@ -125,6 +125,15 @@
"defaultValue": "true",
"visibleRule": "jdkSourceOption != PreInstalled",
"helpMarkDown": "ms-resource:loc.input.help.cleanDestinationDirectory"
},
{
"name": "createExtractDirectory",
"type": "boolean",
"label": "ms-resource:loc.input.label.createExtractDirectory",
"required": false,
"defaultValue": true,
"visibleRule": "jdkSourceOption != PreInstalled",
"helpMarkDown": "ms-resource:loc.input.help.createExtractDirectory"
}
],
"dataSourceBindings": [
Expand Down