File tree Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,14 @@ export class ProjectData implements IProjectData {
2424 // If no project found, projectDir should be null
2525 if ( projectDir ) {
2626 this . projectDir = projectDir ;
27- this . projectName = path . basename ( projectDir ) ;
27+ this . projectName = this . $projectHelper . sanitizeName ( path . basename ( projectDir ) ) ;
2828 this . platformsDir = path . join ( projectDir , "platforms" ) ;
2929 this . projectFilePath = path . join ( projectDir , this . $staticConfig . PROJECT_FILE_NAME ) ;
3030
3131 if ( this . $fs . exists ( this . projectFilePath ) . wait ( ) ) {
3232 try {
33- var fileContent = this . $fs . readJson ( this . projectFilePath ) . wait ( ) ;
34- this . projectId = fileContent . id ;
33+ var fileContent = this . $fs . readJson ( this . projectFilePath ) . wait ( ) ;
34+ this . projectId = fileContent . id ;
3535 } catch ( err ) {
3636 this . $errors . fail ( { formatStr : "The project file %s is corrupted." + os . EOL +
3737 "Consider restoring an earlier version from your source control or backup." + os . EOL +
Original file line number Diff line number Diff line change @@ -156,12 +156,6 @@ class AndroidProjectService implements IPlatformProjectService {
156156 return this . $fs . exists ( path . join ( projectRoot , "assets" , constants . APP_FOLDER_NAME ) ) ;
157157 }
158158
159- private generateBuildFile ( projDir : string , targetSdk : string ) : void {
160- this . $logger . info ( "Generate build.xml for %s" , projDir ) ;
161- var cmd = util . format ( "android update project -p %s --target %s --subprojects" , projDir , targetSdk ) ;
162- this . $childProcess . exec ( cmd ) . wait ( ) ;
163- }
164-
165159 private parseProjectProperties ( projDir : string , destDir : string ) : void {
166160 var projProp = path . join ( projDir , "project.properties" ) ;
167161
@@ -188,7 +182,8 @@ class AndroidProjectService implements IPlatformProjectService {
188182 var targetDir = path . join ( destDir , path . basename ( projDir ) ) ;
189183 // TODO: parametrize targetSdk
190184 var targetSdk = "android-17" ;
191- this . generateBuildFile ( targetDir , targetSdk ) ;
185+ this . $logger . info ( "Generate build.xml for %s" , targetDir ) ;
186+ this . runAndroidUpdate ( targetDir , targetSdk ) . wait ( ) ;
192187 }
193188
194189 private getProjectReferences ( projDir : string ) : ILibRef [ ] {
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import shell = require("shelljs");
1010import util = require( "util" ) ;
1111
1212export class ProjectService implements IProjectService {
13+ private static DEFAULT_APP_IDENTIFIER_PREFIX = "org.nativescript" ;
14+
1315 constructor ( private $errors : IErrors ,
1416 private $fs : IFileSystem ,
1517 private $logger : ILogger ,
@@ -25,7 +27,7 @@ export class ProjectService implements IProjectService {
2527 }
2628 this . $projectNameValidator . validate ( projectName ) ;
2729
28- var projectId = options . appid || this . $projectHelper . generateDefaultAppId ( projectName , "org.nativescript" ) ;
30+ var projectId = options . appid || this . $projectHelper . generateDefaultAppId ( projectName , ProjectService . DEFAULT_APP_IDENTIFIER_PREFIX ) ;
2931
3032 var projectDir = path . join ( path . resolve ( options . path || "." ) , projectName ) ;
3133 this . $fs . createDirectory ( projectDir ) . wait ( ) ;
Original file line number Diff line number Diff line change @@ -321,6 +321,10 @@ export class ProjectHelperStub implements IProjectHelper {
321321 generateDefaultAppId ( appName : string , baseAppId : string ) : string {
322322 return "org.nativescript" ;
323323 }
324+
325+ sanitizeName ( appName : string ) : string {
326+ return "" ;
327+ }
324328}
325329
326330export class ProjectTemplatesService implements IProjectTemplatesService {
You can’t perform that action at this time.
0 commit comments