Skip to content

Commit 8b59feb

Browse files
Merge pull request #1633 from NativeScript/vladimirov/interpolate-all-android-files
Replace plugin variables in all Android .xml files
2 parents 5f3be6e + d30b2ff commit 8b59feb

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

lib/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export var LIVESYNC_EXCLUDED_DIRECTORIES = ["app_resources"];
1515
export var TESTING_FRAMEWORKS = ['jasmine', 'mocha', 'qunit'];
1616
export let TEST_RUNNER_NAME = "nativescript-unit-test-runner";
1717
export let LIVESYNC_EXCLUDED_FILE_PATTERNS = ["**/*.js.map", "**/*.ts"];
18+
export let XML_FILE_EXTENSION = ".xml";
1819

1920
export class ReleaseType {
2021
static MAJOR = "major";

lib/services/android-project-service.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,11 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
327327
this.$fs.ensureDirectoryExists(resourcesDestinationDirectoryPath).wait();
328328
shell.cp("-Rf", path.join(pluginPlatformsFolderPath, "*"), resourcesDestinationDirectoryPath);
329329

330-
let pluginConfigurationFilePath = path.join(resourcesDestinationDirectoryPath, this.platformData.configurationFileName);
331-
if (this.$fs.exists(pluginConfigurationFilePath).wait()) {
332-
this.$pluginVariablesService.interpolate(pluginData, pluginConfigurationFilePath).wait();
333-
}
330+
(this.$fs.enumerateFilesInDirectorySync(resourcesDestinationDirectoryPath, file => this.$fs.getFsStats(file).wait().isDirectory() || path.extname(file) === constants.XML_FILE_EXTENSION) || [])
331+
.forEach(file => {
332+
this.$logger.trace(`Interpolate data for plugin file: ${file}`);
333+
this.$pluginVariablesService.interpolate(pluginData, file).wait();
334+
});
334335
}
335336

336337
// Copy include.gradle file

lib/xml-validator.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"use strict";
33

44
import { EOL } from "os";
5+
import * as constants from "./constants";
56

67
export class XmlValidator implements IXmlValidator {
78
constructor(private $fs: IFileSystem,
@@ -11,7 +12,7 @@ export class XmlValidator implements IXmlValidator {
1112
return (() => {
1213
let xmlHasErrors = false;
1314
sourceFiles
14-
.filter(file => _.endsWith(file, ".xml"))
15+
.filter(file => _.endsWith(file, constants.XML_FILE_EXTENSION))
1516
.forEach(file => {
1617
let errorOutput = this.getXmlFileErrors(file).wait();
1718
let hasErrors = !!errorOutput;

0 commit comments

Comments
 (0)