Skip to content

Commit 8a8dc79

Browse files
Fatme Havaluovateobugslayer
Fatme Havaluova
authored andcommitted
[SPIKE] Use aapt to merge android resources
1 parent 433334c commit 8a8dc79

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/services/android-project-service.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,24 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
286286
if(this.$fs.exists(libsFolderPath).wait()) {
287287
this.addLibrary(libsFolderPath).wait();
288288
}
289+
290+
let configurationsDirectoryPath = path.join(this.platformData.projectRoot, "configurations");
291+
this.$fs.ensureDirectoryExists(configurationsDirectoryPath).wait();
292+
293+
let pluginConfigurationDirectoryPath = path.join(configurationsDirectoryPath, pluginData.name);
294+
this.$fs.ensureDirectoryExists(pluginConfigurationDirectoryPath).wait();
295+
296+
// Copy include include.gradle file
297+
let includeGradleFilePath = path.join(pluginPlatformsFolderPath, "include.gradle");
298+
if(this.$fs.exists(includeGradleFilePath).wait()) {
299+
// TODO: Validate the existing include.gradle
300+
shell.cp("-f", includeGradleFilePath, pluginConfigurationDirectoryPath);
301+
} // TODO: SHOULD generate default include.gradle
302+
303+
// Copy all resources from plugin
304+
let resourcesDestinationDirectoryPath = path.join(this.platformData.projectRoot, "src", pluginData.name);
305+
this.$fs.ensureDirectoryExists(resourcesDestinationDirectoryPath).wait();
306+
shell.cp("-Rf", path.join(pluginPlatformsFolderPath, "*"), resourcesDestinationDirectoryPath);
289307
}).future<void>()();
290308
}
291309

@@ -299,6 +317,9 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
299317
let pluginJars = this.$fs.enumerateFilesInDirectorySync(libsFolderPath);
300318
_.each(pluginJars, jarName => this.$fs.deleteFile(path.join(libsFolderPath, jarName)).wait());
301319
}
320+
321+
this.$fs.deleteDirectory(path.join(this.platformData.projectRoot, "configurations", pluginData.name)).wait();
322+
this.$fs.deleteDirectory(path.join(this.platformData.projectRoot, "src", pluginData.name)).wait();
302323
} catch(e) {
303324
if (e.code === "ENOENT") {
304325
this.$logger.debug("No native code jars found: " + e.message);

0 commit comments

Comments
 (0)