mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 03:53:09 +08:00
CB-12546: on create, update the require path for certain helper modules as directory structure differs. big ol TODO dropped as it _is_ kinda weird.
This commit is contained in:
parent
1d8e6f53a1
commit
884818934f
@ -138,15 +138,25 @@ function copyBuildRules(projectPath) {
|
||||
}
|
||||
|
||||
function copyScripts(projectPath) {
|
||||
var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'cordova');
|
||||
var bin = path.join(ROOT, 'bin');
|
||||
var srcScriptsDir = path.join(bin, 'templates', 'cordova');
|
||||
var destScriptsDir = path.join(projectPath, 'cordova');
|
||||
// Delete old scripts directory if this is an update.
|
||||
shell.rm('-rf', destScriptsDir);
|
||||
// Copy in the new ones.
|
||||
shell.cp('-r', srcScriptsDir, projectPath);
|
||||
shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir);
|
||||
shell.cp(path.join(ROOT, 'bin', 'check_reqs*'), destScriptsDir);
|
||||
shell.cp(path.join(ROOT, 'bin', 'android_sdk_version*'), destScriptsDir);
|
||||
shell.cp(path.join(bin, 'check_reqs*'), destScriptsDir);
|
||||
shell.cp(path.join(bin, 'android_sdk_version*'), destScriptsDir);
|
||||
var check_reqs = path.join(destScriptsDir, 'check_reqs');
|
||||
var android_sdk_version = path.join(destScriptsDir, 'android_sdk_version');
|
||||
// TODO: the two files being edited on-the-fly here are shared between
|
||||
// platform and project-level commands. the below `sed` is updating the
|
||||
// `require` path for the two libraries. if there's a better way to share
|
||||
// modules across both the repo and generated projects, we should make sure
|
||||
// to remove/update this.
|
||||
shell.sed('-i', /templates\/cordova\//, '', android_sdk_version);
|
||||
shell.sed('-i', /templates\/cordova\//, '', check_reqs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
2
bin/templates/cordova/lib/android_sdk.js
vendored
2
bin/templates/cordova/lib/android_sdk.js
vendored
@ -123,7 +123,7 @@ module.exports.list_targets = function() {
|
||||
// there's a chance `android` no longer works.
|
||||
// lets see if `sdkmanager` is available and we can figure it out
|
||||
var avail_regex = /android command is no longer available/;
|
||||
if (err.code && (err.stdout.match(avail_regex) || err.stderr.match(avail_regex))) {
|
||||
if (err.code && ((err.stdout && err.stdout.match(avail_regex)) || (err.stderr && err.stderr.match(avail_regex)))) {
|
||||
return module.exports.list_targets_with_sdkmanager();
|
||||
} else throw err;
|
||||
}).then(function(targets) {
|
||||
|
Loading…
Reference in New Issue
Block a user