diff --git a/.gitignore b/.gitignore index 16ecd65e1..0a7848506 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,13 @@ coverage/ shell/bin/linux shell/bin/darwin shell/bin/win32 + +shell/scripts/bin +shell/scripts/build + +dist/darwin +dist/linux +dist/windows +dist/*.dmg +dist/*.tar.gz +dist/*.exe diff --git a/README.md b/README.md index 1ec1f5809..b7ddb314a 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,19 @@ Once this script has completed, you can launch the shell-based Copay by running: npm run shell ``` +## Building Native Shell Binaries/Installers (OSX) + +``` +npm run dist +``` + +This script will download atom shell binaries and combine them with Copay sources +to build a DMG for osx-x64, an installer EXE for win32, and a .tar.gz for linux-x64. +It was developed to be run on OSX. The outputs are copied to the dist directory. + +DMG is created with hdiutil +EXE is created with makensis (brew install makensis) + ## Tests Open test/index.html in your browser to test the models. Install and run karma diff --git a/dist/README.md b/dist/README.md new file mode 100644 index 000000000..1d883f95d --- /dev/null +++ b/dist/README.md @@ -0,0 +1 @@ +This is the destination directory for the built atom-shell binaries and the files used to create them \ No newline at end of file diff --git a/shell/README.md b/shell/README.md index 970f9882d..36c1408e4 100644 --- a/shell/README.md +++ b/shell/README.md @@ -8,4 +8,5 @@ using [Atom Shell](https://github.com/atom/atom-shell). ## Building -Automated build scripts are currently being developed. +Run from the top level (copay) directory: +npm run dist diff --git a/shell/scripts/dist.js b/shell/scripts/dist.js index 09cd68c30..1555dbe70 100644 --- a/shell/scripts/dist.js +++ b/shell/scripts/dist.js @@ -15,9 +15,17 @@ var darwin_app_dir = '/Copay.app/Contents/Resources/app'; var linux_app_dir = '/resources/app'; var windows_app_dir = '/resources/app'; -rm('-rf', build_dir); -rm('-rf', dist_dir); +console.log(color.blue('{copay}'), ''); +console.log(color.blue('{copay}'), 'Preparing to build Copay binaries'); +console.log(color.blue('{copay}'), ''); +/* Clean up before the build */ +rm('-rf', build_dir); +rm(dist_dir + '/Copay*'); +rm('-rf', dist_dir + '/darwin', dist_dir + '/linux', dist_dir + '/windows'); + +// Download the atom shell binaries. If you exceed your download quota, +// just download the zips manually and unpack them into shell/scripts/bin/ async.series([ function(callback) { download.atom(atom_version, 'darwin', 'x64', callback); @@ -65,6 +73,7 @@ function runBuild() { cp(app_root + '*.json', build_dir + darwin_app_dir); cp(app_root + '*.html', build_dir + darwin_app_dir); + // Copay needs express, put other node deps here if you need any cp('-r', app_root + '/node_modules/express', build_dir + darwin_app_dir + "/node_modules"); // Clean up extra Atom sources @@ -146,9 +155,13 @@ function runBuild() { cp(app_root + "/shell/assets/win32/*", build_dir); + rm('-r', build_dir + windows_app_dir + '/../default_app'); + mkdir('-p', app_root + '/dist/windows'); cp('-r', app_root + build_dir + '/*', app_root + '/dist/windows/'); + rm('-rf', app_root + build_dir + '/*'); + console.log(color.blue('{copay}'), 'Copied files to ' + 'dist/windows'); @@ -156,10 +169,10 @@ function runBuild() { // install on OSX with "brew install makensis" if (which('makensis') != null) { console.log(color.blue('{copay}'), 'Running NSIS to generate win32 installer'); - cd(build_dir); + cd('dist/windows'); exec('makensis -V2 build-installer.nsi'); - cd("../../.."); - cp(build_dir + '/copay-setup.exe', app_root + '/dist/Copay-setup-win32.exe') + cd("../../"); + cp('dist/windows/copay-setup.exe', app_root + '/dist/Copay-setup-win32.exe') } console.log(color.blue('{copay}')); diff --git a/shell/scripts/lib/download.js b/shell/scripts/lib/download.js index 1bb4f0c9a..d13f692a6 100644 --- a/shell/scripts/lib/download.js +++ b/shell/scripts/lib/download.js @@ -26,6 +26,7 @@ var Static = function() { } else { console.log(color.blue('{copay}'), platform + '-' + arch + ' ' + ' already downloaded'); callback.call(this, null); + return; } @@ -36,6 +37,7 @@ var Static = function() { var filename = 'atom-shell-' + version + '-' + platform + '-' + arch + '.zip'; if (err || !releases.length) { + console.log(err); return console.log(color.blue('{copay}'), 'Release not found'); }