Skip to content

Commit 78677fd

Browse files
FatmeFatme
authored andcommitted
Merge pull request #462 from NativeScript/fatme/cherrypick-commits-1.0.1
Cherrypick commits for 1.0.1release
2 parents e6e3b6a + 05f91d1 commit 78677fd

File tree

8 files changed

+16
-17
lines changed

8 files changed

+16
-17
lines changed

lib/project-data.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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 +

lib/services/android-project-service.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff 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[]{

lib/services/ios-debug-service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,11 @@ class IOSDebugService implements IDebugService {
6666

6767
private emulatorDebugBrk(): IFuture<void> {
6868
return (() => {
69-
var device = this.getRunningEmulatorOrRunNew().wait();
7069
var platformData = this.$platformsData.getPlatformData(this.platform);
7170
this.$platformService.buildPlatform(this.platform).wait();
7271
var emulatorPackage = this.$platformService.getLatestApplicationPackageForEmulator(platformData).wait();
73-
device.installApp(emulatorPackage.packageName).wait();
7472
this.executeOpenDebuggerClient().wait();
75-
device.launchApp(this.$projectData.projectId, "--nativescript-debug-brk").wait();
73+
this.$iOSEmulatorServices.startEmulator(emulatorPackage.packageName, { args: "--nativescript-debug-brk" }).wait();
7674
}).future<void>()();
7775
}
7876

lib/services/ios-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class IOSProjectService implements IPlatformProjectService {
230230
this.$errors.failWithoutHelp("The bundle at %s does not contain an Info.plist file.", libraryPath);
231231
}
232232

233-
var packageType = this.$childProcess.exec('/usr/libexec/PlistBuddy -c "Print :CFBundlePackageType" ' + infoPlistPath).wait().trim();
233+
var packageType = this.$childProcess.exec(`/usr/libexec/PlistBuddy -c "Print :CFBundlePackageType" "${infoPlistPath}"`).wait().trim();
234234
if (packageType !== "FMWK") {
235235
this.$errors.failWithoutHelp("The bundle at %s does not appear to be a dynamic framework.", libraryPath);
236236
}

lib/services/project-service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import shell = require("shelljs");
1010
import util = require("util");
1111

1212
export 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();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"gaze": "0.5.1",
3737
"iconv-lite": "0.4.4",
3838
"inquirer": "0.8.2",
39-
"ios-sim-portable": "1.0.5",
39+
"ios-sim-portable": "1.0.6",
4040
"lockfile": "1.0.0",
4141
"lodash": "3.6.0",
4242
"log4js": "0.6.22",

test/stubs.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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

326330
export class ProjectTemplatesService implements IProjectTemplatesService {

0 commit comments

Comments
 (0)