├── LICENSE ├── README.md ├── Vagrantfile └── initialize.sh /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Nathanael Anderson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nativescript-vm 2 | 3 | A NativeScript VM 4 | 5 | ## Discontinued 6 | NativeScript is considerably easier to install on all OS's now; so this should not need to be used for anything... 7 | 8 | 9 | ## License 10 | 11 | This is released under the MIT License, meaning you are free to use this however you want. -- However for entities that need a support and/or a commercial license please contact me (nathan@master-technology.com). 12 | 13 | ##NativeScript Virtual Machine 14 | 15 | The initialize.sh Script can be ran on a fresh Ubuntu 64bit 14.04 Installation. (I've tested it in both VMWare and VirtualBox) 16 | 17 | This sets up a fully function VM with all the NativeScript components; including a clone of all 4 major NativeScript repo's so that you can hack on any part of the NativeScript system. 18 | 19 | If you use Vagrant and VirtualBox or just plain VirtualBox and also use a Android VM that runs on VirtualBox (Like Geny or Andy); then this VM can EASILY connect to the Android VM. 20 | 21 | To Connect; you need the ip address of the Android VM. (Geny typically defaults to 192.168.56.100 if it is the first VM running on VirtualBox) So then you would type: 22 | ```adb connect 192.168.56.100``` 23 | 24 | Please note if you are using Geny you can type: 25 | ```genyshell -c "devices list"``` 26 | to get a list of devices and their status and ip address 27 | 28 | Then when you want to compile, deploy & test to your Android vm you would type: 29 | ```tns run android --device 1``` 30 | 31 | 32 | Nathanael Anderson 33 | [http://Master-Technology.com](http://master-technology.com) 34 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 | # configures the configuration version (we support older styles for 6 | # backwards compatibility). Please don't change it unless you know what 7 | # you're doing. 8 | 9 | Vagrant.configure(2) do |config| 10 | # The most common configuration options are documented and commented below. 11 | # For a complete reference, please see the online documentation at 12 | # https://docs.vagrantup.com. 13 | 14 | # Every Vagrant development environment requires a box. You can search for 15 | # boxes at https://atlas.hashicorp.com/search. 16 | 17 | config.vm.box = "ubuntu/trusty64" 18 | config.vm.hostname = "NativeScript-VM" 19 | 20 | # We want the Host Private_Network as Geny VM's are also on the Private_Network 21 | config.vm.network "private_network", :type => 'dhcp', :adapter => 2 22 | 23 | # Disable automatic box update checking. If you disable this, then 24 | # boxes will only be checked for updates when the user runs 25 | # `vagrant box outdated`. This is not recommended. 26 | # config.vm.box_check_update = false 27 | 28 | # Create a forwarded port mapping which allows access to a specific port 29 | # within the machine from a port on the host machine. In the example below, 30 | # accessing "localhost:8080" will access port 80 on the guest machine. 31 | # config.vm.network "forwarded_port", guest: 80, host: 8080 32 | 33 | # Create a private network, which allows host-only access to the machine 34 | # using a specific IP. 35 | # config.vm.network "private_network", ip: "192.168.33.10" 36 | 37 | # Create a public network, which generally matched to bridged network. 38 | # Bridged networks make the machine appear as another physical device on 39 | # your network. 40 | # config.vm.network "public_network" 41 | 42 | # Share an additional folder to the guest VM. The first argument is 43 | # the path on the host to the actual folder. The second argument is 44 | # the path on the guest to mount the folder. And the optional third 45 | # argument is a set of non-required options. 46 | # config.vm.synced_folder "../data", "/vagrant_data" 47 | 48 | # Provider-specific configuration so you can fine-tune various 49 | # backing providers for Vagrant. These expose provider-specific options. 50 | # Example for VirtualBox: 51 | # 52 | 53 | config.vm.provider "virtualbox" do |vb| 54 | vb.name = "NativeScript VM" 55 | vb.customize ["modifyvm", :id, "--usb", "on"] 56 | 57 | # http://developer.android.com/tools/device.html 58 | vb.customize ["usbfilter", "add", "0", "--target", :id, "--name", "android", "--vendorid", "0x22b8"] 59 | end 60 | # 61 | # View the documentation for the provider you are using for more 62 | # information on available options. 63 | 64 | # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies 65 | # such as FTP and Heroku are also available. See the documentation at 66 | # https://docs.vagrantup.com/v2/push/atlas.html for more information. 67 | # config.push.define "atlas" do |push| 68 | # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" 69 | # end 70 | 71 | # Enable provisioning with a shell script. Additional provisioners such as 72 | # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the 73 | # documentation for more information about their specific syntax and use. 74 | config.vm.provision :shell, path: "initialize.sh" 75 | end -------------------------------------------------------------------------------- /initialize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 2015-09-14 20:17:11 4 | 5 | ANDROID_SDK_FILENAME=android-sdk_r24.3.4-linux.tgz 6 | ANDROID_NDK_FILENAME=android-ndk-r10e 7 | 8 | install_pkgs() { 9 | # Use Gradle ppa to get latest gradle 10 | echo 'deb http://ppa.launchpad.net/cwchien/gradle/ubuntu trusty main' | sudo tee /etc/apt/sources.list.d/gradle.list 11 | echo 'deb-src http://ppa.launchpad.net/cwchien/gradle/ubuntu trusty main' | sudo tee --append /etc/apt/sources.list.d/gradle.list 12 | 13 | # Update & Add i386 Components that are needed 14 | sudo dpkg --add-architecture i386 15 | sudo apt-get update 16 | sudo apt-get upgrade 17 | sudo apt-get install -y libncurses5:i386 libstdc++6:i386 zlib1g:i386 lib32z1 lib32ncurses5 lib32bz2-1.0 libstdc++6:i386 18 | 19 | # Pull in all the Development stuff 20 | sudo apt-get install -y mc linux-headers-generic build-essential g++ ant git openjdk-7-jdk p7zip p7zip-full gradle 21 | } 22 | 23 | 24 | install_node() { 25 | echo Downloading Latest version of Node 26 | sudo wget -q --output-document=/usr/src/node-latest.tar.gz http://nodejs.org/dist/latest-v0.12.x/node-v0.12.7.tar.gz 27 | pushd /usr/src 28 | echo Extracting Node... 29 | sudo tar zxvf node-latest.tar.gz > /dev/null 30 | sudo chown -R $USER:$USER node-v* 31 | cd node-v* 32 | echo Compiling Node -- This might take a while... 33 | ./configure 34 | make 35 | sudo make install 36 | popd 37 | } 38 | 39 | 40 | install_android_sdk() { 41 | echo Downloading Latest version of Android SDK, this can take a while... 42 | sudo wget -q --output-document=/usr/src/android-sdk.tgz http://dl.google.com/android/$ANDROID_SDK_FILENAME 43 | pushd /usr/local 44 | echo Extracting Android SDK... 45 | sudo tar zxvf /usr/src/android-sdk.tgz > /dev/null 46 | sudo chown -R $USER:$USER /usr/local/android-sdk-linux 47 | popd 48 | } 49 | 50 | create_exports() { 51 | # export for our current session 52 | export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 53 | export ANT_HOME=/usr/local/ant 54 | export ANDROID_HOME=/usr/local/android-sdk-linux 55 | export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:/usr/local/$ANDROID_NDK_FILENAME 56 | 57 | 58 | # Write to the Non-Interactive bash file 59 | echo 'export ANDROID_HOME=/usr/local/android-sdk-linux' >> ~/.bashrc 60 | echo 'export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:/usr/local/$ANDROID_NDK_FILENAME' >> ~/.bashrc 61 | echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.bashrc 62 | echo "export ANT_HOME=/usr/local/ant" >> ~/.bashrc 63 | 64 | # Write to the Standard .Profile that everything uses 65 | if [[ -f ~/.profile ]]; then 66 | echo 'ANDROID_HOME=/usr/local/android-sdk-linux' >> ~/.profile 67 | echo 'PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:/usr/local/$ANDROID_NDK_FILENAME' >> ~/.profile 68 | echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.profile 69 | echo "export ANT_HOME=/usr/local/ant" >> ~/.profile 70 | fi 71 | 72 | if [[ -f ~/.bash_profile ]]; then 73 | echo 'export ANDROID_HOME=/usr/local/android-sdk-linux' >> ~/.bash_profile 74 | echo 'export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:/usr/local/$ANDROID_NDK_FILENAME' >> ~/.bash_profile 75 | echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.bash_profile 76 | echo "export ANT_HOME=/usr/local/ant" >> ~/.bash_profile 77 | fi 78 | } 79 | 80 | install_android_tools() { 81 | echo Installing Android Components This can take a while... 82 | # Yes, I fully realize I'm pulling android-17, 21 & 22. 17 & 21 are required for different parts of NativeScript; 22 is the latest 83 | ( sleep 7 && while [ 1 ]; do sleep 2; echo y; done ) | android update sdk --no-ui --filter platform-tool,android-17,android-21,android-22,build-tools-22.0.1 84 | } 85 | 86 | install_android_ndk() { 87 | echo Downloading Android NDK, this can take a while... 88 | sudo wget -q --output-document=/usr/src/$ANDROID_NDK_FILENAME.7z http://dl.google.com/android/ndk/$ANDROID_NDK_FILENAME-linux-x86_64.bin 89 | sudo chmod a+r /usr/src/$ANDROID_NDK_FILENAME.7z 90 | sudo mkdir /usr/local/$ANDROID_NDK_FILENAME 91 | sudo chmod 777 /usr/local/$ANDROID_NDK_FILENAME 92 | 7z x /usr/src/$ANDROID_NDK_FILENAME.7z -o/usr/local 93 | } 94 | 95 | install_nativescript() { 96 | sudo npm install grunt -g --unsafe-perm 97 | sudo npm install grunt-cli -g --unsafe-perm 98 | sudo npm install nativescript -g --unsafe-perm 99 | } 100 | 101 | install_github_support() { 102 | mkdir ~/repos 103 | pushd ~/repos 104 | 105 | git clone https://github.com/NativeScript/NativeScript 106 | git clone https://github.com/NativeScript/android-runtime 107 | git clone https://github.com/NativeScript/nativescript-cli 108 | git clone https://github.com/NativeScript/android-metadata-generator 109 | 110 | cd NativeScript 111 | npm install 112 | cd .. 113 | 114 | cd android-runtime 115 | npm install 116 | cd .. 117 | 118 | cd nativescript-cli 119 | npm install 120 | cd .. 121 | 122 | cd android-metadata-generator 123 | npm install 124 | cd .. 125 | 126 | popd 127 | } 128 | 129 | install_network_support() { 130 | echo 'auto eth1' | sudo tee --append /etc/network/interfaces.d/eth1.cfg 131 | echo 'iface eth1 inet dhcp' | sudo tee --append /etc/network/interfaces.d/eth1.cfg 132 | sudo service networking restart 133 | sleep 5 134 | } 135 | 136 | create_exports 137 | install_pkgs 138 | install_node 139 | install_android_sdk 140 | install_android_tools 141 | install_android_ndk 142 | install_github_support 143 | install_nativescript 144 | install_network_support 145 | 146 | echo "Done" 147 | 148 | 149 | 150 | --------------------------------------------------------------------------------