Skip to content

Conversation

@rosen-vladimirov
Copy link
Contributor

Add new option when adding platform: --platform-template. When it is used, CLI will use the specified template instead of the default template from the runtime. The path to the specified template will be saved in project's package.json, so next time when platform is added, the same template will be used.
In case when --platform-template is not passed, CLI will check the package.json and if there's value for the template, it will be used. Otherwise the default template from runtime will be used.

Sample usage:

$ tns create app1
$ cd app1
$ tns run android --platform-template https://github.com/rosen-vladimirov/android-platform-template/tarball/master

@rosen-vladimirov rosen-vladimirov self-assigned this Mar 4, 2016
@rosen-vladimirov rosen-vladimirov added this to the 1.7.0 milestone Mar 4, 2016
@rosen-vladimirov
Copy link
Contributor Author

Original PR - #1525

this.$projectDataService.initialize(this.$projectData.projectDir);
let customTemplateOptions = this.getPathToPlatformTemplate(this.$options.platformTemplate, platformData.frameworkPackageName).wait();
let pathToTemplate: string;
if(customTemplateOptions) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrite this:

let pathToTemplate = customTemplateOptions && customTemplateOptions.pathToTemplate;

@Mitko-Kerezov
Copy link
Contributor

👍 after addressing comments

@ikoevska
Copy link
Contributor

ikoevska commented Mar 7, 2016

Documentation? :D

@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/custom-native-templates branch 2 times, most recently from aac9dfb to 8c99799 Compare March 7, 2016 11:09
@rosen-vladimirov
Copy link
Contributor Author

@ikoevska thanks, I've updated the PR, can you check the documentation

* `--frameworkPath` - Sets the path to a NativeScript runtime for the specified platform that you want to use instead of the default runtime. If `--symlink` is specified, `<File Path>` must point to directory in which the runtime is already extracted. If `--symlink` is not specified, `<File Path>` must point to a valid npm package.
* `--frameworkPath` - Sets the path to a NativeScript runtime for the specified platform that you want to use instead of the default runtime. If `--symlink` is specified, `<File Path>` must point to directory in which the runtime is already extracted. If `--symlink` is not specified, `<File Path>` must point to a valid npm package.
* `--symlink` - Creates a symlink to a NativeScript runtime for the specified platform that you want to use instead of the default runtime. If `--frameworkPath` is specified, creates a symlink to the specified directory. If `--frameworkPath` is not specified, creates a symlink to platform runtime installed with your current version of NativeScript.
* `--sdk` - Sets the target Android SDK for the project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add a line for --platformTemplate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Set minimum required Android Build Tools 23.0.0
…ersions

Update requirement for Android Build Tools
Our system requirements point that JAVA_HOME must be set, but `tns doctor` is not strict about this.
With version 1.7.0 of the runtime, `jarsigner` from $JAVA_HOME/bin/jarsigner will be called explicitly, so we must be sure JAVA_HOME is correct.
`jarsigner` does not exist in JRE, so add logic to call it in order to verify that the currently set JAVA_HOME is correct.
Validate the information in the following order:
1) Check if JAVA_HOME is set. In case it is not, you cannot build for Android (`tns build android` will fail before starting).
2) Check if JAVA_HOME is correct by executing JAVA_HOME/bin/jarsigner - in case it does not exist - fail
3) Check if the version of the JAVA is correct by calling JAVA_HOME/bin/javac -version and compare it with min required one. In case it's lower - fail.

`tns doctor` will print warning in case any of the above check fails. `tns build android` and any other Android related build operations will fail.
Add new option when adding platform: `--platform-template`. When it is
used, CLI will use the specified template instead of the default template
from the runtime. The path to the specified template will be saved in
project's package.json, so next time when platform is added, the same
template will be used.
In case when `--platform-template` is not passed, CLI will check the
package.json and if there's value for the template, it will be used.
Otherwise the default template from runtime will be used.
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/custom-native-templates branch from 8c99799 to 2c52a34 Compare March 9, 2016 12:21
@rosen-vladimirov
Copy link
Contributor Author

retarget to release for 1.7.0 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants