Skip to content

Commit e5736a1

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
[SPIKE] Use aapt to merge android resources
1 parent 696a28b commit e5736a1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/services/android-project-service.ts

+21
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,24 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
277277
if(this.$fs.exists(libsFolderPath).wait()) {
278278
this.addLibrary(libsFolderPath).wait();
279279
}
280+
281+
let configurationsDirectoryPath = path.join(this.platformData.projectRoot, "configurations");
282+
this.$fs.ensureDirectoryExists(configurationsDirectoryPath).wait();
283+
284+
let pluginConfigurationDirectoryPath = path.join(configurationsDirectoryPath, pluginData.name);
285+
this.$fs.ensureDirectoryExists(pluginConfigurationDirectoryPath).wait();
286+
287+
// Copy include include.gradle file
288+
let includeGradleFilePath = path.join(pluginPlatformsFolderPath, "include.gradle");
289+
if(this.$fs.exists(includeGradleFilePath).wait()) {
290+
// TODO: Validate the existing include.gradle
291+
shell.cp("-f", includeGradleFilePath, pluginConfigurationDirectoryPath);
292+
} // TODO: SHOULD generate default include.gradle
293+
294+
// Copy all resources from plugin
295+
let resourcesDestinationDirectoryPath = path.join(this.platformData.projectRoot, "src", pluginData.name);
296+
this.$fs.ensureDirectoryExists(resourcesDestinationDirectoryPath).wait();
297+
shell.cp("-Rf", path.join(pluginPlatformsFolderPath, "*"), resourcesDestinationDirectoryPath);
280298
}).future<void>()();
281299
}
282300

@@ -290,6 +308,9 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
290308
let pluginJars = this.$fs.enumerateFilesInDirectorySync(libsFolderPath);
291309
_.each(pluginJars, jarName => this.$fs.deleteFile(path.join(libsFolderPath, jarName)).wait());
292310
}
311+
312+
this.$fs.deleteDirectory(path.join(this.platformData.projectRoot, "configurations", pluginData.name)).wait();
313+
this.$fs.deleteDirectory(path.join(this.platformData.projectRoot, "src", pluginData.name)).wait();
293314
} catch(e) {
294315
if (e.code === "ENOENT") {
295316
this.$logger.debug("No native code jars found: " + e.message);

0 commit comments

Comments
 (0)