Skip to content

fix: handle gradleArgs as an array option #5636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions lib/common/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,11 @@ interface IDashedOption {
* Specifies either a single option key (string), or an array of options that must be followed by option values.
*/
requiresArg?: any;

/**
* Set to true to define the option as an array option https://github.com/yargs/yargs/blob/main/docs/api.md#array
*/
array?: any;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ interface IAndroidBundleOptions {

interface IAndroidOptions {
gradlePath: string;
gradleArgs: string;
gradleArgs: string[];
}

interface ITypingsOptions {
Expand Down
4 changes: 2 additions & 2 deletions lib/definitions/android-plugin-migrator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface IAndroidBuildOptions {
aarOutputDir: string;
tempPluginDirPath: string;
gradlePath?: string;
gradleArgs?: string;
gradleArgs?: string[];
}

interface IAndroidPluginBuildService {
Expand Down Expand Up @@ -48,5 +48,5 @@ interface IBuildAndroidPluginData extends Partial<IProjectDir> {
/**
* Optional custom Gradle arguments.
*/
gradleArgs?: string,
gradleArgs?: string[],
}
2 changes: 1 addition & 1 deletion lib/definitions/build.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface IAndroidBuildData
IAndroidSigningData,
IHasAndroidBundle {
gradlePath?: string;
gradleArgs?: string;
gradleArgs?: string[];
}

interface IAndroidSigningData {
Expand Down
2 changes: 1 addition & 1 deletion lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class Options {
hasSensitiveValue: false,
},
gradlePath: { type: OptionType.String, hasSensitiveValue: false },
gradleArgs: { type: OptionType.String, hasSensitiveValue: false },
gradleArgs: { type: OptionType.String, hasSensitiveValue: false, array: true },
aab: { type: OptionType.Boolean, hasSensitiveValue: false },
performance: { type: OptionType.Object, hasSensitiveValue: true },
appleApplicationSpecificPassword: {
Expand Down
6 changes: 5 additions & 1 deletion lib/services/android-plugin-build-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,11 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
`-PappResourcesPath=${this.$projectData.getAppResourcesDirectoryPath()}`
];
if (pluginBuildSettings.gradleArgs) {
localArgs.push(pluginBuildSettings.gradleArgs);
const additionalArgs: string[] = []
pluginBuildSettings.gradleArgs.forEach(arg=>{
additionalArgs.push(...arg.split(' -P').map((a,i) => i === 0 ? a : `-P${a}`));
});
localArgs.push(...additionalArgs);
}

if (this.$logger.getLevel() === "INFO") {
Expand Down
6 changes: 5 additions & 1 deletion lib/services/android/gradle-build-args-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ export class GradleBuildArgsService implements IGradleBuildArgsService {
`-PappResourcesPath=${this.$projectData.getAppResourcesDirectoryPath()}`
);
if (buildData.gradleArgs) {
args.push(buildData.gradleArgs);
const additionalArgs: string[] = []
buildData.gradleArgs.forEach(arg=>{
additionalArgs.push(...arg.split(' -P').map((a,i) => i === 0 ? a : `-P${a}`));
});
args.push(...additionalArgs);
}

if (buildData.release) {
Expand Down