Content-Length: 731398 | pFad | http://github.com/NativeScript/nativescript-cli/commit/387c7c0f2eaefcf942e9d6087edaa2a9c42ce064

74 feat: --gradlePath argument support (#5628) · NativeScript/nativescript-cli@387c7c0 · GitHub
Skip to content

Commit 387c7c0

Browse files
authored
feat: --gradlePath argument support (#5628)
1 parent 42d1487 commit 387c7c0

14 files changed

+42
-16
lines changed

Diff for: lib/commands/plugin/build-plugin.ts

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export class BuildPluginCommand implements ICommand {
5252
);
5353

5454
const options: IPluginBuildOptions = {
55+
gradlePath: this.$options.gradlePath,
5556
aarOutputDir: platformsAndroidPath,
5657
platformsAndroidDirPath: platformsAndroidPath,
5758
pluginName: pluginName,

Diff for: lib/data/build-data.ts

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export class AndroidBuildData extends BuildData {
4747
public keyStoreAliasPassword: string;
4848
public keyStorePassword: string;
4949
public androidBundle: boolean;
50+
public gradlePath: string;
5051

5152
constructor(projectDir: string, platform: string, data: any) {
5253
super(projectDir, platform, data);
@@ -56,5 +57,6 @@ export class AndroidBuildData extends BuildData {
5657
this.keyStoreAliasPassword = data.keyStoreAliasPassword;
5758
this.keyStorePassword = data.keyStorePassword;
5859
this.androidBundle = data.androidBundle || data.aab;
60+
this.gradlePath = data.gradlePath;
5961
}
6062
}

Diff for: lib/declarations.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,10 @@ interface IAndroidBundleOptions {
579579
aab: boolean;
580580
}
581581

582+
interface IAndroidOptions {
583+
gradlePath: string;
584+
}
585+
582586
interface ITypingsOptions {
583587
jar: string;
584588
aar: string;
@@ -598,6 +602,7 @@ interface IOptions
598602
IClean,
599603
IProvision,
600604
ITeamIdentifier,
605+
IAndroidOptions,
601606
IAndroidReleaseOptions,
602607
IAndroidBundleOptions,
603608
INpmInstallConfigurationOptions,

Diff for: lib/definitions/android-plugin-migrator.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface IAndroidBuildOptions {
1010
pluginName: string;
1111
aarOutputDir: string;
1212
tempPluginDirPath: string;
13+
gradlePath?: string;
1314
}
1415

1516
interface IAndroidPluginBuildService {
@@ -37,4 +38,9 @@ interface IBuildAndroidPluginData extends Partial<IProjectDir> {
3738
* Information about tools that will be used to build the plugin, for example compile SDK version, build tools version, etc.
3839
*/
3940
androidToolsInfo?: IAndroidToolsInfoData;
41+
42+
/**
43+
* Optional custom Gradle path.
44+
*/
45+
gradlePath?: string;
4046
}

Diff for: lib/definitions/build.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ interface IiOSBuildData extends IBuildData {
2929
interface IAndroidBuildData
3030
extends IBuildData,
3131
IAndroidSigningData,
32-
IHasAndroidBundle {}
32+
IHasAndroidBundle {
33+
gradlePath?: string;
34+
}
3335

3436
interface IAndroidSigningData {
3537
keyStoreAlias: string;

Diff for: lib/definitions/gradle.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface IGradleCommandOptions {
1313
message?: string;
1414
stdio?: string;
1515
spawnOptions?: ISpawnFromEventOptions;
16+
gradlePath?: string;
1617
}
1718

1819
interface IGradleBuildService {

Diff for: lib/options.ts

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ export class Options {
215215
default: false,
216216
hasSensitiveValue: false,
217217
},
218+
gradlePath: { type: OptionType.String, hasSensitiveValue: false },
218219
aab: { type: OptionType.Boolean, hasSensitiveValue: false },
219220
performance: { type: OptionType.Object, hasSensitiveValue: true },
220221
appleApplicationSpecificPassword: {

Diff for: lib/services/android-plugin-build-service.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
260260
options.projectDir
261261
);
262262
await this.buildPlugin({
263+
gradlePath: options.gradlePath,
263264
pluginDir: pluginTempDir,
264265
pluginName: options.pluginName,
265266
projectDir: options.projectDir,
@@ -715,7 +716,9 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
715716
);
716717
}
717718

718-
const gradlew = this.$hostInfo.isWindows ? "gradlew.bat" : "./gradlew";
719+
const gradlew =
720+
pluginBuildSettings.gradlePath ??
721+
(this.$hostInfo.isWindows ? "gradlew.bat" : "./gradlew");
719722

720723
const localArgs = [
721724
"-p",

Diff for: lib/services/android-project-service.ts

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
6161
$fs: IFileSystem,
6262
private $logger: ILogger,
6363
$projectDataService: IProjectDataService,
64+
private $options: IOptions,
6465
private $injector: IInjector,
6566
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
6667
private $androidPluginBuildService: IAndroidPluginBuildService,
@@ -603,6 +604,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
603604
);
604605
if (this.$fs.exists(pluginPlatformsFolderPath)) {
605606
const options: IPluginBuildOptions = {
607+
gradlePath: this.$options.gradlePath,
606608
projectDir: projectData.projectDir,
607609
pluginName: pluginData.name,
608610
platformsAndroidDirPath: pluginPlatformsFolderPath,

Diff for: lib/services/android/gradle-build-service.ts

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class GradleBuildService
3636
cwd: projectRoot,
3737
message: "Gradle build...",
3838
stdio: buildData.buildOutputStdio,
39+
gradlePath: buildData.gradlePath,
3940
spawnOptions,
4041
};
4142

@@ -60,6 +61,7 @@ export class GradleBuildService
6061
const gradleCommandOptions = {
6162
cwd: projectRoot,
6263
message: "Gradle clean...",
64+
gradlePath: buildData.gradlePath,
6365
};
6466
await this.$gradleCommandService.executeCommand(
6567
cleanTaskArgs,

Diff for: lib/services/android/gradle-command-service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export class GradleCommandService implements IGradleCommandService {
2727
this.$logger.info(message);
2828

2929
const childProcessOptions = { cwd, stdio: stdio || "inherit" };
30-
const gradleExecutable = this.$hostInfo.isWindows
31-
? "gradlew.bat"
32-
: "./gradlew";
30+
const gradleExecutable =
31+
options.gradlePath ??
32+
(this.$hostInfo.isWindows ? "gradlew.bat" : "./gradlew");
3333

3434
const result = await this.executeCommandSafe(
3535
gradleExecutable,

Diff for: package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: test/services/android-project-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const createTestInjector = (): IInjector => {
4141
testInjector.register("androidPluginBuildService", {});
4242
testInjector.register("errors", stubs.ErrorsStub);
4343
testInjector.register("logger", stubs.LoggerStub);
44+
testInjector.register("options", {});
4445
testInjector.register("projectData", stubs.ProjectDataStub);
4546
testInjector.register("androidToolsInfo", {
4647
getToolsInfo: () => {

Diff for: yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -3607,10 +3607,10 @@
36073607
"plist" "^2.0.1"
36083608
"yargs" "^6.5.0"
36093609

3610-
"ios-sim-portable@4.2.4":
3611-
"integrity" "sha512-TqgrBp3omXkKwXEHVpLxo3+uJqi6XTLdXpL/YGlXdQ0fL7RYySmqkVQcc98vea/eQMpR9ImTGxyAsKerW/819A=="
3612-
"resolved" "https://registry.npmjs.org/ios-sim-portable/-/ios-sim-portable-4.2.4.tgz"
3613-
"version" "4.2.4"
3610+
"ios-sim-portable@4.2.5":
3611+
"integrity" "sha512-2xuE60u+cjSwDoj3rXeN7PbuVtCDTZUhY5vkWWjlJj/TlWuLJMFEx9lgr5OGuYv7jRldpqD/nwGhtOdM2llKHw=="
3612+
"resolved" "https://registry.npmjs.org/ios-sim-portable/-/ios-sim-portable-4.2.5.tgz"
3613+
"version" "4.2.5"
36143614
dependencies:
36153615
"bplist-parser" "https://github.com/telerik/node-bplist-parser/tarball/master"
36163616
"colors" "~1.4.0"

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/nativescript-cli/commit/387c7c0f2eaefcf942e9d6087edaa2a9c42ce064

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy