Skip to content

Commit 90fffdb

Browse files
author
Maxim Lobanov
committed
use sudo
1 parent c541e14 commit 90fffdb

File tree

3 files changed

+2
-22
lines changed

3 files changed

+2
-22
lines changed

dist/index.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42116,7 +42116,7 @@ class SDKManager {
4211642116
};
4211742117
const commandString = `${this.sdkManagerPath} ${args.join(" ")}`;
4211842118
console.log(`[command]${commandString}`);
42119-
const exitCode = await exec.exec(`"${this.sdkManagerPath}"`, args, options);
42119+
const exitCode = await exec.exec("sudo", [`"${this.sdkManagerPath}"`, ...args], options);
4212042120
if (exitCode !== 0) {
4212142121
throw new Error(`'${commandString}' has finished with exit code '${exitCode}'`);
4212242122
}
@@ -47557,15 +47557,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
4755747557
Object.defineProperty(exports, "__esModule", { value: true });
4755847558
const cache = __importStar(__webpack_require__(692));
4755947559
const core = __importStar(__webpack_require__(470));
47560-
const exec = __importStar(__webpack_require__(986));
4756147560
const os = __importStar(__webpack_require__(87));
4756247561
const sdk_manager_1 = __webpack_require__(857);
4756347562
const utils_1 = __webpack_require__(611);
47564-
const patchUbuntuPermissions = async (androidHome) => {
47565-
core.startGroup("Patch permissions for $ANDROID_HOME on Ubuntu");
47566-
await exec.exec("sudo", ["chmod", "-R", "a+rwx", androidHome]);
47567-
core.endGroup();
47568-
};
4756947563
const restoreCache = async (sdkmanager, foundPackage) => {
4757047564
core.startGroup("Trying to restore package from cache...");
4757147565
const cacheKey = utils_1.getPackageCacheKey(foundPackage);
@@ -47595,9 +47589,6 @@ const run = async () => {
4759547589
throw new Error("ANDROID_HOME env variable is not defined");
4759647590
}
4759747591
const sdkmanager = new sdk_manager_1.SDKManager(androidHome);
47598-
if (os.platform() === "linux") {
47599-
await patchUbuntuPermissions(androidHome);
47600-
}
4760147592
core.startGroup("Getting list of available components");
4760247593
const allPackages = await sdkmanager.getAllPackagesInfo();
4760347594
core.endGroup();

src/sdk-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class SDKManager {
7676
};
7777
const commandString = `${this.sdkManagerPath} ${args.join(" ")}`;
7878
console.log(`[command]${commandString}`);
79-
const exitCode = await exec.exec(`"${this.sdkManagerPath}"`, args, options);
79+
const exitCode = await exec.exec("sudo", [`"${this.sdkManagerPath}"`, ...args], options);
8080
if (exitCode !== 0) {
8181
throw new Error(`'${commandString}' has finished with exit code '${exitCode}'`);
8282
}

src/setup-android-tools.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
import * as cache from "@actions/cache";
22
import * as core from "@actions/core";
3-
import * as exec from "@actions/exec";
43
import * as os from "os";
54
import { SDKManager } from "./sdk-manager";
65
import { getListInput, getBooleanInput, getPackageCacheKey } from "./utils";
76
import { AndroidPackageInfo } from "./sdk-manager-parser";
87

9-
const patchUbuntuPermissions = async(androidHome: string): Promise<void> => {
10-
core.startGroup("Patch permissions for $ANDROID_HOME on Ubuntu");
11-
await exec.exec("sudo", ["chmod", "-R", "a+rwx", androidHome]);
12-
core.endGroup();
13-
};
14-
158
const restoreCache = async(sdkmanager: SDKManager, foundPackage: AndroidPackageInfo): Promise<boolean> => {
169
core.startGroup("Trying to restore package from cache...");
1710

@@ -48,10 +41,6 @@ const run = async(): Promise<void> => {
4841
if (!androidHome) { throw new Error("ANDROID_HOME env variable is not defined"); }
4942
const sdkmanager = new SDKManager(androidHome);
5043

51-
if (os.platform() === "linux") {
52-
await patchUbuntuPermissions(androidHome);
53-
}
54-
5544
core.startGroup("Getting list of available components");
5645
const allPackages = await sdkmanager.getAllPackagesInfo();
5746
core.endGroup();

0 commit comments

Comments
 (0)