File tree 4 files changed +12
-11
lines changed
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 {
24
24
// If no project found, projectDir should be null
25
25
if ( projectDir ) {
26
26
this . projectDir = projectDir ;
27
- this . projectName = path . basename ( projectDir ) ;
27
+ this . projectName = this . $projectHelper . sanitizeName ( path . basename ( projectDir ) ) ;
28
28
this . platformsDir = path . join ( projectDir , "platforms" ) ;
29
29
this . projectFilePath = path . join ( projectDir , this . $staticConfig . PROJECT_FILE_NAME ) ;
30
30
31
31
if ( this . $fs . exists ( this . projectFilePath ) . wait ( ) ) {
32
32
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 ;
35
35
} catch ( err ) {
36
36
this . $errors . fail ( { formatStr : "The project file %s is corrupted." + os . EOL +
37
37
"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 {
156
156
return this . $fs . exists ( path . join ( projectRoot , "assets" , constants . APP_FOLDER_NAME ) ) ;
157
157
}
158
158
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
-
165
159
private parseProjectProperties ( projDir : string , destDir : string ) : void {
166
160
var projProp = path . join ( projDir , "project.properties" ) ;
167
161
@@ -188,7 +182,8 @@ class AndroidProjectService implements IPlatformProjectService {
188
182
var targetDir = path . join ( destDir , path . basename ( projDir ) ) ;
189
183
// TODO: parametrize targetSdk
190
184
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 ( ) ;
192
187
}
193
188
194
189
private getProjectReferences ( projDir : string ) : ILibRef [ ] {
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import shell = require("shelljs");
10
10
import util = require( "util" ) ;
11
11
12
12
export class ProjectService implements IProjectService {
13
+ private static DEFAULT_APP_IDENTIFIER_PREFIX = "org.nativescript" ;
14
+
13
15
constructor ( private $errors : IErrors ,
14
16
private $fs : IFileSystem ,
15
17
private $logger : ILogger ,
@@ -25,7 +27,7 @@ export class ProjectService implements IProjectService {
25
27
}
26
28
this . $projectNameValidator . validate ( projectName ) ;
27
29
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 ) ;
29
31
30
32
var projectDir = path . join ( path . resolve ( options . path || "." ) , projectName ) ;
31
33
this . $fs . createDirectory ( projectDir ) . wait ( ) ;
Original file line number Diff line number Diff line change @@ -321,6 +321,10 @@ export class ProjectHelperStub implements IProjectHelper {
321
321
generateDefaultAppId ( appName : string , baseAppId : string ) : string {
322
322
return "org.nativescript" ;
323
323
}
324
+
325
+ sanitizeName ( appName : string ) : string {
326
+ return "" ;
327
+ }
324
328
}
325
329
326
330
export class ProjectTemplatesService implements IProjectTemplatesService {
You can’t perform that action at this time.
0 commit comments