Skip to content

Commit 4c560c6

Browse files
author
Dimitar Tachev
authored
Merge pull request #5042 from NativeScript/tachev/marking-mode-warnings
feat: deprecate `markingMode:full`
2 parents 72f0d56 + 04b2ee1 commit 4c560c6

22 files changed

+160
-21
lines changed

lib/bootstrap.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,4 @@ $injector.requirePublicClass("initializeService", "./services/initialize-service
232232
$injector.require("npmConfigService", "./services/npm-config-service");
233233
$injector.require("ipService", "./services/ip-service");
234234
$injector.require("jsonFileSettingsService", "./common/services/json-file-settings-service");
235+
$injector.require("markingModeService", "./services/marking-mode-service");

lib/commands/build.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,13 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
9797
protected $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
9898
$buildDataService: IBuildDataService,
9999
protected $logger: ILogger,
100-
private $migrateController: IMigrateController) {
100+
private $migrateController: IMigrateController,
101+
private $markingModeService: IMarkingModeService) {
101102
super($options, $errors, $projectData, platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $buildDataService, $logger);
102103
}
103104

104105
public async execute(args: string[]): Promise<void> {
106+
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: this.$projectData.projectDir, skipWarnings: true });
105107
await this.executeCore([this.$devicePlatformsConstants.Android.toLowerCase()]);
106108

107109
if (this.$options.aab) {

lib/commands/debug.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,13 @@ export class DebugAndroidCommand implements ICommand {
157157
constructor(protected $errors: IErrors,
158158
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
159159
private $injector: IInjector,
160-
private $projectData: IProjectData) {
160+
private $projectData: IProjectData,
161+
private $markingModeService: IMarkingModeService) {
161162
this.$projectData.initializeProjectData();
162163
}
163164

164-
public execute(args: string[]): Promise<void> {
165+
public async execute(args: string[]): Promise<void> {
166+
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: this.$projectData.projectDir, skipWarnings: true });
165167
return this.debugPlatformCommand.execute(args);
166168
}
167169
public async canExecute(args: string[]): Promise<boolean> {

lib/commands/deploy.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,42 @@ export class DeployOnDeviceCommand extends ValidatePlatformCommandBase implement
1818
private $mobileHelper: Mobile.IMobileHelper,
1919
$platformsDataService: IPlatformsDataService,
2020
private $deployCommandHelper: DeployCommandHelper,
21-
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper) {
21+
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
22+
private $markingModeService: IMarkingModeService,
23+
private $migrateController: IMigrateController) {
2224
super($options, $platformsDataService, $platformValidationService, $projectData);
2325
this.$projectData.initializeProjectData();
2426
}
2527

2628
public async execute(args: string[]): Promise<void> {
27-
const platform = args[0].toLowerCase();
29+
const platform = args[0];
30+
if (this.$mobileHelper.isAndroidPlatform(platform)) {
31+
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: this.$projectData.projectDir, skipWarnings: true });
32+
}
33+
2834
await this.$deployCommandHelper.deploy(platform);
2935
}
3036

3137
public async canExecute(args: string[]): Promise<boolean> {
38+
const platform = args[0];
39+
if (!this.$options.force) {
40+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
41+
}
42+
3243
this.$androidBundleValidatorHelper.validateNoAab();
3344
if (!args || !args.length || args.length > 1) {
3445
return false;
3546
}
3647

37-
if (!(await this.$platformCommandParameter.validate(args[0]))) {
48+
if (!(await this.$platformCommandParameter.validate(platform))) {
3849
return false;
3950
}
4051

41-
if (this.$mobileHelper.isAndroidPlatform(args[0]) && this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
52+
if (this.$mobileHelper.isAndroidPlatform(platform) && this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
4253
this.$errors.failWithHelp(ANDROID_RELEASE_BUILD_ERROR_MESSAGE);
4354
}
4455

45-
const result = await super.canExecuteCommandBase(args[0], { validateOptions: true });
56+
const result = await super.canExecuteCommandBase(platform, { validateOptions: true });
4657
return result;
4758
}
4859
}

lib/commands/prepare.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@ export class PrepareCommand extends ValidatePlatformCommandBase implements IComm
1717
private $platformCommandParameter: ICommandParameter,
1818
$platformsDataService: IPlatformsDataService,
1919
private $prepareDataService: PrepareDataService,
20-
private $migrateController: IMigrateController) {
20+
private $migrateController: IMigrateController,
21+
private $markingModeService: IMarkingModeService,
22+
private $mobileHelper: Mobile.IMobileHelper) {
2123
super($options, $platformsDataService, $platformValidationService, $projectData);
2224
this.$projectData.initializeProjectData();
2325
}
2426

2527
public async execute(args: string[]): Promise<void> {
2628
const platform = args[0];
29+
if (this.$mobileHelper.isAndroidPlatform(platform)) {
30+
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: this.$projectData.projectDir, skipWarnings: true });
31+
}
2732

2833
const prepareData = this.$prepareDataService.getPrepareData(this.$projectData.projectDir, platform, this.$options);
2934
await this.$prepareController.prepare(prepareData);

lib/commands/preview.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ export class PreviewCommand implements ICommand {
1313
private $options: IOptions,
1414
private $previewAppLogProvider: IPreviewAppLogProvider,
1515
private $previewQrCodeService: IPreviewQrCodeService,
16-
$cleanupService: ICleanupService) {
16+
$cleanupService: ICleanupService,
17+
private $markingModeService: IMarkingModeService) {
1718
this.$analyticsService.setShouldDispose(false);
1819
$cleanupService.setShouldDispose(false);
1920
}
2021

2122
public async execute(): Promise<void> {
23+
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: this.$projectData.projectDir, skipWarnings: true });
2224
this.$previewAppLogProvider.on(DEVICE_LOG_EVENT_NAME, (deviceId: string, message: string) => {
2325
this.$logger.info(message);
2426
});

lib/commands/run.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ export class RunAndroidCommand implements ICommand {
113113
private $options: IOptions,
114114
private $platformValidationService: IPlatformValidationService,
115115
private $projectData: IProjectData,
116+
private $markingModeService: IMarkingModeService
116117
) { }
117118

118-
public execute(args: string[]): Promise<void> {
119+
public async execute(args: string[]): Promise<void> {
120+
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: this.$projectData.projectDir, skipWarnings: true });
119121
return this.runCommand.execute(args);
120122
}
121123

lib/commands/test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ abstract class TestCommandBase {
1616
protected abstract $devicesService: Mobile.IDevicesService;
1717
protected abstract $migrateController: IMigrateController;
1818

19-
async execute(args: string[]): Promise<void> {
19+
public async execute(args: string[]): Promise<void> {
2020
let devices = [];
2121
if (this.$options.debugBrk) {
2222
await this.$devicesService.initialize({
@@ -102,9 +102,15 @@ class TestAndroidCommand extends TestCommandBase implements ICommand {
102102
protected $cleanupService: ICleanupService,
103103
protected $liveSyncCommandHelper: ILiveSyncCommandHelper,
104104
protected $devicesService: Mobile.IDevicesService,
105-
protected $migrateController: IMigrateController) {
105+
protected $migrateController: IMigrateController,
106+
protected $markingModeService: IMarkingModeService) {
106107
super();
107108
}
109+
110+
public async execute(args: string[]): Promise<void> {
111+
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: this.$projectData.projectDir, skipWarnings: true });
112+
await super.execute(args);
113+
}
108114
}
109115

110116
class TestIosCommand extends TestCommandBase implements ICommand {

lib/commands/update.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ export class UpdateCommand implements ICommand {
1010
private $options: IOptions,
1111
private $errors: IErrors,
1212
private $logger: ILogger,
13-
private $projectData: IProjectData) {
13+
private $projectData: IProjectData,
14+
private $markingModeService: IMarkingModeService) {
1415
this.$projectData.initializeProjectData();
1516
}
1617

1718
public async execute(args: string[]): Promise<void> {
19+
if (this.$options.markingMode) {
20+
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: this.$projectData.projectDir, forceSwitch: true });
21+
return;
22+
}
23+
1824
if (!await this.$updateController.shouldUpdate({ projectDir: this.$projectData.projectDir, version: args[0] })) {
1925
this.$logger.printMarkdown(`__${UpdateCommand.PROJECT_UP_TO_DATE_MESSAGE}__`);
2026
return;

lib/controllers/prepare-controller.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ export class PrepareController extends EventEmitter {
2727
private $projectDataService: IProjectDataService,
2828
private $webpackCompilerService: IWebpackCompilerService,
2929
private $watchIgnoreListService: IWatchIgnoreListService,
30-
private $analyticsService: IAnalyticsService
30+
private $analyticsService: IAnalyticsService,
31+
private $markingModeService: IMarkingModeService
3132
) { super(); }
3233

3334
public async prepare(prepareData: IPrepareData): Promise<IPrepareResultData> {
3435
const projectData = this.$projectDataService.getProjectData(prepareData.projectDir);
36+
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: projectData.projectDir });
3537

3638
await this.trackRuntimeVersion(prepareData.platform, projectData);
3739
await this.$pluginsService.ensureAllDependenciesAreInstalled(projectData);
@@ -187,8 +189,8 @@ export class PrepareController extends EventEmitter {
187189
path.join(projectData.getAppDirectoryPath(), PACKAGE_JSON_FILE_NAME),
188190
path.join(projectData.getAppResourcesRelativeDirectoryPath(), platformData.normalizedPlatformName),
189191
]
190-
.concat(pluginsNativeDirectories)
191-
.concat(pluginsPackageJsonFiles);
192+
.concat(pluginsNativeDirectories)
193+
.concat(pluginsPackageJsonFiles);
192194

193195
return patterns;
194196
}

0 commit comments

Comments
 (0)