Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Add Windows Build Instructions and Cross Platform Script #86

Merged
merged 5 commits into from
Sep 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 45 additions & 6 deletions docs/guide/contributing/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,39 @@ If you are looking to simply install Nylas-Mail on your system (and are not look
```bash
export NODE_VERSION=6.9 CC=gcc-4.8 CXX=g++-4.8 DEBUG="electron-packager:*" INSTALL_TARGET=client
```
1. [Follow the common instructions](#common-linux-and-macos)
1. [Follow the common instructions](#common)

## Mac OS
1. Download the latest XCode from the App Store then run the following to install CLI tools
```bash
xcode-select --install
```
1. [Follow the common instructions](#common-linux-and-macos)

## Common (Linux and MacOS)
1. Install Node.js version **6.9** (suggested using [NVM](https://github.com/creationix/nvm/blob/master/README.md#install-script))
1. [Follow the common instructions](#common)

## Windows
1. Download and install Visual Studio 2013. The Community Edition works and is free with a Dev Essentials account; once you have a Dev Essentials account, you can access a download at https://my.visualstudio.com/Downloads?q=Visual%20Studio%202013%20with%20Update%205
1. Download and install Python 2.7 (v3.x.x is not supported) - https://www.python.org/downloads/windows/
1. Add Python 2.7 directory to the PATH Environment Variable (see https://www.java.com/en/download/help/path.xml)
1. Due to the way Windows filesystem is built, it is likely you'll need to run Command Prompt as administrator. We have seen issues with rename/symlink permissions.
1. Set the following environment variables:
```bash
set NODE_VERSION=6.9
set DEBUG=electron-windows-installer:*,electron-packager:*
set SIGN_BUILD=false
set INSTALL_TARGET=client

set npm_config_arch=x64
set npm_config_target_arch=x64
set npm_config_msvs_version=2013

npm config set arch x64
npm config set target_arch x64
npm config set msvs_version 2013
```
1. [Follow the common instructions; please follow for **Windows Developers Only** notes](#common)

## Common
1. Install Node.js version **6.9** (suggested using [NVM](https://github.com/creationix/nvm/blob/master/README.md#install-script) or the Windows version of [NVM Windows](https://github.com/coreybutler/nvm-windows/releases))
* If using nvm, prepend all the coming `npm` commands with the following to use the correct NPM version:
```bash
nvm exec 6.9
Expand All @@ -31,6 +53,19 @@ If you are looking to simply install Nylas-Mail on your system (and are not look
git clone our-repo-link
```
* The repo link can be found on the main page of this repository, simply click the green "Clone or download button", and copy its contents over the "our-repo-link" in the above command.
* **Windows Devleopers Only**: Windows has issues with long paths. It is recommended that this repo is cloned to the root directory of a disk drive (not necessarily C:):
```bash
git clone out-repo-link C:\nylas-mail
```
1. Navigate to the nylas-mail directory: (may be different if you cloned it somewhere else)
```bash
cd nylas-mail
```
1. Make sure you don't have any Lerna-caused remnants using:
```bash
git status
```
and making sure you have no unexpected issues/changes with `package.json` like files. If a previous `npm install` failed prematurely, these files may need to be reset. Otherwise, you'll have missing packages. This seems to be most prevalent doing Windows builds. You'll likely see a modified `package.json` file as well as an untracked Lerna backup file.
1. Install the necessary node packages using:
```bash
npm install
Expand All @@ -48,4 +83,8 @@ If you are looking to simply install Nylas-Mail on your system (and are not look
* If the above command threw an error, run the following and make sure your **node version is 6.9**:
```bash
node -v
```
```
* **Windows Developers Only**: The `npm run build-client` step is required; however it won't build a Windows installer binary. To create an installer binary, you must execute an additional command:
```bash
node packages\client-app\build\create-signed-windows-installer.js
```
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"scripts": {
"start": "npm run client",
"test": "npm run test-client && npm run test-cloud",
"client": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --dev",
"benchmark": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --dev --benchmark",
"test-client": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --test",
"test-client-window": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --test=window",
"client": "node scripts/run-client-app --enable-logging --dev",
"benchmark": "node scripts/run-client-app --enable-logging --dev --benchmark",
"test-client": "node scripts/run-client-app --enable-logging --test",
"test-client-window": "node scripts/run-client-app --enable-logging --test=window",
"test-client-junit": "",
"lint-client": "grunt lint --gruntfile=packages/client-app/build/Gruntfile.js --base=./",
"build-client": "grunt build-client --gruntfile=packages/client-app/build/Gruntfile.js --base=./",
Expand Down
29 changes: 29 additions & 0 deletions packages/client-app/build/create-signed-windows-installer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* eslint import/no-dynamic-require:0 */
/**
* NOTE: Due to path issues, this script must be run outside of grunt
* directly from a powershell command.
*/
const path = require('path')
const createWindowsInstaller = require('electron-winstaller').createWindowsInstaller

const appDir = path.join(__dirname, "..");
const version = require(path.join(appDir, 'package.json')).version;

const config = {
usePackageJson: false,
outputDirectory: path.join(appDir, 'dist'),
appDirectory: path.join(appDir, 'dist', 'nylas-win32-x64'),
loadingGif: path.join(appDir, 'build', 'resources', 'win', 'loading.gif'),
iconUrl: 'http://edgehill.s3.amazonaws.com/static/nylas.ico',
description: "Nylas Mail",
version: version,
title: "nylas",
authors: 'Nylas Inc.',
setupIcon: path.join(appDir, 'build', 'resources', 'win', 'nylas.ico'),
setupExe: 'NylasMailSetup.exe',
exe: 'nylas.exe',
name: 'NylasMail',
}
console.log(config);
console.log("---> Starting")
createWindowsInstaller(config, console.log, console.error)
2 changes: 1 addition & 1 deletion packages/client-app/build/tasks/package-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ module.exports = (grunt) => {
'app-category-type': "public.app-category.business",
'tmpdir': tmpdir,
'arch': {
'win32': 'ia32',
'win32': 'x64',
}[platform],
'icon': {
darwin: path.resolve(grunt.config('appDir'), 'build', 'resources', 'mac', 'nylas.icns'),
Expand Down
15 changes: 15 additions & 0 deletions scripts/run-client-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const path = require("path");
const childProcess = require("child_process");

var electronPath = path.join("packages", "client-app", "node_modules", ".bin", "electron");
var clientPath = path.join("packages", "client-app");
var args = process.argv;
args = args.slice(2);
args.unshift(clientPath);

command = electronPath;
for(var i = 0; i < args.length; i++) {
command += " " + args[i];
}

childProcess.exec(command);