mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
Do not explicitly require modules from project directory (#713)
* Allow to pass-through projectPath to Builder * Do not explicitly require modules from project directory
This commit is contained in:
committed by
GitHub
parent
b177f84825
commit
4cf3dcfaae
Vendored
+2
-4
@@ -99,8 +99,7 @@ Api.createPlatform = function (destination, config, options, events) {
|
||||
var result;
|
||||
try {
|
||||
result = require('../../lib/create').create(destination, config, options, events).then(function (destination) {
|
||||
var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
|
||||
return new PlatformApi(PLATFORM, destination, events);
|
||||
return new Api(PLATFORM, destination, events);
|
||||
});
|
||||
} catch (e) {
|
||||
events.emit('error', 'createPlatform is not callable from the android project API.');
|
||||
@@ -130,8 +129,7 @@ Api.updatePlatform = function (destination, options, events) {
|
||||
var result;
|
||||
try {
|
||||
result = require('../../lib/create').update(destination, options, events).then(function (destination) {
|
||||
var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
|
||||
return new PlatformApi('android', destination, events);
|
||||
return new Api(PLATFORM, destination, events);
|
||||
});
|
||||
} catch (e) {
|
||||
events.emit('error', 'updatePlatform is not callable from the android project API, you will need to do this manually.');
|
||||
|
||||
+2
-2
@@ -24,10 +24,10 @@ const CordovaError = require('cordova-common').CordovaError;
|
||||
*
|
||||
* @return {Builder} A builder instance for specified build type.
|
||||
*/
|
||||
module.exports.getBuilder = function () {
|
||||
module.exports.getBuilder = function (projectPath) {
|
||||
try {
|
||||
const Builder = require('./ProjectBuilder');
|
||||
return new Builder();
|
||||
return new Builder(projectPath);
|
||||
} catch (err) {
|
||||
throw new CordovaError('Failed to instantiate ProjectBuilder builder: ' + err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user