Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build for emulator by default #247

Merged
merged 1 commit into from
Feb 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions resources/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ Options:
--[build|ios]--

Usage:
$ tns build ios [--device] [--release]
$ tns build ios [--forDevice] [--release]

Builds the project for iOS and produces an APP or IPA that you can manually deploy in the iOS Simulator or on device, respectively.

Before building for iOS device, verify that you have configured a valid pair of certificate and provisioning profile on your OS X system.

Options:
--release - If set, produces a release build. Otherwise, produces a debug build.
--device - If set, produces an application package that you can deploy on device.
--forDevice - If set, produces an application package that you can deploy on device.
Otherwise, produces a build that you can run only in the native iOS Simulator.

--[/]--
Expand Down