Skip to content

Commit 6d2c76e

Browse files
Merge pull request #1664 from NativeScript/vladimirov/merge-rel-master
Merge release in master
2 parents 9a211ff + a4ae4c5 commit 6d2c76e

File tree

6 files changed

+104
-26
lines changed

6 files changed

+104
-26
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
NativeScript CLI Changelog
22
================
33

4+
1.7.1 (2016, March 30)
5+
==
6+
7+
### New
8+
* [Implemented #1634](https://github.com/NativeScript/nativescript-cli/issues/1634): Replace plugin variables in all .xml files of android's plugin code.
9+
10+
### Fixed
11+
* [Fixed #1610](https://github.com/NativeScript/nativescript-cli/issues/1610): `tns plugin add <plugin>` has issues with postinstall scripts.
12+
* [Fixed #1610](https://github.com/NativeScript/nativescript-cli/issues/1612): Unable to execute unit tests on iOS Simulator in some cases.
13+
* [Fixed #1619](https://github.com/NativeScript/nativescript-cli/issues/1619): Wrong error message on installation (or `tns doctor` command).
14+
* [Fixed #1625](https://github.com/NativeScript/nativescript-cli/issues/1625): Double navigation when showing unit test results.
15+
416
1.7.0 (2016, March 16)
517
==
618

README.md

+34-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ With the NativeScript CLI, you can target the following mobile platforms.
5959
System Requirements
6060
===
6161

62-
You can install and run the NativeScript CLI on Windows or OS X.
62+
You can install and run the NativeScript CLI on Windows, OS X or Linux.
6363

6464
* [Windows](#windows)
6565
* [OS X](#os-x)
@@ -69,6 +69,21 @@ You can install and run the NativeScript CLI on Windows or OS X.
6969

7070
> On Windows systems, you can develop, build, and deploy NativeScript projects that target Android.
7171
72+
### Setup Script
73+
To quickly set up your system for the latest NativeScript CLI, paste the following PowerShell script in the **Command Prompt** and hit `Enter`:
74+
```cmd
75+
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.ps1'))"
76+
```
77+
78+
Alternatively, your can paste the following PowerShell setup script in a **Windows PowerShell console** and hit `Enter`:
79+
```PowerShell
80+
start-process -FilePath PowerShell.exe -Verb Runas -Wait -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.ps1'))"
81+
```
82+
> Both scripts require that you have **.NET 4.0 or later** installed on your system. You can download .NET 4.6.1 from this [link](http://go.microsoft.com/fwlink/?LinkId=671729).
83+
84+
85+
### Manual Setup
86+
7287
* Windows 7 SP1 or later
7388
* The latest Node.js [0.10.x](https://nodejs.org/dist/latest-v0.10.x/), [0.12.x](https://nodejs.org/dist/latest-v0.12.x/), [4.x](https://nodejs.org/dist/latest-v4.x/) or [5.x](https://nodejs.org/dist/latest-v5.x/) stable official release
7489
* (Optional) [Chocolatey][Chocolatey]
@@ -125,6 +140,14 @@ android update sdk --filter tools,platform-tools,android-23,build-tools-23.0.2,s
125140

126141
> On OS X systems, you can develop, build, and deploy NativeScript projects that target iOS and Android.
127142
143+
### Setup Script
144+
To quickly set up your system for the latest NativeScript CLI, paste the following Ruby script in the **Terminal** and hit `Enter`:
145+
```Shell
146+
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.rb)"
147+
```
148+
149+
### Manual Setup
150+
128151
* OS X Mavericks
129152
* The latest Node.js [0.10.x](https://nodejs.org/dist/latest-v0.10.x/), [0.12.x](https://nodejs.org/dist/latest-v0.12.x/), [4.x](https://nodejs.org/dist/latest-v4.x/) or [5.x](https://nodejs.org/dist/latest-v5.x/) stable official release
130153
* For iOS development
@@ -325,7 +348,7 @@ MyApp/
325348
```
326349

327350
* The `app` directory is the **development space for your application**. You should modify all common and platform-specific code within this directory. When you run `prepare <Platform>`, the NativeScript CLI copies relevant content to the platform-specific folders for each target platform.
328-
* The `platforms` directory is created empty. When you add a target platform to your project, the NativeScript CLI creates a new subdirectory with the platform name. The subdirectory contains the ready-to-build resources of your app. When you run `prepare <Platform>`, the NativeScript CLI copies relevant content from the `app` directory to the platform-specific subdirectory for each target platform.<br/>In the `platforms` directory, you can safely modify configuration files such as `AndroidManifest.xml` and `Info.plist`.
351+
* The `platforms` directory is created empty. When you add a target platform to your project, the NativeScript CLI creates a new subdirectory with the platform name. The subdirectory contains the ready-to-build resources of your app. When you run `prepare <Platform>`, the NativeScript CLI copies relevant content from the `app` directory to the platform-specific subdirectory for each target platform.
329352

330353
[Back to Top][1]
331354

@@ -398,9 +421,13 @@ You can develop shared functionality or design in common files. To indicate that
398421

399422
### Development in `platforms`
400423

401-
In `platforms`, you can safely modify files which are part of the native project structure and do not have a corresponding source located in the `app` directory in the root. For example, `AndroidManifest.xml` and `Info.plist`.
424+
> **IMPORTANT:** Avoid editing files located in the `platforms` subdirectory because the NativeScript CLI overrides such files during the `prepare <Platform>` using the contents of the `app` directory.
425+
426+
### Modifying Configuration Files
402427

403-
**Do not modify files and resources that have a corresponding file in the `app` directory in the root**, such as application scripts, icons, and splash screens. The NativeScript CLI overrides such files during the `prepare <Platform>` operation with the content from `app`.
428+
The NativeScript CLI respects any platform configuration files placed inside `app/App_Resources`. Those files are respectively `app/App_Resources/AndroidManifest.xml` for Android and `app/App_Resources/Info.plist` for iOS.
429+
430+
Additionaly, you can modify `app/App_Resources/build.xcconfig` and `app/App_Resources/app.gradle` for adding/removing additional build properties for iOS and Android, respectively.
404431

405432
[Back to Top][1]
406433

@@ -417,8 +444,6 @@ tns prepare ios
417444

418445
Keep in mind that `prepare` overrides changes made to the platform-specific subdirectory in `platforms`. For more information, see [Development in platforms](#development-in-platforms).
419446

420-
> **IMPORTANT:** Always run `prepare <Platform>` before running `build <Platform>`, `deploy <Platform>`, or `emulate <Platform>`. This ensures that the NativeScript CLI will build an application package with your latest code and resources.
421-
422447
[Back to Top][1]
423448

424449
## Build Your Project
@@ -434,7 +459,9 @@ The NativeScript CLI calls the SDK for the selected target platform and uses it
434459

435460
When you build for Android, the NativeScript CLI saves the application package as an `APK` in `platforms` &#8594; `android` &#8594; `bin`.
436461

437-
When you build for iOS, if the `--device` flag is not set, the NativeScript CLI builds your project for the native emulator and saves the application package as an `APP` in `platforms` &#8594; `ios` &#8594; `build` &#8594; `emulator`. If the `--device` flag is set, the NativeScript CLI builds your project for device and saves the application package as an `IPA` in `platforms` &#8594; `ios` &#8594; `build` &#8594; `device`.
462+
When you build for iOS, the NativeScript CLI will either build for a device, if there's a device attached, or for the native emulator if there are no devices attached. To trigger a native emulator build when a device is attached, set the `--emulator` flag.
463+
464+
The native emulator build is saved as an `APP` in `platforms` &#8594; `ios` &#8594; `build` &#8594; `emulator`. The device build is saved as an `IPA` in `platforms` &#8594; `ios` &#8594; `build` &#8594; `device`.
438465

439466
> **IMPORTANT:** To build your app for an iOS device, you must configure a valid certificate and provisioning profile pair, and have that pair present on your system for code signing your application package. For more information, see [iOS Code Signing - A Complete Walkthrough](http://seventhsoulmountain.blogspot.com/2013/09/ios-code-sign-in-complete-walkthrough.html).
440467

lib/services/platform-service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,11 @@ export class PlatformService implements IPlatformService {
299299
// Process configurations files from App_Resources
300300
platformData.platformProjectService.processConfigurationFilesFromAppResources().wait();
301301

302+
this.applyBaseConfigOption(platformData).wait();
303+
302304
// Replace placeholders in configuration files
303305
platformData.platformProjectService.interpolateConfigurationFile().wait();
304306

305-
this.applyBaseConfigOption(platformData).wait();
306-
307307
this.$logger.out("Project successfully prepared");
308308
return true;
309309
}).future<boolean>()();

setup/native-script.ps1

+26-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
# To run it inside a COMMAND PROMPT against the production branch (only one supported with self-elevation) use
55
# @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.ps1'))"
66
# To run it inside a WINDOWS POWERSHELL console against the production branch (only one supported with self-elevation) use
7-
# iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.ps1'))
7+
# start-process -FilePath PowerShell.exe -Verb Runas -Wait -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.ps1'))"
88

99
# Check if latest .NET framework installed is at least 4
1010
$dotNetVersions = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | Get-ItemProperty -name Version,Release -EA 0 | Where { $_.PSChildName -match '^(?!S)\p{L}'} | Select Version
1111
$latestDotNetVersion = $dotNetVersions.GetEnumerator() | Sort-Object Version | Select-Object -Last 1
1212
$latestDotNetMajorNumber = $latestDotNetVersion.Version.Split(".")[0]
1313
if ($latestDotNetMajorNumber -lt 4) {
1414
Write-Host -ForegroundColor Red "To run this script, you need .NET 4.0 or later installed"
15-
if ((Read-Host "Do you want to open Microsoft Download Center (y/n)") -eq 'y') {
16-
Start-Process -FilePath "https://www.microsoft.com/en-us/download/search.aspx?q=.net%20framework&p=0&r=10&t=&s=Relevancy~Descending"
15+
if ((Read-Host "Do you want to open .NET Framework 4.6.1 download page (y/n)") -eq 'y') {
16+
Start-Process -FilePath "http://go.microsoft.com/fwlink/?LinkId=671729"
1717
}
1818

1919
exit 1
@@ -71,16 +71,21 @@ Install "Google Chrome" "Installing Google Chrome (required to debug NativeScrip
7171
Install "Java Development Kit" "Installing Java Development Kit" "cinst jdk8 --force --yes"
7272

7373
Install "Android SDK" "Installing Android SDK" "cinst android-sdk --force --yes"
74-
75-
# setup android sdk
76-
echo yes | cmd /c "$env:localappdata\Android\android-sdk\tools\android" update sdk --filter "tools,platform-tools,android-23" --all --no-ui
77-
echo yes | cmd /c "$env:localappdata\Android\android-sdk\tools\android" update sdk --filter "build-tools-23.0.1,extra-android-m2repository" --all --no-ui
78-
7974
# setup environment
8075

8176
if (!$env:ANDROID_HOME) {
82-
[Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:localappdata\Android\android-sdk", "User")
83-
$env:ANDROID_HOME = "$env:localappdata\Android\android-sdk";
77+
# in case the user has `android` in the PATH, use it as base for setting ANDROID_HOME
78+
$androidExecutableEnvironmentPath = Get-Command android -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Definition
79+
if ($androidExecutableEnvironmentPath -ne $null) {
80+
$androidHomeJoinedPath = [io.path]::combine($androidExecutableEnvironmentPath, "..", "..")
81+
$androidHome = Resolve-Path $androidHomeJoinedPath | Select-Object -ExpandProperty Path
82+
}
83+
else {
84+
$androidHome = "$env:localappdata\Android\android-sdk"
85+
}
86+
87+
$env:ANDROID_HOME = $androidHome;
88+
[Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:ANDROID_HOME", "User")
8489
}
8590

8691
if (!$env:JAVA_HOME) {
@@ -90,5 +95,16 @@ if (!$env:JAVA_HOME) {
9095
$env:JAVA_HOME = $javaHome;
9196
}
9297

98+
# setup android sdk
99+
# following commands are separated in case of having to answer to license agreements
100+
# the android tool will introduce a --accept-license option in subsequent releases
101+
$androidExecutable = [io.path]::combine($env:ANDROID_HOME, "tools", "android")
102+
echo y | cmd /c "$androidExecutable" update sdk --filter "platform-tools" --all --no-ui
103+
echo y | cmd /c "$androidExecutable" update sdk --filter "tools" --all --no-ui
104+
echo y | cmd /c "$androidExecutable" update sdk --filter "android-23" --all --no-ui
105+
echo y | cmd /c "$androidExecutable" update sdk --filter "build-tools-23.0.2" --all --no-ui
106+
echo y | cmd /c "$androidExecutable" update sdk --filter "extra-android-m2repository" --all --no-ui
107+
108+
93109
Write-Host -ForegroundColor Green "This script has modified your environment. You need to log off and log back on for the changes to take effect."
94110
Pause

setup/native-script.rb

+29-6
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,42 @@ def install(program_name, message, script, run_as_root = false, show_all_option
8282
end
8383

8484
install("Java SE Development Kit", "Installing the Java SE Development Kit... This might take some time, please, be patient. (You will be prompted for your password)", 'brew cask install java', false, false)
85-
execute('echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.profile', "Unable to set JAVA_HOME")
86-
8785
install("Android SDK", "Installing Android SDK", 'brew install android-sdk')
88-
execute('echo "export ANDROID_HOME=/usr/local/opt/android-sdk" >> ~/.profile', "Unable to set ANDROID_HOME")
86+
87+
unless ENV["ANDROID_HOME"]
88+
require 'pathname'
89+
# if android-sdk was installed through brew, there should be a symlink in /usr/local/opt/android-sdk pointing to the actual sdk
90+
android_home = "/usr/local/opt/android-sdk"
91+
unless Pathname.new(android_home).exist?
92+
require 'mkmf'
93+
# if there's no such symlink then try to find the `android-sdk` directory through the `android` executable
94+
android_executable_environment_path = find_executable('android')
95+
if android_executable_environment_path
96+
android_home_joined_path = File.join(android_executable_environment_path, "..", "..")
97+
android_home = Pathname.new(android_home_joined_path).realpath
98+
end
99+
end
100+
101+
ENV["ANDROID_HOME"] = android_home
102+
execute('echo "export ANDROID_HOME=%s" >> ~/.profile' % ENV["ANDROID_HOME"], "Unable to set ANDROID_HOME")
103+
end
104+
105+
unless ENV["JAVA_HOME"]
106+
execute('echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.profile', "Unable to set JAVA_HOME")
107+
end
89108

90109
# the -p flag is set in order to ensure zero status code even if the directory exists
91110
execute("mkdir -p ~/.cocoapods", "There was a problem in creating ~/.cocoapods directory")
92111
install("CocoaPods", "Installing CocoaPods... This might take some time, please, be patient.", 'gem install cocoapods -V', true)
93112

94113
puts "Configuring your system for Android development... This might take some time, please, be patient."
95-
# Note that multiple license acceptances may be required, hence the multiple y answers
114+
# Note that multiple license acceptances may be required, hence the multiple commands
96115
# the android tool will introduce a --accept-license option in subsequent releases
97-
execute("(for i in {1..5}; do echo y; sleep 4; done) | /usr/local/opt/android-sdk/tools/android update sdk --filter tools,platform-tools,android-23,build-tools-23.0.2,extra-android-m2repository --all --no-ui",
98-
"There seem to be some problems with the Android configuration")
116+
android_executable = File.join(ENV["ANDROID_HOME"], "tools", "android")
117+
execute("echo y | #{android_executable} update sdk --filter platform-tools --all --no-ui", "There seem to be some problems with the Android configuration")
118+
execute("echo y | #{android_executable} update sdk --filter tools --all --no-ui", "There seem to be some problems with the Android configuration")
119+
execute("echo y | #{android_executable} update sdk --filter android-23 --all --no-ui", "There seem to be some problems with the Android configuration")
120+
execute("echo y | #{android_executable} update sdk --filter build-tools-23.0.2 --all --no-ui", "There seem to be some problems with the Android configuration")
121+
execute("echo y | #{android_executable} update sdk --filter extra-android-m2repository --all --no-ui", "There seem to be some problems with the Android configuration")
99122

100123
puts "The ANDROID_HOME and JAVA_HOME environment variables have been added to your .profile. Restart the terminal to use them."

0 commit comments

Comments
 (0)