Skip to content

Commit 02d179a

Browse files
authored
feat: --gradleArgs option to pass gradle parameters (#5630)
1 parent 387c7c0 commit 02d179a

File tree

9 files changed

+20
-0
lines changed

9 files changed

+20
-0
lines changed

lib/commands/plugin/build-plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class BuildPluginCommand implements ICommand {
5353

5454
const options: IPluginBuildOptions = {
5555
gradlePath: this.$options.gradlePath,
56+
gradleArgs: this.$options.gradleArgs,
5657
aarOutputDir: platformsAndroidPath,
5758
platformsAndroidDirPath: platformsAndroidPath,
5859
pluginName: pluginName,

lib/data/build-data.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class AndroidBuildData extends BuildData {
4848
public keyStorePassword: string;
4949
public androidBundle: boolean;
5050
public gradlePath: string;
51+
public gradleArgs: string;
5152

5253
constructor(projectDir: string, platform: string, data: any) {
5354
super(projectDir, platform, data);
@@ -58,5 +59,6 @@ export class AndroidBuildData extends BuildData {
5859
this.keyStorePassword = data.keyStorePassword;
5960
this.androidBundle = data.androidBundle || data.aab;
6061
this.gradlePath = data.gradlePath;
62+
this.gradleArgs = data.gradleArgs;
6163
}
6264
}

lib/declarations.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ interface IAndroidBundleOptions {
581581

582582
interface IAndroidOptions {
583583
gradlePath: string;
584+
gradleArgs: string;
584585
}
585586

586587
interface ITypingsOptions {

lib/definitions/android-plugin-migrator.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ interface IAndroidBuildOptions {
1111
aarOutputDir: string;
1212
tempPluginDirPath: string;
1313
gradlePath?: string;
14+
gradleArgs?: string;
1415
}
1516

1617
interface IAndroidPluginBuildService {
@@ -43,4 +44,9 @@ interface IBuildAndroidPluginData extends Partial<IProjectDir> {
4344
* Optional custom Gradle path.
4445
*/
4546
gradlePath?: string;
47+
48+
/**
49+
* Optional custom Gradle arguments.
50+
*/
51+
gradleArgs?: string,
4652
}

lib/definitions/build.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface IAndroidBuildData
3131
IAndroidSigningData,
3232
IHasAndroidBundle {
3333
gradlePath?: string;
34+
gradleArgs?: string;
3435
}
3536

3637
interface IAndroidSigningData {

lib/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ export class Options {
216216
hasSensitiveValue: false,
217217
},
218218
gradlePath: { type: OptionType.String, hasSensitiveValue: false },
219+
gradleArgs: { type: OptionType.String, hasSensitiveValue: false },
219220
aab: { type: OptionType.Boolean, hasSensitiveValue: false },
220221
performance: { type: OptionType.Object, hasSensitiveValue: true },
221222
appleApplicationSpecificPassword: {

lib/services/android-plugin-build-service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
261261
);
262262
await this.buildPlugin({
263263
gradlePath: options.gradlePath,
264+
gradleArgs: options.gradleArgs,
264265
pluginDir: pluginTempDir,
265266
pluginName: options.pluginName,
266267
projectDir: options.projectDir,
@@ -727,6 +728,9 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
727728
`-PcompileSdk=android-${pluginBuildSettings.androidToolsInfo.compileSdkVersion}`,
728729
`-PbuildToolsVersion=${pluginBuildSettings.androidToolsInfo.buildToolsVersion}`,
729730
];
731+
if (pluginBuildSettings.gradleArgs) {
732+
localArgs.push(pluginBuildSettings.gradleArgs);
733+
}
730734

731735
if (this.$logger.getLevel() === "INFO") {
732736
localArgs.push("--quiet");

lib/services/android-project-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
605605
if (this.$fs.exists(pluginPlatformsFolderPath)) {
606606
const options: IPluginBuildOptions = {
607607
gradlePath: this.$options.gradlePath,
608+
gradleArgs: this.$options.gradleArgs,
608609
projectDir: projectData.projectDir,
609610
pluginName: pluginData.name,
610611
platformsAndroidDirPath: pluginPlatformsFolderPath,

lib/services/android/gradle-build-args-service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export class GradleBuildArgsService implements IGradleBuildArgsService {
6464
`-PappPath=${this.$projectData.getAppDirectoryPath()}`,
6565
`-PappResourcesPath=${this.$projectData.getAppResourcesDirectoryPath()}`
6666
);
67+
if (buildData.gradleArgs) {
68+
args.push(buildData.gradleArgs);
69+
}
6770

6871
if (buildData.release) {
6972
args.push(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy