Skip to content

Commit

Permalink
feat: --gradleArgs option to pass gradle parameters (#5630)
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug authored Feb 15, 2022
1 parent 387c7c0 commit 02d179a
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/commands/plugin/build-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class BuildPluginCommand implements ICommand {

const options: IPluginBuildOptions = {
gradlePath: this.$options.gradlePath,
gradleArgs: this.$options.gradleArgs,
aarOutputDir: platformsAndroidPath,
platformsAndroidDirPath: platformsAndroidPath,
pluginName: pluginName,
Expand Down
2 changes: 2 additions & 0 deletions lib/data/build-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class AndroidBuildData extends BuildData {
public keyStorePassword: string;
public androidBundle: boolean;
public gradlePath: string;
public gradleArgs: string;

constructor(projectDir: string, platform: string, data: any) {
super(projectDir, platform, data);
Expand All @@ -58,5 +59,6 @@ export class AndroidBuildData extends BuildData {
this.keyStorePassword = data.keyStorePassword;
this.androidBundle = data.androidBundle || data.aab;
this.gradlePath = data.gradlePath;
this.gradleArgs = data.gradleArgs;
}
}
1 change: 1 addition & 0 deletions lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ interface IAndroidBundleOptions {

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

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

interface IAndroidPluginBuildService {
Expand Down Expand Up @@ -43,4 +44,9 @@ interface IBuildAndroidPluginData extends Partial<IProjectDir> {
* Optional custom Gradle path.
*/
gradlePath?: string;

/**
* Optional custom Gradle arguments.
*/
gradleArgs?: string,
}
1 change: 1 addition & 0 deletions lib/definitions/build.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ interface IAndroidBuildData
IAndroidSigningData,
IHasAndroidBundle {
gradlePath?: string;
gradleArgs?: string;
}

interface IAndroidSigningData {
Expand Down
1 change: 1 addition & 0 deletions lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export class Options {
hasSensitiveValue: false,
},
gradlePath: { type: OptionType.String, hasSensitiveValue: false },
gradleArgs: { type: OptionType.String, hasSensitiveValue: false },
aab: { type: OptionType.Boolean, hasSensitiveValue: false },
performance: { type: OptionType.Object, hasSensitiveValue: true },
appleApplicationSpecificPassword: {
Expand Down
4 changes: 4 additions & 0 deletions lib/services/android-plugin-build-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
);
await this.buildPlugin({
gradlePath: options.gradlePath,
gradleArgs: options.gradleArgs,
pluginDir: pluginTempDir,
pluginName: options.pluginName,
projectDir: options.projectDir,
Expand Down Expand Up @@ -727,6 +728,9 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
`-PcompileSdk=android-${pluginBuildSettings.androidToolsInfo.compileSdkVersion}`,
`-PbuildToolsVersion=${pluginBuildSettings.androidToolsInfo.buildToolsVersion}`,
];
if (pluginBuildSettings.gradleArgs) {
localArgs.push(pluginBuildSettings.gradleArgs);
}

if (this.$logger.getLevel() === "INFO") {
localArgs.push("--quiet");
Expand Down
1 change: 1 addition & 0 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
if (this.$fs.exists(pluginPlatformsFolderPath)) {
const options: IPluginBuildOptions = {
gradlePath: this.$options.gradlePath,
gradleArgs: this.$options.gradleArgs,
projectDir: projectData.projectDir,
pluginName: pluginData.name,
platformsAndroidDirPath: pluginPlatformsFolderPath,
Expand Down
3 changes: 3 additions & 0 deletions lib/services/android/gradle-build-args-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export class GradleBuildArgsService implements IGradleBuildArgsService {
`-PappPath=${this.$projectData.getAppDirectoryPath()}`,
`-PappResourcesPath=${this.$projectData.getAppResourcesDirectoryPath()}`
);
if (buildData.gradleArgs) {
args.push(buildData.gradleArgs);
}

if (buildData.release) {
args.push(
Expand Down

0 comments on commit 02d179a

Please sign in to comment.