Skip to content

Commit

Permalink
Build for emulator by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatme Havaluova authored and Fatme Havaluova committed Feb 26, 2015
1 parent fe952b5 commit 44ff495
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var knownOpts:any = {
"release": Boolean,
"emulator": Boolean,
"symlink": Boolean,
"forDevice": Boolean,
"for-device": Boolean,
"keyStorePath": String,
"keyStorePassword": String,
"keyStoreAlias": String,
Expand Down
19 changes: 10 additions & 9 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,27 @@ class IOSProjectService implements IPlatformProjectService {
];
var args: string[] = [];

if(options.emulator) {
args = basicArgs.concat([
"-sdk", "iphonesimulator",
"-arch", "i386",
"VALID_ARCHS=\"i386\"",
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "emulator")
]);
} else {
if(options.forDevice) {
args = basicArgs.concat([
"-xcconfig", path.join(projectRoot, this.$projectData.projectName, "build.xcconfig"),
"-sdk", "iphoneos",
'ARCHS=armv7 arm64',
'VALID_ARCHS=armv7 arm64',
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "device")
]);
} else {
args = basicArgs.concat([
"-sdk", "iphonesimulator",
"-arch", "i386",
"VALID_ARCHS=\"i386\"",
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "emulator")
]);

}

this.$childProcess.spawnFromEvent("xcodebuild", args, "exit", {cwd: options, stdio: 'inherit'}).wait();

if(!options.emulator) {
if(options.forDevice) {
var buildOutputPath = path.join(projectRoot, "build", "device");

// Produce ipa file
Expand Down
9 changes: 6 additions & 3 deletions lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ export class PlatformService implements IPlatformService {

var platformData = this.$platformsData.getPlatformData(platform);

var cachedDeviceOption = options.forDevice;
options.forDevice = true;
this.buildPlatform(platform).wait();
options.forDevice = cachedDeviceOption;

packageFile = this.getLatestApplicationPackageForDevice(platformData).wait().packageName;
this.$logger.out("Using ", packageFile);
Expand Down Expand Up @@ -262,7 +265,10 @@ export class PlatformService implements IPlatformService {

var platformData = this.$platformsData.getPlatformData(platform);

var cachedDeviceOption = options.forDevice;
options.forDevice = true;
this.buildPlatform(platform).wait();
options.forDevice = cachedDeviceOption;

// Get latest package that is produced from build
var packageFile = this.getLatestApplicationPackageForDevice(platformData).wait().packageName;
Expand All @@ -287,10 +293,7 @@ export class PlatformService implements IPlatformService {
emulatorServices.checkDependencies().wait();

if(!options.availableDevices) {
var cachedEmulatorOption = options.emulator;
options.emulator = true;
this.buildPlatform(platform).wait();
options.emulator = cachedEmulatorOption;

var packageFile = this.getLatestApplicationPackageForEmulator(platformData).wait().packageName;
this.$logger.out("Using ", packageFile);
Expand Down

0 comments on commit 44ff495

Please sign in to comment.