mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-31 17:32:51 +08:00
CB-5715 Add Eclipse .project file to create template.
Adds resource filter to hide CordovaLib/, platform_www/, and cordova/. Adds linked resources to root www/, merges/, config.xml
This commit is contained in:
parent
942c77816d
commit
5e0479e414
@ -32,5 +32,5 @@ if (args['--help'] || args._.length === 0) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
create.createProject(args._[0], args._[1], args._[2], args._[3], args['--shared']).done();
|
create.createProject(args._[0], args._[1], args._[2], args._[3], args['--shared'], args['--cli']).done();
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ function copyScripts(projectPath) {
|
|||||||
* Returns a promise.
|
* Returns a promise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.createProject = function(project_path, package_name, project_name, project_template_dir, use_shared_project) {
|
exports.createProject = function(project_path, package_name, project_name, project_template_dir, use_shared_project, use_cli_template) {
|
||||||
var VERSION = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
|
var VERSION = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
|
||||||
|
|
||||||
// Set default values for path, package and name
|
// Set default values for path, package and name
|
||||||
@ -162,6 +162,12 @@ exports.createProject = function(project_path, package_name, project_name, proje
|
|||||||
shell.cp('-r', path.join(project_template_dir, 'res'), project_path);
|
shell.cp('-r', path.join(project_template_dir, 'res'), project_path);
|
||||||
// Manually create directories that would be empty within the template (since git doesn't track directories).
|
// Manually create directories that would be empty within the template (since git doesn't track directories).
|
||||||
shell.mkdir(path.join(project_path, 'libs'));
|
shell.mkdir(path.join(project_path, 'libs'));
|
||||||
|
// Add in the proper eclipse project file.
|
||||||
|
if (use_cli_template) {
|
||||||
|
shell.cp(path.join(project_template_dir, 'eclipse-project-CLI'), path.join(project_path, '.project'));
|
||||||
|
} else {
|
||||||
|
shell.cp(path.join(project_template_dir, 'eclipse-project'), path.join(project_path, '.project'));
|
||||||
|
}
|
||||||
|
|
||||||
// copy cordova.js, cordova.jar and res/xml
|
// copy cordova.js, cordova.jar and res/xml
|
||||||
shell.cp('-r', path.join(ROOT, 'framework', 'res', 'xml'), path.join(project_path, 'res'));
|
shell.cp('-r', path.join(ROOT, 'framework', 'res', 'xml'), path.join(project_path, 'res'));
|
||||||
@ -172,6 +178,7 @@ exports.createProject = function(project_path, package_name, project_name, proje
|
|||||||
shell.cp('-f', path.join(project_template_dir, 'Activity.java'), activity_path);
|
shell.cp('-f', path.join(project_template_dir, 'Activity.java'), activity_path);
|
||||||
shell.sed('-i', /__ACTIVITY__/, safe_activity_name, activity_path);
|
shell.sed('-i', /__ACTIVITY__/, safe_activity_name, activity_path);
|
||||||
shell.sed('-i', /__NAME__/, project_name, path.join(project_path, 'res', 'values', 'strings.xml'));
|
shell.sed('-i', /__NAME__/, project_name, path.join(project_path, 'res', 'values', 'strings.xml'));
|
||||||
|
shell.sed('-i', /__NAME__/, project_name, path.join(project_path, '.project'));
|
||||||
shell.sed('-i', /__ID__/, package_name, activity_path);
|
shell.sed('-i', /__ID__/, package_name, activity_path);
|
||||||
|
|
||||||
shell.cp('-f', path.join(project_template_dir, 'AndroidManifest.xml'), manifest_path);
|
shell.cp('-f', path.join(project_template_dir, 'AndroidManifest.xml'), manifest_path);
|
||||||
|
45
bin/templates/project/eclipse-project
Normal file
45
bin/templates/project/eclipse-project
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>__NAME__</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1388696068187</id>
|
||||||
|
<name></name>
|
||||||
|
<type>10</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-true-CordovaLib|platform_www|cordova</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
||||||
|
|
67
bin/templates/project/eclipse-project-CLI
Normal file
67
bin/templates/project/eclipse-project-CLI
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>__NAME__</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
<linkedResources>
|
||||||
|
<link>
|
||||||
|
<name>** Cordova Project **</name>
|
||||||
|
<type>2</type>
|
||||||
|
<locationURI>virtual:/virtual</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>** Cordova Project **/config.xml</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>$%7BPARENT-2-PROJECT_LOC%7D/www/config.xml</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>** Cordova Project **/www</name>
|
||||||
|
<type>2</type>
|
||||||
|
<locationURI>$%7BPARENT-2-PROJECT_LOC%7D/www</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>** Cordova Project **/merges</name>
|
||||||
|
<type>2</type>
|
||||||
|
<locationURI>$%7BPARENT-2-PROJECT_LOC%7D/merges</locationURI>
|
||||||
|
</link>
|
||||||
|
</linkedResources>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1388696068187</id>
|
||||||
|
<name></name>
|
||||||
|
<type>10</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-true-CordovaLib|platform_www|cordova</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user