Skip to content

Commit 83ef5ac

Browse files
author
Dimitar Kerezov
committed
Print info message upon android version code change
TP reference: [Inform the user about number appending upon android version code change](http://teampulse.telerik.com/view#item/306369)
1 parent c67ae58 commit 83ef5ac

File tree

6 files changed

+114
-1
lines changed

6 files changed

+114
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
prop print AndroidVersionCode
2+
==========
3+
4+
Usage | Synopsis
5+
------|-------
6+
General | `$ appbuilder prop print AndroidVersionCode [--valid-value]`
7+
8+
Prints information about the configuration of the AndroidVersionCode property.
9+
10+
<% if((isConsole && (isNativeScript || isCordova)) || isHtml) { %>
11+
### Options
12+
* `--valid-value` - When set, prints a description for the AndroidVersionCode property.
13+
<% } %>
14+
<% if(isHtml) { %>
15+
### Related Commands
16+
17+
Command | Description
18+
----------|----------
19+
[edit-configuration](edit-configuration.html) | `<ConfigurationFile>` is the configuration file that you want to open.
20+
[mobileframework](mobileframework.html) | Lists all supported versions of the current development framework.
21+
[mobileframework set](mobileframework-set.html) | Sets the selected development framework version for the project.
22+
[prop](prop.html) | Lets you manage the properties for your project.
23+
[prop print](prop-print.html) | Prints information about the configuration of the project or the selected property.
24+
[prop add](prop-add.html) | Enables more options for the selected project property, if the property accepts multiple values.
25+
[prop remove](prop-remove.html) | Disables options for the selected project property, if the property accepts multiple values.
26+
[prop set](prop-set.html) | Sets the selected project property and overwrites its current value.
27+
[resource](resource.html) | Lists information about the image resources for all mobile platforms.
28+
[resource create](resource-create.html) | Creates image resources for all mobile platforms from a single high-resolution image.
29+
[webview](webview.html) | Lists the available web views for iOS and Android.
30+
[webview set](webview-set.html) | Sets the selected web view for the current project.
31+
<% } %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
prop set AndroidVersionCode
2+
==========
3+
4+
Usage | Synopsis
5+
------|-------
6+
General | `$ appbuilder prop set AndroidVersionCode <Integer Value>`
7+
8+
Sets the AndroidVersionCode project property and overwrites its current value.
9+
10+
<% if(isHtml) { %>
11+
### Related Commands
12+
13+
Command | Description
14+
----------|----------
15+
[edit-configuration](edit-configuration.html) | `<ConfigurationFile>` is the configuration file that you want to open.
16+
[mobileframework](mobileframework.html) | Lists all supported versions of the current development framework.
17+
[mobileframework set](mobileframework-set.html) | Sets the selected development framework version for the project.
18+
[prop](prop.html) | Lets you manage the properties for your project.
19+
[prop print](prop-print.html) | Prints information about the configuration of the project or the selected property.
20+
[prop set](prop-set.html) | Sets the selected project property and overwrites its current value.
21+
[prop add](prop-add.html) | Enables more options for the selected project property, if the property accepts multiple values.
22+
[prop remove](prop-remove.html) | Disables options for the selected project property, if the property accepts multiple values.
23+
[resource](resource.html) | Lists information about the image resources for all mobile platforms.
24+
[resource create](resource-create.html) | Creates image resources for all mobile platforms from a single high-resolution image.
25+
[webview](webview.html) | Lists the available web views for iOS and Android.
26+
[webview set](webview-set.html) | Sets the selected web view for the current project.
27+
<% } %>

lib/bootstrap.ts

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ $injector.requireCommand("prop|remove", "./commands/prop/prop-remove");
102102
$injector.requireCommand("prop|print", "./commands/prop/prop-print");
103103
$injector.requireCommand("prop|print|frameworkversion", "./commands/framework-versions/print-versions");
104104
$injector.requireCommand("prop|set|frameworkversion", "./commands/framework-versions/set-version");
105+
$injector.requireCommand("prop|set|androidversioncode", "./commands/prop/prop-set-android-version-code");
106+
$injector.requireCommand("prop|print|androidversioncode", "./commands/prop/prop-print-android-version-code");
105107

106108
$injector.requireCommand("cloud|*list", "./commands/cloud-projects");
107109
$injector.requireCommand("cloud|export", "./commands/cloud-projects");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
///<reference path="../../.d.ts"/>
2+
"use strict";
3+
import {PrintProjectCommand} from "./prop-print";
4+
5+
export class PrintAndroidVersionCodeCommand extends PrintProjectCommand implements ICommand {
6+
constructor($staticConfig: IStaticConfig,
7+
$injector: IInjector,
8+
protected $options: IOptions,
9+
private $logger: ILogger,
10+
private $projectConstants: Project.IProjectConstants) {
11+
super($staticConfig, $injector, $options);
12+
}
13+
14+
public execute(args:string[]): IFuture<void> {
15+
return ((): void => {
16+
super.execute(["AndroidVersionCode"]).wait();
17+
if (this.$project.projectData.Framework === this.$projectConstants.TARGET_FRAMEWORK_IDENTIFIERS.Cordova && !this.$options.validValue) {
18+
this.$logger.printMarkdown("Your final AndroidVersionCode will be `%s2` because Apache Cordova automatically appends a specific number to the version code based on the target Android SDK and architecture. For more information, see https://issues.apache.org/jira/browse/CB-8976.", this.$project.projectData.AndroidVersionCode);
19+
}
20+
21+
}).future<void>()();
22+
}
23+
24+
allowedParameters:ICommandParameter[] = [];
25+
}
26+
$injector.registerCommand("prop|print|androidversioncode", PrintAndroidVersionCodeCommand);

lib/commands/prop/prop-print.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as projectPropertyCommandBaseLib from "./prop-command-base";
55
export class PrintProjectCommand extends projectPropertyCommandBaseLib.ProjectPropertyCommandBase implements ICommand {
66
constructor($staticConfig: IStaticConfig,
77
$injector: IInjector,
8-
private $options: IOptions) {
8+
protected $options: IOptions) {
99
super($staticConfig, $injector);
1010
if(!this.$options.validValue) {
1111
this.$project.ensureProject();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
///<reference path="../../.d.ts"/>
2+
"use strict";
3+
import {SetProjectPropertyCommand} from "./prop-set";
4+
5+
export class SetAndroidVersionCodeCommand extends SetProjectPropertyCommand implements ICommand {
6+
constructor($staticConfig: IStaticConfig,
7+
$injector: IInjector,
8+
private $logger: ILogger,
9+
private $projectConstants: Project.IProjectConstants) {
10+
super($staticConfig, $injector);
11+
}
12+
13+
canExecute(args: string[]): IFuture<boolean> {
14+
return this.$project.validateProjectProperty("AndroidVersionCode", args, "set");
15+
}
16+
17+
public execute(args: string[]): IFuture<void> {
18+
return ((): void => {
19+
super.execute(["AndroidVersionCode", args[0]]).wait();
20+
if (this.$project.projectData.Framework === this.$projectConstants.TARGET_FRAMEWORK_IDENTIFIERS.Cordova) {
21+
this.$logger.printMarkdown("Your final AndroidVersionCode will be `%s2` because Apache Cordova automatically appends a specific number to the version code based on the target Android SDK and architecture. For more information, see https://issues.apache.org/jira/browse/CB-8976.", args[0]);
22+
}
23+
24+
}).future<void>()();
25+
}
26+
}
27+
$injector.registerCommand("prop|set|androidversioncode", SetAndroidVersionCodeCommand);

0 commit comments

Comments
 (0)