Skip to content
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
6 changes: 3 additions & 3 deletions lib/services/android/gradle-command-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ export class GradleCommandService implements IGradleCommandService {
) { }

public async executeCommand(gradleArgs: string[], options: IGradleCommandOptions): Promise<ISpawnResult> {
const { message, cwd, stdio = "inherit", spawnOptions } = options;
const { message, cwd, stdio, spawnOptions } = options;
this.$logger.info(message);

const childProcessOptions = { cwd, stdio };
const childProcessOptions = { cwd, stdio: stdio || "inherit" };
const gradleExecutable = this.$hostInfo.isWindows ? "gradlew.bat" : "./gradlew";

const result = await this.executeCommandSafe(gradleExecutable, gradleArgs, childProcessOptions, spawnOptions);

return result;
}

private async executeCommandSafe(gradleExecutable: string, gradleArgs: string[], childProcessOptions: { cwd: string, stdio: string }, spawnOptions: ISpawnFromEventOptions) {
private async executeCommandSafe(gradleExecutable: string, gradleArgs: string[], childProcessOptions: { cwd: string, stdio: string }, spawnOptions: ISpawnFromEventOptions): Promise<ISpawnResult> {
try {
const result = await this.$childProcess.spawnFromEvent(gradleExecutable, gradleArgs, "close", childProcessOptions, spawnOptions);

Expand Down
7 changes: 4 additions & 3 deletions test/services/android/gradle-build-args-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function createTestInjector(): IInjector {
injector.register("androidToolsInfo", {
getToolsInfo: () => ({
compileSdkVersion: 28,
targetSdkVersion: 26,
buildToolsVersion: "my-build-tools-version",
generateTypings: true
})
Expand Down Expand Up @@ -36,13 +37,13 @@ function executeTests(testCases: any[], testFunction: (gradleBuildArgsService: I

const expectedInfoLoggingArgs = ["--quiet"];
const expectedTraceLoggingArgs = ["--stacktrace", "--debug"];
const expectedDebugBuildArgs = ["-PcompileSdk=android-28", "-PbuildToolsVersion=my-build-tools-version", "-PgenerateTypings=true"];
const expectedReleaseBuildArgs = expectedDebugBuildArgs.concat(["-Prelease", "-PksPath=/Users/havaluova/Work/nativescript-cli/keyStorePath",
const expectedDebugBuildArgs = ["-PcompileSdk=android-28", "-PtargetSdk=26", "-PbuildToolsVersion=my-build-tools-version", "-PgenerateTypings=true"];
const expectedReleaseBuildArgs = expectedDebugBuildArgs.concat(["-Prelease", "-PksPath=/my/key/store/path",
"-Palias=keyStoreAlias", "-Ppassword=keyStoreAliasPassword", "-PksPassword=keyStorePassword"]);

const releaseBuildConfig = {
release: true,
keyStorePath: "keyStorePath",
keyStorePath: "/my/key/store/path",
keyStoreAlias: "keyStoreAlias",
keyStoreAliasPassword: "keyStoreAliasPassword",
keyStorePassword: "keyStorePassword"
Expand Down