Skip to content

Commit f13f6f9

Browse files
committed
refactor: make the build plugin service not use platformData
1 parent c8d021d commit f13f6f9

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ interface IBuildOptions {
33
platformsAndroidDirPath: string,
44
pluginName: string,
55
aarOutputDir: string,
6-
tempPluginDirPath: string,
7-
platformData: IPlatformData //don't make optional! (makes sure the plugins are built with the same parameters as the project),
6+
tempPluginDirPath: string
87
}
98

109
interface IAndroidPluginBuildService {

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
77

88
constructor(private $fs: IFileSystem,
99
private $childProcess: IChildProcess,
10-
private $hostInfo: IHostInfo) { }
10+
private $hostInfo: IHostInfo,
11+
private $androidToolsInfo: IAndroidToolsInfo) { }
1112

1213
private static ANDROID_MANIFEST_XML = "AndroidManifest.xml";
1314
private static INCLUDE_GRADLE = "include.gradle";
@@ -270,15 +271,21 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
270271

271272
// finally build the plugin
272273
const gradlew = this.$hostInfo.isWindows ? "gradlew.bat" : "./gradlew";
273-
let localArgs = [
274+
const localArgs = [
274275
gradlew,
275276
"-p",
276277
newPluginDir,
277278
"assembleRelease"
278279
];
279280

280-
const projectBuildOptions = options.platformData.platformProjectService.getBuildOptions();
281-
localArgs = localArgs.concat(projectBuildOptions);
281+
this.$androidToolsInfo.validateInfo({ showWarningsAsErrors: true, validateTargetSdk: true });
282+
283+
const androidToolsInfo = this.$androidToolsInfo.getToolsInfo();
284+
const compileSdk = androidToolsInfo.compileSdkVersion;
285+
const buildToolsVersion = androidToolsInfo.buildToolsVersion;
286+
287+
localArgs.push(`-PcompileSdk=android-${compileSdk}`);
288+
localArgs.push(`-PbuildToolsVersion=${buildToolsVersion}`);
282289

283290
try {
284291
await this.$childProcess.exec(localArgs.join(" "), { cwd: newPluginDir });

lib/services/android-project-service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,11 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
429429
// build Android plugins which contain AndroidManifest.xml and/or resources
430430
const pluginPlatformsFolderPath = this.getPluginPlatformsFolderPath(pluginData, AndroidProjectService.ANDROID_PLATFORM_NAME);
431431
if (this.$fs.exists(pluginPlatformsFolderPath)) {
432-
const platformData = this.getPlatformData(projectData);
433432
const options: IBuildOptions = {
434433
pluginName: pluginData.name,
435434
platformsAndroidDirPath: pluginPlatformsFolderPath,
436435
aarOutputDir: pluginPlatformsFolderPath,
437-
tempPluginDirPath: path.join(projectData.platformsDir, "tempPlugin"),
438-
platformData: platformData
436+
tempPluginDirPath: path.join(projectData.platformsDir, "tempPlugin")
439437
};
440438

441439
this.prebuildNativePlugin(options);

lib/services/gradle-plugin/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ allprojects {
2020
apply plugin: 'com.android.library'
2121

2222
def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 24 }
23-
def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : 24 }
2423
def computeBuildToolsVersion = { ->
2524
project.hasProperty("buildToolsVersion") ? buildToolsVersion : "27.0.1"
2625
}
@@ -30,8 +29,7 @@ android {
3029
buildToolsVersion computeBuildToolsVersion()
3130

3231
defaultConfig {
33-
minSdkVersion 17
34-
targetSdkVersion computeTargetSdkVersion()
32+
targetSdkVersion 26
3533
versionCode 1
3634
versionName "1.0"
3735
}

lib/services/livesync/livesync-service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
476476
pluginName: item.pluginName,
477477
platformsAndroidDirPath: item.platformsAndroidDirPath,
478478
aarOutputDir: item.platformsAndroidDirPath,
479-
tempPluginDirPath: path.join(projectData.platformsDir, 'tempPlugin'),
480-
platformData: platformData
479+
tempPluginDirPath: path.join(projectData.platformsDir, 'tempPlugin')
481480
};
482481
pluginInfo.push(options);
483482
});
@@ -600,8 +599,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
600599
pluginName: pluginPackageJason.name,
601600
platformsAndroidDirPath: pluginInputOutputPath,
602601
aarOutputDir: pluginInputOutputPath,
603-
tempPluginDirPath: path.join(projectData.platformsDir, "tempPlugin"),
604-
platformData: platformData
602+
tempPluginDirPath: path.join(projectData.platformsDir, "tempPlugin")
605603
};
606604
pluginInfo.push(options);
607605
}

0 commit comments

Comments
 (0)