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

Fix for localization errors and library versioning #6936

Merged
merged 5 commits into from
Apr 12, 2018
Merged
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
16 changes: 8 additions & 8 deletions Tasks/JavaToolInstaller/javatoolinstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ async function getJava(versionSpec: string) {
if (version) { //This version of Java JDK is already in the cache. Use it instead of downloading again.
console.log(taskLib.loc('Info_ResolvedToolFromCache', version));
} else if (fromAzure) { //Download JDK from an Azure blob storage location and extract.
console.log(taskLib.loc('RetrievingJdkFromAzure', version));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was an unused variable being passed into the localization message so I removed it.

compressedFileExtension = getFileEnding(taskLib.getInput('azureCommonVirtualFile', true));
console.log(taskLib.loc('RetrievingJdkFromAzure'));
const fileNameAndPath: string = taskLib.getInput('azureCommonVirtualFile', false);
compressedFileExtension = getFileEnding(fileNameAndPath);

const azureDownloader = new AzureStorageArtifactDownloader(taskLib.getInput('azureResourceManagerEndpoint', true),
taskLib.getInput('azureStorageAccountName', true), taskLib.getInput('azureContainerName', true), taskLib.getInput('azureCommonVirtualFile', false));
await azureDownloader.downloadArtifacts(extractLocation, '*' + compressedFileExtension);
taskLib.getInput('azureStorageAccountName', true), taskLib.getInput('azureContainerName', true), "");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The download artifacts method now treats the path as being a folder and adds a '/' on the end. The work around is to pass the filename in as the itemPattern.

await azureDownloader.downloadArtifacts(extractLocation, '*' + fileNameAndPath);
await sleepFor(250); //Wait for the file to be released before extracting it.

const extractSource = buildFilePath(extractLocation, compressedFileExtension);
const extractSource = buildFilePath(extractLocation, compressedFileExtension, fileNameAndPath);
jdkDirectory = new JavaFilesExtractor().unzipJavaDownload(extractSource, compressedFileExtension, extractLocation);
} else { //JDK is in a local directory. Extract to specified target directory.
console.log(taskLib.loc('RetrievingJdkFromLocalPath', version));
Expand All @@ -72,9 +73,8 @@ function sleepFor(sleepDurationInMillisecondsSeconds): Promise<any> {
});
}

function buildFilePath(localPathRoot: string, fileEnding: string): string {
const azureFileSource: string = taskLib.getInput('azureCommonVirtualFile', true);
const fileName = azureFileSource.split(/[\\\/]/).pop();
function buildFilePath(localPathRoot: string, fileEnding: string, fileNameAndPath: string): string {
const fileName = fileNameAndPath.split(/[\\\/]/).pop();
const extractSource = path.join(localPathRoot, fileName);

return extractSource;
Expand Down
169 changes: 105 additions & 64 deletions Tasks/JavaToolInstaller/package-lock.json

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

6 changes: 3 additions & 3 deletions Tasks/JavaToolInstaller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "java-tool-installer",
"version": "0.126.0",
"version": "0.134.0",
"description": "Java Tool Installer",
"main": "javaToolInstaller.js",
"scripts": {
Expand All @@ -24,7 +24,7 @@
"dependencies": {
"azure-arm-rest": "file:../../_build/Tasks/Common/azure-arm-rest-1.0.2.tgz",
"azure-blobstorage-artifactProvider": "file:../../_build/Tasks/Common/azure-blobstorage-artifactProvider-1.0.0.tgz",
"vsts-task-lib": "2.1.0",
"vsts-task-tool-lib": "^0.4.1"
"vsts-task-lib": "2.4.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating these libraries to include the fixes for localization bugs.

"vsts-task-tool-lib": "0.8.1"
}
}
Loading