Skip to content
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

feat: --gradleArgs option to pass gradle parameters #5630

Merged
merged 3 commits into from
Feb 15, 2022
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
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