Changed how the script sources the tools it needs

Added some more logging
This commit is contained in:
Drew Heavner committed 2019-11-08 15:46:49 -05:00
1 parent 71ce780cd2
commit bd300686fa
131 files changed
+48 -8554

No files matched your search

-28
View File
@@ -1,33 +1,5 @@
import * as tc from '@actions/tool-cache'
import * as core from '@actions/core'
import * as exec from '@actions/exec'
import {Dirent} from "fs";
import fs from "fs";
import * as path from "path";
export async function downloadAndroidTools(toolsVersion: string = "4333796", buildToolsVersion: string = '29.0.2') {
const buildToolDir = tc.find('build-tools', buildToolsVersion);
if (buildToolDir.length == 0) {
const androidToolPath = await tc.downloadTool(`https://dl.google.com/android/repository/sdk-tools-linux-${toolsVersion}.zip`);
const androidToolExtractedFolder = await tc.extractZip(androidToolPath, 'android-sdk');
const cachedPath = await tc.cacheDir(androidToolExtractedFolder, 'android-sdk', toolsVersion);
core.addPath(cachedPath);
core.addPath(path.join(cachedPath, 'bin'));
// Install the platform tools
exec.exec('yes | sdkmanager --licenses');
exec.exec('yes | sdkmanager', [
`\"build-tools;${buildToolsVersion}\"`
]);
// Add our new build tools to the exec path
const cachedBuildTools = await tc.cacheDir(path.join(cachedPath, `build-tools/${buildToolsVersion}`), "build-tools", buildToolsVersion);
core.addPath(cachedBuildTools)
} else {
core.addPath(buildToolDir)
}
}
export function findReleaseFile(releaseDir: string): Dirent | undefined {
const releaseFiles = fs.readdirSync(releaseDir, {withFileTypes: true})