Skip to content

Commit 44ff495

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Build for emulator by default
1 parent fe952b5 commit 44ff495

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

lib/options.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ var knownOpts:any = {
1515
"release": Boolean,
1616
"emulator": Boolean,
1717
"symlink": Boolean,
18+
"forDevice": Boolean,
19+
"for-device": Boolean,
1820
"keyStorePath": String,
1921
"keyStorePassword": String,
2022
"keyStoreAlias": String,

lib/services/ios-project-service.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,26 +132,27 @@ class IOSProjectService implements IPlatformProjectService {
132132
];
133133
var args: string[] = [];
134134

135-
if(options.emulator) {
136-
args = basicArgs.concat([
137-
"-sdk", "iphonesimulator",
138-
"-arch", "i386",
139-
"VALID_ARCHS=\"i386\"",
140-
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "emulator")
141-
]);
142-
} else {
135+
if(options.forDevice) {
143136
args = basicArgs.concat([
144137
"-xcconfig", path.join(projectRoot, this.$projectData.projectName, "build.xcconfig"),
145138
"-sdk", "iphoneos",
146139
'ARCHS=armv7 arm64',
147140
'VALID_ARCHS=armv7 arm64',
148141
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "device")
149142
]);
143+
} else {
144+
args = basicArgs.concat([
145+
"-sdk", "iphonesimulator",
146+
"-arch", "i386",
147+
"VALID_ARCHS=\"i386\"",
148+
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "emulator")
149+
]);
150+
150151
}
151152

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

154-
if(!options.emulator) {
155+
if(options.forDevice) {
155156
var buildOutputPath = path.join(projectRoot, "build", "device");
156157

157158
// Produce ipa file

lib/services/platform-service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ export class PlatformService implements IPlatformService {
218218

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

221+
var cachedDeviceOption = options.forDevice;
222+
options.forDevice = true;
221223
this.buildPlatform(platform).wait();
224+
options.forDevice = cachedDeviceOption;
222225

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

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

268+
var cachedDeviceOption = options.forDevice;
269+
options.forDevice = true;
265270
this.buildPlatform(platform).wait();
271+
options.forDevice = cachedDeviceOption;
266272

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

289295
if(!options.availableDevices) {
290-
var cachedEmulatorOption = options.emulator;
291-
options.emulator = true;
292296
this.buildPlatform(platform).wait();
293-
options.emulator = cachedEmulatorOption;
294297

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

0 commit comments

Comments
 (0)