Skip to content

Commit 24dd109

Browse files
author
Fatme
authored
Merge pull request #4550 from NativeScript/feature/webpack-only
feat: support only webpack workflow
2 parents 53d05f8 + d9241f8 commit 24dd109

File tree

179 files changed

+6263
-9831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+6263
-9831
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ branches:
33
- master
44
- release
55
- release-patch
6+
- feature/webpack-only
67
env:
78
global:
89
- DATE=$(date +%Y-%m-%d)

.travis/add-publishConfig.js

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ switch (branch) {
2626
case "master":
2727
packageDef.publishConfig.tag = "next";
2828
break;
29+
case "feature/webpack-only":
30+
packageDef.publishConfig.tag = "webpack";
31+
break;
2932
default:
3033
throw new Error(`Unable to publish as the branch ${branch} does not have corresponding tag. Supported branches are master (next tag), release (rc tag) and release-patch (patch tag)`);
3134
}

PublicAPI.md

-5
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,6 @@ interface IDebugData {
666666
*/
667667
applicationIdentifier: string;
668668

669-
/**
670-
* Path to .app built for iOS Simulator.
671-
*/
672-
pathToAppPackage?: string;
673-
674669
/**
675670
* The name of the application, for example `MyProject`.
676671
*/

docs/man_pages/project/creation/init.md

-25
This file was deleted.

lib/bootstrap.ts

+34-15
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@ $injector.require("performanceService", "./services/performance-service");
1111
$injector.requirePublic("projectService", "./services/project-service");
1212
$injector.require("androidProjectService", "./services/android-project-service");
1313
$injector.require("androidPluginBuildService", "./services/android-plugin-build-service");
14+
$injector.require("gradleCommandService", "./services/android/gradle-command-service");
15+
$injector.require("gradleBuildService", "./services/android/gradle-build-service");
16+
$injector.require("gradleBuildArgsService", "./services/android/gradle-build-args-service");
1417
$injector.require("iOSEntitlementsService", "./services/ios-entitlements-service");
1518
$injector.require("iOSExtensionsService", "./services/ios-extensions-service");
1619
$injector.require("iOSWatchAppService", "./services/ios-watch-app-service");
1720
$injector.require("iOSProjectService", "./services/ios-project-service");
1821
$injector.require("iOSProvisionService", "./services/ios-provision-service");
1922
$injector.require("xcconfigService", "./services/xcconfig-service");
23+
$injector.require("iOSSigningService", "./services/ios/ios-signing-service");
24+
$injector.require("xcodebuildArgsService", "./services/ios/xcodebuild-args-service");
25+
$injector.require("xcodebuildCommandService", "./services/ios/xcodebuild-command-service");
26+
$injector.require("xcodebuildService", "./services/ios/xcodebuild-service");
27+
$injector.require("exportOptionsPlistService", "./services/ios/export-options-plist-service");
2028

2129
$injector.require("cocoapodsService", "./services/cocoapods-service");
2230
$injector.require("cocoaPodsPlatformManager", "./services/cocoapods-platform-manager");
@@ -25,13 +33,31 @@ $injector.require("projectTemplatesService", "./services/project-templates-servi
2533
$injector.require("projectNameService", "./services/project-name-service");
2634
$injector.require("tnsModulesService", "./services/tns-modules-service");
2735

28-
$injector.require("platformsData", "./platforms-data");
29-
$injector.require("platformService", "./services/platform-service");
30-
$injector.require("preparePlatformJSService", "./services/prepare-platform-js-service");
31-
$injector.require("preparePlatformNativeService", "./services/prepare-platform-native-service");
36+
$injector.require("platformsDataService", "./services/platforms-data-service");
37+
$injector.require("addPlatformService", "./services/platform/add-platform-service");
38+
$injector.require("buildInfoFileService", "./services/build-info-file-service");
39+
$injector.require("prepareNativePlatformService", "./services/platform/prepare-native-platform-service");
40+
$injector.require("platformValidationService", "./services/platform/platform-validation-service");
3241

42+
$injector.require("buildArtefactsService", "./services/build-artefacts-service");
43+
44+
$injector.require("deviceInstallAppService", "./services/device/device-install-app-service");
45+
46+
$injector.require("platformController", "./controllers/platform-controller");
47+
$injector.require("prepareController", "./controllers/prepare-controller");
48+
$injector.require("deployController", "./controllers/deploy-controller");
49+
$injector.requirePublicClass("buildController", "./controllers/build-controller");
50+
$injector.requirePublicClass("runController", "./controllers/run-controller");
51+
$injector.requirePublicClass("debugController", "./controllers/debug-controller");
52+
$injector.requirePublicClass("previewAppController", "./controllers/preview-app-controller");
53+
54+
$injector.require("prepareDataService", "./services/prepare-data-service");
55+
$injector.require("buildDataService", "./services/build-data-service");
56+
57+
$injector.require("liveSyncServiceResolver", "./resolvers/livesync-service-resolver");
58+
59+
$injector.require("liveSyncProcessDataService", "./services/livesync-process-data-service");
3360
$injector.require("debugDataService", "./services/debug-data-service");
34-
$injector.requirePublicClass("debugService", "./services/debug-service");
3561
$injector.require("iOSDeviceDebugService", "./services/ios-device-debug-service");
3662
$injector.require("androidDeviceDebugService", "./services/android-device-debug-service");
3763

@@ -40,8 +66,6 @@ $injector.requirePublic("analyticsSettingsService", "./services/analytics-settin
4066
$injector.require("analyticsService", "./services/analytics/analytics-service");
4167
$injector.require("googleAnalyticsProvider", "./services/analytics/google-analytics-provider");
4268

43-
$injector.require("emulatorSettingsService", "./services/emulator-settings-service");
44-
4569
$injector.require("platformCommandParameter", "./platform-command-param");
4670
$injector.requireCommand("create", "./commands/create-project");
4771
$injector.requireCommand("generate", "./commands/generate");
@@ -59,8 +83,6 @@ $injector.requireCommand("debug|ios", "./commands/debug");
5983
$injector.requireCommand("debug|android", "./commands/debug");
6084

6185
$injector.requireCommand("prepare", "./commands/prepare");
62-
$injector.requireCommand("clean-app|ios", "./commands/clean-app");
63-
$injector.requireCommand("clean-app|android", "./commands/clean-app");
6486
$injector.requireCommand("build|ios", "./commands/build");
6587
$injector.requireCommand("build|android", "./commands/build");
6688
$injector.requireCommand("deploy", "./commands/deploy");
@@ -109,9 +131,6 @@ $injector.require("xcprojService", "./services/xcproj-service");
109131
$injector.require("versionsService", "./services/versions-service");
110132
$injector.requireCommand("install", "./commands/install");
111133

112-
$injector.require("projectInitService", "./services/project-init-service");
113-
$injector.requireCommand("init", "./commands/init");
114-
115134
$injector.require("infoService", "./services/info-service");
116135
$injector.requireCommand("info", "./commands/info");
117136

@@ -127,17 +146,16 @@ $injector.require("bundleValidatorHelper", "./helpers/bundle-validator-helper");
127146
$injector.require("androidBundleValidatorHelper", "./helpers/android-bundle-validator-helper");
128147
$injector.require("liveSyncCommandHelper", "./helpers/livesync-command-helper");
129148
$injector.require("deployCommandHelper", "./helpers/deploy-command-helper");
149+
$injector.require("platformCommandHelper", "./helpers/platform-command-helper");
130150
$injector.require("optionsTracker", "./helpers/options-track-helper");
131151

132152
$injector.requirePublicClass("localBuildService", "./services/local-build-service");
133-
$injector.requirePublicClass("liveSyncService", "./services/livesync/livesync-service");
134153
$injector.require("LiveSyncSocket", "./services/livesync/livesync-socket");
135154
$injector.requirePublicClass("androidLivesyncTool", "./services/livesync/android-livesync-tool");
136155
$injector.require("androidLiveSyncService", "./services/livesync/android-livesync-service");
137156
$injector.require("iOSLiveSyncService", "./services/livesync/ios-livesync-service");
138157
$injector.require("usbLiveSyncService", "./services/livesync/livesync-service"); // The name is used in https://github.com/NativeScript/nativescript-dev-typescript
139158
$injector.require("previewAppFilesService", "./services/livesync/playground/preview-app-files-service");
140-
$injector.require("previewAppLiveSyncService", "./services/livesync/playground/preview-app-livesync-service");
141159
$injector.require("previewAppLogProvider", "./services/livesync/playground/preview-app-log-provider");
142160
$injector.require("previewAppPluginsService", "./services/livesync/playground/preview-app-plugins-service");
143161
$injector.require("previewSdkService", "./services/livesync/playground/preview-sdk-service");
@@ -191,11 +209,12 @@ $injector.require("hmrStatusService", "./services/hmr-status-service");
191209
$injector.require("pacoteService", "./services/pacote-service");
192210
$injector.require("qrCodeTerminalService", "./services/qr-code-terminal-service");
193211
$injector.require("testInitializationService", "./services/test-initialization-service");
194-
$injector.require("workflowService", "./services/workflow-service");
195212

196213
$injector.require("networkConnectivityValidator", "./helpers/network-connectivity-validator");
197214
$injector.requirePublic("cleanupService", "./services/cleanup-service");
198215

216+
$injector.require("webpackCompilerService", "./services/webpack/webpack-compiler-service");
217+
199218
$injector.require("applePortalSessionService", "./services/apple-portal/apple-portal-session-service");
200219
$injector.require("applePortalCookieService", "./services/apple-portal/apple-portal-cookie-service");
201220
$injector.require("applePortalApplicationService", "./services/apple-portal/apple-portal-application-service");

lib/commands/add-platform.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ export class AddPlatformCommand extends ValidatePlatformCommandBase implements I
44
public allowedParameters: ICommandParameter[] = [];
55

66
constructor($options: IOptions,
7-
$platformService: IPlatformService,
7+
private $platformCommandHelper: IPlatformCommandHelper,
8+
$platformValidationService: IPlatformValidationService,
89
$projectData: IProjectData,
9-
$platformsData: IPlatformsData,
10+
$platformsDataService: IPlatformsDataService,
1011
private $errors: IErrors) {
11-
super($options, $platformsData, $platformService, $projectData);
12+
super($options, $platformsDataService, $platformValidationService, $projectData);
1213
this.$projectData.initializeProjectData();
1314
}
1415

1516
public async execute(args: string[]): Promise<void> {
16-
await this.$platformService.addPlatforms(args, this.$options.platformTemplate, this.$projectData, this.$options, this.$options.frameworkPath);
17+
await this.$platformCommandHelper.addPlatforms(args, this.$projectData, this.$options.frameworkPath);
1718
}
1819

1920
public async canExecute(args: string[]): Promise<ICanExecuteCommandOutput> {
@@ -23,9 +24,9 @@ export class AddPlatformCommand extends ValidatePlatformCommandBase implements I
2324

2425
let canExecute = true;
2526
for (const arg of args) {
26-
this.$platformService.validatePlatform(arg, this.$projectData);
27+
this.$platformValidationService.validatePlatform(arg, this.$projectData);
2728

28-
if (!this.$platformService.isPlatformSupportedForOS(arg, this.$projectData)) {
29+
if (!this.$platformValidationService.isPlatformSupportedForOS(arg, this.$projectData)) {
2930
this.$errors.fail(`Applications for platform ${arg} can not be built on this OS`);
3031
}
3132

lib/commands/appstore-list.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ export class ListiOSApps implements ICommand {
99
private $logger: ILogger,
1010
private $projectData: IProjectData,
1111
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
12-
private $platformService: IPlatformService,
12+
private $platformValidationService: IPlatformValidationService,
1313
private $errors: IErrors,
1414
private $prompter: IPrompter) {
1515
this.$projectData.initializeProjectData();
1616
}
1717

1818
public async execute(args: string[]): Promise<void> {
19-
if (!this.$platformService.isPlatformSupportedForOS(this.$devicePlatformsConstants.iOS, this.$projectData)) {
19+
if (!this.$platformValidationService.isPlatformSupportedForOS(this.$devicePlatformsConstants.iOS, this.$projectData)) {
2020
this.$errors.fail(`Applications for platform ${this.$devicePlatformsConstants.iOS} can not be built on this OS`);
2121
}
2222

lib/commands/appstore-upload.ts

+19-57
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { StringCommandParameter } from "../common/command-params";
21
import * as path from "path";
3-
import { IOSProjectService } from "../services/ios-project-service";
2+
import { StringCommandParameter } from "../common/command-params";
3+
import { BuildController } from "../controllers/build-controller";
4+
import { IOSBuildData } from "../data/build-data";
45

56
export class PublishIOS implements ICommand {
67
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector),
@@ -15,26 +16,18 @@ export class PublishIOS implements ICommand {
1516
private $prompter: IPrompter,
1617
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
1718
private $hostInfo: IHostInfo,
18-
private $errors: IErrors) {
19+
private $errors: IErrors,
20+
private $buildController: BuildController,
21+
private $platformValidationService: IPlatformValidationService
22+
) {
1923
this.$projectData.initializeProjectData();
2024
}
2125

22-
private get $platformsData(): IPlatformsData {
23-
return this.$injector.resolve("platformsData");
24-
}
25-
26-
// This property was introduced due to the fact that the $platformService dependency
27-
// ultimately tries to resolve the current project's dir and fails if not executed from within a project
28-
private get $platformService(): IPlatformService {
29-
return this.$injector.resolve("platformService");
30-
}
31-
3226
public async execute(args: string[]): Promise<void> {
3327
let username = args[0];
3428
let password = args[1];
3529
const mobileProvisionIdentifier = args[2];
3630
const codeSignIdentity = args[3];
37-
const teamID = this.$options.teamId;
3831
let ipaFilePath = this.$options.ipa ? path.resolve(this.$options.ipa) : null;
3932

4033
if (!username) {
@@ -54,55 +47,24 @@ export class PublishIOS implements ICommand {
5447
}
5548

5649
this.$options.release = true;
50+
const platform = this.$devicePlatformsConstants.iOS.toLowerCase();
5751

5852
if (!ipaFilePath) {
59-
const platform = this.$devicePlatformsConstants.iOS;
6053
// No .ipa path provided, build .ipa on out own.
61-
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = {
62-
bundle: !!this.$options.bundle,
63-
release: this.$options.release,
64-
useHotModuleReload: false
65-
};
66-
const platformInfo: IPreparePlatformInfo = {
67-
platform,
68-
appFilesUpdaterOptions,
69-
platformTemplate: this.$options.platformTemplate,
70-
projectData: this.$projectData,
71-
config: this.$options,
72-
env: this.$options.env
73-
};
74-
7554
if (mobileProvisionIdentifier || codeSignIdentity) {
76-
const iOSBuildConfig: IBuildConfig = {
77-
projectDir: this.$options.path,
78-
release: this.$options.release,
79-
device: this.$options.device,
80-
provision: this.$options.provision,
81-
teamId: this.$options.teamId,
82-
buildForDevice: true,
83-
iCloudContainerEnvironment: this.$options.iCloudContainerEnvironment,
84-
mobileProvisionIdentifier,
85-
codeSignIdentity
86-
};
87-
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
8855
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
89-
await this.$platformService.preparePlatform(platformInfo);
90-
await this.$platformService.buildPlatform(platform, iOSBuildConfig, this.$projectData);
91-
ipaFilePath = this.$platformService.lastOutputPath(platform, iOSBuildConfig, this.$projectData);
92-
} else {
93-
this.$logger.info("No .ipa, mobile provision or certificate set. Perfect! Now we'll build .xcarchive and let Xcode pick the distribution certificate and provisioning profile for you when exporting .ipa for AppStore submission.");
94-
await this.$platformService.preparePlatform(platformInfo);
95-
96-
const platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
97-
const iOSProjectService = <IOSProjectService>platformData.platformProjectService;
98-
99-
const archivePath = await iOSProjectService.archive(this.$projectData);
100-
this.$logger.info("Archive at: " + archivePath);
56+
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
10157

102-
const exportPath = await iOSProjectService.exportArchive(this.$projectData, { archivePath, teamID, provision: mobileProvisionIdentifier || this.$options.provision });
103-
this.$logger.info("Export at: " + exportPath);
58+
// As we need to build the package for device
59+
this.$options.forDevice = true;
10460

105-
ipaFilePath = exportPath;
61+
const buildData = new IOSBuildData(this.$projectData.projectDir, platform, this.$options);
62+
ipaFilePath = await this.$buildController.prepareAndBuild(buildData);
63+
} else {
64+
this.$logger.info("No .ipa, mobile provision or certificate set. Perfect! Now we'll build .xcarchive and let Xcode pick the distribution certificate and provisioning profile for you when exporting .ipa for AppStore submission.");
65+
const buildData = new IOSBuildData(this.$projectData.projectDir, platform, { ...this.$options, buildForAppStore: true });
66+
ipaFilePath = await this.$buildController.prepareAndBuild(buildData);
67+
this.$logger.info(`Export at: ${ipaFilePath}`);
10668
}
10769
}
10870

@@ -120,7 +82,7 @@ export class PublishIOS implements ICommand {
12082
this.$errors.failWithoutHelp("iOS publishing is only available on Mac OS X.");
12183
}
12284

123-
if (!this.$platformService.isPlatformSupportedForOS(this.$devicePlatformsConstants.iOS, this.$projectData)) {
85+
if (!this.$platformValidationService.isPlatformSupportedForOS(this.$devicePlatformsConstants.iOS, this.$projectData)) {
12486
this.$errors.fail(`Applications for platform ${this.$devicePlatformsConstants.iOS} can not be built on this OS`);
12587
}
12688

0 commit comments

Comments
 (0)