Skip to content

feat: use runtime Gradle version during plugin AAR build #3731

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

Merged
merged 7 commits into from
Jul 10, 2018
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
5 changes: 5 additions & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,9 @@ export class Hooks {
public static createProject = "createProject";
}

export class AndroidBuildDefaults {
public static GradleVersion = "4.4";
public static GradleAndroidPluginVersion = "3.1.2";
}

export const PACKAGE_PLACEHOLDER_NAME = "__PACKAGE__";
8 changes: 8 additions & 0 deletions lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,3 +850,11 @@ interface IAssetsGenerationService {
*/
generateSplashScreens(splashesGenerationData: ISplashesGenerationData): Promise<void>;
}

/**
* Describes the Gradle versions specified in the package.json of the Android runtime
*/
interface IRuntimeGradleVersions {
gradleVersion?: string;
gradleAndroidPluginVersion?: string;
}
3 changes: 2 additions & 1 deletion lib/definitions/android-plugin-migrator.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

interface IBuildOptions extends IAndroidBuildOptions{
projectDir?: string
}

interface IAndroidBuildOptions {
Expand Down Expand Up @@ -33,5 +34,5 @@ interface IBuildAndroidPluginData {
/**
* Information about tools that will be used to build the plugin, for example compile SDK version, build tools version, etc.
*/
androidToolsInfo: IAndroidToolsInfoData;
androidToolsInfo?: IAndroidToolsInfoData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this is not mandatory anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using it in a single place and now it defaults to the old logic inside (this.$androidToolsInfo.getToolsInfo();)

}
242 changes: 147 additions & 95 deletions lib/services/android-plugin-build-service.ts

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
return this._platformData;
}

// TODO: Remove prior to the 4.0 CLI release @Pip3r4o @PanayotCankov
// Similar to the private method of the same name in platform-service.
private getCurrentPlatformVersion(platformData: IPlatformData, projectData: IProjectData): string {
public getCurrentPlatformVersion(platformData: IPlatformData, projectData: IProjectData): string {
const currentPlatformData: IDictionary<any> = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName);

return currentPlatformData && currentPlatformData[constants.VERSION_STRING];
Expand Down Expand Up @@ -422,6 +420,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
const pluginPlatformsFolderPath = this.getPluginPlatformsFolderPath(pluginData, AndroidProjectService.ANDROID_PLATFORM_NAME);
if (this.$fs.exists(pluginPlatformsFolderPath)) {
const options: IBuildOptions = {
projectDir: projectData.projectDir,
pluginName: pluginData.name,
platformsAndroidDirPath: pluginPlatformsFolderPath,
aarOutputDir: pluginPlatformsFolderPath,
Expand Down Expand Up @@ -533,9 +532,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject

public async removePluginNativeCode(pluginData: IPluginData, projectData: IProjectData): Promise<void> {
try {
// check whether the dependency that's being removed has native code
// TODO: Remove prior to the 4.1 CLI release @Pip3r4o @PanayotCankov
// the updated gradle script will take care of cleaning the prepared android plugins
if (!this.runtimeVersionIsGreaterThanOrEquals(projectData, "3.3.0")) {
const pluginConfigDir = path.join(this.getPlatformData(projectData).projectRoot, "configurations", pluginData.name);
if (this.$fs.exists(pluginConfigDir)) {
Expand Down Expand Up @@ -563,8 +559,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
if (shouldUseNewRoutine) {
this.provideDependenciesJson(projectData, dependencies);
} else {
// TODO: Remove prior to the 4.1 CLI release @Pip3r4o @PanayotCankov

const platformDir = path.join(projectData.platformsDir, AndroidProjectService.ANDROID_PLATFORM_NAME);
const buildDir = path.join(platformDir, "build-tools");
const checkV8dependants = path.join(buildDir, "check-v8-dependants.js");
Expand All @@ -580,7 +574,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
}

if (!shouldUseNewRoutine) {
// TODO: Remove prior to the 4.0 CLI release @Pip3r4o @PanayotCankov
const projectRoot = this.getPlatformData(projectData).projectRoot;
await this.cleanProject(projectRoot, projectData);
}
Expand Down
Loading