mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
CB-3445 Add .gradle template files for "update" as well as "create"
This commit is contained in:
parent
7133576fe9
commit
36eab713a1
@ -88,11 +88,13 @@ function runAndroidUpdate(projectPath, target_api, shared) {
|
|||||||
return exec('android update project --subprojects --path "' + projectPath + '" --target ' + target_api + ' --library "' + path.relative(projectPath, targetFrameworkDir) + '"');
|
return exec('android update project --subprojects --path "' + projectPath + '" --target ' + target_api + ' --library "' + path.relative(projectPath, targetFrameworkDir) + '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyAntRules(projectPath) {
|
function copyBuildRules(projectPath) {
|
||||||
var srcDir = path.join(ROOT, 'bin', 'templates', 'project');
|
var srcDir = path.join(ROOT, 'bin', 'templates', 'project');
|
||||||
if (fs.existsSync(path.join(srcDir, 'custom_rules.xml'))) {
|
shell.cp('-f', path.join(srcDir, 'custom_rules.xml'), projectPath);
|
||||||
shell.cp('-f', path.join(srcDir, 'custom_rules.xml'), projectPath);
|
|
||||||
}
|
shell.cp('-f', path.join(srcDir, 'build.gradle'), projectPath);
|
||||||
|
shell.cp('-f', path.join(srcDir, 'libraries.gradle'), projectPath);
|
||||||
|
shell.cp('-f', path.join(srcDir, 'settings.gradle'), projectPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyScripts(projectPath) {
|
function copyScripts(projectPath) {
|
||||||
@ -263,7 +265,7 @@ exports.createProject = function(project_path, package_name, project_name, proje
|
|||||||
shell.sed('-i', /__PACKAGE__/, package_name, manifest_path);
|
shell.sed('-i', /__PACKAGE__/, package_name, manifest_path);
|
||||||
shell.sed('-i', /__APILEVEL__/, target_api.split('-')[1], manifest_path);
|
shell.sed('-i', /__APILEVEL__/, target_api.split('-')[1], manifest_path);
|
||||||
copyScripts(project_path);
|
copyScripts(project_path);
|
||||||
copyAntRules(project_path);
|
copyBuildRules(project_path);
|
||||||
});
|
});
|
||||||
// Link it to local android install.
|
// Link it to local android install.
|
||||||
return runAndroidUpdate(project_path, target_api, use_shared_project);
|
return runAndroidUpdate(project_path, target_api, use_shared_project);
|
||||||
@ -298,7 +300,7 @@ exports.updateProject = function(projectPath) {
|
|||||||
var target_api = check_reqs.get_target();
|
var target_api = check_reqs.get_target();
|
||||||
copyJsAndLibrary(projectPath, false, projectName);
|
copyJsAndLibrary(projectPath, false, projectName);
|
||||||
copyScripts(projectPath);
|
copyScripts(projectPath);
|
||||||
copyAntRules(projectPath);
|
copyBuildRules(projectPath);
|
||||||
removeDebuggableFromManifest(projectPath);
|
removeDebuggableFromManifest(projectPath);
|
||||||
return runAndroidUpdate(projectPath, target_api, false)
|
return runAndroidUpdate(projectPath, target_api, false)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user