diff --git a/bin/create b/bin/create index 7aaa7d61..9a4fc90b 100755 --- a/bin/create +++ b/bin/create @@ -32,5 +32,5 @@ if (args['--help'] || args._.length === 0) { 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(); diff --git a/bin/lib/create.js b/bin/lib/create.js index 7de29429..0ca877c1 100755 --- a/bin/lib/create.js +++ b/bin/lib/create.js @@ -116,7 +116,7 @@ function copyScripts(projectPath) { * 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(); // 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); // Manually create directories that would be empty within the template (since git doesn't track directories). 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 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.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, '.project')); shell.sed('-i', /__ID__/, package_name, activity_path); shell.cp('-f', path.join(project_template_dir, 'AndroidManifest.xml'), manifest_path); diff --git a/bin/templates/project/eclipse-project b/bin/templates/project/eclipse-project new file mode 100644 index 00000000..42bcc3ee --- /dev/null +++ b/bin/templates/project/eclipse-project @@ -0,0 +1,45 @@ + + + __NAME__ + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + + + 1388696068187 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-true-CordovaLib|platform_www|cordova + + + + + diff --git a/bin/templates/project/eclipse-project-CLI b/bin/templates/project/eclipse-project-CLI new file mode 100644 index 00000000..5772dec1 --- /dev/null +++ b/bin/templates/project/eclipse-project-CLI @@ -0,0 +1,67 @@ + + + __NAME__ + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + + + ** Cordova Project ** + 2 + virtual:/virtual + + + ** Cordova Project **/config.xml + 1 + $%7BPARENT-2-PROJECT_LOC%7D/www/config.xml + + + ** Cordova Project **/www + 2 + $%7BPARENT-2-PROJECT_LOC%7D/www + + + ** Cordova Project **/merges + 2 + $%7BPARENT-2-PROJECT_LOC%7D/merges + + + + + 1388696068187 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-true-CordovaLib|platform_www|cordova + + + + +