From 23d8d999257f9cf1331d81489c96f00fa134b3b5 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Thu, 30 Mar 2017 13:38:18 -0700 Subject: [PATCH] Moving Android Manifest finding to the Gradle and Studio builders. --- bin/lib/create.js | 3 +- .../cordova/lib/builders/GenericBuilder.js | 32 ------------------ .../cordova/lib/builders/GradleBuilder.js | 31 +++++++++++++++++ .../cordova/lib/builders/StudioBuilder.js | 33 +++++++++++++++++++ 4 files changed, 66 insertions(+), 33 deletions(-) diff --git a/bin/lib/create.js b/bin/lib/create.js index 2fa0c8cd..cfd6395c 100755 --- a/bin/lib/create.js +++ b/bin/lib/create.js @@ -125,9 +125,10 @@ function writeProjectProperties(projectPath, target_api) { fs.writeFileSync(dstPath, data); } +// This makes no sense, what if you're building with a different build system? function prepBuildFiles(projectPath) { var buildModule = require(path.resolve(projectPath, 'cordova/lib/builders/builders')); - buildModule.getBuilder('gradle').prepBuildFiles(); + buildModule.getBuilder('studio').prepBuildFiles(); } function copyBuildRules(projectPath) { diff --git a/bin/templates/cordova/lib/builders/GenericBuilder.js b/bin/templates/cordova/lib/builders/GenericBuilder.js index 362da431..16a69f57 100644 --- a/bin/templates/cordova/lib/builders/GenericBuilder.js +++ b/bin/templates/cordova/lib/builders/GenericBuilder.js @@ -27,7 +27,6 @@ var CordovaError = require('cordova-common').CordovaError; function GenericBuilder (projectDir) { this.root = projectDir || path.resolve(__dirname, '../../..'); this.binDirs = { - ant: path.join(this.root, hasCustomRules(this.root) ? 'ant-build' : 'bin'), gradle: path.join(this.root, 'build', 'outputs', 'apk') }; } @@ -59,37 +58,6 @@ GenericBuilder.prototype.findOutputApks = function(build_type, arch) { .sort(apkSorter); }; -GenericBuilder.prototype.readProjectProperties = function () { - function findAllUniq(data, r) { - var s = {}; - var m; - while ((m = r.exec(data))) { - s[m[1]] = 1; - } - return Object.keys(s); - } - - var data = fs.readFileSync(path.join(this.root, 'project.properties'), 'utf8'); - return { - libs: findAllUniq(data, /^\s*android\.library\.reference\.\d+=(.*)(?:\s|$)/mg), - gradleIncludes: findAllUniq(data, /^\s*cordova\.gradle\.include\.\d+=(.*)(?:\s|$)/mg), - systemLibs: findAllUniq(data, /^\s*cordova\.system\.library\.\d+=(.*)(?:\s|$)/mg) - }; -}; - -GenericBuilder.prototype.extractRealProjectNameFromManifest = function () { - var manifestPath = path.join(this.root, 'AndroidManifest.xml'); - var manifestData = fs.readFileSync(manifestPath, 'utf8'); - var m = /