From d4958e41f13c731be1b73d758ab98b1af5c75a8c Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 22 Mar 2016 22:40:27 -0600 Subject: [PATCH 001/221] Move build to build-old to make way for a rewrite --- {build => build-old}/.npmrc | 0 {build => build-old}/Gruntfile.coffee | 0 {build => build-old}/README.md | 0 .../certs/AtomDevTestSignKey.p12 | Bin {build => build-old}/debian/Dockerfile | 0 {build => build-old}/deprecated-packages.json | 0 {build => build-old}/lib/uses-babel.coffee | 0 build-old/package.json | 49 ++++++++++++++++++ {build => build-old}/tasks/build-task.coffee | 0 .../tasks/check-licenses-task.coffee | 0 {build => build-old}/tasks/clean-task.coffee | 0 .../tasks/codesign-task.coffee | 0 .../tasks/compile-packages-slug-task.coffee | 0 .../tasks/copy-info-plist-task.coffee | 0 {build => build-old}/tasks/docs-task.coffee | 0 .../tasks/dump-symbols-task.coffee | 0 .../tasks/fingerprint-task.js | 0 .../tasks/generate-asar-task.coffee | 0 .../tasks/generate-license-task.coffee | 0 .../tasks/generate-module-cache-task.coffee | 0 .../tasks/install-task.coffee | 0 .../tasks/license-overrides.coffee | 0 {build => build-old}/tasks/mkdeb-task.coffee | 0 {build => build-old}/tasks/mkrpm-task.coffee | 0 {build => build-old}/tasks/mktar-task.coffee | 0 {build => build-old}/tasks/nof-task.coffee | 0 .../tasks/output-build-filetypes.coffee | 0 .../tasks/output-disk-space.coffee | 0 .../tasks/output-for-loop-returns.coffee | 0 .../tasks/output-long-paths-task.coffee | 0 .../tasks/output-module-counts.coffee | 0 .../tasks/prebuild-less-task.coffee | 0 .../tasks/publish-build-task.coffee | 0 .../tasks/set-exe-icon-task.coffee | 0 .../tasks/set-version-task.coffee | 0 {build => build-old}/tasks/spec-task.coffee | 0 .../tasks/task-helpers.coffee | 0 build/package.json | 49 ++---------------- old-build/certs/AtomDevTestSignKey.p12 | Bin 0 -> 1765 bytes old-build/tasks/mktar-task.coffee | 30 +++++++++++ 40 files changed, 83 insertions(+), 45 deletions(-) rename {build => build-old}/.npmrc (100%) rename {build => build-old}/Gruntfile.coffee (100%) rename {build => build-old}/README.md (100%) rename {build => build-old}/certs/AtomDevTestSignKey.p12 (100%) rename {build => build-old}/debian/Dockerfile (100%) rename {build => build-old}/deprecated-packages.json (100%) rename {build => build-old}/lib/uses-babel.coffee (100%) create mode 100644 build-old/package.json rename {build => build-old}/tasks/build-task.coffee (100%) rename {build => build-old}/tasks/check-licenses-task.coffee (100%) rename {build => build-old}/tasks/clean-task.coffee (100%) rename {build => build-old}/tasks/codesign-task.coffee (100%) rename {build => build-old}/tasks/compile-packages-slug-task.coffee (100%) rename {build => build-old}/tasks/copy-info-plist-task.coffee (100%) rename {build => build-old}/tasks/docs-task.coffee (100%) rename {build => build-old}/tasks/dump-symbols-task.coffee (100%) rename {build => build-old}/tasks/fingerprint-task.js (100%) rename {build => build-old}/tasks/generate-asar-task.coffee (100%) rename {build => build-old}/tasks/generate-license-task.coffee (100%) rename {build => build-old}/tasks/generate-module-cache-task.coffee (100%) rename {build => build-old}/tasks/install-task.coffee (100%) rename {build => build-old}/tasks/license-overrides.coffee (100%) rename {build => build-old}/tasks/mkdeb-task.coffee (100%) rename {build => build-old}/tasks/mkrpm-task.coffee (100%) rename {build => build-old}/tasks/mktar-task.coffee (100%) rename {build => build-old}/tasks/nof-task.coffee (100%) rename {build => build-old}/tasks/output-build-filetypes.coffee (100%) rename {build => build-old}/tasks/output-disk-space.coffee (100%) rename {build => build-old}/tasks/output-for-loop-returns.coffee (100%) rename {build => build-old}/tasks/output-long-paths-task.coffee (100%) rename {build => build-old}/tasks/output-module-counts.coffee (100%) rename {build => build-old}/tasks/prebuild-less-task.coffee (100%) rename {build => build-old}/tasks/publish-build-task.coffee (100%) rename {build => build-old}/tasks/set-exe-icon-task.coffee (100%) rename {build => build-old}/tasks/set-version-task.coffee (100%) rename {build => build-old}/tasks/spec-task.coffee (100%) rename {build => build-old}/tasks/task-helpers.coffee (100%) create mode 100644 old-build/certs/AtomDevTestSignKey.p12 create mode 100644 old-build/tasks/mktar-task.coffee diff --git a/build/.npmrc b/build-old/.npmrc similarity index 100% rename from build/.npmrc rename to build-old/.npmrc diff --git a/build/Gruntfile.coffee b/build-old/Gruntfile.coffee similarity index 100% rename from build/Gruntfile.coffee rename to build-old/Gruntfile.coffee diff --git a/build/README.md b/build-old/README.md similarity index 100% rename from build/README.md rename to build-old/README.md diff --git a/build/certs/AtomDevTestSignKey.p12 b/build-old/certs/AtomDevTestSignKey.p12 similarity index 100% rename from build/certs/AtomDevTestSignKey.p12 rename to build-old/certs/AtomDevTestSignKey.p12 diff --git a/build/debian/Dockerfile b/build-old/debian/Dockerfile similarity index 100% rename from build/debian/Dockerfile rename to build-old/debian/Dockerfile diff --git a/build/deprecated-packages.json b/build-old/deprecated-packages.json similarity index 100% rename from build/deprecated-packages.json rename to build-old/deprecated-packages.json diff --git a/build/lib/uses-babel.coffee b/build-old/lib/uses-babel.coffee similarity index 100% rename from build/lib/uses-babel.coffee rename to build-old/lib/uses-babel.coffee diff --git a/build-old/package.json b/build-old/package.json new file mode 100644 index 000000000..2f8d88d8a --- /dev/null +++ b/build-old/package.json @@ -0,0 +1,49 @@ +{ + "name": "atom-build", + "description": "Atom build", + "repository": { + "type": "git", + "url": "https://github.com/atom/atom.git" + }, + "dependencies": { + "asar": "^0.8.0", + "async": "~0.2.9", + "aws-sdk": "^2.2.18", + "babel-eslint": "^5.0.0-beta6", + "donna": "^1.0.13", + "escope": "~3.3.0", + "formidable": "~1.0.14", + "fs-plus": "2.x", + "github-releases": "~0.3.1", + "glob": "^5.0.14", + "grunt": "~0.4.1", + "grunt-babel": "^5.0.1", + "grunt-cli": "~0.1.9", + "grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe", + "grunt-contrib-coffee": "~0.12.0", + "grunt-contrib-csslint": "~0.2.0", + "grunt-contrib-less": "~0.8.0", + "grunt-cson": "0.16.0", + "grunt-download-electron": "^2.1.1", + "grunt-electron-installer": "1.2.2", + "grunt-lesslint": "0.17.0", + "grunt-peg": "~1.1.0", + "grunt-shell": "~0.3.1", + "grunt-standard": "^2.0.0", + "legal-eagle": "~0.13.0", + "minidump": "~0.9", + "npm": "2.13.3", + "rcedit": "~0.3.0", + "request": "~2.27.0", + "rimraf": "~2.2.2", + "runas": "^3.1", + "standard": "^5.4.1", + "tello": "1.0.5", + "temp": "~0.8.1", + "time-grunt": "1.2.2", + "underscore-plus": "1.x", + "unzip": "~0.1.9", + "vm-compatibility-layer": "~0.1.0", + "webdriverio": "^2.4.5" + } +} diff --git a/build/tasks/build-task.coffee b/build-old/tasks/build-task.coffee similarity index 100% rename from build/tasks/build-task.coffee rename to build-old/tasks/build-task.coffee diff --git a/build/tasks/check-licenses-task.coffee b/build-old/tasks/check-licenses-task.coffee similarity index 100% rename from build/tasks/check-licenses-task.coffee rename to build-old/tasks/check-licenses-task.coffee diff --git a/build/tasks/clean-task.coffee b/build-old/tasks/clean-task.coffee similarity index 100% rename from build/tasks/clean-task.coffee rename to build-old/tasks/clean-task.coffee diff --git a/build/tasks/codesign-task.coffee b/build-old/tasks/codesign-task.coffee similarity index 100% rename from build/tasks/codesign-task.coffee rename to build-old/tasks/codesign-task.coffee diff --git a/build/tasks/compile-packages-slug-task.coffee b/build-old/tasks/compile-packages-slug-task.coffee similarity index 100% rename from build/tasks/compile-packages-slug-task.coffee rename to build-old/tasks/compile-packages-slug-task.coffee diff --git a/build/tasks/copy-info-plist-task.coffee b/build-old/tasks/copy-info-plist-task.coffee similarity index 100% rename from build/tasks/copy-info-plist-task.coffee rename to build-old/tasks/copy-info-plist-task.coffee diff --git a/build/tasks/docs-task.coffee b/build-old/tasks/docs-task.coffee similarity index 100% rename from build/tasks/docs-task.coffee rename to build-old/tasks/docs-task.coffee diff --git a/build/tasks/dump-symbols-task.coffee b/build-old/tasks/dump-symbols-task.coffee similarity index 100% rename from build/tasks/dump-symbols-task.coffee rename to build-old/tasks/dump-symbols-task.coffee diff --git a/build/tasks/fingerprint-task.js b/build-old/tasks/fingerprint-task.js similarity index 100% rename from build/tasks/fingerprint-task.js rename to build-old/tasks/fingerprint-task.js diff --git a/build/tasks/generate-asar-task.coffee b/build-old/tasks/generate-asar-task.coffee similarity index 100% rename from build/tasks/generate-asar-task.coffee rename to build-old/tasks/generate-asar-task.coffee diff --git a/build/tasks/generate-license-task.coffee b/build-old/tasks/generate-license-task.coffee similarity index 100% rename from build/tasks/generate-license-task.coffee rename to build-old/tasks/generate-license-task.coffee diff --git a/build/tasks/generate-module-cache-task.coffee b/build-old/tasks/generate-module-cache-task.coffee similarity index 100% rename from build/tasks/generate-module-cache-task.coffee rename to build-old/tasks/generate-module-cache-task.coffee diff --git a/build/tasks/install-task.coffee b/build-old/tasks/install-task.coffee similarity index 100% rename from build/tasks/install-task.coffee rename to build-old/tasks/install-task.coffee diff --git a/build/tasks/license-overrides.coffee b/build-old/tasks/license-overrides.coffee similarity index 100% rename from build/tasks/license-overrides.coffee rename to build-old/tasks/license-overrides.coffee diff --git a/build/tasks/mkdeb-task.coffee b/build-old/tasks/mkdeb-task.coffee similarity index 100% rename from build/tasks/mkdeb-task.coffee rename to build-old/tasks/mkdeb-task.coffee diff --git a/build/tasks/mkrpm-task.coffee b/build-old/tasks/mkrpm-task.coffee similarity index 100% rename from build/tasks/mkrpm-task.coffee rename to build-old/tasks/mkrpm-task.coffee diff --git a/build/tasks/mktar-task.coffee b/build-old/tasks/mktar-task.coffee similarity index 100% rename from build/tasks/mktar-task.coffee rename to build-old/tasks/mktar-task.coffee diff --git a/build/tasks/nof-task.coffee b/build-old/tasks/nof-task.coffee similarity index 100% rename from build/tasks/nof-task.coffee rename to build-old/tasks/nof-task.coffee diff --git a/build/tasks/output-build-filetypes.coffee b/build-old/tasks/output-build-filetypes.coffee similarity index 100% rename from build/tasks/output-build-filetypes.coffee rename to build-old/tasks/output-build-filetypes.coffee diff --git a/build/tasks/output-disk-space.coffee b/build-old/tasks/output-disk-space.coffee similarity index 100% rename from build/tasks/output-disk-space.coffee rename to build-old/tasks/output-disk-space.coffee diff --git a/build/tasks/output-for-loop-returns.coffee b/build-old/tasks/output-for-loop-returns.coffee similarity index 100% rename from build/tasks/output-for-loop-returns.coffee rename to build-old/tasks/output-for-loop-returns.coffee diff --git a/build/tasks/output-long-paths-task.coffee b/build-old/tasks/output-long-paths-task.coffee similarity index 100% rename from build/tasks/output-long-paths-task.coffee rename to build-old/tasks/output-long-paths-task.coffee diff --git a/build/tasks/output-module-counts.coffee b/build-old/tasks/output-module-counts.coffee similarity index 100% rename from build/tasks/output-module-counts.coffee rename to build-old/tasks/output-module-counts.coffee diff --git a/build/tasks/prebuild-less-task.coffee b/build-old/tasks/prebuild-less-task.coffee similarity index 100% rename from build/tasks/prebuild-less-task.coffee rename to build-old/tasks/prebuild-less-task.coffee diff --git a/build/tasks/publish-build-task.coffee b/build-old/tasks/publish-build-task.coffee similarity index 100% rename from build/tasks/publish-build-task.coffee rename to build-old/tasks/publish-build-task.coffee diff --git a/build/tasks/set-exe-icon-task.coffee b/build-old/tasks/set-exe-icon-task.coffee similarity index 100% rename from build/tasks/set-exe-icon-task.coffee rename to build-old/tasks/set-exe-icon-task.coffee diff --git a/build/tasks/set-version-task.coffee b/build-old/tasks/set-version-task.coffee similarity index 100% rename from build/tasks/set-version-task.coffee rename to build-old/tasks/set-version-task.coffee diff --git a/build/tasks/spec-task.coffee b/build-old/tasks/spec-task.coffee similarity index 100% rename from build/tasks/spec-task.coffee rename to build-old/tasks/spec-task.coffee diff --git a/build/tasks/task-helpers.coffee b/build-old/tasks/task-helpers.coffee similarity index 100% rename from build/tasks/task-helpers.coffee rename to build-old/tasks/task-helpers.coffee diff --git a/build/package.json b/build/package.json index 2f8d88d8a..ad2bbe28d 100644 --- a/build/package.json +++ b/build/package.json @@ -1,49 +1,8 @@ { - "name": "atom-build", - "description": "Atom build", - "repository": { - "type": "git", - "url": "https://github.com/atom/atom.git" - }, + "name": "atom-build-scripts", + "description": "Atom build scripts", "dependencies": { - "asar": "^0.8.0", - "async": "~0.2.9", - "aws-sdk": "^2.2.18", - "babel-eslint": "^5.0.0-beta6", - "donna": "^1.0.13", - "escope": "~3.3.0", - "formidable": "~1.0.14", - "fs-plus": "2.x", - "github-releases": "~0.3.1", - "glob": "^5.0.14", - "grunt": "~0.4.1", - "grunt-babel": "^5.0.1", - "grunt-cli": "~0.1.9", - "grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe", - "grunt-contrib-coffee": "~0.12.0", - "grunt-contrib-csslint": "~0.2.0", - "grunt-contrib-less": "~0.8.0", - "grunt-cson": "0.16.0", - "grunt-download-electron": "^2.1.1", - "grunt-electron-installer": "1.2.2", - "grunt-lesslint": "0.17.0", - "grunt-peg": "~1.1.0", - "grunt-shell": "~0.3.1", - "grunt-standard": "^2.0.0", - "legal-eagle": "~0.13.0", - "minidump": "~0.9", - "npm": "2.13.3", - "rcedit": "~0.3.0", - "request": "~2.27.0", - "rimraf": "~2.2.2", - "runas": "^3.1", - "standard": "^5.4.1", - "tello": "1.0.5", - "temp": "~0.8.1", - "time-grunt": "1.2.2", - "underscore-plus": "1.x", - "unzip": "~0.1.9", - "vm-compatibility-layer": "~0.1.0", - "webdriverio": "^2.4.5" + "glob": "^7.0.3", + "mkdirp": "^0.5.1" } } diff --git a/old-build/certs/AtomDevTestSignKey.p12 b/old-build/certs/AtomDevTestSignKey.p12 new file mode 100644 index 0000000000000000000000000000000000000000..a93e9a9f042a29411a05cdf832c99041fd6d6180 GIT binary patch literal 1765 zcmb7FX;c$e6n--kgF*JN2!|yK2+B4g2@((#0yaktvM6vs!xADON+3jBs7iveDWJuQ ziqXi9R0Tv-tY8rX9wVq&WDBAqu2rcDiWT~>Ew$(Pr{~U_x%a#8yLaZ!d}nY8@d1ip zxP&Mrk`|=1)5p{i6+|W><`N{tYzU|0670%s?L4xjU5^!8sZU|RO&n#=eOfsq7hlf{6-QGPd zN^vc!Deho{doNAf#RQ#~XIp7Y+8y#MRqlJ#@k~9(=3BFrSs$#) zd`02jljrXL(%+Ok-0#^`u^d}9vO^@U?$q;@+In8I=`m4T+c+6{px0}~J+FPmzwWKd zeqEGpwK$VJ=x>-|q7c1Z>Z@?RU+;Qj!l?Sy>E;50oa3e~tZE=*0IBDrJ#O-}|*FF1AK)**vT^=o;o>j|mW?snuqjixmXK+hj zN`w|G?ec{)iIhv?jK*-|9AqM^Vty+n$s*?M^*z01XKSLas@&W;l4t|sxH_ykg=>tq zJauamQN71Cm)ck|s}z;iEmyc*NWY9^=YRI)fgR7S$F-Y{lp@`H_OeBq0@|Ltn-k)* zY|gGPcyIM=vN>qU@9t3+^O`z4l|E8#wm-#l6fPLKK>k$+XUFRb%gxJb=dK=IM?({ReW?q|0{~WUz_};=g+EdmI z%~zF1YgcX0vs|$&wUuEpX4qnt?UI|rxP+=jW?p$3Js4y7v!yUb{fJz!cb_<+>%_rs zzZa!hvWnHpxx-E4f$5{RZ7Dv|P;{C|cVM%XBR%1#4nD zyfS9>7clzBqO!n&>r`+hasWA(R7OfFaA>eEdSwHW}%srI-n5nD~b$d(==!A6P~KbgNlkiZvGR`HWWlz`ai z_}KVpipM5Vj6fJG+KQVRs8gMAnj;Oz=}vU#5Ce4@lj=x=2ZPCAhTsdS44n2?McZ#x zWC^19(`8wFp(u7;EH6UD$Hm9LzByzDz{EKK7iXbjF=&~`>Fe^F`*2|UZnM}0-M1$` z-C>80Z8Tu`sQA51JQq}$U{aEztr3=Z>@;=3HY3}*5)~5z>H0WEuEc^xk87-OXUm39 zI-FX1Ap5$3z;Q4^(OY?A_vmN#4}^St@y>)4JqB})=foL*_Z7tlU$>lR8&*B`ST>;1 znWNM66Q}zziXi|gPQnv$HTY;IWCWQcpg6!IrXqw8f(NH+HQ$wNeG`1b_l=|>53PA0 ze!}tpPgkN9IIoAB_GDron={)vb6_Il>zTk8hQVQwf}aD$Ctgs4^jMjTB9x-aCA>ho zt*I++$>lTUbY-dRWN5h?=_unYJMFDp=aqUgXY}Lz{oV}QXGra6QO7P$M0ZbzfrI@} zx#8^F^6}#|{STkpTccWTF7c+|)+J_FG5*2W(K(vdXj>ugqjGf8CGMcvfboa1uCTo8cd_e`A@*-rK0Jqhg6_rrc^3ot+O=)Q RYtV|ry%{EHmBgtZ&Yvnyq?G^w literal 0 HcmV?d00001 diff --git a/old-build/tasks/mktar-task.coffee b/old-build/tasks/mktar-task.coffee new file mode 100644 index 000000000..f5edbb4be --- /dev/null +++ b/old-build/tasks/mktar-task.coffee @@ -0,0 +1,30 @@ +path = require 'path' + +module.exports = (grunt) -> + {spawn, fillTemplate} = require('./task-helpers')(grunt) + + grunt.registerTask 'mktar', 'Create an archive', -> + done = @async() + + appFileName = grunt.config.get('atom.appFileName') + buildDir = grunt.config.get('atom.buildDir') + shellAppDir = grunt.config.get('atom.shellAppDir') + {version, description} = grunt.config.get('atom.metadata') + + if process.arch is 'ia32' + arch = 'i386' + else if process.arch is 'x64' + arch = 'amd64' + else + return done("Unsupported arch #{process.arch}") + + iconPath = path.join(shellAppDir, 'resources', 'app.asar.unpacked', 'resources', 'atom.png') + + cmd = path.join('script', 'mktar') + args = [appFileName, version, arch, iconPath, buildDir] + spawn {cmd, args}, (error) -> + if error? + done(error) + else + grunt.log.ok "Created " + path.join(buildDir, "#{appFileName}-#{version}-#{arch}.tar.gz") + done() From ff9b0af78065207b5a007224075aefdcb4ff9621 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 22 Mar 2016 22:40:44 -0600 Subject: [PATCH 002/221] Start on new build, starting with babel transpilation --- build/build.js | 11 ++++++ build/config.js | 30 ++++++++++++++++ build/lib/transpile-babel-paths.js | 56 ++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 build/build.js create mode 100644 build/config.js create mode 100644 build/lib/transpile-babel-paths.js diff --git a/build/build.js b/build/build.js new file mode 100644 index 000000000..49103e63d --- /dev/null +++ b/build/build.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node + +'use strict' + +const transpileBabelPaths = require('./lib/transpile-babel-paths') + +function transpile () { + transpileBabelPaths() +} + +transpile() diff --git a/build/config.js b/build/config.js new file mode 100644 index 000000000..75fa97b31 --- /dev/null +++ b/build/config.js @@ -0,0 +1,30 @@ +// This module exports paths, names, and other metadata that is referenced +// throughout the build. + +'use strict' + +const path = require('path') + +const appMetadata = require('../package.json') + +const repositoryRootPath = path.resolve(__dirname, '..') +const buildOutputPath = path.join(repositoryRootPath, 'out') + +const appName = appMetadata.productName +const appFileName = appMetadata.name + +let electronRootPath, electronAppPath + +switch (process.platform) { + case 'darwin': + electronRootPath = path.join(buildOutputPath, appName, 'Contents') + electronAppPath = path.join(electronRootPath, 'Resources', 'app') + break; +} + +module.exports = { + appMetadata, + repositoryRootPath, buildOutputPath, + appName, appFileName, + electronRootPath, electronAppPath +} diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js new file mode 100644 index 000000000..06e4c5c45 --- /dev/null +++ b/build/lib/transpile-babel-paths.js @@ -0,0 +1,56 @@ +// This module exports a function that transpiles all files with a babel prefix +// into the appropriate location in the build output directory. + +'use strict' + +module.exports = transpileBabelPaths + +const babel = require('babel-core') +const fs = require('fs') +const glob = require('glob') +const mkdirp = require('mkdirp') +const path = require('path') + +const BABEL_OPTIONS = require('../../static/babelrc.json') +const BABEL_PREFIXES = [ + "'use babel'", + '"use babel"', + '/** @babel */', + '/* @flow */' +] +const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.length)) +const BUFFER = Buffer(PREFIX_LENGTH) + +const CONFIG = require('../config') + +function transpileBabelPaths () { + for (let srcPath of glob.sync(`${__dirname}/../../src/**/*.js`)) { + if (usesBabel(srcPath)) { + const relPath = path.relative(CONFIG.repositoryRootPath, srcPath) + const destPath = path.join(CONFIG.electronAppPath, relPath) + transpileBabelPath(srcPath, destPath) + } + } +} + +function usesBabel (path) { + const file = fs.openSync(path, 'r') + fs.readSync(file, BUFFER, 0, PREFIX_LENGTH) + fs.closeSync(file) + const filePrefix = BUFFER.toString('utf8', 0, PREFIX_LENGTH).trim() + return BABEL_PREFIXES.indexOf(filePrefix) !== -1 +} + +function transpileBabelPath (srcPath, destPath) { + const options = Object.assign({}, BABEL_OPTIONS) + options.sourceFileName = path.relative(path.dirname(destPath), srcPath) + if (process.platform === 'win32') { + options.sourceFileName = options.sourceFileName.replace(/\\/g, '/') + } + options.sourceMapTarget = path.basename(destPath) + + let result = babel.transformFileSync(srcPath, options) + + mkdirp.sync(path.dirname(destPath)) + fs.writeFileSync(destPath, result.code) +} From fb2f4fc5a4e5e79e80c5ea79b1cdbfaab9c3c70f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 22 Mar 2016 23:06:28 -0600 Subject: [PATCH 003/221] WIP: Start on coffee transpilation --- build/build.js | 4 ++- build/lib/compute-destination-path.js | 13 ++++++++ build/lib/transpile-babel-paths.js | 10 +++--- build/lib/transpile-coffee-script-paths.js | 36 ++++++++++++++++++++++ 4 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 build/lib/compute-destination-path.js create mode 100644 build/lib/transpile-coffee-script-paths.js diff --git a/build/build.js b/build/build.js index 49103e63d..5d90029a9 100644 --- a/build/build.js +++ b/build/build.js @@ -3,9 +3,11 @@ 'use strict' const transpileBabelPaths = require('./lib/transpile-babel-paths') +const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') function transpile () { - transpileBabelPaths() + // transpileBabelPaths() + transpileCoffeeScriptPaths() } transpile() diff --git a/build/lib/compute-destination-path.js b/build/lib/compute-destination-path.js new file mode 100644 index 000000000..d79b01198 --- /dev/null +++ b/build/lib/compute-destination-path.js @@ -0,0 +1,13 @@ +// Takes an absolute path, relativizes it based on the repository root, then +// makes it absolute again in the output app path. + +'use strict' + +const path = require('path') +const CONFIG = require('../config') + +module.exports = +function computeDestinationPath (srcPath) { + let relativePath = path.relative(CONFIG.repositoryRootPath, srcPath) + return path.join(CONFIG.electronAppPath, relativePath) +} diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index 06e4c5c45..c38baf41d 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -10,7 +10,9 @@ const fs = require('fs') const glob = require('glob') const mkdirp = require('mkdirp') const path = require('path') +const computeDestinationPath = require('./compute-destination-path') +const CONFIG = require('../config') const BABEL_OPTIONS = require('../../static/babelrc.json') const BABEL_PREFIXES = [ "'use babel'", @@ -21,14 +23,10 @@ const BABEL_PREFIXES = [ const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.length)) const BUFFER = Buffer(PREFIX_LENGTH) -const CONFIG = require('../config') - function transpileBabelPaths () { - for (let srcPath of glob.sync(`${__dirname}/../../src/**/*.js`)) { + for (let srcPath of glob.sync(`${CONFIG.repositoryRootPath}/src/**/*.js`)) { if (usesBabel(srcPath)) { - const relPath = path.relative(CONFIG.repositoryRootPath, srcPath) - const destPath = path.join(CONFIG.electronAppPath, relPath) - transpileBabelPath(srcPath, destPath) + transpileBabelPath(srcPath, computeDestinationPath(srcPath)) } } } diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js new file mode 100644 index 000000000..886234ef6 --- /dev/null +++ b/build/lib/transpile-coffee-script-paths.js @@ -0,0 +1,36 @@ +// This module exports a function that transpiles all .coffee files into the +// appropriate location in the build output directory. + +'use strict' + +const glob = require('glob') +const path = require('path') + +const CONFIG = require('../config') +const computeDestinationPath = require('./compute-destination-path') + +const GLOBS = [ + 'src/**/*.coffee,spec/*.coffee', + '!spec/*-spec.coffee', + 'exports/**/*.coffee', + 'static/**/*.coffee' +] + +module.exports = +function transpileCoffeeScriptPaths () { + for (let srcPath of getPathsToTranspile()) { + transpileCoffeeScriptPath(srcPath, computeDestinationPath(srcPath)) + } +} + +function getPathsToTranspile () { + let paths = [] + paths = paths.concat(glob.sync(`${CONFIG.repositoryRootPath}/src/**/*.coffee`)) + paths = paths.concat(glob.sync(`${CONFIG.repositoryRootPath}/spec/*.coffee`, {ignore: '**/*-spec.coffee'})) + paths = paths.concat(glob.sync(`${CONFIG.repositoryRootPath}/exports/**/*.coffee`)) + return paths +} + +function transpileCoffeeScriptPath (srcPath, destPath) { + console.log(srcPath); +} From e8392bd7130c793023afcbcdad9849cdf23b389f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 23 Mar 2016 19:43:32 -0600 Subject: [PATCH 004/221] more progress --- build/build.js | 2 +- build/config.js | 3 ++- build/lib/transpile-babel-paths.js | 1 + build/lib/transpile-coffee-script-paths.js | 11 +++++++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build/build.js b/build/build.js index 5d90029a9..94ffd895a 100644 --- a/build/build.js +++ b/build/build.js @@ -6,7 +6,7 @@ const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') function transpile () { - // transpileBabelPaths() + transpileBabelPaths() transpileCoffeeScriptPaths() } diff --git a/build/config.js b/build/config.js index 75fa97b31..680d11228 100644 --- a/build/config.js +++ b/build/config.js @@ -10,13 +10,14 @@ const appMetadata = require('../package.json') const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') -const appName = appMetadata.productName +let appName = appMetadata.productName const appFileName = appMetadata.name let electronRootPath, electronAppPath switch (process.platform) { case 'darwin': + appName += '.app' electronRootPath = path.join(buildOutputPath, appName, 'Contents') electronAppPath = path.join(electronRootPath, 'Resources', 'app') break; diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index c38baf41d..b1dfa754d 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -24,6 +24,7 @@ const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.l const BUFFER = Buffer(PREFIX_LENGTH) function transpileBabelPaths () { + console.log('Transpiling Babel paths...'); for (let srcPath of glob.sync(`${CONFIG.repositoryRootPath}/src/**/*.js`)) { if (usesBabel(srcPath)) { transpileBabelPath(srcPath, computeDestinationPath(srcPath)) diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js index 886234ef6..80a92d41a 100644 --- a/build/lib/transpile-coffee-script-paths.js +++ b/build/lib/transpile-coffee-script-paths.js @@ -3,7 +3,10 @@ 'use strict' +const coffee = require('coffee-script') +const fs = require('fs') const glob = require('glob') +const mkdirp = require('mkdirp') const path = require('path') const CONFIG = require('../config') @@ -18,8 +21,9 @@ const GLOBS = [ module.exports = function transpileCoffeeScriptPaths () { + console.log('Transpiling CoffeeScript paths...'); for (let srcPath of getPathsToTranspile()) { - transpileCoffeeScriptPath(srcPath, computeDestinationPath(srcPath)) + transpileCoffeeScriptPath(srcPath, computeDestinationPath(srcPath).replace(/coffee$/, 'js')) } } @@ -32,5 +36,8 @@ function getPathsToTranspile () { } function transpileCoffeeScriptPath (srcPath, destPath) { - console.log(srcPath); + const inputCode = fs.readFileSync(srcPath, 'utf8') + let outputCode = coffee.compile(inputCode) + mkdirp.sync(path.dirname(destPath)) + fs.writeFileSync(destPath, outputCode) } From e6ae7d836dd6a778b2001d67b9459b087f790c39 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 26 Jul 2016 14:51:07 +0200 Subject: [PATCH 005/221] Inline transpile call --- build/build.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/build/build.js b/build/build.js index 94ffd895a..2129f0d0f 100644 --- a/build/build.js +++ b/build/build.js @@ -5,9 +5,5 @@ const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') -function transpile () { - transpileBabelPaths() - transpileCoffeeScriptPaths() -} - -transpile() +transpileBabelPaths() +transpileCoffeeScriptPaths() From 265cb90a6daf9df116166a62346276ef0f19a93d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 26 Jul 2016 14:51:51 +0200 Subject: [PATCH 006/221] Clean output directory before building --- build/build.js | 2 ++ build/lib/clean-output-directory.js | 10 ++++++++++ build/package.json | 5 +++-- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 build/lib/clean-output-directory.js diff --git a/build/build.js b/build/build.js index 2129f0d0f..39ca7bc41 100644 --- a/build/build.js +++ b/build/build.js @@ -2,8 +2,10 @@ 'use strict' +const cleanOutputDirectory = require('./lib/clean-output-directory') const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') +cleanOutputDirectory() transpileBabelPaths() transpileCoffeeScriptPaths() diff --git a/build/lib/clean-output-directory.js b/build/lib/clean-output-directory.js new file mode 100644 index 000000000..56613ed50 --- /dev/null +++ b/build/lib/clean-output-directory.js @@ -0,0 +1,10 @@ +const fs = require('fs-extra') +const path = require('path') +const CONFIG = require('../config') + +module.exports = function () { + if (fs.existsSync(CONFIG.buildOutputPath)) { + console.log(`Cleaning ${CONFIG.buildOutputPath}...`); + fs.removeSync(CONFIG.buildOutputPath) + } +} diff --git a/build/package.json b/build/package.json index ad2bbe28d..0b2c461cf 100644 --- a/build/package.json +++ b/build/package.json @@ -2,7 +2,8 @@ "name": "atom-build-scripts", "description": "Atom build scripts", "dependencies": { - "glob": "^7.0.3", - "mkdirp": "^0.5.1" + "fs-extra": "0.30.0", + "glob": "7.0.3", + "mkdirp": "0.5.1" } } From 59bc5d427e78bf8826dd07cd40d15b8ca52ae2b2 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 26 Jul 2016 14:52:14 +0200 Subject: [PATCH 007/221] Copy static/, dot-atom/ and vendor/ as they are --- build/build.js | 2 ++ build/lib/copy-static-assets.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 build/lib/copy-static-assets.js diff --git a/build/build.js b/build/build.js index 39ca7bc41..0688033e6 100644 --- a/build/build.js +++ b/build/build.js @@ -5,7 +5,9 @@ const cleanOutputDirectory = require('./lib/clean-output-directory') const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') +const copyStaticAssets = require('./lib/copy-static-assets') cleanOutputDirectory() transpileBabelPaths() transpileCoffeeScriptPaths() +copyStaticAssets() diff --git a/build/lib/copy-static-assets.js b/build/lib/copy-static-assets.js new file mode 100644 index 000000000..b5ef54983 --- /dev/null +++ b/build/lib/copy-static-assets.js @@ -0,0 +1,22 @@ +// This module exports a function that copies all the static assets into the +// appropriate location in the build output directory. + +'use strict' + +const path = require('path') +const fs = require('fs-extra') +const computeDestinationPath = require('./compute-destination-path') +const CONFIG = require('../config') + +module.exports = function () { + console.log('Copying static assets...'); + const sourcePaths = [ + path.join(CONFIG.repositoryRootPath, 'static'), + path.join(CONFIG.repositoryRootPath, 'dot-atom'), + path.join(CONFIG.repositoryRootPath, 'vendor') + ] + + for (let srcPath of sourcePaths) { + fs.copySync(srcPath, computeDestinationPath(srcPath)) + } +} From d4795ab5621905ffada3341a60f17cc099cd2070 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 27 Jul 2016 16:09:49 +0200 Subject: [PATCH 008/221] Transpile assets in-place --- build/build.js | 4 +-- .../{copy-static-assets.js => copy-assets.js} | 14 ++++++---- build/lib/transpile-babel-paths.js | 22 ++++----------- build/lib/transpile-coffee-script-paths.js | 28 +++++++------------ 4 files changed, 27 insertions(+), 41 deletions(-) rename build/lib/{copy-static-assets.js => copy-assets.js} (59%) diff --git a/build/build.js b/build/build.js index 0688033e6..60777a70c 100644 --- a/build/build.js +++ b/build/build.js @@ -3,11 +3,11 @@ 'use strict' const cleanOutputDirectory = require('./lib/clean-output-directory') +const copyAssets = require('./lib/copy-assets') const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') -const copyStaticAssets = require('./lib/copy-static-assets') cleanOutputDirectory() +copyAssets() transpileBabelPaths() transpileCoffeeScriptPaths() -copyStaticAssets() diff --git a/build/lib/copy-static-assets.js b/build/lib/copy-assets.js similarity index 59% rename from build/lib/copy-static-assets.js rename to build/lib/copy-assets.js index b5ef54983..3b15f17f7 100644 --- a/build/lib/copy-static-assets.js +++ b/build/lib/copy-assets.js @@ -7,16 +7,20 @@ const path = require('path') const fs = require('fs-extra') const computeDestinationPath = require('./compute-destination-path') const CONFIG = require('../config') +const glob = require('glob') module.exports = function () { - console.log('Copying static assets...'); - const sourcePaths = [ - path.join(CONFIG.repositoryRootPath, 'static'), + console.log('Copying assets...'); + const srcPaths = [ path.join(CONFIG.repositoryRootPath, 'dot-atom'), + path.join(CONFIG.repositoryRootPath, 'exports'), + path.join(CONFIG.repositoryRootPath, 'node_modules'), + path.join(CONFIG.repositoryRootPath, 'static'), + path.join(CONFIG.repositoryRootPath, 'src'), path.join(CONFIG.repositoryRootPath, 'vendor') ] - - for (let srcPath of sourcePaths) { + srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: '**/*-spec.*'})) + for (let srcPath of srcPaths) { fs.copySync(srcPath, computeDestinationPath(srcPath)) } } diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index b1dfa754d..3fbff56c9 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -8,9 +8,7 @@ module.exports = transpileBabelPaths const babel = require('babel-core') const fs = require('fs') const glob = require('glob') -const mkdirp = require('mkdirp') const path = require('path') -const computeDestinationPath = require('./compute-destination-path') const CONFIG = require('../config') const BABEL_OPTIONS = require('../../static/babelrc.json') @@ -25,9 +23,9 @@ const BUFFER = Buffer(PREFIX_LENGTH) function transpileBabelPaths () { console.log('Transpiling Babel paths...'); - for (let srcPath of glob.sync(`${CONFIG.repositoryRootPath}/src/**/*.js`)) { - if (usesBabel(srcPath)) { - transpileBabelPath(srcPath, computeDestinationPath(srcPath)) + for (let path of glob.sync(`${CONFIG.electronAppPath}/src/**/*.js`)) { + if (usesBabel(path)) { + transpileBabelPath(path) } } } @@ -40,16 +38,8 @@ function usesBabel (path) { return BABEL_PREFIXES.indexOf(filePrefix) !== -1 } -function transpileBabelPath (srcPath, destPath) { +function transpileBabelPath (path) { const options = Object.assign({}, BABEL_OPTIONS) - options.sourceFileName = path.relative(path.dirname(destPath), srcPath) - if (process.platform === 'win32') { - options.sourceFileName = options.sourceFileName.replace(/\\/g, '/') - } - options.sourceMapTarget = path.basename(destPath) - - let result = babel.transformFileSync(srcPath, options) - - mkdirp.sync(path.dirname(destPath)) - fs.writeFileSync(destPath, result.code) + options.sourceMap = null + fs.writeFileSync(path, babel.transformFileSync(path, options).code) } diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js index 80a92d41a..a53993a52 100644 --- a/build/lib/transpile-coffee-script-paths.js +++ b/build/lib/transpile-coffee-script-paths.js @@ -10,34 +10,26 @@ const mkdirp = require('mkdirp') const path = require('path') const CONFIG = require('../config') -const computeDestinationPath = require('./compute-destination-path') - -const GLOBS = [ - 'src/**/*.coffee,spec/*.coffee', - '!spec/*-spec.coffee', - 'exports/**/*.coffee', - 'static/**/*.coffee' -] module.exports = function transpileCoffeeScriptPaths () { console.log('Transpiling CoffeeScript paths...'); - for (let srcPath of getPathsToTranspile()) { - transpileCoffeeScriptPath(srcPath, computeDestinationPath(srcPath).replace(/coffee$/, 'js')) + for (let path of getPathsToTranspile()) { + transpileCoffeeScriptPath(path) } } function getPathsToTranspile () { let paths = [] - paths = paths.concat(glob.sync(`${CONFIG.repositoryRootPath}/src/**/*.coffee`)) - paths = paths.concat(glob.sync(`${CONFIG.repositoryRootPath}/spec/*.coffee`, {ignore: '**/*-spec.coffee'})) - paths = paths.concat(glob.sync(`${CONFIG.repositoryRootPath}/exports/**/*.coffee`)) + paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/src/**/*.coffee`)) + paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/spec/*.coffee`, {ignore: '**/*-spec.coffee'})) + paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/exports/**/*.coffee`)) return paths } -function transpileCoffeeScriptPath (srcPath, destPath) { - const inputCode = fs.readFileSync(srcPath, 'utf8') - let outputCode = coffee.compile(inputCode) - mkdirp.sync(path.dirname(destPath)) - fs.writeFileSync(destPath, outputCode) +function transpileCoffeeScriptPath (coffeePath) { + const inputCode = fs.readFileSync(coffeePath, 'utf8') + const jsPath = coffeePath.replace(/coffee$/g, 'js') + fs.writeFileSync(jsPath, coffee.compile(inputCode)) + fs.unlinkSync(coffeePath) } From c4c12c2e1d979e66d57c3a5fce3c0fe1a5c99cad Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 27 Jul 2016 16:17:52 +0200 Subject: [PATCH 009/221] Transpile package sources --- build/lib/transpile-babel-paths.js | 11 ++++++++++- build/lib/transpile-coffee-script-paths.js | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index 3fbff56c9..fa837ec27 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -23,13 +23,22 @@ const BUFFER = Buffer(PREFIX_LENGTH) function transpileBabelPaths () { console.log('Transpiling Babel paths...'); - for (let path of glob.sync(`${CONFIG.electronAppPath}/src/**/*.js`)) { + for (let path of getPathsToTranspile()) { if (usesBabel(path)) { transpileBabelPath(path) } } } +function getPathsToTranspile () { + let paths = [] + paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/src/**/*.js`)) + for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { + paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/node_modules/${packageName}/**/*.js`)) + } + return paths +} + function usesBabel (path) { const file = fs.openSync(path, 'r') fs.readSync(file, BUFFER, 0, PREFIX_LENGTH) diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js index a53993a52..f76d9722e 100644 --- a/build/lib/transpile-coffee-script-paths.js +++ b/build/lib/transpile-coffee-script-paths.js @@ -24,6 +24,9 @@ function getPathsToTranspile () { paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/src/**/*.coffee`)) paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/spec/*.coffee`, {ignore: '**/*-spec.coffee'})) paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/exports/**/*.coffee`)) + for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { + paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/node_modules/${packageName}/**/*.coffee`)) + } return paths } From 6903e941d9f443f289d449aaa7d102ee60712f5d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 27 Jul 2016 16:39:53 +0200 Subject: [PATCH 010/221] Use `path.join` instead of manually creating paths --- build/lib/copy-assets.js | 2 +- build/lib/transpile-babel-paths.js | 4 ++-- build/lib/transpile-coffee-script-paths.js | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 3b15f17f7..f067ff3b2 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -19,7 +19,7 @@ module.exports = function () { path.join(CONFIG.repositoryRootPath, 'src'), path.join(CONFIG.repositoryRootPath, 'vendor') ] - srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: '**/*-spec.*'})) + srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')})) for (let srcPath of srcPaths) { fs.copySync(srcPath, computeDestinationPath(srcPath)) } diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index fa837ec27..889466961 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -32,9 +32,9 @@ function transpileBabelPaths () { function getPathsToTranspile () { let paths = [] - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/src/**/*.js`)) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'src', '**', '*.js'))) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/node_modules/${packageName}/**/*.js`)) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.js'))) } return paths } diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js index f76d9722e..53407aa5a 100644 --- a/build/lib/transpile-coffee-script-paths.js +++ b/build/lib/transpile-coffee-script-paths.js @@ -6,7 +6,6 @@ const coffee = require('coffee-script') const fs = require('fs') const glob = require('glob') -const mkdirp = require('mkdirp') const path = require('path') const CONFIG = require('../config') @@ -21,11 +20,11 @@ function transpileCoffeeScriptPaths () { function getPathsToTranspile () { let paths = [] - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/src/**/*.coffee`)) - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/spec/*.coffee`, {ignore: '**/*-spec.coffee'})) - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/exports/**/*.coffee`)) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'src', '**', '*.coffee'))) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'spec', '*.coffee'))) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'exports', '**', '*.coffee'))) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/node_modules/${packageName}/**/*.coffee`)) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.coffee'))) } return paths } From ee60a2daaa9f6215ce628383fde458e581def9f4 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 27 Jul 2016 16:43:01 +0200 Subject: [PATCH 011/221] :art: --- build/lib/transpile-babel-paths.js | 12 +++++------- build/lib/transpile-coffee-script-paths.js | 11 +++++------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index 889466961..4d1cd5709 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -1,10 +1,5 @@ -// This module exports a function that transpiles all files with a babel prefix -// into the appropriate location in the build output directory. - 'use strict' -module.exports = transpileBabelPaths - const babel = require('babel-core') const fs = require('fs') const glob = require('glob') @@ -21,7 +16,7 @@ const BABEL_PREFIXES = [ const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.length)) const BUFFER = Buffer(PREFIX_LENGTH) -function transpileBabelPaths () { +module.exports = function () { console.log('Transpiling Babel paths...'); for (let path of getPathsToTranspile()) { if (usesBabel(path)) { @@ -34,7 +29,10 @@ function getPathsToTranspile () { let paths = [] paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'src', '**', '*.js'))) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { - paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.js'))) + paths = paths.concat(glob.sync( + path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.js'), + {ignore: path.join(CONFIG.electronAppPath, 'node_modules', packageName, 'spec', '**', '*.js')} + )) } return paths } diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js index 53407aa5a..6df2cd7f9 100644 --- a/build/lib/transpile-coffee-script-paths.js +++ b/build/lib/transpile-coffee-script-paths.js @@ -1,6 +1,3 @@ -// This module exports a function that transpiles all .coffee files into the -// appropriate location in the build output directory. - 'use strict' const coffee = require('coffee-script') @@ -10,8 +7,7 @@ const path = require('path') const CONFIG = require('../config') -module.exports = -function transpileCoffeeScriptPaths () { +module.exports = function () { console.log('Transpiling CoffeeScript paths...'); for (let path of getPathsToTranspile()) { transpileCoffeeScriptPath(path) @@ -24,7 +20,10 @@ function getPathsToTranspile () { paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'spec', '*.coffee'))) paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'exports', '**', '*.coffee'))) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { - paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.coffee'))) + paths = paths.concat(glob.sync( + path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.coffee'), + {ignore: path.join(CONFIG.electronAppPath, 'node_modules', packageName, 'spec', '**', '*.coffee')} + )) } return paths } From 59d995b21df8a7a74c5c710073d1acd2a6f3dc59 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 27 Jul 2016 16:53:38 +0200 Subject: [PATCH 012/221] Transpile CSON --- build/build.js | 2 ++ build/lib/copy-assets.js | 2 ++ build/lib/transpile-cson-paths.js | 36 +++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 build/lib/transpile-cson-paths.js diff --git a/build/build.js b/build/build.js index 60777a70c..77be716eb 100644 --- a/build/build.js +++ b/build/build.js @@ -6,8 +6,10 @@ const cleanOutputDirectory = require('./lib/clean-output-directory') const copyAssets = require('./lib/copy-assets') const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') +const transpileCsonPaths = require('./lib/transpile-cson-paths') cleanOutputDirectory() copyAssets() transpileBabelPaths() transpileCoffeeScriptPaths() +transpileCsonPaths() diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index f067ff3b2..79c401064 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -14,6 +14,8 @@ module.exports = function () { const srcPaths = [ path.join(CONFIG.repositoryRootPath, 'dot-atom'), path.join(CONFIG.repositoryRootPath, 'exports'), + path.join(CONFIG.repositoryRootPath, 'keymaps'), + path.join(CONFIG.repositoryRootPath, 'menus'), path.join(CONFIG.repositoryRootPath, 'node_modules'), path.join(CONFIG.repositoryRootPath, 'static'), path.join(CONFIG.repositoryRootPath, 'src'), diff --git a/build/lib/transpile-cson-paths.js b/build/lib/transpile-cson-paths.js new file mode 100644 index 000000000..04dfe41ed --- /dev/null +++ b/build/lib/transpile-cson-paths.js @@ -0,0 +1,36 @@ +'use strict' + +const CSON = require('season') +const fs = require('fs') +const glob = require('glob') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + console.log('Transpiling CSON paths...'); + for (let path of getPathsToTranspile()) { + transpileCsonPath(path) + } +} + +function getPathsToTranspile () { + let paths = [] + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'menus', '*.cson'))) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'keymaps', '*.cson'))) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'static', '**', '*.cson'))) + for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { + paths = paths.concat(glob.sync( + path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.cson'), + {ignore: path.join(CONFIG.electronAppPath, 'node_modules', packageName, 'spec', '**', '*.cson')} + )) + } + return paths +} + +function transpileCsonPath (csonPath) { + const jsonContent = CSON.readFileSync(csonPath) + const jsonPath = csonPath.replace(/cson$/g, 'json') + fs.writeFileSync(jsonPath, JSON.stringify(jsonContent)) + fs.unlinkSync(csonPath) +} From 2232f61c97a8603cd93cae34565541c8eb300220 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 27 Jul 2016 16:58:30 +0200 Subject: [PATCH 013/221] Inline computeDestinationPath into copyAssets ...as we don't need that function to be reusable anymore. We can always extract it later if needed. --- build/lib/compute-destination-path.js | 13 ------------- build/lib/copy-assets.js | 6 +++++- 2 files changed, 5 insertions(+), 14 deletions(-) delete mode 100644 build/lib/compute-destination-path.js diff --git a/build/lib/compute-destination-path.js b/build/lib/compute-destination-path.js deleted file mode 100644 index d79b01198..000000000 --- a/build/lib/compute-destination-path.js +++ /dev/null @@ -1,13 +0,0 @@ -// Takes an absolute path, relativizes it based on the repository root, then -// makes it absolute again in the output app path. - -'use strict' - -const path = require('path') -const CONFIG = require('../config') - -module.exports = -function computeDestinationPath (srcPath) { - let relativePath = path.relative(CONFIG.repositoryRootPath, srcPath) - return path.join(CONFIG.electronAppPath, relativePath) -} diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 79c401064..a62c52e74 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -5,7 +5,6 @@ const path = require('path') const fs = require('fs-extra') -const computeDestinationPath = require('./compute-destination-path') const CONFIG = require('../config') const glob = require('glob') @@ -26,3 +25,8 @@ module.exports = function () { fs.copySync(srcPath, computeDestinationPath(srcPath)) } } + +function computeDestinationPath (srcPath) { + let relativePath = path.relative(CONFIG.repositoryRootPath, srcPath) + return path.join(CONFIG.electronAppPath, relativePath) +} From a082be3c8c1f88c45cbded55f96680e6aca5f806 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 27 Jul 2016 17:46:45 -0600 Subject: [PATCH 014/221] Fix concat --- build/lib/copy-assets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index a62c52e74..3b87a0dc4 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -10,7 +10,7 @@ const glob = require('glob') module.exports = function () { console.log('Copying assets...'); - const srcPaths = [ + let srcPaths = [ path.join(CONFIG.repositoryRootPath, 'dot-atom'), path.join(CONFIG.repositoryRootPath, 'exports'), path.join(CONFIG.repositoryRootPath, 'keymaps'), @@ -20,7 +20,7 @@ module.exports = function () { path.join(CONFIG.repositoryRootPath, 'src'), path.join(CONFIG.repositoryRootPath, 'vendor') ] - srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')})) + srcPaths = srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')})) for (let srcPath of srcPaths) { fs.copySync(srcPath, computeDestinationPath(srcPath)) } From 366cafc64a3bea14a868426ea9f7ceb2e4f6a3df Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 27 Jul 2016 18:47:33 -0600 Subject: [PATCH 015/221] Copy everything to an intermediate electron app directory We need to do this so we can transpile everything in place, but then we should be able to run electron-packager directly on this directory. --- build/config.js | 18 ++---------------- build/lib/copy-assets.js | 6 +++--- build/lib/transpile-babel-paths.js | 8 ++++---- build/lib/transpile-coffee-script-paths.js | 12 ++++++------ build/lib/transpile-cson-paths.js | 10 +++++----- 5 files changed, 20 insertions(+), 34 deletions(-) diff --git a/build/config.js b/build/config.js index 680d11228..f71edf1bf 100644 --- a/build/config.js +++ b/build/config.js @@ -9,23 +9,9 @@ const appMetadata = require('../package.json') const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') - -let appName = appMetadata.productName -const appFileName = appMetadata.name - -let electronRootPath, electronAppPath - -switch (process.platform) { - case 'darwin': - appName += '.app' - electronRootPath = path.join(buildOutputPath, appName, 'Contents') - electronAppPath = path.join(electronRootPath, 'Resources', 'app') - break; -} +const intermediateAppPath = path.join(buildOutputPath, 'app') module.exports = { appMetadata, - repositoryRootPath, buildOutputPath, - appName, appFileName, - electronRootPath, electronAppPath + repositoryRootPath, buildOutputPath, intermediateAppPath, } diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 3b87a0dc4..5a47788d4 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -9,7 +9,7 @@ const CONFIG = require('../config') const glob = require('glob') module.exports = function () { - console.log('Copying assets...'); + console.log(`Copying assets to ${CONFIG.intermediateAppPath}...`); let srcPaths = [ path.join(CONFIG.repositoryRootPath, 'dot-atom'), path.join(CONFIG.repositoryRootPath, 'exports'), @@ -27,6 +27,6 @@ module.exports = function () { } function computeDestinationPath (srcPath) { - let relativePath = path.relative(CONFIG.repositoryRootPath, srcPath) - return path.join(CONFIG.electronAppPath, relativePath) + const relativePath = path.relative(CONFIG.repositoryRootPath, srcPath) + return path.join(CONFIG.intermediateAppPath, relativePath) } diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index 4d1cd5709..eecd77d7e 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -17,7 +17,7 @@ const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.l const BUFFER = Buffer(PREFIX_LENGTH) module.exports = function () { - console.log('Transpiling Babel paths...'); + console.log(`Transpiling Babel paths in ${CONFIG.intermediateAppPath}...`); for (let path of getPathsToTranspile()) { if (usesBabel(path)) { transpileBabelPath(path) @@ -27,11 +27,11 @@ module.exports = function () { function getPathsToTranspile () { let paths = [] - paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'src', '**', '*.js'))) + paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'src', '**', '*.js'))) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { paths = paths.concat(glob.sync( - path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.js'), - {ignore: path.join(CONFIG.electronAppPath, 'node_modules', packageName, 'spec', '**', '*.js')} + path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, '**', '*.js'), + {ignore: path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, 'spec', '**', '*.js')} )) } return paths diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js index 6df2cd7f9..6a2f1183c 100644 --- a/build/lib/transpile-coffee-script-paths.js +++ b/build/lib/transpile-coffee-script-paths.js @@ -8,7 +8,7 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log('Transpiling CoffeeScript paths...'); + console.log(`Transpiling CoffeeScript paths in ${CONFIG.intermediateAppPath}...`); for (let path of getPathsToTranspile()) { transpileCoffeeScriptPath(path) } @@ -16,13 +16,13 @@ module.exports = function () { function getPathsToTranspile () { let paths = [] - paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'src', '**', '*.coffee'))) - paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'spec', '*.coffee'))) - paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'exports', '**', '*.coffee'))) + paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'src', '**', '*.coffee'))) + paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'spec', '*.coffee'))) + paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'exports', '**', '*.coffee'))) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { paths = paths.concat(glob.sync( - path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.coffee'), - {ignore: path.join(CONFIG.electronAppPath, 'node_modules', packageName, 'spec', '**', '*.coffee')} + path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, '**', '*.coffee'), + {ignore: path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, 'spec', '**', '*.coffee')} )) } return paths diff --git a/build/lib/transpile-cson-paths.js b/build/lib/transpile-cson-paths.js index 04dfe41ed..15925a56e 100644 --- a/build/lib/transpile-cson-paths.js +++ b/build/lib/transpile-cson-paths.js @@ -16,13 +16,13 @@ module.exports = function () { function getPathsToTranspile () { let paths = [] - paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'menus', '*.cson'))) - paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'keymaps', '*.cson'))) - paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'static', '**', '*.cson'))) + paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'menus', '*.cson'))) + paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'keymaps', '*.cson'))) + paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'static', '**', '*.cson'))) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { paths = paths.concat(glob.sync( - path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.cson'), - {ignore: path.join(CONFIG.electronAppPath, 'node_modules', packageName, 'spec', '**', '*.cson')} + path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, '**', '*.cson'), + {ignore: path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, 'spec', '**', '*.cson')} )) } return paths From fa816eab8c1e023fbc2d9003a45d96ef74bd9787 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 27 Jul 2016 18:54:31 -0600 Subject: [PATCH 016/221] WIP: Add packageApplication step based on intermediate directory --- build/build.js | 2 + build/lib/package-application.js | 76 ++++++++++++++++++++++++++++++++ build/package.json | 1 + 3 files changed, 79 insertions(+) create mode 100644 build/lib/package-application.js diff --git a/build/build.js b/build/build.js index 77be716eb..056e787ff 100644 --- a/build/build.js +++ b/build/build.js @@ -7,9 +7,11 @@ const copyAssets = require('./lib/copy-assets') const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') const transpileCsonPaths = require('./lib/transpile-cson-paths') +const packageApplication = require('./lib/package-application') cleanOutputDirectory() copyAssets() transpileBabelPaths() transpileCoffeeScriptPaths() transpileCsonPaths() +packageApplication() diff --git a/build/lib/package-application.js b/build/lib/package-application.js new file mode 100644 index 000000000..88cc79cfc --- /dev/null +++ b/build/lib/package-application.js @@ -0,0 +1,76 @@ +'use strict' + +// This is where we'll run electron-packager on our intermediate app dir. +// It takes an ignore regex for paths to exclude, and I've started on a function +// to build up this regexp based on existing work in build-task.coffee. We should +// try to lean on electron-packager to do as much of the work for us as possible +// other than transpilation. It looks like it has a programmatic API. We'll need to +// copy more stuff such as the package.json for the packager to work correctly. + +const electronPackager = require('electron-packager') + +const CONFIG = require('../config') + +module.exports = function () { + console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`) + // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md + // electronPackager(...) +} + +function buildIgnoredPathsRegExp () { + const ignoredPaths = [ + '.DS_Store', + '.jshintrc', + '.npmignore', + '.pairs', + '.travis.yml', + 'appveyor.yml', + '.idea', + '.editorconfig', + '.lint', + '.lintignore', + '.eslintrc', + '.jshintignore', + 'coffeelint.json', + '.coffeelintignore', + '.gitattributes', + '.gitkeep', + path.join('git-utils', 'deps'), + path.join('oniguruma', 'deps'), + path.join('less', 'dist'), + path.join('npm', 'doc'), + path.join('npm', 'html'), + path.join('npm', 'man'), + path.join('npm', 'node_modules', '.bin', 'beep'), + path.join('npm', 'node_modules', '.bin', 'clear'), + path.join('npm', 'node_modules', '.bin', 'starwars'), + path.join('pegjs', 'examples'), + path.join('get-parameter-names', 'node_modules', 'testla'), + path.join('get-parameter-names', 'node_modules', '.bin', 'testla'), + path.join('jasmine-reporters', 'ext'), + path.join('jasmine-node', 'node_modules', 'gaze'), + path.join('jasmine-node', 'spec'), + path.join('node_modules', 'nan'), + path.join('node_modules', 'native-mate'), + path.join('build', 'binding.Makefile'), + path.join('build', 'config.gypi'), + path.join('build', 'gyp-mac-tool'), + path.join('build', 'Makefile'), + path.join('build', 'Release', 'obj.target'), + path.join('build', 'Release', 'obj'), + path.join('build', 'Release', '.deps'), + path.join('vendor', 'apm'), + + // These are only required in dev-mode, when pegjs grammars aren't precompiled + path.join('snippets', 'node_modules', 'loophole'), + path.join('snippets', 'node_modules', 'pegjs'), + path.join('snippets', 'node_modules', '.bin', 'pegjs'), + ] + + const regExpSource = ignoredPaths.map(path => '(' + escapeRegExp(path) + ')').join('|') + return new RegExp(regExpSource) +} + +function escapeRegExp (string) { + string.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") +} diff --git a/build/package.json b/build/package.json index 0b2c461cf..6f883b78c 100644 --- a/build/package.json +++ b/build/package.json @@ -2,6 +2,7 @@ "name": "atom-build-scripts", "description": "Atom build scripts", "dependencies": { + "electron-packager": "^7.3.0", "fs-extra": "0.30.0", "glob": "7.0.3", "mkdirp": "0.5.1" From 2be73d66bd0473558d2f4bb41b1f06f9b1875aad Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 10:56:03 +0200 Subject: [PATCH 017/221] Start on electronPackager --- .gitignore | 2 +- build/config.js | 3 ++- build/lib/copy-assets.js | 1 + build/lib/package-application.js | 32 +++++++++++++++++++++++++++++++- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index bce6c56d3..5d7bccec3 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,8 @@ npm-debug.log debug.log /tags /atom-shell/ -/electron/ /out/ +/cache/ docs/output docs/includes spec/fixtures/evil-files/ diff --git a/build/config.js b/build/config.js index f71edf1bf..9605a6e4d 100644 --- a/build/config.js +++ b/build/config.js @@ -10,8 +10,9 @@ const appMetadata = require('../package.json') const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') const intermediateAppPath = path.join(buildOutputPath, 'app') +const cachePath = path.join(repositoryRootPath, 'cache') module.exports = { appMetadata, - repositoryRootPath, buildOutputPath, intermediateAppPath, + repositoryRootPath, buildOutputPath, intermediateAppPath, cachePath } diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 5a47788d4..29eee4ee4 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -16,6 +16,7 @@ module.exports = function () { path.join(CONFIG.repositoryRootPath, 'keymaps'), path.join(CONFIG.repositoryRootPath, 'menus'), path.join(CONFIG.repositoryRootPath, 'node_modules'), + path.join(CONFIG.repositoryRootPath, 'package.json'), path.join(CONFIG.repositoryRootPath, 'static'), path.join(CONFIG.repositoryRootPath, 'src'), path.join(CONFIG.repositoryRootPath, 'vendor') diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 88cc79cfc..d201f1cf6 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -7,6 +7,7 @@ // other than transpilation. It looks like it has a programmatic API. We'll need to // copy more stuff such as the package.json for the packager to work correctly. +const path = require('path') const electronPackager = require('electron-packager') const CONFIG = require('../config') @@ -14,7 +15,36 @@ const CONFIG = require('../config') module.exports = function () { console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`) // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md - // electronPackager(...) + electronPackager({ + arch: process.arch, + asar: {unpack: buildAsarUnpackGlobExpression()}, + download: {cache: CONFIG.cachePath}, + dir: CONFIG.intermediateAppPath, + ignore: buildIgnoredPathsRegExp(), + out: CONFIG.buildOutputPath, + overwrite: true, + platform: process.platform + }, (err, appPaths) => { + if (err) { + console.error(err) + } else { + console.log(`Application bundle(s) created on ${appPaths}`) + } + }) +} + +function buildAsarUnpackGlobExpression () { + const unpack = [ + '*.node', + 'ctags-config', + 'ctags-darwin', + 'ctags-linux', + 'ctags-win32.exe', + path.join('**', 'node_modules', 'spellchecker', '**'), + path.join('**', 'resources', 'atom.png') + ] + + return `{${unpack.join(',')}}` } function buildIgnoredPathsRegExp () { From a3d7230f066e2abf9085c0f3e70d929cd45868f0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 10:56:31 +0200 Subject: [PATCH 018/221] Run new build script on CIs --- .travis.yml | 6 +++++- appveyor.yml | 4 +++- circle.yml | 8 +++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9ac8cc72a..5796e9c87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,11 +23,15 @@ install: - source /tmp/.nvm/nvm.sh - nvm install $NODE_VERSION - nvm use --delete-prefix $NODE_VERSION + - script/bootstrap + - node build/build.js -script: script/cibuild +script: + - echo 'Run tests at some point.' cache: directories: + - cache - node_modules - apm/node_modules - build/node_modules diff --git a/appveyor.yml b/appveyor.yml index 316701aae..0917740af 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,7 +23,8 @@ install: build_script: - cd %APPVEYOR_BUILD_FOLDER% - - C:\projects\atom\script\cibuild.cmd + - script\bootstrap.cmd + - node build\build.js test: off deploy: off @@ -37,6 +38,7 @@ cache: - '%APPVEYOR_BUILD_FOLDER%\build\node_modules' - '%APPVEYOR_BUILD_FOLDER%\apm\node_modules' - '%APPVEYOR_BUILD_FOLDER%\node_modules' + - '%APPVEYOR_BUILD_FOLDER%\cache' - '%USERPROFILE%\.atom\.apm' - '%USERPROFILE%\.atom\.node-gyp\.atom' - '%USERPROFILE%\.atom\.npm' diff --git a/circle.yml b/circle.yml index 95ebb024c..8f7ac6039 100644 --- a/circle.yml +++ b/circle.yml @@ -17,22 +17,20 @@ dependencies: - nvm install 4.4.7 - nvm use 4.4.7 - npm install -g npm - - script/fingerprint-clean override: - script/bootstrap - - post: - - script/fingerprint-write + - node build/build.js cache_directories: + - cache - apm/node_modules - build/node_modules - node_modules test: override: - - script/grunt ci + - echo 'Run tests!!!' post: - zip -r out/Atom.zip out/Atom.app From f953287e5485746ab1aad455c801b349ab115ef2 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 11:05:33 +0200 Subject: [PATCH 019/221] Specify electronVersion in electronPackager --- build/lib/package-application.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/lib/package-application.js b/build/lib/package-application.js index d201f1cf6..e8fde6be2 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -23,7 +23,8 @@ module.exports = function () { ignore: buildIgnoredPathsRegExp(), out: CONFIG.buildOutputPath, overwrite: true, - platform: process.platform + platform: process.platform, + version: CONFIG.appMetadata.electronVersion }, (err, appPaths) => { if (err) { console.error(err) From 9583c5b2cc48066487e54929bbbba0ceea248a14 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 11:18:30 +0200 Subject: [PATCH 020/221] Specify app-version and build-version --- build/lib/package-application.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/build/lib/package-application.js b/build/lib/package-application.js index e8fde6be2..2beaafda3 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -16,15 +16,17 @@ module.exports = function () { console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`) // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md electronPackager({ - arch: process.arch, - asar: {unpack: buildAsarUnpackGlobExpression()}, - download: {cache: CONFIG.cachePath}, - dir: CONFIG.intermediateAppPath, - ignore: buildIgnoredPathsRegExp(), - out: CONFIG.buildOutputPath, - overwrite: true, - platform: process.platform, - version: CONFIG.appMetadata.electronVersion + 'app-version': CONFIG.appMetadata.version, + 'arch': process.arch, + 'asar': {unpack: buildAsarUnpackGlobExpression()}, + 'build-version': CONFIG.appMetadata.version, + 'download': {cache: CONFIG.cachePath}, + 'dir': CONFIG.intermediateAppPath, + 'ignore': buildIgnoredPathsRegExp(), + 'out': CONFIG.buildOutputPath, + 'overwrite': true, + 'platform': process.platform, + 'version': CONFIG.appMetadata.electronVersion }, (err, appPaths) => { if (err) { console.error(err) From be8f6a8fcb3dcc67c6f1b6d617a9568d93069365 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 11:24:44 +0200 Subject: [PATCH 021/221] Zip correct artifact --- circle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index 8f7ac6039..61f54c20e 100644 --- a/circle.yml +++ b/circle.yml @@ -22,6 +22,9 @@ dependencies: - script/bootstrap - node build/build.js + post: + - zip -r out/Atom.zip out/Atom-darwin-x64 + cache_directories: - cache - apm/node_modules @@ -31,6 +34,3 @@ dependencies: test: override: - echo 'Run tests!!!' - - post: - - zip -r out/Atom.zip out/Atom.app From 9f0925c08c67f1a6dbf958ef8a2956f313e09c95 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 15:40:24 +0200 Subject: [PATCH 022/221] Port ignore regexps from build-task.coffee --- build/lib/package-application.js | 119 ++++++++++++++++++------------- 1 file changed, 70 insertions(+), 49 deletions(-) diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 2beaafda3..c44868c34 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -14,7 +14,6 @@ const CONFIG = require('../config') module.exports = function () { console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`) - // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md electronPackager({ 'app-version': CONFIG.appMetadata.version, 'arch': process.arch, @@ -51,59 +50,81 @@ function buildAsarUnpackGlobExpression () { } function buildIgnoredPathsRegExp () { - const ignoredPaths = [ - '.DS_Store', - '.jshintrc', - '.npmignore', - '.pairs', - '.travis.yml', - 'appveyor.yml', - '.idea', - '.editorconfig', - '.lint', - '.lintignore', - '.eslintrc', - '.jshintignore', - 'coffeelint.json', - '.coffeelintignore', - '.gitattributes', - '.gitkeep', - path.join('git-utils', 'deps'), - path.join('oniguruma', 'deps'), - path.join('less', 'dist'), - path.join('npm', 'doc'), - path.join('npm', 'html'), - path.join('npm', 'man'), - path.join('npm', 'node_modules', '.bin', 'beep'), - path.join('npm', 'node_modules', '.bin', 'clear'), - path.join('npm', 'node_modules', '.bin', 'starwars'), - path.join('pegjs', 'examples'), - path.join('get-parameter-names', 'node_modules', 'testla'), - path.join('get-parameter-names', 'node_modules', '.bin', 'testla'), - path.join('jasmine-reporters', 'ext'), - path.join('jasmine-node', 'node_modules', 'gaze'), - path.join('jasmine-node', 'spec'), - path.join('node_modules', 'nan'), - path.join('node_modules', 'native-mate'), - path.join('build', 'binding.Makefile'), - path.join('build', 'config.gypi'), - path.join('build', 'gyp-mac-tool'), - path.join('build', 'Makefile'), - path.join('build', 'Release', 'obj.target'), - path.join('build', 'Release', 'obj'), - path.join('build', 'Release', '.deps'), - path.join('vendor', 'apm'), + const ignoreRegExps = [ + escapeRegExp('.DS_Store'), + escapeRegExp('.jshintrc'), + escapeRegExp('.npmignore'), + escapeRegExp('.pairs'), + escapeRegExp('.travis.yml'), + escapeRegExp('appveyor.yml'), + escapeRegExp('.idea'), + escapeRegExp('.editorconfig'), + escapeRegExp('.lint'), + escapeRegExp('.lintignore'), + escapeRegExp('.eslintrc'), + escapeRegExp('.jshintignore'), + escapeRegExp('coffeelint.json'), + escapeRegExp('.coffeelintignore'), + escapeRegExp('.gitattributes'), + escapeRegExp('.gitkeep'), + escapeRegExp(path.join('git-utils', 'deps')), + escapeRegExp(path.join('oniguruma', 'deps')), + escapeRegExp(path.join('less', 'dist')), + escapeRegExp(path.join('pegjs', 'examples')), + escapeRegExp(path.join('get-parameter-names', 'node_modules', 'testla')), + escapeRegExp(path.join('get-parameter-names', 'node_modules', '.bin', 'testla')), + escapeRegExp(path.join('jasmine-reporters', 'ext')), + escapeRegExp(path.join('node_modules', 'nan')), + escapeRegExp(path.join('node_modules', 'native-mate')), + escapeRegExp(path.join('build', 'binding.Makefile')), + escapeRegExp(path.join('build', 'config.gypi')), + escapeRegExp(path.join('build', 'gyp-mac-tool')), + escapeRegExp(path.join('build', 'Makefile')), + escapeRegExp(path.join('build', 'Release', 'obj.target')), + escapeRegExp(path.join('build', 'Release', 'obj')), + escapeRegExp(path.join('build', 'Release', '.deps')), + escapeRegExp(path.join('vendor', 'apm')), // These are only required in dev-mode, when pegjs grammars aren't precompiled - path.join('snippets', 'node_modules', 'loophole'), - path.join('snippets', 'node_modules', 'pegjs'), - path.join('snippets', 'node_modules', '.bin', 'pegjs'), - ] + escapeRegExp(path.join('node_modules', 'loophole')), + escapeRegExp(path.join('node_modules', 'pegjs')), + escapeRegExp(path.join('node_modules', '.bin', 'pegjs')), + escapeRegExp(path.join('node_modules', 'spellchecker', 'vendor', 'hunspell') + path.sep) + '.*', + escapeRegExp(path.join('build', 'Release') + path.sep) + '.*\\.pdb', - const regExpSource = ignoredPaths.map(path => '(' + escapeRegExp(path) + ')').join('|') + // Ignore *.cc and *.h files from native modules + escapeRegExp(path.join('ctags', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('git-utils', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('keytar', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('nslog', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('oniguruma', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('pathwatcher', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('runas', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('scrollbar-style', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('spellchecker', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('cached-run-in-this-context', 'src') + path.sep) + '.*\\.(cc|h)?', + escapeRegExp(path.join('keyboard-layout', 'src') + path.sep) + '.*\\.(cc|h|mm)*', + + // Ignore build files + escapeRegExp(path.sep) + 'binding\\.gyp$', + escapeRegExp(path.sep) + '.+\\.target.mk$', + escapeRegExp(path.sep) + 'linker\\.lock$', + escapeRegExp(path.join('build', 'Release') + path.sep) + '.+\\.node\\.dSYM', + + // Ignore test, spec and example folders for packages + 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + '_*te?sts?_*' + escapeRegExp(path.sep), + 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'spec' + escapeRegExp(path.sep), + 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'examples?' + escapeRegExp(path.sep), + ] + // Ignore Hunspell dictionaries only on macOS. + if (process.platform === 'darwin') { + ignoreRegExps.push(escapeRegExp(path.join('spellchecker', 'vendor', 'hunspell_dictionaries'))) + } + + const regExpSource = ignoreRegExps.map(path => `(${path})`).join('|') return new RegExp(regExpSource) } function escapeRegExp (string) { - string.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") + return string.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") } From 18c20c095f7595955c2a45235fd1528808991aa2 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 16:07:40 +0200 Subject: [PATCH 023/221] Don't copy paths that will be ignored --- build/lib/copy-assets.js | 71 +++++++++++++++++++++++++++- build/lib/package-application.js | 81 -------------------------------- 2 files changed, 70 insertions(+), 82 deletions(-) diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 29eee4ee4..d15527f42 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -22,8 +22,13 @@ module.exports = function () { path.join(CONFIG.repositoryRootPath, 'vendor') ] srcPaths = srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')})) + const ignoredPathsRegExp = buildIgnoredPathsRegExp() for (let srcPath of srcPaths) { - fs.copySync(srcPath, computeDestinationPath(srcPath)) + fs.copySync( + srcPath, + computeDestinationPath(srcPath), + {filter: (path) => !ignoredPathsRegExp.test(path)} + ) } } @@ -31,3 +36,67 @@ function computeDestinationPath (srcPath) { const relativePath = path.relative(CONFIG.repositoryRootPath, srcPath) return path.join(CONFIG.intermediateAppPath, relativePath) } + +function buildIgnoredPathsRegExp () { + const ignoreRegExps = [ + escapeRegExp(path.join('git-utils', 'deps')), + escapeRegExp(path.join('oniguruma', 'deps')), + escapeRegExp(path.join('less', 'dist')), + escapeRegExp(path.join('pegjs', 'examples')), + escapeRegExp(path.join('get-parameter-names', 'node_modules', 'testla')), + escapeRegExp(path.join('get-parameter-names', 'node_modules', '.bin', 'testla')), + escapeRegExp(path.join('jasmine-reporters', 'ext')), + escapeRegExp(path.join('node_modules', 'nan')), + escapeRegExp(path.join('node_modules', 'native-mate')), + escapeRegExp(path.join('build', 'binding.Makefile')), + escapeRegExp(path.join('build', 'config.gypi')), + escapeRegExp(path.join('build', 'gyp-mac-tool')), + escapeRegExp(path.join('build', 'Makefile')), + escapeRegExp(path.join('build', 'Release', 'obj.target')), + escapeRegExp(path.join('build', 'Release', 'obj')), + escapeRegExp(path.join('build', 'Release', '.deps')), + escapeRegExp(path.join('vendor', 'apm')), + + // These are only required in dev-mode, when pegjs grammars aren't precompiled + escapeRegExp(path.join('node_modules', 'loophole')), + escapeRegExp(path.join('node_modules', 'pegjs')), + escapeRegExp(path.join('node_modules', '.bin', 'pegjs')), + escapeRegExp(path.join('node_modules', 'spellchecker', 'vendor', 'hunspell') + path.sep) + '.*', + escapeRegExp(path.join('build', 'Release') + path.sep) + '.*\\.pdb', + + // Ignore *.cc and *.h files from native modules + escapeRegExp(path.join('ctags', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('git-utils', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('keytar', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('nslog', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('oniguruma', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('pathwatcher', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('runas', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('scrollbar-style', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('spellchecker', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('cached-run-in-this-context', 'src') + path.sep) + '.*\\.(cc|h)?', + escapeRegExp(path.join('keyboard-layout', 'src') + path.sep) + '.*\\.(cc|h|mm)*', + + // Ignore build files + escapeRegExp(path.sep) + 'binding\\.gyp$', + escapeRegExp(path.sep) + '.+\\.target.mk$', + escapeRegExp(path.sep) + 'linker\\.lock$', + escapeRegExp(path.join('build', 'Release') + path.sep) + '.+\\.node\\.dSYM', + + // Ignore test, spec and example folders for packages + 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + '_*te?sts?_*' + escapeRegExp(path.sep), + 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'spec' + escapeRegExp(path.sep), + 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'examples?' + escapeRegExp(path.sep), + ] + // Ignore Hunspell dictionaries only on macOS. + if (process.platform === 'darwin') { + ignoreRegExps.push(escapeRegExp(path.join('spellchecker', 'vendor', 'hunspell_dictionaries'))) + } + + const regExpSource = ignoreRegExps.map(path => `(${path})`).join('|') + return new RegExp(regExpSource) +} + +function escapeRegExp (string) { + return string.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") +} diff --git a/build/lib/package-application.js b/build/lib/package-application.js index c44868c34..116b9fad5 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -21,7 +21,6 @@ module.exports = function () { 'build-version': CONFIG.appMetadata.version, 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, - 'ignore': buildIgnoredPathsRegExp(), 'out': CONFIG.buildOutputPath, 'overwrite': true, 'platform': process.platform, @@ -48,83 +47,3 @@ function buildAsarUnpackGlobExpression () { return `{${unpack.join(',')}}` } - -function buildIgnoredPathsRegExp () { - const ignoreRegExps = [ - escapeRegExp('.DS_Store'), - escapeRegExp('.jshintrc'), - escapeRegExp('.npmignore'), - escapeRegExp('.pairs'), - escapeRegExp('.travis.yml'), - escapeRegExp('appveyor.yml'), - escapeRegExp('.idea'), - escapeRegExp('.editorconfig'), - escapeRegExp('.lint'), - escapeRegExp('.lintignore'), - escapeRegExp('.eslintrc'), - escapeRegExp('.jshintignore'), - escapeRegExp('coffeelint.json'), - escapeRegExp('.coffeelintignore'), - escapeRegExp('.gitattributes'), - escapeRegExp('.gitkeep'), - escapeRegExp(path.join('git-utils', 'deps')), - escapeRegExp(path.join('oniguruma', 'deps')), - escapeRegExp(path.join('less', 'dist')), - escapeRegExp(path.join('pegjs', 'examples')), - escapeRegExp(path.join('get-parameter-names', 'node_modules', 'testla')), - escapeRegExp(path.join('get-parameter-names', 'node_modules', '.bin', 'testla')), - escapeRegExp(path.join('jasmine-reporters', 'ext')), - escapeRegExp(path.join('node_modules', 'nan')), - escapeRegExp(path.join('node_modules', 'native-mate')), - escapeRegExp(path.join('build', 'binding.Makefile')), - escapeRegExp(path.join('build', 'config.gypi')), - escapeRegExp(path.join('build', 'gyp-mac-tool')), - escapeRegExp(path.join('build', 'Makefile')), - escapeRegExp(path.join('build', 'Release', 'obj.target')), - escapeRegExp(path.join('build', 'Release', 'obj')), - escapeRegExp(path.join('build', 'Release', '.deps')), - escapeRegExp(path.join('vendor', 'apm')), - - // These are only required in dev-mode, when pegjs grammars aren't precompiled - escapeRegExp(path.join('node_modules', 'loophole')), - escapeRegExp(path.join('node_modules', 'pegjs')), - escapeRegExp(path.join('node_modules', '.bin', 'pegjs')), - escapeRegExp(path.join('node_modules', 'spellchecker', 'vendor', 'hunspell') + path.sep) + '.*', - escapeRegExp(path.join('build', 'Release') + path.sep) + '.*\\.pdb', - - // Ignore *.cc and *.h files from native modules - escapeRegExp(path.join('ctags', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('git-utils', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('keytar', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('nslog', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('oniguruma', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('pathwatcher', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('runas', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('scrollbar-style', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('spellchecker', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('cached-run-in-this-context', 'src') + path.sep) + '.*\\.(cc|h)?', - escapeRegExp(path.join('keyboard-layout', 'src') + path.sep) + '.*\\.(cc|h|mm)*', - - // Ignore build files - escapeRegExp(path.sep) + 'binding\\.gyp$', - escapeRegExp(path.sep) + '.+\\.target.mk$', - escapeRegExp(path.sep) + 'linker\\.lock$', - escapeRegExp(path.join('build', 'Release') + path.sep) + '.+\\.node\\.dSYM', - - // Ignore test, spec and example folders for packages - 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + '_*te?sts?_*' + escapeRegExp(path.sep), - 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'spec' + escapeRegExp(path.sep), - 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'examples?' + escapeRegExp(path.sep), - ] - // Ignore Hunspell dictionaries only on macOS. - if (process.platform === 'darwin') { - ignoreRegExps.push(escapeRegExp(path.join('spellchecker', 'vendor', 'hunspell_dictionaries'))) - } - - const regExpSource = ignoreRegExps.map(path => `(${path})`).join('|') - return new RegExp(regExpSource) -} - -function escapeRegExp (string) { - return string.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") -} From f5c6baa064f6e43c3204dbe9acc66dc0c0da8aad Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 17:07:54 +0200 Subject: [PATCH 024/221] Copy apm in Mac Resources folder --- build/config.js | 4 +++- build/lib/copy-assets.js | 25 +++++++++++++++++++------ build/lib/package-application.js | 12 ++++++++++++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/build/config.js b/build/config.js index 9605a6e4d..979090fba 100644 --- a/build/config.js +++ b/build/config.js @@ -10,9 +10,11 @@ const appMetadata = require('../package.json') const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') const intermediateAppPath = path.join(buildOutputPath, 'app') +const intermediateResourcesPath = path.join(buildOutputPath, 'resources') const cachePath = path.join(repositoryRootPath, 'cache') module.exports = { appMetadata, - repositoryRootPath, buildOutputPath, intermediateAppPath, cachePath + repositoryRootPath, buildOutputPath, intermediateAppPath, intermediateResourcesPath, + cachePath } diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index d15527f42..870aac6ea 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -10,6 +10,8 @@ const glob = require('glob') module.exports = function () { console.log(`Copying assets to ${CONFIG.intermediateAppPath}...`); + const ignoredPathsRegExp = buildIgnoredPathsRegExp() + const skipIgnoredPaths = (path) => !ignoredPathsRegExp.test(path) let srcPaths = [ path.join(CONFIG.repositoryRootPath, 'dot-atom'), path.join(CONFIG.repositoryRootPath, 'exports'), @@ -22,13 +24,18 @@ module.exports = function () { path.join(CONFIG.repositoryRootPath, 'vendor') ] srcPaths = srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')})) - const ignoredPathsRegExp = buildIgnoredPathsRegExp() for (let srcPath of srcPaths) { - fs.copySync( - srcPath, - computeDestinationPath(srcPath), - {filter: (path) => !ignoredPathsRegExp.test(path)} - ) + fs.copySync(srcPath, computeDestinationPath(srcPath), {filter: skipIgnoredPaths}) + } + + console.log(`Copying resources to ${CONFIG.intermediateResourcesPath}...`); + fs.copySync( + path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), + path.join(CONFIG.intermediateResourcesPath, 'apm'), + {filter: skipIgnoredPaths} + ) + if (process.platform !== 'windows') { + fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(CONFIG.intermediateResourcesPath, 'atom.sh')) } } @@ -42,6 +49,12 @@ function buildIgnoredPathsRegExp () { escapeRegExp(path.join('git-utils', 'deps')), escapeRegExp(path.join('oniguruma', 'deps')), escapeRegExp(path.join('less', 'dist')), + escapeRegExp(path.join('npm', 'doc')), + escapeRegExp(path.join('npm', 'html')), + escapeRegExp(path.join('npm', 'man')), + escapeRegExp(path.join('npm', 'node_modules', '.bin', 'beep')), + escapeRegExp(path.join('npm', 'node_modules', '.bin', 'clear')), + escapeRegExp(path.join('npm', 'node_modules', '.bin', 'starwars')), escapeRegExp(path.join('pegjs', 'examples')), escapeRegExp(path.join('get-parameter-names', 'node_modules', 'testla')), escapeRegExp(path.join('get-parameter-names', 'node_modules', '.bin', 'testla')), diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 116b9fad5..d5e2765e2 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -7,6 +7,7 @@ // other than transpilation. It looks like it has a programmatic API. We'll need to // copy more stuff such as the package.json for the packager to work correctly. +const fs = require('fs-extra') const path = require('path') const electronPackager = require('electron-packager') @@ -29,6 +30,17 @@ module.exports = function () { if (err) { console.error(err) } else { + if (appPaths.length > 1) { + throw new Error('TODO: handle this case!') + } + + if (process.platform === 'darwin') { + const bundleResourcesPath = path.join(appPaths[0], 'Atom.app', 'Contents', 'Resources') + fs.copySync(CONFIG.intermediateResourcesPath, path.join(bundleResourcesPath, 'app')) + } else { + throw new Error('TODO: handle this case!') + } + console.log(`Application bundle(s) created on ${appPaths}`) } }) From 2953014609452a79e1ada53bade1d5669c1512cb Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 17:53:03 +0200 Subject: [PATCH 025/221] Add coffee-script and babel in build/package.json ...and use the same versions found on the root package.json. --- build/package.json | 7 +++++-- package.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build/package.json b/build/package.json index 6f883b78c..dcf51f739 100644 --- a/build/package.json +++ b/build/package.json @@ -2,9 +2,12 @@ "name": "atom-build-scripts", "description": "Atom build scripts", "dependencies": { - "electron-packager": "^7.3.0", + "babel-core": "5.8.38", + "coffee-script": "1.8.0", + "electron-packager": "7.3.0", "fs-extra": "0.30.0", "glob": "7.0.3", - "mkdirp": "0.5.1" + "mkdirp": "0.5.1", + "npm": "3.10.5" } } diff --git a/package.json b/package.json index 717c0e00d..886216133 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "async": "0.2.6", "atom-keymap": "6.3.2", "atom-ui": "0.4.1", - "babel-core": "^5.8.21", + "babel-core": "5.8.38", "cached-run-in-this-context": "0.4.1", "chai": "3.5.0", "clear-cut": "^2.0.1", From 3c414579f366055c0b485a2c45307572abdcc129 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 18:18:16 +0200 Subject: [PATCH 026/221] Transpile PEG.js files --- build/build.js | 2 ++ build/lib/transpile-peg-js-paths.js | 31 +++++++++++++++++++++++++++++ build/package.json | 3 ++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 build/lib/transpile-peg-js-paths.js diff --git a/build/build.js b/build/build.js index 056e787ff..cf7001ee9 100644 --- a/build/build.js +++ b/build/build.js @@ -7,6 +7,7 @@ const copyAssets = require('./lib/copy-assets') const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') const transpileCsonPaths = require('./lib/transpile-cson-paths') +const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') const packageApplication = require('./lib/package-application') cleanOutputDirectory() @@ -14,4 +15,5 @@ copyAssets() transpileBabelPaths() transpileCoffeeScriptPaths() transpileCsonPaths() +transpilePegJsPaths() packageApplication() diff --git a/build/lib/transpile-peg-js-paths.js b/build/lib/transpile-peg-js-paths.js new file mode 100644 index 000000000..75b1b53b2 --- /dev/null +++ b/build/lib/transpile-peg-js-paths.js @@ -0,0 +1,31 @@ +'use strict' + +const peg = require("pegjs") +const fs = require('fs') +const glob = require('glob') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + console.log(`Transpiling PEG.js paths in ${CONFIG.intermediateAppPath}...`); + for (let path of getPathsToTranspile()) { + transpilePegJsPath(path) + } +} + +function getPathsToTranspile () { + let paths = [] + for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { + paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, '**', '*.pegjs'))) + } + return paths +} + +function transpilePegJsPath (pegJsPath) { + const inputCode = fs.readFileSync(pegJsPath, 'utf8') + const jsPath = pegJsPath.replace(/pegjs$/g, 'js') + const outputCode = 'module.exports = ' + peg.buildParser(inputCode, {output: 'source'}) + fs.writeFileSync(jsPath, outputCode) + fs.unlinkSync(pegJsPath) +} diff --git a/build/package.json b/build/package.json index dcf51f739..4764f4935 100644 --- a/build/package.json +++ b/build/package.json @@ -8,6 +8,7 @@ "fs-extra": "0.30.0", "glob": "7.0.3", "mkdirp": "0.5.1", - "npm": "3.10.5" + "npm": "3.10.5", + "pegjs": "0.9.0" } } From bda6447f327fb3187f4caa75d71565c3eda60d84 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 18:22:47 +0200 Subject: [PATCH 027/221] :art: --- build/lib/transpile-babel-paths.js | 2 +- build/lib/transpile-coffee-script-paths.js | 2 +- build/lib/transpile-cson-paths.js | 2 +- build/lib/transpile-peg-js-paths.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index eecd77d7e..51d243991 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -17,7 +17,7 @@ const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.l const BUFFER = Buffer(PREFIX_LENGTH) module.exports = function () { - console.log(`Transpiling Babel paths in ${CONFIG.intermediateAppPath}...`); + console.log(`Transpiling Babel paths in ${CONFIG.intermediateAppPath}...`) for (let path of getPathsToTranspile()) { if (usesBabel(path)) { transpileBabelPath(path) diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js index 6a2f1183c..b832c1c2e 100644 --- a/build/lib/transpile-coffee-script-paths.js +++ b/build/lib/transpile-coffee-script-paths.js @@ -8,7 +8,7 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log(`Transpiling CoffeeScript paths in ${CONFIG.intermediateAppPath}...`); + console.log(`Transpiling CoffeeScript paths in ${CONFIG.intermediateAppPath}...`) for (let path of getPathsToTranspile()) { transpileCoffeeScriptPath(path) } diff --git a/build/lib/transpile-cson-paths.js b/build/lib/transpile-cson-paths.js index 15925a56e..4391c42bc 100644 --- a/build/lib/transpile-cson-paths.js +++ b/build/lib/transpile-cson-paths.js @@ -8,7 +8,7 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log('Transpiling CSON paths...'); + console.log(`Transpiling CSON paths in ${CONFIG.intermediateAppPath}...`) for (let path of getPathsToTranspile()) { transpileCsonPath(path) } diff --git a/build/lib/transpile-peg-js-paths.js b/build/lib/transpile-peg-js-paths.js index 75b1b53b2..10ef50a9b 100644 --- a/build/lib/transpile-peg-js-paths.js +++ b/build/lib/transpile-peg-js-paths.js @@ -8,7 +8,7 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log(`Transpiling PEG.js paths in ${CONFIG.intermediateAppPath}...`); + console.log(`Transpiling PEG.js paths in ${CONFIG.intermediateAppPath}...`) for (let path of getPathsToTranspile()) { transpilePegJsPath(path) } From 22af37a8963e16dd82f97472a8c2edbed690b93a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 18:32:10 +0200 Subject: [PATCH 028/221] Add module cache generation --- build/build.js | 4 ++++ build/lib/generate-module-cache.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 build/lib/generate-module-cache.js diff --git a/build/build.js b/build/build.js index cf7001ee9..24aa8ef0d 100644 --- a/build/build.js +++ b/build/build.js @@ -2,12 +2,15 @@ 'use strict' +require('coffee-script/register') + const cleanOutputDirectory = require('./lib/clean-output-directory') const copyAssets = require('./lib/copy-assets') const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') const transpileCsonPaths = require('./lib/transpile-cson-paths') const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') +const generateModuleCache = require('./lib/generate-module-cache') const packageApplication = require('./lib/package-application') cleanOutputDirectory() @@ -16,4 +19,5 @@ transpileBabelPaths() transpileCoffeeScriptPaths() transpileCsonPaths() transpilePegJsPaths() +generateModuleCache() packageApplication() diff --git a/build/lib/generate-module-cache.js b/build/lib/generate-module-cache.js new file mode 100644 index 000000000..4013e7578 --- /dev/null +++ b/build/lib/generate-module-cache.js @@ -0,0 +1,30 @@ +'use strict' + +const fs = require('fs') +const path = require('path') +const ModuleCache = require('../../src/module-cache') + +const CONFIG = require('../config') + +module.exports = function () { + console.log(`Generating module cache for ${CONFIG.intermediateAppPath}...`) + for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { + ModuleCache.create(path.join(CONFIG.intermediateAppPath, 'node_modules', packageName)) + } + ModuleCache.create(CONFIG.intermediateAppPath) + const newMetadata = JSON.parse(fs.readFileSync(path.join(CONFIG.intermediateAppPath, 'package.json'))) + for (let folder of newMetadata._atomModuleCache.folders) { + if (folder.paths.indexOf('') !== -1) { + folder.paths = [ + '', + 'exports', + 'spec', + 'src', + 'src/main-process', + 'static', + 'vendor' + ] + } + } + fs.writeFileSync(path.join(CONFIG.intermediateAppPath, 'package.json'), JSON.stringify(newMetadata)) +} From 82bbf0cd3ccb9c7099fb94da370db7bcdd936253 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 18:52:23 +0200 Subject: [PATCH 029/221] Export channel from build/config.js --- build/config.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/build/config.js b/build/config.js index 979090fba..3b0f302ba 100644 --- a/build/config.js +++ b/build/config.js @@ -12,9 +12,28 @@ const buildOutputPath = path.join(repositoryRootPath, 'out') const intermediateAppPath = path.join(buildOutputPath, 'app') const intermediateResourcesPath = path.join(buildOutputPath, 'resources') const cachePath = path.join(repositoryRootPath, 'cache') +const channel = getChannel() module.exports = { - appMetadata, + appMetadata, channel, repositoryRootPath, buildOutputPath, intermediateAppPath, intermediateResourcesPath, cachePath } + +function getChannel () { + if (appMetadata.version.match(/dev/) || isBuildingPR()) { + return 'dev' + } else if (appMetadata.version.match(/beta/)) { + return 'beta' + } else { + return 'stable' + } +} + +function isBuildingPR () { + return ( + process.env.APPVEYOR_PULL_REQUEST_NUMBER || + process.env.TRAVIS_PULL_REQUEST || + process.env.CI_PULL_REQUEST + ) +} From 0775062e9e2c8154fcf4c454016faffffbd47c6b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 18:54:50 +0200 Subject: [PATCH 030/221] `resourcesPath` -> `shellCommandsPath` --- build/config.js | 4 ++-- build/lib/copy-assets.js | 6 +++--- build/lib/package-application.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/config.js b/build/config.js index 3b0f302ba..ca996bccc 100644 --- a/build/config.js +++ b/build/config.js @@ -10,13 +10,13 @@ const appMetadata = require('../package.json') const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') const intermediateAppPath = path.join(buildOutputPath, 'app') -const intermediateResourcesPath = path.join(buildOutputPath, 'resources') +const intermediateShellCommandsPath = path.join(buildOutputPath, 'shell') const cachePath = path.join(repositoryRootPath, 'cache') const channel = getChannel() module.exports = { appMetadata, channel, - repositoryRootPath, buildOutputPath, intermediateAppPath, intermediateResourcesPath, + repositoryRootPath, buildOutputPath, intermediateAppPath, intermediateShellCommandsPath, cachePath } diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 870aac6ea..684b66fa1 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -28,14 +28,14 @@ module.exports = function () { fs.copySync(srcPath, computeDestinationPath(srcPath), {filter: skipIgnoredPaths}) } - console.log(`Copying resources to ${CONFIG.intermediateResourcesPath}...`); + console.log(`Copying shell commands to ${CONFIG.intermediateShellCommandsPath}...`); fs.copySync( path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), - path.join(CONFIG.intermediateResourcesPath, 'apm'), + path.join(CONFIG.intermediateShellCommandsPath, 'apm'), {filter: skipIgnoredPaths} ) if (process.platform !== 'windows') { - fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(CONFIG.intermediateResourcesPath, 'atom.sh')) + fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(CONFIG.intermediateShellCommandsPath, 'atom.sh')) } } diff --git a/build/lib/package-application.js b/build/lib/package-application.js index d5e2765e2..eefff42dc 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -36,7 +36,7 @@ module.exports = function () { if (process.platform === 'darwin') { const bundleResourcesPath = path.join(appPaths[0], 'Atom.app', 'Contents', 'Resources') - fs.copySync(CONFIG.intermediateResourcesPath, path.join(bundleResourcesPath, 'app')) + fs.copySync(CONFIG.intermediateShellCommandsPath, path.join(bundleResourcesPath, 'app')) } else { throw new Error('TODO: handle this case!') } From 6804156266f22bea2e6c2e0afc7fa01432b960cf Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 20:05:04 +0200 Subject: [PATCH 031/221] :fire: Remove speakeasy Signed-off-by: Nathan Sobo --- resources/mac/speakeasy.pem | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 resources/mac/speakeasy.pem diff --git a/resources/mac/speakeasy.pem b/resources/mac/speakeasy.pem deleted file mode 100644 index 791182f81..000000000 --- a/resources/mac/speakeasy.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIIDOjCCAi0GByqGSM44BAEwggIgAoIBAQCEh+j0nKWTw7soK6w3uk9PzPGVBksk -wDIaA+d+1CHJY9qhjp7OjAlSOl6nrUlGHzU87DRmBlwYZONAzDZnYpLi7zmPVASg -Xk+AmuqzqahTKtwodJp7R/Aq/lCbB2tXTXOxVo+Jya1BQbfd0wWXJFUlD/xTvrgu -zrtw6VYBvaRu8jCjHAJNZn0CO80igj1ZNxRqmmz1Rkt1tT0KBBfGBTNzXeBmGKHN -bVIKW7zImgfm+UQky+WFei1dqcfWOyfrHIYa3Qn1Nes48SBdrolvfvrChlSpqgEN -wxFW9aoognS1UJTu350AQb2NwOOSQRsR++y3iJp+60nBSDZu7sjNN9etAhUAvqki -JOjBjooRd2odMh7imICHQ3kCggEATwa6W0s2xrolPRpwWZS8ORUNDgEI4eOIvonq -O2qZgwD21zUQOsFjLMbWn0cCtrORr7iM8pFg8Yn8dSccpqs+2cM4uFZAycKXf6w3 -jIvV6M3IPQuUSqVFZtqUVuteGTEuAHZKIrXE05P4aJXHLjqSC9JuaXNRm9q7OW7m -rwsoAFyfkKqbtl5Ch+WZ21CE4J+ByTfVwVU4XLiOtce6NABSDWNJsF9fIoFCZCDc -uumLllDJysD8S6aBNhOjNMHPmeIpZBXT23zHH5du/blcEyBbVF3a2ntgudfJmyln -T178CIEUSSjcbz9JyAhhK7OfNlzKhRiO1c4Y3XaZIniLGjF5DwOCAQUAAoIBABGZ -mfuHBW89ub19iICE//VbB91m2f0nUvHk8vE4vvAK8AdD91GODPJr4DU0kJM6ne8r -ohvZgokgDRkGAEceX/nVoG0RLq9T15Xr2qedWVwAffpU10iV9mYwbhHqUKPtG8cj -GW0cDdSI+0oG6UEyn8aQ5p93YEm5N6lq4rWKpxXb/gkrIla4sJJP8VHOOKmo6l1H -AKVIfofiaNAQShu72WVCCurWaoVTUEliEBhy3WlcjuKXEuoL1lpNxyqkt7mf6w71 -6y2+Nh+XUTiFoTIVhk/CH0z+BQTneWEALvfTFzDae+a42rPAisKlt+Gbe7zopnVA -kcQwM0lLzgwx4T1DV3s= ------END PUBLIC KEY----- \ No newline at end of file From 510ef53398bae4528dcc0903a8db9ecf5bcf1fd3 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 20:05:49 +0200 Subject: [PATCH 032/221] Move shell scripts copying into package-application step Signed-off-by: Nathan Sobo --- build/config.js | 3 +- build/lib/copy-assets.js | 85 +---------------------- build/lib/include-path-in-packaged-app.js | 76 ++++++++++++++++++++ build/lib/package-application.js | 35 ++++++---- 4 files changed, 99 insertions(+), 100 deletions(-) create mode 100644 build/lib/include-path-in-packaged-app.js diff --git a/build/config.js b/build/config.js index ca996bccc..19d02e64f 100644 --- a/build/config.js +++ b/build/config.js @@ -10,13 +10,12 @@ const appMetadata = require('../package.json') const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') const intermediateAppPath = path.join(buildOutputPath, 'app') -const intermediateShellCommandsPath = path.join(buildOutputPath, 'shell') const cachePath = path.join(repositoryRootPath, 'cache') const channel = getChannel() module.exports = { appMetadata, channel, - repositoryRootPath, buildOutputPath, intermediateAppPath, intermediateShellCommandsPath, + repositoryRootPath, buildOutputPath, intermediateAppPath, cachePath } diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 684b66fa1..0401f44b0 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -7,11 +7,10 @@ const path = require('path') const fs = require('fs-extra') const CONFIG = require('../config') const glob = require('glob') +const includePathInPackagedApp = require('./include-path-in-packaged-app') module.exports = function () { console.log(`Copying assets to ${CONFIG.intermediateAppPath}...`); - const ignoredPathsRegExp = buildIgnoredPathsRegExp() - const skipIgnoredPaths = (path) => !ignoredPathsRegExp.test(path) let srcPaths = [ path.join(CONFIG.repositoryRootPath, 'dot-atom'), path.join(CONFIG.repositoryRootPath, 'exports'), @@ -25,17 +24,7 @@ module.exports = function () { ] srcPaths = srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')})) for (let srcPath of srcPaths) { - fs.copySync(srcPath, computeDestinationPath(srcPath), {filter: skipIgnoredPaths}) - } - - console.log(`Copying shell commands to ${CONFIG.intermediateShellCommandsPath}...`); - fs.copySync( - path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), - path.join(CONFIG.intermediateShellCommandsPath, 'apm'), - {filter: skipIgnoredPaths} - ) - if (process.platform !== 'windows') { - fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(CONFIG.intermediateShellCommandsPath, 'atom.sh')) + fs.copySync(srcPath, computeDestinationPath(srcPath), {filter: includePathInPackagedApp}) } } @@ -43,73 +32,3 @@ function computeDestinationPath (srcPath) { const relativePath = path.relative(CONFIG.repositoryRootPath, srcPath) return path.join(CONFIG.intermediateAppPath, relativePath) } - -function buildIgnoredPathsRegExp () { - const ignoreRegExps = [ - escapeRegExp(path.join('git-utils', 'deps')), - escapeRegExp(path.join('oniguruma', 'deps')), - escapeRegExp(path.join('less', 'dist')), - escapeRegExp(path.join('npm', 'doc')), - escapeRegExp(path.join('npm', 'html')), - escapeRegExp(path.join('npm', 'man')), - escapeRegExp(path.join('npm', 'node_modules', '.bin', 'beep')), - escapeRegExp(path.join('npm', 'node_modules', '.bin', 'clear')), - escapeRegExp(path.join('npm', 'node_modules', '.bin', 'starwars')), - escapeRegExp(path.join('pegjs', 'examples')), - escapeRegExp(path.join('get-parameter-names', 'node_modules', 'testla')), - escapeRegExp(path.join('get-parameter-names', 'node_modules', '.bin', 'testla')), - escapeRegExp(path.join('jasmine-reporters', 'ext')), - escapeRegExp(path.join('node_modules', 'nan')), - escapeRegExp(path.join('node_modules', 'native-mate')), - escapeRegExp(path.join('build', 'binding.Makefile')), - escapeRegExp(path.join('build', 'config.gypi')), - escapeRegExp(path.join('build', 'gyp-mac-tool')), - escapeRegExp(path.join('build', 'Makefile')), - escapeRegExp(path.join('build', 'Release', 'obj.target')), - escapeRegExp(path.join('build', 'Release', 'obj')), - escapeRegExp(path.join('build', 'Release', '.deps')), - escapeRegExp(path.join('vendor', 'apm')), - - // These are only required in dev-mode, when pegjs grammars aren't precompiled - escapeRegExp(path.join('node_modules', 'loophole')), - escapeRegExp(path.join('node_modules', 'pegjs')), - escapeRegExp(path.join('node_modules', '.bin', 'pegjs')), - escapeRegExp(path.join('node_modules', 'spellchecker', 'vendor', 'hunspell') + path.sep) + '.*', - escapeRegExp(path.join('build', 'Release') + path.sep) + '.*\\.pdb', - - // Ignore *.cc and *.h files from native modules - escapeRegExp(path.join('ctags', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('git-utils', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('keytar', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('nslog', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('oniguruma', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('pathwatcher', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('runas', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('scrollbar-style', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('spellchecker', 'src') + path.sep) + '.*\\.(cc|h)*', - escapeRegExp(path.join('cached-run-in-this-context', 'src') + path.sep) + '.*\\.(cc|h)?', - escapeRegExp(path.join('keyboard-layout', 'src') + path.sep) + '.*\\.(cc|h|mm)*', - - // Ignore build files - escapeRegExp(path.sep) + 'binding\\.gyp$', - escapeRegExp(path.sep) + '.+\\.target.mk$', - escapeRegExp(path.sep) + 'linker\\.lock$', - escapeRegExp(path.join('build', 'Release') + path.sep) + '.+\\.node\\.dSYM', - - // Ignore test, spec and example folders for packages - 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + '_*te?sts?_*' + escapeRegExp(path.sep), - 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'spec' + escapeRegExp(path.sep), - 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'examples?' + escapeRegExp(path.sep), - ] - // Ignore Hunspell dictionaries only on macOS. - if (process.platform === 'darwin') { - ignoreRegExps.push(escapeRegExp(path.join('spellchecker', 'vendor', 'hunspell_dictionaries'))) - } - - const regExpSource = ignoreRegExps.map(path => `(${path})`).join('|') - return new RegExp(regExpSource) -} - -function escapeRegExp (string) { - return string.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") -} diff --git a/build/lib/include-path-in-packaged-app.js b/build/lib/include-path-in-packaged-app.js new file mode 100644 index 000000000..0736a2f6f --- /dev/null +++ b/build/lib/include-path-in-packaged-app.js @@ -0,0 +1,76 @@ +'use strict' + +const path = require('path') + +module.exports = function (path) { + return !EXCLUDED_PATHS_REGEXP.test(path) +} + +const EXCLUDE_REGEXPS_SOURCES = [ + escapeRegExp(path.join('git-utils', 'deps')), + escapeRegExp(path.join('oniguruma', 'deps')), + escapeRegExp(path.join('less', 'dist')), + escapeRegExp(path.join('npm', 'doc')), + escapeRegExp(path.join('npm', 'html')), + escapeRegExp(path.join('npm', 'man')), + escapeRegExp(path.join('npm', 'node_modules', '.bin', 'beep')), + escapeRegExp(path.join('npm', 'node_modules', '.bin', 'clear')), + escapeRegExp(path.join('npm', 'node_modules', '.bin', 'starwars')), + escapeRegExp(path.join('pegjs', 'examples')), + escapeRegExp(path.join('get-parameter-names', 'node_modules', 'testla')), + escapeRegExp(path.join('get-parameter-names', 'node_modules', '.bin', 'testla')), + escapeRegExp(path.join('jasmine-reporters', 'ext')), + escapeRegExp(path.join('node_modules', 'nan')), + escapeRegExp(path.join('node_modules', 'native-mate')), + escapeRegExp(path.join('build', 'binding.Makefile')), + escapeRegExp(path.join('build', 'config.gypi')), + escapeRegExp(path.join('build', 'gyp-mac-tool')), + escapeRegExp(path.join('build', 'Makefile')), + escapeRegExp(path.join('build', 'Release', 'obj.target')), + escapeRegExp(path.join('build', 'Release', 'obj')), + escapeRegExp(path.join('build', 'Release', '.deps')), + escapeRegExp(path.join('vendor', 'apm')), + + // These are only required in dev-mode, when pegjs grammars aren't precompiled + escapeRegExp(path.join('node_modules', 'loophole')), + escapeRegExp(path.join('node_modules', 'pegjs')), + escapeRegExp(path.join('node_modules', '.bin', 'pegjs')), + escapeRegExp(path.join('node_modules', 'spellchecker', 'vendor', 'hunspell') + path.sep) + '.*', + escapeRegExp(path.join('build', 'Release') + path.sep) + '.*\\.pdb', + + // Ignore *.cc and *.h files from native modules + escapeRegExp(path.join('ctags', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('git-utils', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('keytar', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('nslog', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('oniguruma', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('pathwatcher', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('runas', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('scrollbar-style', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('spellchecker', 'src') + path.sep) + '.*\\.(cc|h)*', + escapeRegExp(path.join('cached-run-in-this-context', 'src') + path.sep) + '.*\\.(cc|h)?', + escapeRegExp(path.join('keyboard-layout', 'src') + path.sep) + '.*\\.(cc|h|mm)*', + + // Ignore build files + escapeRegExp(path.sep) + 'binding\\.gyp$', + escapeRegExp(path.sep) + '.+\\.target.mk$', + escapeRegExp(path.sep) + 'linker\\.lock$', + escapeRegExp(path.join('build', 'Release') + path.sep) + '.+\\.node\\.dSYM', + + // Ignore test, spec and example folders for packages + 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + '_*te?sts?_*' + escapeRegExp(path.sep), + 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'spec' + escapeRegExp(path.sep), + 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'examples?' + escapeRegExp(path.sep), +] +// Ignore Hunspell dictionaries only on macOS. +if (process.platform === 'darwin') { + EXCLUDE_REGEXPS_SOURCES.push(escapeRegExp(path.join('spellchecker', 'vendor', 'hunspell_dictionaries'))) +} + +const EXCLUDED_PATHS_REGEXP = new RegExp( + EXCLUDE_REGEXPS_SOURCES.map(path => `(${path})`).join('|') +) + +function escapeRegExp (string) { + return string.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") +} diff --git a/build/lib/package-application.js b/build/lib/package-application.js index eefff42dc..e672a74ac 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -1,15 +1,10 @@ 'use strict' -// This is where we'll run electron-packager on our intermediate app dir. -// It takes an ignore regex for paths to exclude, and I've started on a function -// to build up this regexp based on existing work in build-task.coffee. We should -// try to lean on electron-packager to do as much of the work for us as possible -// other than transpilation. It looks like it has a programmatic API. We'll need to -// copy more stuff such as the package.json for the packager to work correctly. - +const assert = require('assert') const fs = require('fs-extra') const path = require('path') const electronPackager = require('electron-packager') +const includePathInPackagedApp = require('./include-path-in-packaged-app') const CONFIG = require('../config') @@ -26,22 +21,32 @@ module.exports = function () { 'overwrite': true, 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion - }, (err, appPaths) => { + }, (err, packagedAppPaths) => { if (err) { console.error(err) } else { - if (appPaths.length > 1) { - throw new Error('TODO: handle this case!') - } - + assert(packagedAppPaths.length === 1, 'Generated more than one electron application!') + const packagedAppPath = packagedAppPaths[0] if (process.platform === 'darwin') { - const bundleResourcesPath = path.join(appPaths[0], 'Atom.app', 'Contents', 'Resources') - fs.copySync(CONFIG.intermediateShellCommandsPath, path.join(bundleResourcesPath, 'app')) + const bundledResourcesPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Resources') + const bundledShellCommandsPath = path.join(bundledResourcesPath, 'app') + console.log(`Copying shell commands to ${bundledShellCommandsPath}...`); + fs.copySync( + path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), + path.join(bundledShellCommandsPath, 'apm'), + {filter: includePathInPackagedApp} + ) + if (process.platform !== 'windows') { + // Existing symlinks on user systems point to an outdated path, so just symlink it to the real location of the apm binary. + // TODO: Change command installer to point to appropriate path and remove this fallback after a few releases. + fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(bundledShellCommandsPath, 'apm', 'node_modules', '.bin', 'apm')) + fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledShellCommandsPath, 'atom.sh')) + } } else { throw new Error('TODO: handle this case!') } - console.log(`Application bundle(s) created on ${appPaths}`) + console.log(`Application bundle(s) created on ${packagedAppPath}`) } }) } From 3a30f166d7e707be291d4e81ee6c4c67cd77e327 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 20:17:07 +0200 Subject: [PATCH 033/221] :art: Signed-off-by: Nathan Sobo --- build/lib/package-application.js | 51 +++++++++++++++++--------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/build/lib/package-application.js b/build/lib/package-application.js index e672a74ac..accf8e68d 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -22,35 +22,38 @@ module.exports = function () { 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion }, (err, packagedAppPaths) => { - if (err) { - console.error(err) - } else { - assert(packagedAppPaths.length === 1, 'Generated more than one electron application!') - const packagedAppPath = packagedAppPaths[0] - if (process.platform === 'darwin') { - const bundledResourcesPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Resources') - const bundledShellCommandsPath = path.join(bundledResourcesPath, 'app') - console.log(`Copying shell commands to ${bundledShellCommandsPath}...`); - fs.copySync( - path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), - path.join(bundledShellCommandsPath, 'apm'), - {filter: includePathInPackagedApp} - ) - if (process.platform !== 'windows') { - // Existing symlinks on user systems point to an outdated path, so just symlink it to the real location of the apm binary. - // TODO: Change command installer to point to appropriate path and remove this fallback after a few releases. - fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(bundledShellCommandsPath, 'apm', 'node_modules', '.bin', 'apm')) - fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledShellCommandsPath, 'atom.sh')) - } - } else { - throw new Error('TODO: handle this case!') - } + if (err) throw new Error(err) + assert(packagedAppPaths.length === 1, 'Generated more than one electron application!') - console.log(`Application bundle(s) created on ${packagedAppPath}`) + const packagedAppPath = packagedAppPaths[0] + let bundledResourcesPath + if (process.platform === 'darwin') { + bundledResourcesPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Resources') + } else { + throw new Error('TODO: handle this case!') } + + copyShellCommands(bundledResourcesPath) + console.log(`Application bundle(s) created on ${packagedAppPath}`) }) } +function copyShellCommands (bundledResourcesPath) { + const bundledShellCommandsPath = path.join(bundledResourcesPath, 'app') + console.log(`Copying shell commands to ${bundledShellCommandsPath}...`); + fs.copySync( + path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), + path.join(bundledShellCommandsPath, 'apm'), + {filter: includePathInPackagedApp} + ) + if (process.platform !== 'win32') { + // Existing symlinks on user systems point to an outdated path, so just symlink it to the real location of the apm binary. + // TODO: Change command installer to point to appropriate path and remove this fallback after a few releases. + fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(bundledShellCommandsPath, 'apm', 'node_modules', '.bin', 'apm')) + fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledShellCommandsPath, 'atom.sh')) + } +} + function buildAsarUnpackGlobExpression () { const unpack = [ '*.node', From 2b97a21029b2e0a2796feef178a298d0128a8b3f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 20:32:02 +0200 Subject: [PATCH 034/221] Set icon on OS X Signed-off-by: Nathan Sobo --- build/lib/package-application.js | 1 + 1 file changed, 1 insertion(+) diff --git a/build/lib/package-application.js b/build/lib/package-application.js index accf8e68d..1a248af18 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -17,6 +17,7 @@ module.exports = function () { 'build-version': CONFIG.appMetadata.version, 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, + 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns'), 'out': CONFIG.buildOutputPath, 'overwrite': true, 'platform': process.platform, From 7914409a489f84594f37fcf5c6a1763ef39a6375 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 20:50:39 +0200 Subject: [PATCH 035/221] Copy file.icns on OS X Signed-off-by: Nathan Sobo --- build/lib/package-application.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 1a248af18..9b81fb797 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -34,12 +34,12 @@ module.exports = function () { throw new Error('TODO: handle this case!') } - copyShellCommands(bundledResourcesPath) + copyNonASARResources(bundledResourcesPath) console.log(`Application bundle(s) created on ${packagedAppPath}`) }) } -function copyShellCommands (bundledResourcesPath) { +function copyNonASARResources (bundledResourcesPath) { const bundledShellCommandsPath = path.join(bundledResourcesPath, 'app') console.log(`Copying shell commands to ${bundledShellCommandsPath}...`); fs.copySync( @@ -53,6 +53,9 @@ function copyShellCommands (bundledResourcesPath) { fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(bundledShellCommandsPath, 'apm', 'node_modules', '.bin', 'apm')) fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledShellCommandsPath, 'atom.sh')) } + if (process.platform === 'darwin') { + fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'file.icns'), path.join(bundledResourcesPath, 'file.icns')) + } } function buildAsarUnpackGlobExpression () { From c983b6ed36a955291d05b61cc959571c551baf72 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 28 Jul 2016 20:52:12 +0200 Subject: [PATCH 036/221] Copy 1024.png as atom.png to intermediate app dir based on channel Signed-off-by: Nathan Sobo --- build/lib/copy-assets.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 0401f44b0..136e8bb08 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -26,6 +26,11 @@ module.exports = function () { for (let srcPath of srcPaths) { fs.copySync(srcPath, computeDestinationPath(srcPath), {filter: includePathInPackagedApp}) } + + fs.copySync( + path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), + path.join(CONFIG.intermediateAppPath, 'resources', 'atom.png') + ) } function computeDestinationPath (srcPath) { From 764bd8fa142c98979744027315f110718fba5953 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 13:29:23 +0200 Subject: [PATCH 037/221] Exclude dotfiles when copying assets --- build/lib/include-path-in-packaged-app.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build/lib/include-path-in-packaged-app.js b/build/lib/include-path-in-packaged-app.js index 0736a2f6f..515bc501c 100644 --- a/build/lib/include-path-in-packaged-app.js +++ b/build/lib/include-path-in-packaged-app.js @@ -7,6 +7,23 @@ module.exports = function (path) { } const EXCLUDE_REGEXPS_SOURCES = [ + escapeRegExp('.DS_Store'), + escapeRegExp('.jshintrc'), + escapeRegExp('.npmignore'), + escapeRegExp('.pairs'), + escapeRegExp('.travis.yml'), + escapeRegExp('appveyor.yml'), + escapeRegExp('circle.yml'), + escapeRegExp('.idea'), + escapeRegExp('.editorconfig'), + escapeRegExp('.lint'), + escapeRegExp('.lintignore'), + escapeRegExp('.eslintrc'), + escapeRegExp('.jshintignore'), + escapeRegExp('coffeelint.json'), + escapeRegExp('.coffeelintignore'), + escapeRegExp('.gitattributes'), + escapeRegExp('.gitkeep'), escapeRegExp(path.join('git-utils', 'deps')), escapeRegExp(path.join('oniguruma', 'deps')), escapeRegExp(path.join('less', 'dist')), From 236897ecb95e792d2f70cb640a4e54f1d33c0dfe Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 13:29:38 +0200 Subject: [PATCH 038/221] Update CONFIG.appMetadata after generate-module-cache --- build/lib/generate-module-cache.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/lib/generate-module-cache.js b/build/lib/generate-module-cache.js index 4013e7578..71bf4988c 100644 --- a/build/lib/generate-module-cache.js +++ b/build/lib/generate-module-cache.js @@ -26,5 +26,6 @@ module.exports = function () { ] } } - fs.writeFileSync(path.join(CONFIG.intermediateAppPath, 'package.json'), JSON.stringify(newMetadata)) + CONFIG.appMetadata = newMetadata + fs.writeFileSync(path.join(CONFIG.intermediateAppPath, 'package.json'), JSON.stringify(CONFIG.appMetadata)) } From 88aafe12efb4abd5371dab840b834459e7860c60 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 13:30:38 +0200 Subject: [PATCH 039/221] Generate metadata for all package.json files --- build/build.js | 2 + build/deprecated-packages.json | 1713 +++++++++++++++++++++++++++++ build/lib/copy-assets.js | 2 - build/lib/generate-metadata.js | 132 +++ build/lib/transpile-cson-paths.js | 3 - build/package.json | 1 + 6 files changed, 1848 insertions(+), 5 deletions(-) create mode 100644 build/deprecated-packages.json create mode 100644 build/lib/generate-metadata.js diff --git a/build/build.js b/build/build.js index 24aa8ef0d..781d9b061 100644 --- a/build/build.js +++ b/build/build.js @@ -11,6 +11,7 @@ const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths' const transpileCsonPaths = require('./lib/transpile-cson-paths') const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') const generateModuleCache = require('./lib/generate-module-cache') +const generateMetadata = require('./lib/generate-metadata') const packageApplication = require('./lib/package-application') cleanOutputDirectory() @@ -20,4 +21,5 @@ transpileCoffeeScriptPaths() transpileCsonPaths() transpilePegJsPaths() generateModuleCache() +generateMetadata() packageApplication() diff --git a/build/deprecated-packages.json b/build/deprecated-packages.json new file mode 100644 index 000000000..08f4d1186 --- /dev/null +++ b/build/deprecated-packages.json @@ -0,0 +1,1713 @@ +{ + "advanced-new-file": { + "version": "<=0.4.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "angularjs-helper": { + "version": "<=0.9.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "apex-ui-personalize": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "api-blueprint-preview": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "asciidoc-preview": { + "version": "<=0.5.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "ask-stack": { + "version": "<=1.1.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "assign-align": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "asteroids": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-2048": { + "version": "<=1.2.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-angularjs": { + "hasAlternative": true, + "alternative": "angularjs" + }, + "atom-beautifier": { + "version": "<=0.5.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-beautify": { + "version": "<=0.27.6", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atom-browser-webview": { + "version": "<=0.6.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-charcode": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-cli-diff": { + "version": "<=0.11.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-compile-coffee": { + "version": "<=1.4.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atom-ctags": { + "version": "<=3.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atom-eslint": { + "hasAlternative": true, + "alternative": "linter" + }, + "atom-faker": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-flake8": { + "hasAlternative": true, + "alternative": "linter" + }, + "atom-go-format": { + "hasAlternative": true, + "alternative": "go-plus" + }, + "atom-grunt-configs": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-html-preview": { + "version": "<=0.1.6", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-html5-boilerplate": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-htmlizer": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-jsfmt": { + "version": "<=0.6.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atom-jshint": { + "version": "<=1.5.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atom-lint": { + "hasAlternative": true, + "alternative": "linter" + }, + "atom-pair": { + "version": "<=1.1.5", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atom-prettify": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-processing": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-python-debugger": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-rails": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-raml-preview": { + "version": "<=0.0.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-runner": { + "version": "<=2.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atom-semicolons": { + "version": "<=0.1.5", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-spotify": { + "version": "<=1.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-terminal-panel": { + "version": "<=4.3.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atom-typescript": { + "version": "<=4.1.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atom-ungit": { + "version": "<=0.4.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "atom-yeoman": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atomatigit": { + "version": "<=1.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atomic-emacs": { + "version": "<=0.5.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "atomic-rest": { + "version": "<=0.2.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "auto-detect-indentation": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "auto-indent": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "auto-replace-in-selection": { + "version": "<=2.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "auto-update-packages": { + "version": "<=0.2.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "autoclose-html": { + "version": "<=0.15.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "autocomplete-haskell": { + "version": "<=0.2.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "autocomplete-jedi": { + "hasAlternative": true, + "alternative": "autocomplete-python" + }, + "autocomplete-paths": { + "version": "<=1.0.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "autocomplete-phpunit": { + "version": "<=1.0.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "autocomplete-plus-async": { + "hasAlternative": true, + "message": "`autocomplete-plus-async` has been replaced by `autocomplete-plus` which is bundled in core", + "alternative": "core" + }, + "autocomplete-plus-jedi": { + "version": "<=0.0.9", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "autocomplete-plus-python-jedi": { + "hasAlternative": true, + "alternative": "autocomplete-python" + }, + "autocomplete-snippets": { + "version": "<=1.0.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "bezier-curve-editor": { + "version": "<=0.6.6", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "big-cursor": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "block-comment": { + "version": "<=0.4.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "browser-refresh": { + "version": "<=0.8.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "cabal": { + "version": "<=0.0.13", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "change-case": { + "version": "<=0.5.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "circle-ci": { + "version": "<=0.9.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "clang-format": { + "version": "<=1.8.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "clipboard-history": { + "version": "<=0.6.5", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "clone-cursor": { + "version": "<=1.0.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "closure-linter": { + "version": "<=0.2.5", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "code-links": { + "version": "<=0.3.8", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "codeship-status": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "coffee-compile": { + "version": "<=0.5.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "coffee-lint": { + "hasAlternative": true, + "alternative": "linter" + }, + "coffee-trace": { + "version": "<=0.2.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "coffeescript-preview": { + "hasAlternative": true, + "alternative": "preview" + }, + "color": { + "version": "<=0.5.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "color-picker": { + "version": "<=1.7.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "command-logger": { + "version": "<=0.20.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "comment": { + "version": "<=0.2.7", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "compass": { + "version": "<=0.8.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "composer": { + "version": "<=0.3.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "convert-to-utf8": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "coverage": { + "version": "<=0.6.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "csscomb": { + "version": "<=0.1.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "ctags-status": { + "version": "<=1.2.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "cucumber-runner": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "cucumber-step": { + "version": "<=0.1.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "custom-title": { + "version": "<=0.7.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "cut-line": { + "hasAlternative": true, + "alternative": "core" + }, + "dash": { + "version": "<=1.0.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "data-atom": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "devdocs": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "django-templates": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "docblockr": { + "version": "<=0.6.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "easy-motion": { + "version": "<=1.1.4", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "editor-stats": { + "version": "<=0.16.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "editorconfig": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "elixir-cmd": { + "version": "<=0.2.6", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "emacs-mode": { + "version": "<=0.0.29", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "ember-cli-helper": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "emmet": { + "version": "<=2.3.7", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "emp-debugger": { + "version": "<=0.6.13", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "emp-template-management": { + "version": "<=0.1.13", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "enhanced-tabs": { + "version": "<=1.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "erb-snippets": { + "version": "<=0.5.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "error-status": { + "version": "<=0.3.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "eslint": { + "version": "<=0.15.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "eval": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "ex-mode": { + "version": "<=0.4.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "execute-as-ruby": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "expand-selection": { + "version": "<=0.2.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "explicit-reload": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "fancy-new-file": { + "version": "<=0.7.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "file-icon-supplement": { + "version": "<=0.7.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "file-icons": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "file-types": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "filetype-color": { + "version": "<=0.1.4", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "firepad": { + "version": "<=0.3.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "flake8": { + "hasAlternative": true, + "alternative": "linter" + }, + "floobits": { + "version": "<=0.4.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "function-name-in-status-bar": { + "version": "<=0.2.6", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "fuzzy-finder": { + "version": "<=0.60.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "get-routes": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "gist-it": { + "version": "<=0.6.10", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "git-blame": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "git-control": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "git-diff": { + "version": "<=0.43.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "git-diff-details": { + "version": "<=0.8.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "git-log": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "git-plus": { + "version": "<=4.5.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "git-review": { + "version": "<=0.2.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "git-tab-status": { + "version": "<=1.5.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "github-issues": { + "version": "<=0.5.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "gitignore-snippets": { + "version": "<=0.2.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "gitter": { + "version": "<=0.6.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "go-oracle": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "go-plus": { + "version": "<=2.0.8", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "go-to-view": { + "version": "<=0.1.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "gocode": { + "version": "<=0.2.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "gradle-ci": { + "version": "<=0.2.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "grunt-runner": { + "version": "<=0.8.2", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "gulp-helper": { + "version": "<=4.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "gutter-shadow": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "hiera-eyaml": { + "version": "<=0.4.7", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "highlight-column": { + "version": "<=0.3.2", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "highlight-cov": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "highlight-css-color": { + "hasAlternative": true, + "alternative": "pigments" + }, + "highlight-line": { + "version": "<=0.9.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "highlight-selected": { + "version": "<=0.7.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "hipster-ipsum": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "html-entities": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "html-helper": { + "version": "<=0.2.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "html-img": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "html2haml": { + "version": "<=0.6.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "html2jade": { + "version": "<=0.7.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "htmlhint": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "icon-font-picker": { + "version": "<=0.0.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "ide-flow": { + "version": "<=0.7.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "ide-haskell": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "import": { + "version": "<=1.3.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "inc-dec-value": { + "version": "<=0.0.7", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "increment-number": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "indent-helper": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "indentation-jumper": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "inline-autocomplete": { + "version": "<=1.0.4", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "ionic-atom": { + "version": "<=0.3.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "japanese-zen-han-convert": { + "version": "<=0.3.2", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "jsdoc": { + "version": "<=0.9.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "jsformat": { + "version": "<=0.8.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "jslint": { + "version": "<=1.2.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "jsonlint": { + "version": "<=1.0.2", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "jsonpp": { + "version": "<=0.0.6", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "keycodes": { + "version": "<=0.1.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "kinetic": { + "version": "<=0.2.5", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "language-javascript-semantic": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "language-jsoniq": { + "version": "<=1.4.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "language-jxa": { + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "language-rspec": { + "version": "<=0.2.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "language-typescript": { + "hasAlternative": true, + "alternative": "atom-typescript" + }, + "laravel-facades": { + "version": "<=1.0.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "last-cursor-position": { + "version": "<=0.6.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "layout-manager": { + "version": "<=0.2.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "less-autocompile": { + "version": "<=0.3.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "letter-spacing": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "line-count": { + "version": "<=0.3.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "line-jumper": { + "version": "<=0.13.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "linter": { + "version": "<=0.11.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "linter-flow": { + "version": "<=0.1.4", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "livereload": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "local-history": { + "version": "<=3.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "local-server": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "local-server-express": { + "version": "<=0.2.2", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "local-settings": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "localization": { + "version": "<=1.16.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "log-console": { + "version": "<=0.1.2", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "lorem-ipsum": { + "version": "<=0.5.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "mark-ring": { + "version": "<=3.0.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "markdown-format": { + "version": "<=2.5.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "markdown-helpers": { + "version": "<=0.2.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "markdown-pdf": { + "version": "<=1.3.6", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "markdown-preview-plus": { + "version": "<=1.4.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "markdown-stream": { + "version": "<=0.6.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "markdown-writer": { + "version": "<=1.3.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "marked": { + "version": "<=0.1.8", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "mate-subword-navigation": { + "version": "<=3.0.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "MavensMate-Atom": { + "version": "<=0.0.20", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "max-tabs": { + "hasAlternative": true, + "alternative": "tidy-tabs" + }, + "maximize-panes": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "mdurl": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "mechanical-keyboard": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "minifier": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "minimap": { + "version": "<=3.5.6", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "minimap-color-highlight": { + "version": "<=4.1.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "minimap-git-diff": { + "version": "<=3.0.4", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "mocha": { + "version": "<=0.0.5", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "mocha-ui": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "nbsp-detect": { + "hasAlternative": true, + "alternative": "core" + }, + "node-debugger": { + "version": "<=0.2.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "npm-autocomplete": { + "version": "<=0.1.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "omni-ruler": { + "version": "<=0.3.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "omnisharp-atom": { + "version": "<=0.4.9", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "open-git-modified-files": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "open-in-github-app": { + "version": "<=0.2.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "open-in-gitx": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "open-in-sourcetree": { + "version": "<=0.1.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "open-last-project": { + "hasAlternative": true, + "alternative": "core" + }, + "open-recent": { + "version": "<=2.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "package-cop": { + "version": "<=0.2.5", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "package-list-downloader": { + "version": "<=0.2.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "pair-programming": { + "version": "<=0.7.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "pane-layout-switcher": { + "version": "<=0.0.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "paredit": { + "version": "<=1.0.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "party-hard": { + "version": "<=0.3.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "path": { + "version": "<=0.4.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "pep8": { + "hasAlternative": true, + "alternative": "linter" + }, + "pepper-autocomplete": { + "version": "<=0.6.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "permute": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "php-documentation-online": { + "version": "<=0.2.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "php-getters-setters": { + "version": "<=0.5.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "php-server": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "phpunit": { + "version": "<=1.0.9", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "playlist": { + "version": "<=0.1.7", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "pretty-json": { + "version": "<=0.3.2", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "preview": { + "version": "<=0.14.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "preview-plus": { + "version": "<=1.1.42", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "project-colorize": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "project-manager": { + "version": "<=1.11.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "project-palette-finder": { + "version": "<=2.4.7", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "project-ring": { + "version": "<=0.20.5", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "python": { + "hasAlternative": true, + "alternative": "script" + }, + "python-coverage": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "python-isort": { + "version": "<=0.0.6", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "python-jedi": { + "version": "<=0.1.7", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "quick-move-file": { + "version": "<=0.7.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "r-exec": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "rails-navigation": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "react": { + "version": "<=0.5.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "recent-projects": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "regex-railroad-diagram": { + "version": "<=0.7.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "related-files": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "remember-session": { + "hasAlternative": true, + "alternative": "core" + }, + "remote-atom": { + "version": "<=1.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "remote-edit": { + "version": "<=1.6.4", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "remote-sync": { + "version": "<=3.1.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "resize-panes": { + "hasAlternative": true, + "alternative": "core" + }, + "rest-client": { + "version": "<=0.3.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "revert-buffer": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "rsense": { + "version": "<=0.6.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "rspec": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "rst-preview-pandoc": { + "version": "<=0.1.6", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "ruby-define-method": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "ruby-hash-rocket": { + "version": "<=1.1.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "ruby-strftime-reference": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "ruby-test": { + "version": "<=0.9.5", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "ruler": { + "version": "<=0.2.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "run-command": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "run-file": { + "version": "<=0.9.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "run-in-browser": { + "version": "<=0.1.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "runcoderun": { + "version": "<=0.5.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "sass-autocompile": { + "version": "<=0.6.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "sassbeautify": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "save-commands": { + "version": "<=0.6.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "save-session": { + "version": "<=0.15.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "scope-inspector": { + "version": "<=0.2.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "script": { + "version": "<=2.20.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "script-runner": { + "version": "<=1.6.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "select-scope": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "selection-count": { + "hasAlternative": true, + "alternative": "core" + }, + "slash-closer": { + "version": "<=0.7.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "sloc": { + "version": "<=0.1.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "smarter-delete-line": { + "version": "<=1.0.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "space-block-jumper": { + "version": "<=0.4.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "space-tab": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "spark-dfu-util": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "status-tab-spacing": { + "version": "<=0.3.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "sublime-tabs": { + "hasAlternative": true, + "message": "`sublime-tabs` has been replaced by the 'Use Preview Tabs' option in the `tabs` package settings.", + "alternative": "core" + }, + "supercollider": { + "version": "<=0.4.2", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "supercopair": { + "version": "<=0.9.34", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "support-gbk": { + "version": "<=1.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "swift-playground": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "symbol-gen": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "synced-sidebar": { + "version": "<=0.2.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "tab-history": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "tab-switcher": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "tabs-to-spaces": { + "version": "<=0.8.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "tag": { + "version": "<=0.2.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "tasks": { + "version": "<=1.0.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "term": { + "version": "<=0.2.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "terminal-panel": { + "version": "<=1.11.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "terminal-status": { + "version": "<=1.6.4", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "ternjs": { + "hasAlternative": true, + "alternative": "atom-ternjs" + }, + "test-status": { + "version": "<=0.27.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "the-closer": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "ti-alloy-related": { + "version": "<=0.8.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "tidal": { + "version": "<=0.6.6", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "tidy-markdown": { + "version": "<=0.2.2", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "timecop": { + "version": "<=0.23.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "timekeeper": { + "version": "<=0.4.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "toggle-tabs": { + "version": "<=0.1.8", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "travis-ci-status": { + "version": "<=0.13.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "true-color": { + "version": "<=0.4.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "turbo-javascript": { + "version": "<=0.0.10", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "turnip-step": { + "version": "<=1.0.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "unity-ui": { + "version": "<=1.0.5", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "update-package-dependencies": { + "version": "<=0.6.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "update-packages": { + "hasAlternative": true, + "alternative": "core" + }, + "vertical-align": { + "version": "<=0.6.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "view-tail-large-files": { + "version": "<=0.1.17", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "vim-mode": { + "version": "<=0.46.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "virtualenv": { + "version": "<=0.6.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "visual-bell": { + "version": "<=0.11.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "vnc": { + "version": "<=0.1.3", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "voicecode": { + "version": "<=0.9.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "w3c-validation": { + "version": "<=0.1.3", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "weather-package": { + "version": "<=1.5.4", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "web-view": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "webbox-color": { + "version": "<=0.5.4", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "webview-pane": { + "version": "<=0.0.1", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "wercker-status": { + "version": "<=0.3.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "white-cursor": { + "version": "<=0.5.1", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "whitespace": { + "version": "<=0.24.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "word-count": { + "version": "<=0.1.0", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "word-jumper": { + "version": "<=0.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "wordcount": { + "version": "<=2.2.0", + "hasDeprecations": true, + "latestHasDeprecations": false + }, + "wrap-lines": { + "hasAlternative": true, + "message": "`wrap-lines` has been replaced by a feature in core. Open the command palette and search for `autoflow`.", + "alternative": "core" + }, + "yosemite-unity-ui": { + "version": "<=0.3.13", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "yuno-commit": { + "version": "<=0.0.2", + "hasDeprecations": true, + "latestHasDeprecations": true + }, + "zentabs": { + "version": "<=0.6.1", + "hasDeprecations": true, + "latestHasDeprecations": false + } +} diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 136e8bb08..b6566fc40 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -14,8 +14,6 @@ module.exports = function () { let srcPaths = [ path.join(CONFIG.repositoryRootPath, 'dot-atom'), path.join(CONFIG.repositoryRootPath, 'exports'), - path.join(CONFIG.repositoryRootPath, 'keymaps'), - path.join(CONFIG.repositoryRootPath, 'menus'), path.join(CONFIG.repositoryRootPath, 'node_modules'), path.join(CONFIG.repositoryRootPath, 'package.json'), path.join(CONFIG.repositoryRootPath, 'static'), diff --git a/build/lib/generate-metadata.js b/build/lib/generate-metadata.js new file mode 100644 index 000000000..251f07e13 --- /dev/null +++ b/build/lib/generate-metadata.js @@ -0,0 +1,132 @@ +'use strict' + +const path = require('path') +const CSON = require('season') +const fs = require('fs-extra') +const normalizePackageData = require('normalize-package-data') +const semver = require('semver') + +const CONFIG = require('../config') + +module.exports = function () { + console.log(`Generating metadata for ${path.join(CONFIG.intermediateAppPath, 'package.json')}...`) + CONFIG.appMetadata._atomPackages = buildBundledPackagesMetadata() + CONFIG.appMetadata._atomMenu = buildPlatformMenuMetadata() + CONFIG.appMetadata._atomKeymaps = buildPlatformKeymapsMetadata() + CONFIG.appMetadata._deprecatedPackages = buildDeprecatedPackagesMetadata() + fs.writeFileSync(path.join(CONFIG.intermediateAppPath, 'package.json'), JSON.stringify(CONFIG.appMetadata)) +} + +function buildBundledPackagesMetadata () { + const packages = {} + for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { + const packagePath = path.join(CONFIG.intermediateAppPath, 'node_modules', packageName) + const packageMetadataPath = path.join(packagePath, 'package.json') + const packageMetadata = JSON.parse(fs.readFileSync(packageMetadataPath, 'utf8')) + normalizePackageData(packageMetadata, () => { + throw new Error(`Invalid package metadata. ${metadata.name}: ${msg}`) + }, true) + if (packageMetadata.repository && packageMetadata.repository.url && packageMetadata.repository.type === 'git') { + packageMetadata.repository.url = packageMetadata.repository.url.replace(/^git\+/, '') + } + + delete packageMetadata['_from'] + delete packageMetadata['_id'] + delete packageMetadata['dist'] + delete packageMetadata['readme'] + delete packageMetadata['readmeFilename'] + + const packageModuleCache = packageMetadata._atomModuleCache || {} + if (packageModuleCache.extensions && packageModuleCache.extensions['.json']) { + const index = packageModuleCache.extensions['.json'].indexOf('package.json') + if (index !== -1) { + packageModuleCache.extensions['.json'].splice(index, 1) + } + } + + const packageNewMetadata = {metadata: packageMetadata, keymaps: {}, menus: {}} + if (packageMetadata.main) { + const mainPath = require.resolve(path.resolve(packagePath, packageMetadata.main)) + packageNewMetadata.main = path.relative(CONFIG.intermediateAppPath, mainPath) + } + + const packageKeymapsPath = path.join(packagePath, 'keymaps') + if (fs.existsSync(packageKeymapsPath)) { + for (let packageKeymapName of fs.readdirSync(packageKeymapsPath)) { + const packageKeymapPath = path.join(packageKeymapsPath, packageKeymapName) + if (packageKeymapPath.endsWith('.cson') || packageKeymapPath.endsWith('.json')) { + const relativePath = path.relative(CONFIG.intermediateAppPath, packageKeymapPath) + packageNewMetadata.keymaps[relativePath] = CSON.readFileSync(packageKeymapPath) + fs.removeSync(packageKeymapPath) + } + } + if (fs.readdirSync(packageKeymapsPath).length === 0) { + fs.removeSync(packageKeymapsPath) + } + } + + const packageMenusPath = path.join(packagePath, 'menus') + if (fs.existsSync(packageMenusPath)) { + for (let packageMenuName of fs.readdirSync(packageMenusPath)) { + const packageMenuPath = path.join(packageMenusPath, packageMenuName) + if (packageMenuPath.endsWith('.cson') || packageMenuPath.endsWith('.json')) { + const relativePath = path.relative(CONFIG.intermediateAppPath, packageMenuPath) + packageNewMetadata.menus[relativePath] = CSON.readFileSync(packageMenuPath) + fs.removeSync(packageMenuPath) + } + } + if (fs.readdirSync(packageMenusPath).length === 0) { + fs.removeSync(packageMenusPath) + } + } + + packages[packageMetadata.name] = packageNewMetadata + if (packageModuleCache.extensions) { + for (let extension of Object.keys(packageModuleCache.extensions)) { + const paths = packageModuleCache.extensions[extension] + if (paths.length === 0) { + delete packageModuleCache.extensions[extension] + } + } + } + + fs.removeSync(packageMetadataPath) + } + return packages +} + +function buildPlatformMenuMetadata () { + const menuPath = path.join(CONFIG.repositoryRootPath, 'menus', `${process.platform}.cson`) + if (fs.existsSync(menuPath)) { + return CSON.readFileSync(menuPath) + } else { + return null + } +} + +function buildPlatformKeymapsMetadata () { + const invalidPlatforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32'].filter(p => p !== process.platform) + const keymapsPath = path.join(CONFIG.repositoryRootPath, 'keymaps') + const keymaps = {} + for (let keymapName of fs.readdirSync(keymapsPath)) { + const keymapPath = path.join(keymapsPath, keymapName) + if (keymapPath.endsWith('.cson') || keymapPath.endsWith('.json')) { + const keymapPlatform = path.basename(keymapPath, path.extname(keymapPath)) + if (invalidPlatforms.indexOf(keymapPlatform) === -1) { + keymaps[path.basename(keymapPath)] = CSON.readFileSync(keymapPath) + } + } + } + return keymaps +} + +function buildDeprecatedPackagesMetadata () { + const deprecatedPackagesMetadata = require('../deprecated-packages') + for (let packageName of Object.keys(deprecatedPackagesMetadata)) { + const packageMetadata = deprecatedPackagesMetadata[packageName] + if (packageMetadata.version && !semver.validRange(packageMetadata.version)) { + throw new Error(`Invalid range: ${version} (${name}).`) + } + } + return deprecatedPackagesMetadata +} diff --git a/build/lib/transpile-cson-paths.js b/build/lib/transpile-cson-paths.js index 4391c42bc..524ae544c 100644 --- a/build/lib/transpile-cson-paths.js +++ b/build/lib/transpile-cson-paths.js @@ -16,9 +16,6 @@ module.exports = function () { function getPathsToTranspile () { let paths = [] - paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'menus', '*.cson'))) - paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'keymaps', '*.cson'))) - paths = paths.concat(glob.sync(path.join(CONFIG.intermediateAppPath, 'static', '**', '*.cson'))) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { paths = paths.concat(glob.sync( path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, '**', '*.cson'), diff --git a/build/package.json b/build/package.json index 4764f4935..c11aaee0b 100644 --- a/build/package.json +++ b/build/package.json @@ -8,6 +8,7 @@ "fs-extra": "0.30.0", "glob": "7.0.3", "mkdirp": "0.5.1", + "normalize-package-data": "2.3.5", "npm": "3.10.5", "pegjs": "0.9.0" } From 4e597eea40a5724195a526e2f79a0eada28d7368 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 14:48:56 +0200 Subject: [PATCH 040/221] Add LICENSE.md when packaging the app --- build/build.js | 1 + build/{ => lib}/deprecated-packages.json | 0 build/lib/generate-metadata.js | 2 +- build/lib/get-license-text.js | 38 +++++++++++ build/lib/license-overrides.js | 84 ++++++++++++++++++++++++ build/lib/package-application.js | 61 ++++++++++++----- build/package.json | 1 + 7 files changed, 168 insertions(+), 19 deletions(-) rename build/{ => lib}/deprecated-packages.json (100%) create mode 100644 build/lib/get-license-text.js create mode 100644 build/lib/license-overrides.js diff --git a/build/build.js b/build/build.js index 781d9b061..cb3115d5b 100644 --- a/build/build.js +++ b/build/build.js @@ -3,6 +3,7 @@ 'use strict' require('coffee-script/register') +require('babel-core/register') const cleanOutputDirectory = require('./lib/clean-output-directory') const copyAssets = require('./lib/copy-assets') diff --git a/build/deprecated-packages.json b/build/lib/deprecated-packages.json similarity index 100% rename from build/deprecated-packages.json rename to build/lib/deprecated-packages.json diff --git a/build/lib/generate-metadata.js b/build/lib/generate-metadata.js index 251f07e13..5934ad149 100644 --- a/build/lib/generate-metadata.js +++ b/build/lib/generate-metadata.js @@ -4,6 +4,7 @@ const path = require('path') const CSON = require('season') const fs = require('fs-extra') const normalizePackageData = require('normalize-package-data') +const deprecatedPackagesMetadata = require('./deprecated-packages') const semver = require('semver') const CONFIG = require('../config') @@ -121,7 +122,6 @@ function buildPlatformKeymapsMetadata () { } function buildDeprecatedPackagesMetadata () { - const deprecatedPackagesMetadata = require('../deprecated-packages') for (let packageName of Object.keys(deprecatedPackagesMetadata)) { const packageMetadata = deprecatedPackagesMetadata[packageName] if (packageMetadata.version && !semver.validRange(packageMetadata.version)) { diff --git a/build/lib/get-license-text.js b/build/lib/get-license-text.js new file mode 100644 index 000000000..1cb257202 --- /dev/null +++ b/build/lib/get-license-text.js @@ -0,0 +1,38 @@ +'use strict' + +const fs = require('fs') +const path = require('path') +const legalEagle = require('legal-eagle') + +const licenseOverrides = require('./license-overrides') +const CONFIG = require('../config') + +module.exports = function () { + return new Promise((resolve, reject) => { + legalEagle({path: CONFIG.repositoryRootPath, overrides: licenseOverrides}, (err, packagesLicenses) => { + if (err) { + reject(err) + throw new Error(err) + } else { + let text = + fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'LICENSE.md'), 'utf8') + '\n\n' + + 'This application bundles the following third-party packages in accordance\n' + + 'with the following licenses:\n\n' + for (let packageName of Object.keys(packagesLicenses).sort()) { + const packageLicense = packagesLicenses[packageName] + text += "-------------------------------------------------------------------------\n\n" + text += `Package: ${packageName}\n` + text += `License: ${packageLicense.license}\n` + if (packageLicense.source) { + text += `License Source: ${packageLicense.source}\n` + } + if (packageLicense.sourceText) { + text += `Source Text:\n\n${packageLicense.sourceText}` + } + text += '\n' + } + resolve(text) + } + }) + }) +} diff --git a/build/lib/license-overrides.js b/build/lib/license-overrides.js new file mode 100644 index 000000000..780c5b864 --- /dev/null +++ b/build/lib/license-overrides.js @@ -0,0 +1,84 @@ +module.exports = { + "aws-sign@0.3.0": { + repository: "https://github.com/mikeal/aws-sign", + license: "MIT", + source: "index.js", + sourceText: "/*!\n * knox - auth\n * Copyright(c) 2010 LearnBoost \n * MIT Licensed\n */\n" + }, + + "bufferjs@2.0.0": { + repository: "https://github.com/coolaj86/node-bufferjs", + license: "MIT", + source: "LICENSE.MIT", + sourceText: "Copyright (c) 2010 AJ ONeal (and Contributors)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + }, + + "buffers@0.1.1": { + repository: "http://github.com/substack/node-buffers", + license: "MIT", + source: "README.markdown", + sourceText: "\nlicense\n=======\n\nMIT/X11" + }, + + "cheerio@0.15.0": { + repository: "https://github.com/cheeriojs/cheerio", + license: "MIT", + source: "https://github.com/cheeriojs/cheerio/blob/master/package.json" + }, + + "specificity@0.1.3": { + repository: "https://github.com/keeganstreet/specificity", + license: "MIT", + source: "package.json in repository" + }, + + "promzard@0.2.0": { + license: "ISC", + source: "LICENSE in the repository", + sourceText: "The ISC License\n\nCopyright (c) Isaac Z. Schlueter\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR\nIN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE." + }, + + "jschardet@1.1.1": { + license: "LGPL", + source: "README.md in the repository", + sourceText: "JsChardet\n=========\n\nPort of python's chardet (http://chardet.feedparser.org/).\n\nLicense\n-------\n\nLGPL" + }, + + "core-js@0.4.10": { + license: "MIT", + source: "http://rock.mit-license.org linked in source files and bower.json says MIT" + }, + + "log-driver@1.2.4": { + license: "ISC", + source: "LICENSE file in the repository", + sourceText: "Copyright (c) 2014, Gregg Caines, gregg@caines.ca\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE." + }, + + "shelljs@0.3.0": { + license: "BSD", + source: "LICENSE file in repository - 3-clause BSD (aka BSD-new)", + sourceText: "Copyright (c) 2012, Artur Adib \nAll rights reserved.\n\nYou may use this project under the terms of the New BSD license as follows:\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n * Neither the name of Artur Adib nor the\n names of the contributors may be used to endorse or promote products\n derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + }, + + "json-schema@0.2.2": { + repository: "https://github.com/kriszyp/json-schema", + license: "BSD", + source: "README links to https://github.com/dojo/dojo/blob/8b6a5e4c42f9cf777dd39eaae8b188e0ebb59a4c/LICENSE", + sourceText: "Dojo is available under *either* the terms of the modified BSD license *or* the\nAcademic Free License version 2.1. As a recipient of Dojo, you may choose which\nlicense to receive this code under (except as noted in per-module LICENSE\nfiles). Some modules may not be the copyright of the Dojo Foundation. These\nmodules contain explicit declarations of copyright in both the LICENSE files in\nthe directories in which they reside and in the code itself. No external\ncontributions are allowed under licenses which are fundamentally incompatible\nwith the AFL or BSD licenses that Dojo is distributed under.\n\nThe text of the AFL and BSD licenses is reproduced below.\n\n-------------------------------------------------------------------------------\nThe \"New\" BSD License:\n**********************\n\nCopyright (c) 2005-2015, The Dojo Foundation\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n * Neither the name of the Dojo Foundation nor the names of its contributors\n may be used to endorse or promote products derived from this software\n without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n-------------------------------------------------------------------------------\nThe Academic Free License, v. 2.1:\n**********************************\n\nThis Academic Free License (the \"License\") applies to any original work of\nauthorship (the \"Original Work\") whose owner (the \"Licensor\") has placed the\nfollowing notice immediately following the copyright notice for the Original\nWork:\n\nLicensed under the Academic Free License version 2.1\n\n1) Grant of Copyright License. Licensor hereby grants You a world-wide,\nroyalty-free, non-exclusive, perpetual, sublicenseable license to do the\nfollowing:\n\na) to reproduce the Original Work in copies;\n\nb) to prepare derivative works (\"Derivative Works\") based upon the Original\nWork;\n\nc) to distribute copies of the Original Work and Derivative Works to the\npublic;\n\nd) to perform the Original Work publicly; and\n\ne) to display the Original Work publicly.\n\n2) Grant of Patent License. Licensor hereby grants You a world-wide,\nroyalty-free, non-exclusive, perpetual, sublicenseable license, under patent\nclaims owned or controlled by the Licensor that are embodied in the Original\nWork as furnished by the Licensor, to make, use, sell and offer for sale the\nOriginal Work and Derivative Works.\n\n3) Grant of Source Code License. The term \"Source Code\" means the preferred\nform of the Original Work for making modifications to it and all available\ndocumentation describing how to modify the Original Work. Licensor hereby\nagrees to provide a machine-readable copy of the Source Code of the Original\nWork along with each copy of the Original Work that Licensor distributes.\nLicensor reserves the right to satisfy this obligation by placing a\nmachine-readable copy of the Source Code in an information repository\nreasonably calculated to permit inexpensive and convenient access by You for as\nlong as Licensor continues to distribute the Original Work, and by publishing\nthe address of that information repository in a notice immediately following\nthe copyright notice that applies to the Original Work.\n\n4) Exclusions From License Grant. Neither the names of Licensor, nor the names\nof any contributors to the Original Work, nor any of their trademarks or\nservice marks, may be used to endorse or promote products derived from this\nOriginal Work without express prior written permission of the Licensor. Nothing\nin this License shall be deemed to grant any rights to trademarks, copyrights,\npatents, trade secrets or any other intellectual property of Licensor except as\nexpressly stated herein. No patent license is granted to make, use, sell or\noffer to sell embodiments of any patent claims other than the licensed claims\ndefined in Section 2. No right is granted to the trademarks of Licensor even if\nsuch marks are included in the Original Work. Nothing in this License shall be\ninterpreted to prohibit Licensor from licensing under different terms from this\nLicense any Original Work that Licensor otherwise would have a right to\nlicense.\n\n5) This section intentionally omitted.\n\n6) Attribution Rights. You must retain, in the Source Code of any Derivative\nWorks that You create, all copyright, patent or trademark notices from the\nSource Code of the Original Work, as well as any notices of licensing and any\ndescriptive text identified therein as an \"Attribution Notice.\" You must cause\nthe Source Code for any Derivative Works that You create to carry a prominent\nAttribution Notice reasonably calculated to inform recipients that You have\nmodified the Original Work.\n\n7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that\nthe copyright in and to the Original Work and the patent rights granted herein\nby Licensor are owned by the Licensor or are sublicensed to You under the terms\nof this License with the permission of the contributor(s) of those copyrights\nand patent rights. Except as expressly stated in the immediately proceeding\nsentence, the Original Work is provided under this License on an \"AS IS\" BASIS\nand WITHOUT WARRANTY, either express or implied, including, without limitation,\nthe warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR\nPURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.\nThis DISCLAIMER OF WARRANTY constitutes an essential part of this License. No\nlicense to Original Work is granted hereunder except under this disclaimer.\n\n8) Limitation of Liability. Under no circumstances and under no legal theory,\nwhether in tort (including negligence), contract, or otherwise, shall the\nLicensor be liable to any person for any direct, indirect, special, incidental,\nor consequential damages of any character arising as a result of this License\nor the use of the Original Work including, without limitation, damages for loss\nof goodwill, work stoppage, computer failure or malfunction, or any and all\nother commercial damages or losses. This limitation of liability shall not\napply to liability for death or personal injury resulting from Licensor's\nnegligence to the extent applicable law prohibits such limitation. Some\njurisdictions do not allow the exclusion or limitation of incidental or\nconsequential damages, so this exclusion and limitation may not apply to You.\n\n9) Acceptance and Termination. If You distribute copies of the Original Work or\na Derivative Work, You must make a reasonable effort under the circumstances to\nobtain the express assent of recipients to the terms of this License. Nothing\nelse but this License (or another written agreement between Licensor and You)\ngrants You permission to create Derivative Works based upon the Original Work\nor to exercise any of the rights granted in Section 1 herein, and any attempt\nto do so except under the terms of this License (or another written agreement\nbetween Licensor and You) is expressly prohibited by U.S. copyright law, the\nequivalent laws of other countries, and by international treaty. Therefore, by\nexercising any of the rights granted to You in Section 1 herein, You indicate\nYour acceptance of this License and all of its terms and conditions.\n\n10) Termination for Patent Action. This License shall terminate automatically\nand You may no longer exercise any of the rights granted to You by this License\nas of the date You commence an action, including a cross-claim or counterclaim,\nagainst Licensor or any licensee alleging that the Original Work infringes a\npatent. This termination provision shall not apply for an action alleging\npatent infringement by combinations of the Original Work with other software or\nhardware.\n\n11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this\nLicense may be brought only in the courts of a jurisdiction wherein the\nLicensor resides or in which Licensor conducts its primary business, and under\nthe laws of that jurisdiction excluding its conflict-of-law provisions. The\napplication of the United Nations Convention on Contracts for the International\nSale of Goods is expressly excluded. Any use of the Original Work outside the\nscope of this License or after its termination shall be subject to the\nrequirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et\nseq., the equivalent laws of other countries, and international treaty. This\nsection shall survive the termination of this License.\n\n12) Attorneys Fees. In any action to enforce the terms of this License or\nseeking damages relating thereto, the prevailing party shall be entitled to\nrecover its costs and expenses, including, without limitation, reasonable\nattorneys' fees and costs incurred in connection with such action, including\nany appeal of such action. This section shall survive the termination of this\nLicense.\n\n13) Miscellaneous. This License represents the complete agreement concerning\nthe subject matter hereof. If any provision of this License is held to be\nunenforceable, such provision shall be reformed only to the extent necessary to\nmake it enforceable.\n\n14) Definition of \"You\" in This License. \"You\" throughout this License, whether\nin upper or lower case, means an individual or a legal entity exercising rights\nunder, and complying with all of the terms of, this License. For legal\nentities, \"You\" includes any entity that controls, is controlled by, or is\nunder common control with you. For purposes of this definition, \"control\" means\n(i) the power, direct or indirect, to cause the direction or management of such\nentity, whether by contract or otherwise, or (ii) ownership of fifty percent\n(50%) or more of the outstanding shares, or (iii) beneficial ownership of such\nentity.\n\n15) Right to Use. You may use the Original Work in all ways not otherwise\nrestricted or conditioned by this License or by law, and Licensor promises not\nto interfere with or be responsible for such uses by You.\n\nThis license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.\nPermission is hereby granted to copy and distribute this license without\nmodification. This license may not be modified without the express written\npermission of its copyright owner." + }, + + "inherit@2.2.2": { + license: "MIT", + repository: "https://github.com/dfilatov/inherit", + source: "LICENSE.md", + sourceText: "Copyright (c) 2012 Dmitry Filatov\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + }, + + "tweetnacl@0.14.3": { + license: "Public Domain", + repository: "https://github.com/dchest/tweetnacl", + source: "COPYING.txt", + sourceText: "Public Domain\n\nThe person who associated a work with this deed has dedicated the work to the\npublic domain by waiving all of his or her rights to the work worldwide under\ncopyright law, including all related and neighboring rights, to the extent\nallowed by law.\n\nYou can copy, modify, distribute and perform the work, even for commercial\npurposes, all without asking permission." + } +} diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 9b81fb797..57e91336e 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -5,12 +5,13 @@ const fs = require('fs-extra') const path = require('path') const electronPackager = require('electron-packager') const includePathInPackagedApp = require('./include-path-in-packaged-app') +const getLicenseText = require('./get-license-text') const CONFIG = require('../config') -module.exports = function () { +module.exports = async function () { console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`) - electronPackager({ + const packagedAppPath = await runPackager({ 'app-version': CONFIG.appMetadata.version, 'arch': process.arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, @@ -22,26 +23,21 @@ module.exports = function () { 'overwrite': true, 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion - }, (err, packagedAppPaths) => { - if (err) throw new Error(err) - assert(packagedAppPaths.length === 1, 'Generated more than one electron application!') - - const packagedAppPath = packagedAppPaths[0] - let bundledResourcesPath - if (process.platform === 'darwin') { - bundledResourcesPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Resources') - } else { - throw new Error('TODO: handle this case!') - } - - copyNonASARResources(bundledResourcesPath) - console.log(`Application bundle(s) created on ${packagedAppPath}`) }) + let bundledResourcesPath + if (process.platform === 'darwin') { + bundledResourcesPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Resources') + } else { + throw new Error('TODO: handle this case!') + } + + await copyNonASARResources(bundledResourcesPath) + console.log(`Application bundle created on ${packagedAppPath}`) } -function copyNonASARResources (bundledResourcesPath) { +async function copyNonASARResources (bundledResourcesPath) { const bundledShellCommandsPath = path.join(bundledResourcesPath, 'app') - console.log(`Copying shell commands to ${bundledShellCommandsPath}...`); + console.log(`Copying shell commands to ${bundledShellCommandsPath}...`) fs.copySync( path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), path.join(bundledShellCommandsPath, 'apm'), @@ -56,6 +52,9 @@ function copyNonASARResources (bundledResourcesPath) { if (process.platform === 'darwin') { fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'file.icns'), path.join(bundledResourcesPath, 'file.icns')) } + + console.log(`Writing LICENSE.md to ${bundledResourcesPath}...`) + fs.writeFileSync(path.join(bundledResourcesPath, 'LICENSE.md'), await getLicenseText()) } function buildAsarUnpackGlobExpression () { @@ -71,3 +70,29 @@ function buildAsarUnpackGlobExpression () { return `{${unpack.join(',')}}` } + +function runPackager (options) { + return new Promise((resolve, reject) => { + electronPackager({ + 'app-version': CONFIG.appMetadata.version, + 'arch': process.arch, + 'asar': {unpack: buildAsarUnpackGlobExpression()}, + 'build-version': CONFIG.appMetadata.version, + 'download': {cache: CONFIG.cachePath}, + 'dir': CONFIG.intermediateAppPath, + 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns'), + 'out': CONFIG.buildOutputPath, + 'overwrite': true, + 'platform': process.platform, + 'version': CONFIG.appMetadata.electronVersion + }, (err, packagedAppPaths) => { + if (err) { + reject(err) + throw new Error(err) + } else { + assert(packagedAppPaths.length === 1, 'Generated more than one electron application!') + resolve(packagedAppPaths[0]) + } + }) + }) +} diff --git a/build/package.json b/build/package.json index c11aaee0b..1485970fb 100644 --- a/build/package.json +++ b/build/package.json @@ -7,6 +7,7 @@ "electron-packager": "7.3.0", "fs-extra": "0.30.0", "glob": "7.0.3", + "legal-eagle": "0.13.0", "mkdirp": "0.5.1", "normalize-package-data": "2.3.5", "npm": "3.10.5", From cc514f0fc5162521517533e539708c6cfdf8f329 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 15:34:07 +0200 Subject: [PATCH 041/221] :art: --- build/{lib => }/deprecated-packages.json | 0 build/lib/generate-metadata.js | 8 ++++---- build/lib/get-license-text.js | 2 +- build/{lib => }/license-overrides.js | 0 4 files changed, 5 insertions(+), 5 deletions(-) rename build/{lib => }/deprecated-packages.json (100%) rename build/{lib => }/license-overrides.js (100%) diff --git a/build/lib/deprecated-packages.json b/build/deprecated-packages.json similarity index 100% rename from build/lib/deprecated-packages.json rename to build/deprecated-packages.json diff --git a/build/lib/generate-metadata.js b/build/lib/generate-metadata.js index 5934ad149..62decc42a 100644 --- a/build/lib/generate-metadata.js +++ b/build/lib/generate-metadata.js @@ -4,7 +4,7 @@ const path = require('path') const CSON = require('season') const fs = require('fs-extra') const normalizePackageData = require('normalize-package-data') -const deprecatedPackagesMetadata = require('./deprecated-packages') +const deprecatedPackagesMetadata = require('../deprecated-packages') const semver = require('semver') const CONFIG = require('../config') @@ -14,7 +14,8 @@ module.exports = function () { CONFIG.appMetadata._atomPackages = buildBundledPackagesMetadata() CONFIG.appMetadata._atomMenu = buildPlatformMenuMetadata() CONFIG.appMetadata._atomKeymaps = buildPlatformKeymapsMetadata() - CONFIG.appMetadata._deprecatedPackages = buildDeprecatedPackagesMetadata() + CONFIG.appMetadata._deprecatedPackages = deprecatedPackagesMetadata + checkDeprecatedPackagesMetadata() fs.writeFileSync(path.join(CONFIG.intermediateAppPath, 'package.json'), JSON.stringify(CONFIG.appMetadata)) } @@ -121,12 +122,11 @@ function buildPlatformKeymapsMetadata () { return keymaps } -function buildDeprecatedPackagesMetadata () { +function checkDeprecatedPackagesMetadata () { for (let packageName of Object.keys(deprecatedPackagesMetadata)) { const packageMetadata = deprecatedPackagesMetadata[packageName] if (packageMetadata.version && !semver.validRange(packageMetadata.version)) { throw new Error(`Invalid range: ${version} (${name}).`) } } - return deprecatedPackagesMetadata } diff --git a/build/lib/get-license-text.js b/build/lib/get-license-text.js index 1cb257202..0e3c156a6 100644 --- a/build/lib/get-license-text.js +++ b/build/lib/get-license-text.js @@ -4,7 +4,7 @@ const fs = require('fs') const path = require('path') const legalEagle = require('legal-eagle') -const licenseOverrides = require('./license-overrides') +const licenseOverrides = require('../license-overrides') const CONFIG = require('../config') module.exports = function () { diff --git a/build/lib/license-overrides.js b/build/license-overrides.js similarity index 100% rename from build/lib/license-overrides.js rename to build/license-overrides.js From 3f469d77e0249f937d7c4a21f1ba3e23302f098a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 15:37:27 +0200 Subject: [PATCH 042/221] Try running specs --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 61f54c20e..bb401b092 100644 --- a/circle.yml +++ b/circle.yml @@ -33,4 +33,4 @@ dependencies: test: override: - - echo 'Run tests!!!' + - out/Atom-darwin-x64/Atom.app/Contents/MacOS/Atom --test spec From ba0ecffcb042e0dfd42eb85cc27617717c66ec89 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 15:57:06 +0200 Subject: [PATCH 043/221] Append sha to dev versions --- build/config.js | 14 ++++++++++++-- build/lib/copy-assets.js | 2 +- build/lib/package-application.js | 20 ++++---------------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/build/config.js b/build/config.js index 19d02e64f..b6a6d10b4 100644 --- a/build/config.js +++ b/build/config.js @@ -4,6 +4,7 @@ 'use strict' const path = require('path') +const childProcess = require('child_process') const appMetadata = require('../package.json') @@ -11,14 +12,23 @@ const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') const intermediateAppPath = path.join(buildOutputPath, 'app') const cachePath = path.join(repositoryRootPath, 'cache') -const channel = getChannel() module.exports = { - appMetadata, channel, + appMetadata, getAppVersion, getChannel, repositoryRootPath, buildOutputPath, intermediateAppPath, cachePath } +function getAppVersion () { + let version = appMetadata.version + if (getChannel() === 'dev') { + const result = childProcess.spawnSync('git', ['rev-parse', '--short', 'HEAD'], {cwd: repositoryRootPath}) + const commitHash = result.stdout.toString().trim() + version += '-' + commitHash + } + return version +} + function getChannel () { if (appMetadata.version.match(/dev/) || isBuildingPR()) { return 'dev' diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index b6566fc40..d6aea38a5 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -26,7 +26,7 @@ module.exports = function () { } fs.copySync( - path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), + path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.getChannel(), 'png', '1024.png'), path.join(CONFIG.intermediateAppPath, 'resources', 'atom.png') ) } diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 57e91336e..8cc4aeeef 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -12,13 +12,13 @@ const CONFIG = require('../config') module.exports = async function () { console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`) const packagedAppPath = await runPackager({ - 'app-version': CONFIG.appMetadata.version, + 'app-version': CONFIG.getAppVersion(), 'arch': process.arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, - 'build-version': CONFIG.appMetadata.version, + 'build-version': CONFIG.getAppVersion(), 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, - 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns'), + 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.getChannel(), 'atom.icns'), 'out': CONFIG.buildOutputPath, 'overwrite': true, 'platform': process.platform, @@ -73,19 +73,7 @@ function buildAsarUnpackGlobExpression () { function runPackager (options) { return new Promise((resolve, reject) => { - electronPackager({ - 'app-version': CONFIG.appMetadata.version, - 'arch': process.arch, - 'asar': {unpack: buildAsarUnpackGlobExpression()}, - 'build-version': CONFIG.appMetadata.version, - 'download': {cache: CONFIG.cachePath}, - 'dir': CONFIG.intermediateAppPath, - 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns'), - 'out': CONFIG.buildOutputPath, - 'overwrite': true, - 'platform': process.platform, - 'version': CONFIG.appMetadata.electronVersion - }, (err, packagedAppPaths) => { + electronPackager(options, (err, packagedAppPaths) => { if (err) { reject(err) throw new Error(err) From ff12c274fdb74e9661e53a96ded8a04ff5b3bc19 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 15:59:22 +0200 Subject: [PATCH 044/221] Specify resource path --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index bb401b092..b4520db06 100644 --- a/circle.yml +++ b/circle.yml @@ -33,4 +33,4 @@ dependencies: test: override: - - out/Atom-darwin-x64/Atom.app/Contents/MacOS/Atom --test spec + - out/Atom-darwin-x64/Atom.app/Contents/MacOS/Atom --resource-path $(pwd) --test spec From 6f5b284d48bc927394293473a23f378cd00ef6cc Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 16:16:18 +0200 Subject: [PATCH 045/221] Set AtomHelper version --- build/build.js | 1 - build/lib/package-application.js | 42 ++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/build/build.js b/build/build.js index cb3115d5b..781d9b061 100644 --- a/build/build.js +++ b/build/build.js @@ -3,7 +3,6 @@ 'use strict' require('coffee-script/register') -require('babel-core/register') const cleanOutputDirectory = require('./lib/clean-output-directory') const copyAssets = require('./lib/copy-assets') diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 8cc4aeeef..07113be72 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -3,15 +3,16 @@ const assert = require('assert') const fs = require('fs-extra') const path = require('path') +const childProcess = require('child_process') const electronPackager = require('electron-packager') const includePathInPackagedApp = require('./include-path-in-packaged-app') const getLicenseText = require('./get-license-text') const CONFIG = require('../config') -module.exports = async function () { +module.exports = function () { console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`) - const packagedAppPath = await runPackager({ + return runPackager({ 'app-version': CONFIG.getAppVersion(), 'arch': process.arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, @@ -23,19 +24,22 @@ module.exports = async function () { 'overwrite': true, 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion - }) - let bundledResourcesPath - if (process.platform === 'darwin') { - bundledResourcesPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Resources') - } else { - throw new Error('TODO: handle this case!') - } + }).then((packagedAppPath) => { + let bundledResourcesPath + if (process.platform === 'darwin') { + bundledResourcesPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Resources') + } else { + throw new Error('TODO: handle this case!') + } - await copyNonASARResources(bundledResourcesPath) - console.log(`Application bundle created on ${packagedAppPath}`) + setAtomHelperVersion(packagedAppPath) + return copyNonASARResources(bundledResourcesPath).then(() => { + console.log(`Application bundle created on ${packagedAppPath}`) + }) + }) } -async function copyNonASARResources (bundledResourcesPath) { +function copyNonASARResources (bundledResourcesPath) { const bundledShellCommandsPath = path.join(bundledResourcesPath, 'app') console.log(`Copying shell commands to ${bundledShellCommandsPath}...`) fs.copySync( @@ -54,7 +58,19 @@ async function copyNonASARResources (bundledResourcesPath) { } console.log(`Writing LICENSE.md to ${bundledResourcesPath}...`) - fs.writeFileSync(path.join(bundledResourcesPath, 'LICENSE.md'), await getLicenseText()) + return getLicenseText().then((licenseText) => { + fs.writeFileSync(path.join(bundledResourcesPath, 'LICENSE.md'), licenseText) + }) +} + +function setAtomHelperVersion (packagedAppPath) { + if (process.platform === 'darwin') { + const frameworksPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Frameworks') + const helperPListPath = path.join(frameworksPath, 'Atom Helper.app', 'Contents', 'Info.plist') + console.log(`Setting Atom Helper Version for ${helperPListPath}...`) + childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleVersion', CONFIG.getAppVersion(), helperPListPath]) + childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleShortVersionString', CONFIG.getAppVersion(), helperPListPath]) + } } function buildAsarUnpackGlobExpression () { From d3f0897ca6400121f6429186decdcb59c180332a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 16:37:55 +0200 Subject: [PATCH 046/221] Export CONFIG.channel instead of getChannel() function --- build/config.js | 3 ++- build/lib/copy-assets.js | 2 +- build/lib/package-application.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build/config.js b/build/config.js index b6a6d10b4..0eeb6c783 100644 --- a/build/config.js +++ b/build/config.js @@ -7,6 +7,7 @@ const path = require('path') const childProcess = require('child_process') const appMetadata = require('../package.json') +const channel = getChannel() const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') @@ -14,7 +15,7 @@ const intermediateAppPath = path.join(buildOutputPath, 'app') const cachePath = path.join(repositoryRootPath, 'cache') module.exports = { - appMetadata, getAppVersion, getChannel, + appMetadata, channel, repositoryRootPath, buildOutputPath, intermediateAppPath, cachePath } diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index d6aea38a5..b6566fc40 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -26,7 +26,7 @@ module.exports = function () { } fs.copySync( - path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.getChannel(), 'png', '1024.png'), + path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), path.join(CONFIG.intermediateAppPath, 'resources', 'atom.png') ) } diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 07113be72..36879a397 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -19,7 +19,7 @@ module.exports = function () { 'build-version': CONFIG.getAppVersion(), 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, - 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.getChannel(), 'atom.icns'), + 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns'), 'out': CONFIG.buildOutputPath, 'overwrite': true, 'platform': process.platform, From 2688f7708d0a7297fdf5fe51dde432ad71673a89 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 16:38:11 +0200 Subject: [PATCH 047/221] Move appVersion generation inside `generateMetadata` --- build/config.js | 11 ----------- build/lib/generate-metadata.js | 12 ++++++++++++ build/lib/package-application.js | 8 ++++---- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/build/config.js b/build/config.js index 0eeb6c783..b45ca106f 100644 --- a/build/config.js +++ b/build/config.js @@ -4,7 +4,6 @@ 'use strict' const path = require('path') -const childProcess = require('child_process') const appMetadata = require('../package.json') const channel = getChannel() @@ -20,16 +19,6 @@ module.exports = { cachePath } -function getAppVersion () { - let version = appMetadata.version - if (getChannel() === 'dev') { - const result = childProcess.spawnSync('git', ['rev-parse', '--short', 'HEAD'], {cwd: repositoryRootPath}) - const commitHash = result.stdout.toString().trim() - version += '-' + commitHash - } - return version -} - function getChannel () { if (appMetadata.version.match(/dev/) || isBuildingPR()) { return 'dev' diff --git a/build/lib/generate-metadata.js b/build/lib/generate-metadata.js index 62decc42a..8a7dfc469 100644 --- a/build/lib/generate-metadata.js +++ b/build/lib/generate-metadata.js @@ -1,5 +1,6 @@ 'use strict' +const childProcess = require('child_process') const path = require('path') const CSON = require('season') const fs = require('fs-extra') @@ -15,6 +16,7 @@ module.exports = function () { CONFIG.appMetadata._atomMenu = buildPlatformMenuMetadata() CONFIG.appMetadata._atomKeymaps = buildPlatformKeymapsMetadata() CONFIG.appMetadata._deprecatedPackages = deprecatedPackagesMetadata + CONFIG.appMetadata.version = computeAppVersion() checkDeprecatedPackagesMetadata() fs.writeFileSync(path.join(CONFIG.intermediateAppPath, 'package.json'), JSON.stringify(CONFIG.appMetadata)) } @@ -130,3 +132,13 @@ function checkDeprecatedPackagesMetadata () { } } } + +function computeAppVersion () { + let version = CONFIG.appMetadata.version + if (CONFIG.channel === 'dev') { + const result = childProcess.spawnSync('git', ['rev-parse', '--short', 'HEAD'], {cwd: CONFIG.repositoryRootPath}) + const commitHash = result.stdout.toString().trim() + version += '-' + commitHash + } + return version +} diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 36879a397..931a1e43b 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -13,10 +13,10 @@ const CONFIG = require('../config') module.exports = function () { console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`) return runPackager({ - 'app-version': CONFIG.getAppVersion(), + 'app-version': CONFIG.appMetadata.version, 'arch': process.arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, - 'build-version': CONFIG.getAppVersion(), + 'build-version': CONFIG.appMetadata.version, 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns'), @@ -68,8 +68,8 @@ function setAtomHelperVersion (packagedAppPath) { const frameworksPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Frameworks') const helperPListPath = path.join(frameworksPath, 'Atom Helper.app', 'Contents', 'Info.plist') console.log(`Setting Atom Helper Version for ${helperPListPath}...`) - childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleVersion', CONFIG.getAppVersion(), helperPListPath]) - childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleShortVersionString', CONFIG.getAppVersion(), helperPListPath]) + childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleVersion', CONFIG.appMetadata.version, helperPListPath]) + childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleShortVersionString', CONFIG.appMetadata.version, helperPListPath]) } } From d660f9b9afc2ab3a4261b92cab1ad36138a6be36 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 17:23:19 +0200 Subject: [PATCH 048/221] Make build/build.js executable --- build/build.js | 0 circle.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 build/build.js diff --git a/build/build.js b/build/build.js old mode 100644 new mode 100755 diff --git a/circle.yml b/circle.yml index b4520db06..6f75569e0 100644 --- a/circle.yml +++ b/circle.yml @@ -20,7 +20,7 @@ dependencies: override: - script/bootstrap - - node build/build.js + - build/build.js post: - zip -r out/Atom.zip out/Atom-darwin-x64 From 1369a61df42c9aeafa19f98a2b0eafdccb16d3ee Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 29 Jul 2016 17:42:56 +0200 Subject: [PATCH 049/221] Start on build/test.js --- build/package.json | 1 + build/test.js | 22 ++++++++++++++++++++++ circle.yml | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 build/test.js diff --git a/build/package.json b/build/package.json index 1485970fb..141f64652 100644 --- a/build/package.json +++ b/build/package.json @@ -4,6 +4,7 @@ "dependencies": { "babel-core": "5.8.38", "coffee-script": "1.8.0", + "colors": "1.1.2", "electron-packager": "7.3.0", "fs-extra": "0.30.0", "glob": "7.0.3", diff --git a/build/test.js b/build/test.js new file mode 100755 index 000000000..36b13e3a5 --- /dev/null +++ b/build/test.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node + +'use strict' + +require('colors') + +const path = require('path') +const childProcess = require('child_process') +const CONFIG = require('./config') + +const packagedAppPath = path.resolve(__dirname, '..', 'out', 'Atom-darwin-x64') +const executablePath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'MacOS', 'Atom') + +const resourcePath = CONFIG.repositoryRootPath +const testPath = path.join(CONFIG.repositoryRootPath, 'spec') +const testArguments = [ + '--resource-path', resourcePath, + '--test', testPath +] + +console.log('Executing core specs...'.bold.green) +childProcess.spawnSync(executablePath, testArguments, {stdio: 'inherit'}) diff --git a/circle.yml b/circle.yml index 6f75569e0..a7e5eb2b2 100644 --- a/circle.yml +++ b/circle.yml @@ -33,4 +33,4 @@ dependencies: test: override: - - out/Atom-darwin-x64/Atom.app/Contents/MacOS/Atom --resource-path $(pwd) --test spec + - build/test.js From 8f265218dfd634439c5ab9f4033e504815a15c1f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 29 Jul 2016 10:56:12 -0600 Subject: [PATCH 050/221] Explicitly exclude package spec directories This avoid accidentally excluding subdirectories of other modules called spec, which caused problems for babel-core. Signed-off-by: Max Brunsfeld --- build/lib/include-path-in-packaged-app.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build/lib/include-path-in-packaged-app.js b/build/lib/include-path-in-packaged-app.js index 515bc501c..d594f15d0 100644 --- a/build/lib/include-path-in-packaged-app.js +++ b/build/lib/include-path-in-packaged-app.js @@ -1,6 +1,7 @@ 'use strict' const path = require('path') +const CONFIG = require('../config') module.exports = function (path) { return !EXCLUDED_PATHS_REGEXP.test(path) @@ -74,11 +75,17 @@ const EXCLUDE_REGEXPS_SOURCES = [ escapeRegExp(path.sep) + 'linker\\.lock$', escapeRegExp(path.join('build', 'Release') + path.sep) + '.+\\.node\\.dSYM', - // Ignore test, spec and example folders for packages + // Ignore test and example folders 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + '_*te?sts?_*' + escapeRegExp(path.sep), - 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'spec' + escapeRegExp(path.sep), 'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'examples?' + escapeRegExp(path.sep), ] + +// Ignore spec directories in all bundled packages +const packageMetadata = require(path.join(CONFIG.repositoryRootPath, 'package.json')) +for (let packageName in packageMetadata.packageDependencies) { + EXCLUDE_REGEXPS_SOURCES.push('^' + escapeRegExp(path.join(CONFIG.repositoryRootPath, 'node_modules', packageName, 'spec'))) +} + // Ignore Hunspell dictionaries only on macOS. if (process.platform === 'darwin') { EXCLUDE_REGEXPS_SOURCES.push(escapeRegExp(path.join('spellchecker', 'vendor', 'hunspell_dictionaries'))) From c47c380ff8fa6f04964e1151a714fbcd65a4d392 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 29 Jul 2016 11:41:32 -0600 Subject: [PATCH 051/221] Forward child process exit code when exiting test script Signed-off-by: Antonio Scandurra --- build/test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/test.js b/build/test.js index 36b13e3a5..046d0bb05 100755 --- a/build/test.js +++ b/build/test.js @@ -19,4 +19,5 @@ const testArguments = [ ] console.log('Executing core specs...'.bold.green) -childProcess.spawnSync(executablePath, testArguments, {stdio: 'inherit'}) +const exitStatus = childProcess.spawnSync(executablePath, testArguments, {stdio: 'inherit'}).status +process.exit(exitStatus) From 3d71112d75302c5ee254e4d9a387435c5ff219df Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 29 Jul 2016 12:00:34 -0600 Subject: [PATCH 052/221] Get core specs ready to run in parallel w/ package specs --- build/package.json | 1 + build/test.js | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/build/package.json b/build/package.json index 141f64652..9c72e4a0c 100644 --- a/build/package.json +++ b/build/package.json @@ -2,6 +2,7 @@ "name": "atom-build-scripts", "description": "Atom build scripts", "dependencies": { + "async": "^2.0.1", "babel-core": "5.8.38", "coffee-script": "1.8.0", "colors": "1.1.2", diff --git a/build/test.js b/build/test.js index 046d0bb05..e1277b827 100755 --- a/build/test.js +++ b/build/test.js @@ -2,6 +2,7 @@ 'use strict' +const async = require('async') require('colors') const path = require('path') @@ -18,6 +19,19 @@ const testArguments = [ '--test', testPath ] -console.log('Executing core specs...'.bold.green) -const exitStatus = childProcess.spawnSync(executablePath, testArguments, {stdio: 'inherit'}).status -process.exit(exitStatus) +function runCoreSpecs (callback) { + console.log('Executing core specs...'.bold.green) + const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit'}) + cp.on('error', error => { callback(error) }) + cp.on('close', exitCode => { callback(null, exitCode) }) +} + +async.parallelLimit([runCoreSpecs], 2, function (err, exitCodes) { + if (err) { + console.error(err) + process.exit(1) + } else { + const testsPassed = exitCodes.every(exitCode => exitCode === 0) + process.exit(testsPassed ? 0 : 1) + } +}) From 976c8007b8784e5134f5840b2f1d61520c46b398 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 29 Jul 2016 12:10:05 -0600 Subject: [PATCH 053/221] Run main process tests in test.js --- build/test.js | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/build/test.js b/build/test.js index e1277b827..58370498b 100755 --- a/build/test.js +++ b/build/test.js @@ -11,22 +11,37 @@ const CONFIG = require('./config') const packagedAppPath = path.resolve(__dirname, '..', 'out', 'Atom-darwin-x64') const executablePath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'MacOS', 'Atom') - const resourcePath = CONFIG.repositoryRootPath -const testPath = path.join(CONFIG.repositoryRootPath, 'spec') -const testArguments = [ - '--resource-path', resourcePath, - '--test', testPath -] -function runCoreSpecs (callback) { - console.log('Executing core specs...'.bold.green) +function runCoreMainProcessTests (callback) { + const testPath = path.join(CONFIG.repositoryRootPath, 'spec', 'main-process') + const testArguments = [ + '--resource-path', resourcePath, + '--test', '--main-process', testPath + ] + + console.log('Executing core main process tests...'.bold.green) const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit'}) cp.on('error', error => { callback(error) }) cp.on('close', exitCode => { callback(null, exitCode) }) } -async.parallelLimit([runCoreSpecs], 2, function (err, exitCodes) { +function runCoreRenderProcessTests (callback) { + const testPath = path.join(CONFIG.repositoryRootPath, 'spec') + const testArguments = [ + '--resource-path', resourcePath, + '--test', testPath + ] + + console.log('Executing core render process tests...'.bold.green) + const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit'}) + cp.on('error', error => { callback(error) }) + cp.on('close', exitCode => { callback(null, exitCode) }) +} + +const testSuitesToRun = [runCoreMainProcessTests, runCoreRenderProcessTests] + +async.parallelLimit(testSuitesToRun, 2, function (err, exitCodes) { if (err) { console.error(err) process.exit(1) From 28f94fcc1538a6cecbf63d133d5b3174ff3b5015 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 29 Jul 2016 12:23:28 -0600 Subject: [PATCH 054/221] Run package tests in test.js --- build/test.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/build/test.js b/build/test.js index 58370498b..d67ea9340 100755 --- a/build/test.js +++ b/build/test.js @@ -2,11 +2,12 @@ 'use strict' -const async = require('async') require('colors') - -const path = require('path') +const async = require('async') const childProcess = require('child_process') +const fs = require('fs') +const path = require('path') + const CONFIG = require('./config') const packagedAppPath = path.resolve(__dirname, '..', 'out', 'Atom-darwin-x64') @@ -39,7 +40,25 @@ function runCoreRenderProcessTests (callback) { cp.on('close', exitCode => { callback(null, exitCode) }) } -const testSuitesToRun = [runCoreMainProcessTests, runCoreRenderProcessTests] +const packageTestSuites = [] +for (let packageName in CONFIG.appMetadata.packageDependencies) { + const packageSpecDirPath = path.join(CONFIG.repositoryRootPath, 'node_modules', packageName, 'spec') + if (!fs.existsSync(packageSpecDirPath)) continue + + packageTestSuites.push(function (callback) { + const testArguments = [ + '--resource-path', resourcePath, + '--test', packageSpecDirPath + ] + + console.log(`Executing ${packageName} tests...`.bold.green) + const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit'}) + cp.on('error', error => { callback(error) }) + cp.on('close', exitCode => { callback(null, exitCode) }) + }) +} + +const testSuitesToRun = [runCoreMainProcessTests, runCoreRenderProcessTests].concat(packageTestSuites) async.parallelLimit(testSuitesToRun, 2, function (err, exitCodes) { if (err) { From 989ae0a49c24d5998e1214f53c04c04b740f996d Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 29 Jul 2016 12:32:40 -0600 Subject: [PATCH 055/221] Suppress output for package tests unless they fail --- build/test.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/build/test.js b/build/test.js index d67ea9340..106450a29 100755 --- a/build/test.js +++ b/build/test.js @@ -40,6 +40,7 @@ function runCoreRenderProcessTests (callback) { cp.on('close', exitCode => { callback(null, exitCode) }) } +// Build an array of functions, each running tests for a different bundled package const packageTestSuites = [] for (let packageName in CONFIG.appMetadata.packageDependencies) { const packageSpecDirPath = path.join(CONFIG.repositoryRootPath, 'node_modules', packageName, 'spec') @@ -52,9 +53,17 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) { ] console.log(`Executing ${packageName} tests...`.bold.green) - const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit'}) + const cp = childProcess.spawn(executablePath, testArguments) + let stderrOutput = '' + cp.stderr.on('data', data => stderrOutput += data) cp.on('error', error => { callback(error) }) - cp.on('close', exitCode => { callback(null, exitCode) }) + cp.on('close', exitCode => { + if (exitCode !== 0) { + console.log(`Package tests failed for ${packageName}:`.red) + console.log(stderrOutput) + } + callback(null, exitCode) + }) }) } From a29b4065325157736bc1f15da6e19fe43e37eeb9 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 29 Jul 2016 15:25:27 -0600 Subject: [PATCH 056/221] Delete old-build --- old-build/certs/AtomDevTestSignKey.p12 | Bin 1765 -> 0 bytes old-build/tasks/mktar-task.coffee | 30 ------------------------- 2 files changed, 30 deletions(-) delete mode 100644 old-build/certs/AtomDevTestSignKey.p12 delete mode 100644 old-build/tasks/mktar-task.coffee diff --git a/old-build/certs/AtomDevTestSignKey.p12 b/old-build/certs/AtomDevTestSignKey.p12 deleted file mode 100644 index a93e9a9f042a29411a05cdf832c99041fd6d6180..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1765 zcmb7FX;c$e6n--kgF*JN2!|yK2+B4g2@((#0yaktvM6vs!xADON+3jBs7iveDWJuQ ziqXi9R0Tv-tY8rX9wVq&WDBAqu2rcDiWT~>Ew$(Pr{~U_x%a#8yLaZ!d}nY8@d1ip zxP&Mrk`|=1)5p{i6+|W><`N{tYzU|0670%s?L4xjU5^!8sZU|RO&n#=eOfsq7hlf{6-QGPd zN^vc!Deho{doNAf#RQ#~XIp7Y+8y#MRqlJ#@k~9(=3BFrSs$#) zd`02jljrXL(%+Ok-0#^`u^d}9vO^@U?$q;@+In8I=`m4T+c+6{px0}~J+FPmzwWKd zeqEGpwK$VJ=x>-|q7c1Z>Z@?RU+;Qj!l?Sy>E;50oa3e~tZE=*0IBDrJ#O-}|*FF1AK)**vT^=o;o>j|mW?snuqjixmXK+hj zN`w|G?ec{)iIhv?jK*-|9AqM^Vty+n$s*?M^*z01XKSLas@&W;l4t|sxH_ykg=>tq zJauamQN71Cm)ck|s}z;iEmyc*NWY9^=YRI)fgR7S$F-Y{lp@`H_OeBq0@|Ltn-k)* zY|gGPcyIM=vN>qU@9t3+^O`z4l|E8#wm-#l6fPLKK>k$+XUFRb%gxJb=dK=IM?({ReW?q|0{~WUz_};=g+EdmI z%~zF1YgcX0vs|$&wUuEpX4qnt?UI|rxP+=jW?p$3Js4y7v!yUb{fJz!cb_<+>%_rs zzZa!hvWnHpxx-E4f$5{RZ7Dv|P;{C|cVM%XBR%1#4nD zyfS9>7clzBqO!n&>r`+hasWA(R7OfFaA>eEdSwHW}%srI-n5nD~b$d(==!A6P~KbgNlkiZvGR`HWWlz`ai z_}KVpipM5Vj6fJG+KQVRs8gMAnj;Oz=}vU#5Ce4@lj=x=2ZPCAhTsdS44n2?McZ#x zWC^19(`8wFp(u7;EH6UD$Hm9LzByzDz{EKK7iXbjF=&~`>Fe^F`*2|UZnM}0-M1$` z-C>80Z8Tu`sQA51JQq}$U{aEztr3=Z>@;=3HY3}*5)~5z>H0WEuEc^xk87-OXUm39 zI-FX1Ap5$3z;Q4^(OY?A_vmN#4}^St@y>)4JqB})=foL*_Z7tlU$>lR8&*B`ST>;1 znWNM66Q}zziXi|gPQnv$HTY;IWCWQcpg6!IrXqw8f(NH+HQ$wNeG`1b_l=|>53PA0 ze!}tpPgkN9IIoAB_GDron={)vb6_Il>zTk8hQVQwf}aD$Ctgs4^jMjTB9x-aCA>ho zt*I++$>lTUbY-dRWN5h?=_unYJMFDp=aqUgXY}Lz{oV}QXGra6QO7P$M0ZbzfrI@} zx#8^F^6}#|{STkpTccWTF7c+|)+J_FG5*2W(K(vdXj>ugqjGf8CGMcvfboa1uCTo8cd_e`A@*-rK0Jqhg6_rrc^3ot+O=)Q RYtV|ry%{EHmBgtZ&Yvnyq?G^w diff --git a/old-build/tasks/mktar-task.coffee b/old-build/tasks/mktar-task.coffee deleted file mode 100644 index f5edbb4be..000000000 --- a/old-build/tasks/mktar-task.coffee +++ /dev/null @@ -1,30 +0,0 @@ -path = require 'path' - -module.exports = (grunt) -> - {spawn, fillTemplate} = require('./task-helpers')(grunt) - - grunt.registerTask 'mktar', 'Create an archive', -> - done = @async() - - appFileName = grunt.config.get('atom.appFileName') - buildDir = grunt.config.get('atom.buildDir') - shellAppDir = grunt.config.get('atom.shellAppDir') - {version, description} = grunt.config.get('atom.metadata') - - if process.arch is 'ia32' - arch = 'i386' - else if process.arch is 'x64' - arch = 'amd64' - else - return done("Unsupported arch #{process.arch}") - - iconPath = path.join(shellAppDir, 'resources', 'app.asar.unpacked', 'resources', 'atom.png') - - cmd = path.join('script', 'mktar') - args = [appFileName, version, arch, iconPath, buildDir] - spawn {cmd, args}, (error) -> - if error? - done(error) - else - grunt.log.ok "Created " + path.join(buildDir, "#{appFileName}-#{version}-#{arch}.tar.gz") - done() From bf47eda5832d36c41e81ada67aafec172b4e6a34 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 29 Jul 2016 16:54:55 -0600 Subject: [PATCH 057/221] Use already-loaded app metadata --- build/lib/include-path-in-packaged-app.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/lib/include-path-in-packaged-app.js b/build/lib/include-path-in-packaged-app.js index d594f15d0..4dc397698 100644 --- a/build/lib/include-path-in-packaged-app.js +++ b/build/lib/include-path-in-packaged-app.js @@ -81,8 +81,7 @@ const EXCLUDE_REGEXPS_SOURCES = [ ] // Ignore spec directories in all bundled packages -const packageMetadata = require(path.join(CONFIG.repositoryRootPath, 'package.json')) -for (let packageName in packageMetadata.packageDependencies) { +for (let packageName in CONFIG.appMetadata.packageDependencies) { EXCLUDE_REGEXPS_SOURCES.push('^' + escapeRegExp(path.join(CONFIG.repositoryRootPath, 'node_modules', packageName, 'spec'))) } From 5178e8d2c65e7e0caf2f45094aec667ef706ad31 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 29 Jul 2016 16:55:27 -0600 Subject: [PATCH 058/221] Pre-build less cache in build.js before packaging --- build/build.js | 2 + build/config.js | 3 +- build/lib/prebuild-less-cache.js | 78 ++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 build/lib/prebuild-less-cache.js diff --git a/build/build.js b/build/build.js index 781d9b061..26e49cd76 100755 --- a/build/build.js +++ b/build/build.js @@ -11,6 +11,7 @@ const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths' const transpileCsonPaths = require('./lib/transpile-cson-paths') const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') const generateModuleCache = require('./lib/generate-module-cache') +const prebuildLessCache = require('./lib/prebuild-less-cache') const generateMetadata = require('./lib/generate-metadata') const packageApplication = require('./lib/package-application') @@ -21,5 +22,6 @@ transpileCoffeeScriptPaths() transpileCsonPaths() transpilePegJsPaths() generateModuleCache() +prebuildLessCache() generateMetadata() packageApplication() diff --git a/build/config.js b/build/config.js index b45ca106f..b92a74e26 100644 --- a/build/config.js +++ b/build/config.js @@ -12,11 +12,12 @@ const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') const intermediateAppPath = path.join(buildOutputPath, 'app') const cachePath = path.join(repositoryRootPath, 'cache') +const homeDirPath = process.env.HOME || process.env.USERPROFILE module.exports = { appMetadata, channel, repositoryRootPath, buildOutputPath, intermediateAppPath, - cachePath + cachePath, homeDirPath } function getChannel () { diff --git a/build/lib/prebuild-less-cache.js b/build/lib/prebuild-less-cache.js new file mode 100644 index 000000000..a1119bd6d --- /dev/null +++ b/build/lib/prebuild-less-cache.js @@ -0,0 +1,78 @@ +'use strict' + +const fs = require('fs') +const glob = require('glob') +const path = require('path') +const LessCache = require('less-cache') + +const CONFIG = require('../config') +const LESS_CACHE_VERSION =require('less-cache/package.json').version +const FALLBACK_VARIABLE_IMPORTS = '@import "variables/ui-variables";\n@import "variables/syntax-variables";\n' + +module.exports = function () { + const cacheDirPath = path.join(CONFIG.intermediateAppPath, 'less-compile-cache') + console.log(`Generating pre-built less cache in ${cacheDirPath}`) + + // Group bundled packages into UI themes, syntax themes, and non-theme packages + const uiThemes = [] + const syntaxThemes = [] + const nonThemePackages = [] + for (let packageName in CONFIG.appMetadata.packageDependencies) { + const packageMetadata = require(path.join(CONFIG.intermediateAppPath, 'node_modules', packageName, 'package.json')) + if (packageMetadata.theme === 'ui') { + uiThemes.push(packageName) + } else if (packageMetadata.theme === 'syntax') { + syntaxThemes.push(packageName) + } else { + nonThemePackages.push(packageName) + } + } + + // Warm cache for every combination of the default UI and syntax themes, + // because themes assign variables which may be used in any style sheet. + for (let uiTheme of uiThemes) { + for (let syntaxTheme of syntaxThemes) { + // Build a LessCache instance with import paths based on the current theme combination + const lessCache = new LessCache({ + cacheDir: cacheDirPath, + fallbackDir: path.join(CONFIG.homeDirPath, '.atom', 'compile-cache', 'prebuild-less', LESS_CACHE_VERSION), + syncCaches: true, + resourcePath: CONFIG.intermediateAppPath, + importPaths: [ + path.join(CONFIG.intermediateAppPath, 'node_modules', syntaxTheme, 'styles'), + path.join(CONFIG.intermediateAppPath, 'node_modules', uiTheme, 'styles'), + path.join(CONFIG.intermediateAppPath, 'static', 'variables'), + path.join(CONFIG.intermediateAppPath, 'static'), + ] + }) + + function cacheCompiledCSS(lessFilePath, importFallbackVariables) { + let lessSource = fs.readFileSync(lessFilePath, 'utf8') + if (importFallbackVariables) { + lessSource = FALLBACK_VARIABLE_IMPORTS + lessSource + } + lessCache.cssForFile(lessFilePath, lessSource) + } + + // Cache all styles in static; don't append variable imports + for (let lessFilePath of glob.sync(path.join(CONFIG.intermediateAppPath, 'static', '**', '*.less'))) { + cacheCompiledCSS(lessFilePath, false) + } + + // Cache styles for all bundled non-theme packages + for (let nonThemePackage of nonThemePackages) { + for (let lessFilePath of glob.sync(path.join(CONFIG.intermediateAppPath, 'node_modules', nonThemePackage, '**', '*.less'))) { + cacheCompiledCSS(lessFilePath, true) + } + } + + // Cache styles for this UI theme + const uiThemeMainPath = path.join(CONFIG.intermediateAppPath, 'node_modules', uiTheme, 'index.less') + cacheCompiledCSS(uiThemeMainPath, true) + + // Cache styles for this syntax theme + const syntaxThemeMainPath = path.join(CONFIG.intermediateAppPath, 'node_modules', syntaxTheme, 'index.less') + cacheCompiledCSS(syntaxThemeMainPath, true) + } + } +} From 250d1044f3eaf1a7f40b334edccc2d0978b46334 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 30 Jul 2016 08:35:22 -0600 Subject: [PATCH 059/221] Write CI fingerprint in build.js --- build/build.js | 10 ++++++---- build/config.js | 4 +++- build/lib/fingerprint.js | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 build/lib/fingerprint.js diff --git a/build/build.js b/build/build.js index 26e49cd76..3d60c7e0c 100755 --- a/build/build.js +++ b/build/build.js @@ -6,14 +6,15 @@ require('coffee-script/register') const cleanOutputDirectory = require('./lib/clean-output-directory') const copyAssets = require('./lib/copy-assets') +const generateMetadata = require('./lib/generate-metadata') +const generateModuleCache = require('./lib/generate-module-cache') +const packageApplication = require('./lib/package-application') +const prebuildLessCache = require('./lib/prebuild-less-cache') const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') const transpileCsonPaths = require('./lib/transpile-cson-paths') const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') -const generateModuleCache = require('./lib/generate-module-cache') -const prebuildLessCache = require('./lib/prebuild-less-cache') -const generateMetadata = require('./lib/generate-metadata') -const packageApplication = require('./lib/package-application') +const writeFingerprint = require('./lib/fingerprint').writeFingerprint cleanOutputDirectory() copyAssets() @@ -25,3 +26,4 @@ generateModuleCache() prebuildLessCache() generateMetadata() packageApplication() +writeFingerprint() diff --git a/build/config.js b/build/config.js index b92a74e26..c81aea757 100644 --- a/build/config.js +++ b/build/config.js @@ -6,6 +6,8 @@ const path = require('path') const appMetadata = require('../package.json') +const apmMetadata = require('../apm/node_modules/atom-package-manager/package.json') + const channel = getChannel() const repositoryRootPath = path.resolve(__dirname, '..') @@ -15,7 +17,7 @@ const cachePath = path.join(repositoryRootPath, 'cache') const homeDirPath = process.env.HOME || process.env.USERPROFILE module.exports = { - appMetadata, channel, + appMetadata, apmMetadata, channel, repositoryRootPath, buildOutputPath, intermediateAppPath, cachePath, homeDirPath } diff --git a/build/lib/fingerprint.js b/build/lib/fingerprint.js new file mode 100644 index 000000000..182eab8ed --- /dev/null +++ b/build/lib/fingerprint.js @@ -0,0 +1,34 @@ +const crypto = require('crypto') +const fs = require('fs') +const path = require('path') + +const CONFIG = require('../config') +const FINGERPRINT_PATH = path.join(CONFIG.repositoryRootPath, 'node_modules', '.atom-ci-fingerprint') + +exports.writeFingerprint = function () { + const fingerprint = computeFingerprint() + fs.writeFileSync(FINGERPRINT_PATH, fingerprint) + console.log('Wrote CI fingerprint:', FINGERPRINT_PATH, fingerprint) +}, + +exports.fingerprintMatches = function () { + const oldFingerprint = readFingerprint() + return oldFingerprint && oldFingerprint === computeFingerprint() +} + +function computeFingerprint () { + //Include the electron minor version in the fingerprint since that changing requires a re-install + const electronVersion = CONFIG.appMetadata.electronVersion.replace(/\.\d+$/, '') + const apmVersion = CONFIG.apmMetadata.version + + const body = electronVersion + apmVersion + process.platform + process.version + return crypto.createHash('sha1').update(body).digest('hex') +} + +function readFingerprint () { + if (fs.existsSync(FINGERPRINT_PATH)) { + return fs.readFileSync(FINGERPRINT_PATH, 'utf8') + } else { + return null + } +} From 6e75c99ea2c9999eff6aa8a50954f0876e6088be Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 1 Aug 2016 14:32:22 +0200 Subject: [PATCH 060/221] Start on signing --- build/lib/package-application.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 931a1e43b..f14e320ec 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -21,6 +21,7 @@ module.exports = function () { 'dir': CONFIG.intermediateAppPath, 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns'), 'out': CONFIG.buildOutputPath, + 'osx-sign': getSignOptions(), 'overwrite': true, 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion @@ -87,6 +88,14 @@ function buildAsarUnpackGlobExpression () { return `{${unpack.join(',')}}` } +function getSignOptions () { + if (process.env.CI) { + return {identity: 'GitHub'} + } else { + return null + } +} + function runPackager (options) { return new Promise((resolve, reject) => { electronPackager(options, (err, packagedAppPaths) => { From ce8c86362f434ce2bb21115860f48d176477506b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 1 Aug 2016 17:22:30 +0200 Subject: [PATCH 061/221] Dump symbols and make them build artifacts --- build/build.js | 3 ++- build/config.js | 3 ++- build/lib/dump-symbols.js | 36 ++++++++++++++++++++++++++++++++++++ build/package.json | 1 + circle.yml | 6 ++++-- 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 build/lib/dump-symbols.js diff --git a/build/build.js b/build/build.js index 3d60c7e0c..7761f0eb7 100755 --- a/build/build.js +++ b/build/build.js @@ -6,6 +6,7 @@ require('coffee-script/register') const cleanOutputDirectory = require('./lib/clean-output-directory') const copyAssets = require('./lib/copy-assets') +const dumpSymbols = require('./lib/dump-symbols') const generateMetadata = require('./lib/generate-metadata') const generateModuleCache = require('./lib/generate-module-cache') const packageApplication = require('./lib/package-application') @@ -25,5 +26,5 @@ transpilePegJsPaths() generateModuleCache() prebuildLessCache() generateMetadata() -packageApplication() writeFingerprint() +dumpSymbols().then(packageApplication) diff --git a/build/config.js b/build/config.js index c81aea757..81064309a 100644 --- a/build/config.js +++ b/build/config.js @@ -13,12 +13,13 @@ const channel = getChannel() const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') const intermediateAppPath = path.join(buildOutputPath, 'app') +const symbolsPath = path.join(buildOutputPath, 'symbols') const cachePath = path.join(repositoryRootPath, 'cache') const homeDirPath = process.env.HOME || process.env.USERPROFILE module.exports = { appMetadata, apmMetadata, channel, - repositoryRootPath, buildOutputPath, intermediateAppPath, + repositoryRootPath, buildOutputPath, intermediateAppPath, symbolsPath, cachePath, homeDirPath } diff --git a/build/lib/dump-symbols.js b/build/lib/dump-symbols.js new file mode 100644 index 000000000..76971b6bb --- /dev/null +++ b/build/lib/dump-symbols.js @@ -0,0 +1,36 @@ +const fs = require('fs-extra') +const glob = require('glob') +const minidump = require('minidump') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + console.log(`Dumping symbols in ${CONFIG.symbolsPath}...`) + const binaryPaths = glob.sync(path.join(CONFIG.intermediateAppPath, 'node_modules', '**', '*.node')) + return Promise.all(binaryPaths.map(dumpSymbol)) +} + +function dumpSymbol (binaryPath) { + return new Promise(function (resolve, reject) { + minidump.dumpSymbol(binaryPath, function (error, content) { + if (error) { + reject(error) + throw new Error(error) + } else { + const moduleLine = /MODULE [^ ]+ [^ ]+ ([0-9A-F]+) (.*)\n/.exec(content) + if (moduleLine.length !== 3) { + reject() + throw new Error(`Invalid output when dumping symbol for ${binaryPath}`) + } else { + const filename = moduleLine[2] + const symbolDirPath = path.join(CONFIG.symbolsPath, filename, moduleLine[1]) + const symbolFilePath = path.join(symbolDirPath, `${filename}.sym`) + fs.mkdirpSync(symbolDirPath) + fs.writeFileSync(symbolFilePath) + resolve() + } + } + }) + }) +} diff --git a/build/package.json b/build/package.json index 9c72e4a0c..1b610b1e9 100644 --- a/build/package.json +++ b/build/package.json @@ -10,6 +10,7 @@ "fs-extra": "0.30.0", "glob": "7.0.3", "legal-eagle": "0.13.0", + "minidump": "0.9.0", "mkdirp": "0.5.1", "normalize-package-data": "2.3.5", "npm": "3.10.5", diff --git a/circle.yml b/circle.yml index a7e5eb2b2..215f2120c 100644 --- a/circle.yml +++ b/circle.yml @@ -9,7 +9,8 @@ machine: general: artifacts: - - out/Atom.zip + - out/atom-mac.zip + - out/atom-mac-symbols.zip dependencies: pre: @@ -23,7 +24,8 @@ dependencies: - build/build.js post: - - zip -r out/Atom.zip out/Atom-darwin-x64 + - cd out/Atom-darwin-x64 && zip -r ../atom-mac.zip ./Atom.app && cd - + - cd out && zip -r ./atom-mac-symbols.zip ./symbols && cd - cache_directories: - cache From 088510696fb53ab25d1e0eea9653ffb95da6159b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 1 Aug 2016 11:57:45 -0600 Subject: [PATCH 062/221] Rename AtomDevTestSignKey.p12 to windows-dev.p12 Signed-off-by: Antonio Scandurra --- .../{AtomDevTestSignKey.p12 => windows-dev.p12} | Bin build-old/tasks/codesign-task.coffee | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename build-old/certs/{AtomDevTestSignKey.p12 => windows-dev.p12} (100%) diff --git a/build-old/certs/AtomDevTestSignKey.p12 b/build-old/certs/windows-dev.p12 similarity index 100% rename from build-old/certs/AtomDevTestSignKey.p12 rename to build-old/certs/windows-dev.p12 diff --git a/build-old/tasks/codesign-task.coffee b/build-old/tasks/codesign-task.coffee index e46e899cb..f253210c3 100644 --- a/build-old/tasks/codesign-task.coffee +++ b/build-old/tasks/codesign-task.coffee @@ -74,7 +74,7 @@ module.exports = (grunt) -> downloadFile process.env.WIN_P12KEY_URL, downloadedCertificateFile, (done) -> callback(downloadedCertificateFile, process.env.WIN_P12KEY_PASSWORD ? 'password') else - callback(path.resolve(__dirname, '..', 'certs', 'AtomDevTestSignKey.p12'), process.env.WIN_P12KEY_PASSWORD ? 'password') + callback(path.resolve(__dirname, '..', 'certs', 'windows-dev.p12'), process.env.WIN_P12KEY_PASSWORD ? 'password') downloadFile = (sourceUrl, targetPath, callback) -> options = { From a093780268c995d1ac4cde8d9ef6656da62ee7a7 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 1 Aug 2016 12:15:19 -0600 Subject: [PATCH 063/221] Add comment Signed-off-by: Antonio Scandurra --- build/build.js | 1 + 1 file changed, 1 insertion(+) diff --git a/build/build.js b/build/build.js index 7761f0eb7..90f3fe816 100755 --- a/build/build.js +++ b/build/build.js @@ -2,6 +2,7 @@ 'use strict' +// Needed so we can require src/module-cache.coffee during generateModuleCache require('coffee-script/register') const cleanOutputDirectory = require('./lib/clean-output-directory') From da89626c68d25ff0f6e5e2be2c407cf6d80d1283 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 1 Aug 2016 12:46:44 -0600 Subject: [PATCH 064/221] Base app name on channel when packaging application Signed-off-by: Antonio Scandurra --- build/lib/package-application.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/build/lib/package-application.js b/build/lib/package-application.js index f14e320ec..896585b74 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -11,7 +11,9 @@ const getLicenseText = require('./get-license-text') const CONFIG = require('../config') module.exports = function () { - console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`) + const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' + + console.log(`Running electron-packager on ${CONFIG.intermediateAppPath} with app name "${appName}"`) return runPackager({ 'app-version': CONFIG.appMetadata.version, 'arch': process.arch, @@ -20,22 +22,25 @@ module.exports = function () { 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns'), + 'name': appName, 'out': CONFIG.buildOutputPath, 'osx-sign': getSignOptions(), 'overwrite': true, 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion - }).then((packagedAppPath) => { - let bundledResourcesPath + }).then((packageOutputDirPath) => { + let bundledAppPath, bundledResourcesPath if (process.platform === 'darwin') { - bundledResourcesPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Resources') + bundledAppPath = path.join(packageOutputDirPath, appName + '.app') + bundledResourcesPath = path.join(bundledAppPath, 'Contents', 'Resources') } else { throw new Error('TODO: handle this case!') } - setAtomHelperVersion(packagedAppPath) + setAtomHelperVersion(bundledAppPath) return copyNonASARResources(bundledResourcesPath).then(() => { - console.log(`Application bundle created on ${packagedAppPath}`) + console.log(`Application bundle created at ${bundledAppPath}`) + return bundledAppPath }) }) } @@ -64,9 +69,9 @@ function copyNonASARResources (bundledResourcesPath) { }) } -function setAtomHelperVersion (packagedAppPath) { +function setAtomHelperVersion (bundledAppPath) { if (process.platform === 'darwin') { - const frameworksPath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'Frameworks') + const frameworksPath = path.join(bundledAppPath, 'Contents', 'Frameworks') const helperPListPath = path.join(frameworksPath, 'Atom Helper.app', 'Contents', 'Info.plist') console.log(`Setting Atom Helper Version for ${helperPListPath}...`) childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleVersion', CONFIG.appMetadata.version, helperPListPath]) @@ -98,13 +103,13 @@ function getSignOptions () { function runPackager (options) { return new Promise((resolve, reject) => { - electronPackager(options, (err, packagedAppPaths) => { + electronPackager(options, (err, packageOutputDirPaths) => { if (err) { reject(err) throw new Error(err) } else { - assert(packagedAppPaths.length === 1, 'Generated more than one electron application!') - resolve(packagedAppPaths[0]) + assert(packageOutputDirPaths.length === 1, 'Generated more than one electron application!') + resolve(packageOutputDirPaths[0]) } }) }) From 9789109083dad0981312c1e0d0e65bb77d12f914 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 1 Aug 2016 14:11:24 -0600 Subject: [PATCH 065/221] Download and install OS X signing cert on CircleCI --- circle.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/circle.yml b/circle.yml index 215f2120c..b1969c7d7 100644 --- a/circle.yml +++ b/circle.yml @@ -7,6 +7,13 @@ machine: xcode: version: 7.3 + post: + - |- # this weird literal syntax allows a : on the next line + curl --header 'Accept: application/vnd.github.v3.raw' --output /tmp/mac.p12 $MAC_CODE_SIGNING_CERT_DOWNLOAD_URL + - security unlock-keychain -p circle circle.keychain + - security import /tmp/mac.p12 -P $MAC_CODE_SIGNING_CERT_PASSWORD -k circle.keychain -T /usr/bin/codesign + - security find-identity -p codesigning + general: artifacts: - out/atom-mac.zip From e93145d05773024a1dba056871c9992e4ac58a78 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 1 Aug 2016 14:35:12 -0600 Subject: [PATCH 066/221] :art: --- build/lib/package-application.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build/lib/package-application.js b/build/lib/package-application.js index 896585b74..99ddbf82b 100644 --- a/build/lib/package-application.js +++ b/build/lib/package-application.js @@ -29,18 +29,18 @@ module.exports = function () { 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion }).then((packageOutputDirPath) => { - let bundledAppPath, bundledResourcesPath + let packagedAppPath, bundledResourcesPath if (process.platform === 'darwin') { - bundledAppPath = path.join(packageOutputDirPath, appName + '.app') - bundledResourcesPath = path.join(bundledAppPath, 'Contents', 'Resources') + packagedAppPath = path.join(packageOutputDirPath, appName + '.app') + bundledResourcesPath = path.join(packagedAppPath, 'Contents', 'Resources') } else { throw new Error('TODO: handle this case!') } - setAtomHelperVersion(bundledAppPath) + setAtomHelperVersion(packagedAppPath) return copyNonASARResources(bundledResourcesPath).then(() => { - console.log(`Application bundle created at ${bundledAppPath}`) - return bundledAppPath + console.log(`Application bundle created at ${packagedAppPath}`) + return packagedAppPath }) }) } @@ -69,9 +69,9 @@ function copyNonASARResources (bundledResourcesPath) { }) } -function setAtomHelperVersion (bundledAppPath) { +function setAtomHelperVersion (packagedAppPath) { if (process.platform === 'darwin') { - const frameworksPath = path.join(bundledAppPath, 'Contents', 'Frameworks') + const frameworksPath = path.join(packagedAppPath, 'Contents', 'Frameworks') const helperPListPath = path.join(frameworksPath, 'Atom Helper.app', 'Contents', 'Info.plist') console.log(`Setting Atom Helper Version for ${helperPListPath}...`) childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleVersion', CONFIG.appMetadata.version, helperPListPath]) From a9664f63f8c5cd170a5e3aa3a4b6dc76e0bb65f8 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 1 Aug 2016 15:06:18 -0600 Subject: [PATCH 067/221] Perform code-signing on CircleCI --- build/build.js | 5 ++++- build/lib/code-sign.js | 23 +++++++++++++++++++++++ build/package.json | 3 ++- circle.yml | 6 +++--- 4 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 build/lib/code-sign.js diff --git a/build/build.js b/build/build.js index 90f3fe816..e51c75aa0 100755 --- a/build/build.js +++ b/build/build.js @@ -6,6 +6,7 @@ require('coffee-script/register') const cleanOutputDirectory = require('./lib/clean-output-directory') +const codeSign = require('./lib/code-sign') const copyAssets = require('./lib/copy-assets') const dumpSymbols = require('./lib/dump-symbols') const generateMetadata = require('./lib/generate-metadata') @@ -28,4 +29,6 @@ generateModuleCache() prebuildLessCache() generateMetadata() writeFingerprint() -dumpSymbols().then(packageApplication) +dumpSymbols() + .then(packageApplication) + .then(codeSign) diff --git a/build/lib/code-sign.js b/build/lib/code-sign.js new file mode 100644 index 000000000..f32eae067 --- /dev/null +++ b/build/lib/code-sign.js @@ -0,0 +1,23 @@ +const argv = require('yargs').argv +const childProcess = require('child_process') + +module.exports = function (packagedAppPath) { + if (!argv.codeSign) { + console.log('Skipping code-signing. Specify --code-sign option to perform code-signing...') + return + } + + console.log(`Unlocking keychain ${process.env.MAC_CODE_SIGNING_KEYCHAIN}`) + childProcess.spawnSync('security', [ + 'unlock-keychain', + '-p', process.env.MAC_CODE_SIGNING_KEYCHAIN_PASSWORD, + process.env.MAC_CODE_SIGNING_KEYCHAIN + ], {stdio: 'inherit'}) + + console.log(`Code-signing application at ${packagedAppPath}`) + childProcess.spawnSync('codesign', [ + '--deep', '--force', '--verbose', + '--keychain', process.env.MAC_CODE_SIGNING_KEYCHAIN, + '--sign', 'Developer ID Application: GitHub', packagedAppPath + ], {stdio: 'inherit'}) +} diff --git a/build/package.json b/build/package.json index 1b610b1e9..1655a012d 100644 --- a/build/package.json +++ b/build/package.json @@ -14,6 +14,7 @@ "mkdirp": "0.5.1", "normalize-package-data": "2.3.5", "npm": "3.10.5", - "pegjs": "0.9.0" + "pegjs": "0.9.0", + "yargs": "^4.8.1" } } diff --git a/circle.yml b/circle.yml index b1969c7d7..9c4f620c8 100644 --- a/circle.yml +++ b/circle.yml @@ -10,8 +10,8 @@ machine: post: - |- # this weird literal syntax allows a : on the next line curl --header 'Accept: application/vnd.github.v3.raw' --output /tmp/mac.p12 $MAC_CODE_SIGNING_CERT_DOWNLOAD_URL - - security unlock-keychain -p circle circle.keychain - - security import /tmp/mac.p12 -P $MAC_CODE_SIGNING_CERT_PASSWORD -k circle.keychain -T /usr/bin/codesign + - security unlock-keychain -p $MAC_CODE_SIGNING_KEYCHAIN_PASSWORD $MAC_CODE_SIGNING_KEYCHAIN + - security import /tmp/mac.p12 -P $MAC_CODE_SIGNING_CERT_PASSWORD -k $MAC_CODE_SIGNING_KEYCHAIN -T /usr/bin/codesign - security find-identity -p codesigning general: @@ -28,7 +28,7 @@ dependencies: override: - script/bootstrap - - build/build.js + - build/build.js --code-sign post: - cd out/Atom-darwin-x64 && zip -r ../atom-mac.zip ./Atom.app && cd - From 947de55fa4481b0d611ff16331a989d3e3e1fcf0 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 1 Aug 2016 16:04:05 -0600 Subject: [PATCH 068/221] :art: Clarify build environment variables related to code-signing --- build/lib/code-sign.js | 8 ++++---- circle.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build/lib/code-sign.js b/build/lib/code-sign.js index f32eae067..99dc32eb5 100644 --- a/build/lib/code-sign.js +++ b/build/lib/code-sign.js @@ -7,17 +7,17 @@ module.exports = function (packagedAppPath) { return } - console.log(`Unlocking keychain ${process.env.MAC_CODE_SIGNING_KEYCHAIN}`) + console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) childProcess.spawnSync('security', [ 'unlock-keychain', - '-p', process.env.MAC_CODE_SIGNING_KEYCHAIN_PASSWORD, - process.env.MAC_CODE_SIGNING_KEYCHAIN + '-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD, + process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN ], {stdio: 'inherit'}) console.log(`Code-signing application at ${packagedAppPath}`) childProcess.spawnSync('codesign', [ '--deep', '--force', '--verbose', - '--keychain', process.env.MAC_CODE_SIGNING_KEYCHAIN, + '--keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, '--sign', 'Developer ID Application: GitHub', packagedAppPath ], {stdio: 'inherit'}) } diff --git a/circle.yml b/circle.yml index 9c4f620c8..58bbe03cd 100644 --- a/circle.yml +++ b/circle.yml @@ -9,9 +9,9 @@ machine: post: - |- # this weird literal syntax allows a : on the next line - curl --header 'Accept: application/vnd.github.v3.raw' --output /tmp/mac.p12 $MAC_CODE_SIGNING_CERT_DOWNLOAD_URL - - security unlock-keychain -p $MAC_CODE_SIGNING_KEYCHAIN_PASSWORD $MAC_CODE_SIGNING_KEYCHAIN - - security import /tmp/mac.p12 -P $MAC_CODE_SIGNING_CERT_PASSWORD -k $MAC_CODE_SIGNING_KEYCHAIN -T /usr/bin/codesign + curl --header 'Accept: application/vnd.github.v3.raw' --output /tmp/mac.p12 $ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL + - security unlock-keychain -p $ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD $ATOM_MAC_CODE_SIGNING_KEYCHAIN + - security import /tmp/mac.p12 -P $ATOM_MAC_CODE_SIGNING_CERT_PASSWORD -k $ATOM_MAC_CODE_SIGNING_KEYCHAIN -T /usr/bin/codesign - security find-identity -p codesigning general: From a4c85673b8336b1601a530447816ffc8fe85cd4b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 09:17:28 +0200 Subject: [PATCH 069/221] Use a strict version on build/package.json --- build/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/package.json b/build/package.json index 1655a012d..6855bc29b 100644 --- a/build/package.json +++ b/build/package.json @@ -2,7 +2,7 @@ "name": "atom-build-scripts", "description": "Atom build scripts", "dependencies": { - "async": "^2.0.1", + "async": "2.0.1", "babel-core": "5.8.38", "coffee-script": "1.8.0", "colors": "1.1.2", @@ -15,6 +15,6 @@ "normalize-package-data": "2.3.5", "npm": "3.10.5", "pegjs": "0.9.0", - "yargs": "^4.8.1" + "yargs": "4.8.1" } } From 7f67966c000a2db6763373075cb8537789dfb894 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 09:19:03 +0200 Subject: [PATCH 070/221] Move using yargs up the call stack --- build/build.js | 9 ++++++++- build/lib/code-sign.js | 6 ------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/build/build.js b/build/build.js index e51c75aa0..e884d6643 100755 --- a/build/build.js +++ b/build/build.js @@ -5,6 +5,7 @@ // Needed so we can require src/module-cache.coffee during generateModuleCache require('coffee-script/register') +const argv = require('yargs').argv const cleanOutputDirectory = require('./lib/clean-output-directory') const codeSign = require('./lib/code-sign') const copyAssets = require('./lib/copy-assets') @@ -31,4 +32,10 @@ generateMetadata() writeFingerprint() dumpSymbols() .then(packageApplication) - .then(codeSign) + .then(packagedAppPath => { + if (argv.codeSign) { + codeSign(packagedAppPath) + } else { + console.log('Skipping code-signing. Specify --code-sign option to perform code-signing...') + } + }) diff --git a/build/lib/code-sign.js b/build/lib/code-sign.js index 99dc32eb5..d6fe553ea 100644 --- a/build/lib/code-sign.js +++ b/build/lib/code-sign.js @@ -1,12 +1,6 @@ -const argv = require('yargs').argv const childProcess = require('child_process') module.exports = function (packagedAppPath) { - if (!argv.codeSign) { - console.log('Skipping code-signing. Specify --code-sign option to perform code-signing...') - return - } - console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) childProcess.spawnSync('security', [ 'unlock-keychain', From 68565349c12d94c12a576a6cec40c7616d8395a5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 09:22:55 +0200 Subject: [PATCH 071/221] Move script to script-old --- {script => script-old}/bootstrap | 0 {script => script-old}/bootstrap.cmd | 0 {script => script-old}/build | 0 {script => script-old}/build.cmd | 0 {script => script-old}/cibuild | 0 {script => script-old}/cibuild-atom-linux | 0 {script => script-old}/cibuild-atom-rpm | 0 {script => script-old}/cibuild.cmd | 0 {script => script-old}/clean | 0 {script => script-old}/clean.cmd | 0 {script => script-old}/copy-folder.cmd | 0 {script => script-old}/fingerprint-clean | 0 {script => script-old}/fingerprint-write | 0 {script => script-old}/grunt | 0 {script => script-old}/grunt.cmd | 0 {script => script-old}/mkdeb | 0 {script => script-old}/mkrpm | 0 {script => script-old}/mktar | 0 {script => script-old}/railcar | 0 {script => script-old}/rpmbuild | 0 {script => script-old}/set-version | 0 {script => script-old}/test | 0 {script => script-old}/utils/child-process-wrapper.js | 0 {script => script-old}/utils/clean-merged-branches | 0 {script => script-old}/utils/clean-open-with-menu | 0 {script => script-old}/utils/compile-main-to-app | 0 {script => script-old}/utils/fingerprint.js | 0 {script => script-old}/utils/fix-author | 0 {script => script-old}/utils/run-grunt.js | 0 {script => script-old}/utils/translate-crash-log-addresses.coffee | 0 {script => script-old}/utils/verify-requirements.js | 0 31 files changed, 0 insertions(+), 0 deletions(-) rename {script => script-old}/bootstrap (100%) rename {script => script-old}/bootstrap.cmd (100%) rename {script => script-old}/build (100%) rename {script => script-old}/build.cmd (100%) rename {script => script-old}/cibuild (100%) rename {script => script-old}/cibuild-atom-linux (100%) rename {script => script-old}/cibuild-atom-rpm (100%) rename {script => script-old}/cibuild.cmd (100%) rename {script => script-old}/clean (100%) rename {script => script-old}/clean.cmd (100%) rename {script => script-old}/copy-folder.cmd (100%) rename {script => script-old}/fingerprint-clean (100%) rename {script => script-old}/fingerprint-write (100%) rename {script => script-old}/grunt (100%) rename {script => script-old}/grunt.cmd (100%) rename {script => script-old}/mkdeb (100%) rename {script => script-old}/mkrpm (100%) rename {script => script-old}/mktar (100%) rename {script => script-old}/railcar (100%) rename {script => script-old}/rpmbuild (100%) rename {script => script-old}/set-version (100%) rename {script => script-old}/test (100%) rename {script => script-old}/utils/child-process-wrapper.js (100%) rename {script => script-old}/utils/clean-merged-branches (100%) rename {script => script-old}/utils/clean-open-with-menu (100%) rename {script => script-old}/utils/compile-main-to-app (100%) rename {script => script-old}/utils/fingerprint.js (100%) rename {script => script-old}/utils/fix-author (100%) rename {script => script-old}/utils/run-grunt.js (100%) rename {script => script-old}/utils/translate-crash-log-addresses.coffee (100%) rename {script => script-old}/utils/verify-requirements.js (100%) diff --git a/script/bootstrap b/script-old/bootstrap similarity index 100% rename from script/bootstrap rename to script-old/bootstrap diff --git a/script/bootstrap.cmd b/script-old/bootstrap.cmd similarity index 100% rename from script/bootstrap.cmd rename to script-old/bootstrap.cmd diff --git a/script/build b/script-old/build similarity index 100% rename from script/build rename to script-old/build diff --git a/script/build.cmd b/script-old/build.cmd similarity index 100% rename from script/build.cmd rename to script-old/build.cmd diff --git a/script/cibuild b/script-old/cibuild similarity index 100% rename from script/cibuild rename to script-old/cibuild diff --git a/script/cibuild-atom-linux b/script-old/cibuild-atom-linux similarity index 100% rename from script/cibuild-atom-linux rename to script-old/cibuild-atom-linux diff --git a/script/cibuild-atom-rpm b/script-old/cibuild-atom-rpm similarity index 100% rename from script/cibuild-atom-rpm rename to script-old/cibuild-atom-rpm diff --git a/script/cibuild.cmd b/script-old/cibuild.cmd similarity index 100% rename from script/cibuild.cmd rename to script-old/cibuild.cmd diff --git a/script/clean b/script-old/clean similarity index 100% rename from script/clean rename to script-old/clean diff --git a/script/clean.cmd b/script-old/clean.cmd similarity index 100% rename from script/clean.cmd rename to script-old/clean.cmd diff --git a/script/copy-folder.cmd b/script-old/copy-folder.cmd similarity index 100% rename from script/copy-folder.cmd rename to script-old/copy-folder.cmd diff --git a/script/fingerprint-clean b/script-old/fingerprint-clean similarity index 100% rename from script/fingerprint-clean rename to script-old/fingerprint-clean diff --git a/script/fingerprint-write b/script-old/fingerprint-write similarity index 100% rename from script/fingerprint-write rename to script-old/fingerprint-write diff --git a/script/grunt b/script-old/grunt similarity index 100% rename from script/grunt rename to script-old/grunt diff --git a/script/grunt.cmd b/script-old/grunt.cmd similarity index 100% rename from script/grunt.cmd rename to script-old/grunt.cmd diff --git a/script/mkdeb b/script-old/mkdeb similarity index 100% rename from script/mkdeb rename to script-old/mkdeb diff --git a/script/mkrpm b/script-old/mkrpm similarity index 100% rename from script/mkrpm rename to script-old/mkrpm diff --git a/script/mktar b/script-old/mktar similarity index 100% rename from script/mktar rename to script-old/mktar diff --git a/script/railcar b/script-old/railcar similarity index 100% rename from script/railcar rename to script-old/railcar diff --git a/script/rpmbuild b/script-old/rpmbuild similarity index 100% rename from script/rpmbuild rename to script-old/rpmbuild diff --git a/script/set-version b/script-old/set-version similarity index 100% rename from script/set-version rename to script-old/set-version diff --git a/script/test b/script-old/test similarity index 100% rename from script/test rename to script-old/test diff --git a/script/utils/child-process-wrapper.js b/script-old/utils/child-process-wrapper.js similarity index 100% rename from script/utils/child-process-wrapper.js rename to script-old/utils/child-process-wrapper.js diff --git a/script/utils/clean-merged-branches b/script-old/utils/clean-merged-branches similarity index 100% rename from script/utils/clean-merged-branches rename to script-old/utils/clean-merged-branches diff --git a/script/utils/clean-open-with-menu b/script-old/utils/clean-open-with-menu similarity index 100% rename from script/utils/clean-open-with-menu rename to script-old/utils/clean-open-with-menu diff --git a/script/utils/compile-main-to-app b/script-old/utils/compile-main-to-app similarity index 100% rename from script/utils/compile-main-to-app rename to script-old/utils/compile-main-to-app diff --git a/script/utils/fingerprint.js b/script-old/utils/fingerprint.js similarity index 100% rename from script/utils/fingerprint.js rename to script-old/utils/fingerprint.js diff --git a/script/utils/fix-author b/script-old/utils/fix-author similarity index 100% rename from script/utils/fix-author rename to script-old/utils/fix-author diff --git a/script/utils/run-grunt.js b/script-old/utils/run-grunt.js similarity index 100% rename from script/utils/run-grunt.js rename to script-old/utils/run-grunt.js diff --git a/script/utils/translate-crash-log-addresses.coffee b/script-old/utils/translate-crash-log-addresses.coffee similarity index 100% rename from script/utils/translate-crash-log-addresses.coffee rename to script-old/utils/translate-crash-log-addresses.coffee diff --git a/script/utils/verify-requirements.js b/script-old/utils/verify-requirements.js similarity index 100% rename from script/utils/verify-requirements.js rename to script-old/utils/verify-requirements.js From aa63162aed5c1097e53b1aa5d31bd507e6557a87 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 09:24:02 +0200 Subject: [PATCH 072/221] Move build to script --- {build => script}/build.js | 0 {build => script}/config.js | 0 {build => script}/deprecated-packages.json | 0 {build => script}/lib/clean-output-directory.js | 0 {build => script}/lib/code-sign.js | 0 {build => script}/lib/copy-assets.js | 0 {build => script}/lib/dump-symbols.js | 0 {build => script}/lib/fingerprint.js | 0 {build => script}/lib/generate-metadata.js | 0 {build => script}/lib/generate-module-cache.js | 0 {build => script}/lib/get-license-text.js | 0 {build => script}/lib/include-path-in-packaged-app.js | 0 {build => script}/lib/package-application.js | 0 {build => script}/lib/prebuild-less-cache.js | 0 {build => script}/lib/transpile-babel-paths.js | 0 {build => script}/lib/transpile-coffee-script-paths.js | 0 {build => script}/lib/transpile-cson-paths.js | 0 {build => script}/lib/transpile-peg-js-paths.js | 0 {build => script}/license-overrides.js | 0 {build => script}/package.json | 0 {build => script}/test.js | 0 21 files changed, 0 insertions(+), 0 deletions(-) rename {build => script}/build.js (100%) rename {build => script}/config.js (100%) rename {build => script}/deprecated-packages.json (100%) rename {build => script}/lib/clean-output-directory.js (100%) rename {build => script}/lib/code-sign.js (100%) rename {build => script}/lib/copy-assets.js (100%) rename {build => script}/lib/dump-symbols.js (100%) rename {build => script}/lib/fingerprint.js (100%) rename {build => script}/lib/generate-metadata.js (100%) rename {build => script}/lib/generate-module-cache.js (100%) rename {build => script}/lib/get-license-text.js (100%) rename {build => script}/lib/include-path-in-packaged-app.js (100%) rename {build => script}/lib/package-application.js (100%) rename {build => script}/lib/prebuild-less-cache.js (100%) rename {build => script}/lib/transpile-babel-paths.js (100%) rename {build => script}/lib/transpile-coffee-script-paths.js (100%) rename {build => script}/lib/transpile-cson-paths.js (100%) rename {build => script}/lib/transpile-peg-js-paths.js (100%) rename {build => script}/license-overrides.js (100%) rename {build => script}/package.json (100%) rename {build => script}/test.js (100%) diff --git a/build/build.js b/script/build.js similarity index 100% rename from build/build.js rename to script/build.js diff --git a/build/config.js b/script/config.js similarity index 100% rename from build/config.js rename to script/config.js diff --git a/build/deprecated-packages.json b/script/deprecated-packages.json similarity index 100% rename from build/deprecated-packages.json rename to script/deprecated-packages.json diff --git a/build/lib/clean-output-directory.js b/script/lib/clean-output-directory.js similarity index 100% rename from build/lib/clean-output-directory.js rename to script/lib/clean-output-directory.js diff --git a/build/lib/code-sign.js b/script/lib/code-sign.js similarity index 100% rename from build/lib/code-sign.js rename to script/lib/code-sign.js diff --git a/build/lib/copy-assets.js b/script/lib/copy-assets.js similarity index 100% rename from build/lib/copy-assets.js rename to script/lib/copy-assets.js diff --git a/build/lib/dump-symbols.js b/script/lib/dump-symbols.js similarity index 100% rename from build/lib/dump-symbols.js rename to script/lib/dump-symbols.js diff --git a/build/lib/fingerprint.js b/script/lib/fingerprint.js similarity index 100% rename from build/lib/fingerprint.js rename to script/lib/fingerprint.js diff --git a/build/lib/generate-metadata.js b/script/lib/generate-metadata.js similarity index 100% rename from build/lib/generate-metadata.js rename to script/lib/generate-metadata.js diff --git a/build/lib/generate-module-cache.js b/script/lib/generate-module-cache.js similarity index 100% rename from build/lib/generate-module-cache.js rename to script/lib/generate-module-cache.js diff --git a/build/lib/get-license-text.js b/script/lib/get-license-text.js similarity index 100% rename from build/lib/get-license-text.js rename to script/lib/get-license-text.js diff --git a/build/lib/include-path-in-packaged-app.js b/script/lib/include-path-in-packaged-app.js similarity index 100% rename from build/lib/include-path-in-packaged-app.js rename to script/lib/include-path-in-packaged-app.js diff --git a/build/lib/package-application.js b/script/lib/package-application.js similarity index 100% rename from build/lib/package-application.js rename to script/lib/package-application.js diff --git a/build/lib/prebuild-less-cache.js b/script/lib/prebuild-less-cache.js similarity index 100% rename from build/lib/prebuild-less-cache.js rename to script/lib/prebuild-less-cache.js diff --git a/build/lib/transpile-babel-paths.js b/script/lib/transpile-babel-paths.js similarity index 100% rename from build/lib/transpile-babel-paths.js rename to script/lib/transpile-babel-paths.js diff --git a/build/lib/transpile-coffee-script-paths.js b/script/lib/transpile-coffee-script-paths.js similarity index 100% rename from build/lib/transpile-coffee-script-paths.js rename to script/lib/transpile-coffee-script-paths.js diff --git a/build/lib/transpile-cson-paths.js b/script/lib/transpile-cson-paths.js similarity index 100% rename from build/lib/transpile-cson-paths.js rename to script/lib/transpile-cson-paths.js diff --git a/build/lib/transpile-peg-js-paths.js b/script/lib/transpile-peg-js-paths.js similarity index 100% rename from build/lib/transpile-peg-js-paths.js rename to script/lib/transpile-peg-js-paths.js diff --git a/build/license-overrides.js b/script/license-overrides.js similarity index 100% rename from build/license-overrides.js rename to script/license-overrides.js diff --git a/build/package.json b/script/package.json similarity index 100% rename from build/package.json rename to script/package.json diff --git a/build/test.js b/script/test.js similarity index 100% rename from build/test.js rename to script/test.js From 4a3a430ad7bee99e56d0c4f66ba2f11c2c8d00aa Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 12:50:35 +0200 Subject: [PATCH 073/221] Add semver to script/package.json --- script/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/script/package.json b/script/package.json index 6855bc29b..212ce8467 100644 --- a/script/package.json +++ b/script/package.json @@ -15,6 +15,7 @@ "normalize-package-data": "2.3.5", "npm": "3.10.5", "pegjs": "0.9.0", + "semver": "5.3.0", "yargs": "4.8.1" } } From 9def97fe9c070651cd8e48261181344cdbf0940f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 12:58:25 +0200 Subject: [PATCH 074/221] Remove .npmrc files --- .npmrc | 3 --- apm/.npmrc | 1 - 2 files changed, 4 deletions(-) delete mode 100644 .npmrc delete mode 100644 apm/.npmrc diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 9fa375bb0..000000000 --- a/.npmrc +++ /dev/null @@ -1,3 +0,0 @@ -cache = ~/.atom/.npm -runtime = electron -disturl = https://atom.io/download/atom-shell diff --git a/apm/.npmrc b/apm/.npmrc deleted file mode 100644 index c5ff09782..000000000 --- a/apm/.npmrc +++ /dev/null @@ -1 +0,0 @@ -cache = ~/.atom/.npm From cf85bd032da36c5c3479fd5272248394c235220a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 14:04:45 +0200 Subject: [PATCH 075/221] Reimplement script/bootstrap --- .travis.yml | 6 +- appveyor.yml | 4 +- circle.yml | 8 +-- script/bootstrap.cmd | 6 ++ script/bootstrap.js | 15 +++++ script/build.cmd | 5 ++ script/config.js | 31 ++++++++--- script/lib/fingerprint.js | 2 +- script/lib/install-apm.js | 15 +++++ script/lib/install-atom-dependencies.js | 22 ++++++++ script/lib/install-script-dependencies.js | 15 +++++ script/lib/verify-machine-requirements.js | 67 +++++++++++++++++++++++ 12 files changed, 179 insertions(+), 17 deletions(-) create mode 100644 script/bootstrap.cmd create mode 100755 script/bootstrap.js create mode 100644 script/build.cmd create mode 100644 script/lib/install-apm.js create mode 100644 script/lib/install-atom-dependencies.js create mode 100644 script/lib/install-script-dependencies.js create mode 100644 script/lib/verify-machine-requirements.js diff --git a/.travis.yml b/.travis.yml index 5796e9c87..61d3a713d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,8 @@ install: - source /tmp/.nvm/nvm.sh - nvm install $NODE_VERSION - nvm use --delete-prefix $NODE_VERSION - - script/bootstrap - - node build/build.js + - script/bootstrap.js + - script/build.js script: - echo 'Run tests at some point.' @@ -34,7 +34,7 @@ cache: - cache - node_modules - apm/node_modules - - build/node_modules + - script/node_modules notifications: email: diff --git a/appveyor.yml b/appveyor.yml index 0917740af..aebde2fa3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,7 +24,7 @@ install: build_script: - cd %APPVEYOR_BUILD_FOLDER% - script\bootstrap.cmd - - node build\build.js + - script\build.cmd test: off deploy: off @@ -35,7 +35,7 @@ artifacts: name: AtomSetup.msi cache: - - '%APPVEYOR_BUILD_FOLDER%\build\node_modules' + - '%APPVEYOR_BUILD_FOLDER%\script\node_modules' - '%APPVEYOR_BUILD_FOLDER%\apm\node_modules' - '%APPVEYOR_BUILD_FOLDER%\node_modules' - '%APPVEYOR_BUILD_FOLDER%\cache' diff --git a/circle.yml b/circle.yml index 58bbe03cd..d84120947 100644 --- a/circle.yml +++ b/circle.yml @@ -27,8 +27,8 @@ dependencies: - npm install -g npm override: - - script/bootstrap - - build/build.js --code-sign + - script/bootstrap.js + - script/build.js --code-sign post: - cd out/Atom-darwin-x64 && zip -r ../atom-mac.zip ./Atom.app && cd - @@ -37,9 +37,9 @@ dependencies: cache_directories: - cache - apm/node_modules - - build/node_modules + - script/node_modules - node_modules test: override: - - build/test.js + - script/test.js diff --git a/script/bootstrap.cmd b/script/bootstrap.cmd new file mode 100644 index 000000000..c9cf66238 --- /dev/null +++ b/script/bootstrap.cmd @@ -0,0 +1,6 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\bootstrap" %* +) ELSE ( + node "%~dp0\bootstrap" %* +) + diff --git a/script/bootstrap.js b/script/bootstrap.js new file mode 100755 index 000000000..fe9e8986c --- /dev/null +++ b/script/bootstrap.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node + +'use strict' + +const path = require('path') + +const installApm = require('./lib/install-apm') +const installAtomDependencies = require('./lib/install-atom-dependencies') +const installScriptDependencies = require('./lib/install-script-dependencies') +const verifyMachineRequirements = require('./lib/verify-machine-requirements') + +verifyMachineRequirements() +installScriptDependencies() +installApm() +installAtomDependencies() diff --git a/script/build.cmd b/script/build.cmd new file mode 100644 index 000000000..8b12f7a47 --- /dev/null +++ b/script/build.cmd @@ -0,0 +1,5 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\build" %* +) ELSE ( + node "%~dp0\build" %* +) diff --git a/script/config.js b/script/config.js index 81064309a..d68b87307 100644 --- a/script/config.js +++ b/script/config.js @@ -3,24 +3,30 @@ 'use strict' +const fs = require('fs') const path = require('path') -const appMetadata = require('../package.json') -const apmMetadata = require('../apm/node_modules/atom-package-manager/package.json') - -const channel = getChannel() - const repositoryRootPath = path.resolve(__dirname, '..') +const apmRootPath = path.join(repositoryRootPath, 'apm') +const scriptRootPath = path.join(repositoryRootPath, 'script') const buildOutputPath = path.join(repositoryRootPath, 'out') const intermediateAppPath = path.join(buildOutputPath, 'app') const symbolsPath = path.join(buildOutputPath, 'symbols') const cachePath = path.join(repositoryRootPath, 'cache') const homeDirPath = process.env.HOME || process.env.USERPROFILE +const appMetadata = require(path.join(repositoryRootPath, 'package.json')) +const apmMetadata = require(path.join(apmRootPath, 'package.json')) +const channel = getChannel() + +const apmBinPath = getApmBinPath() +const npmBinPath = getNpmBinPath() + module.exports = { appMetadata, apmMetadata, channel, - repositoryRootPath, buildOutputPath, intermediateAppPath, symbolsPath, - cachePath, homeDirPath + repositoryRootPath, apmRootPath, scriptRootPath, buildOutputPath, intermediateAppPath, symbolsPath, + cachePath, homeDirPath, + apmBinPath, npmBinPath } function getChannel () { @@ -40,3 +46,14 @@ function isBuildingPR () { process.env.CI_PULL_REQUEST ) } + +function getApmBinPath () { + const apmBinName = process.platform === 'win32' ? 'apm.cmd' : 'apm' + return path.join(apmRootPath, 'node_modules', '.bin', apmBinName) +} + +function getNpmBinPath () { + const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm' + const localNpmBinPath = path.resolve(repositoryRootPath, 'script', 'node_modules', '.bin', npmBinName) + return fs.existsSync(localNpmBinPath) ? localNpmBinPath : npmBinName +} diff --git a/script/lib/fingerprint.js b/script/lib/fingerprint.js index 182eab8ed..b9848ff5f 100644 --- a/script/lib/fingerprint.js +++ b/script/lib/fingerprint.js @@ -19,7 +19,7 @@ exports.fingerprintMatches = function () { function computeFingerprint () { //Include the electron minor version in the fingerprint since that changing requires a re-install const electronVersion = CONFIG.appMetadata.electronVersion.replace(/\.\d+$/, '') - const apmVersion = CONFIG.apmMetadata.version + const apmVersion = CONFIG.apmMetadata.dependencies['atom-package-manager'] const body = electronVersion + apmVersion + process.platform + process.version return crypto.createHash('sha1').update(body).digest('hex') diff --git a/script/lib/install-apm.js b/script/lib/install-apm.js new file mode 100644 index 000000000..a4478f8e3 --- /dev/null +++ b/script/lib/install-apm.js @@ -0,0 +1,15 @@ +'use strict' + +const childProcess = require('child_process') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + console.log('Installing apm...') + childProcess.execFileSync( + CONFIG.npmBinPath, + ['--global-style', '--loglevel=error', 'install'], + {env: process.env, cwd: CONFIG.apmRootPath} + ) +} diff --git a/script/lib/install-atom-dependencies.js b/script/lib/install-atom-dependencies.js new file mode 100644 index 000000000..f6b578c4e --- /dev/null +++ b/script/lib/install-atom-dependencies.js @@ -0,0 +1,22 @@ +'use strict' + +const childProcess = require('child_process') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + const installEnv = Object.assign({}, process.env) + // Set our target (Electron) version so that node-pre-gyp can download the + // proper binaries. + installEnv.npm_config_target = CONFIG.appMetadata.electronVersion; + // Force 32-bit modules on Windows. (Ref.: https://github.com/atom/atom/issues/10450) + if (process.platform === 'win32') { + installEnv.npm_config_target_arch = 'ia32' + } + childProcess.execFileSync( + CONFIG.apmBinPath, + ['--loglevel=error', 'install'], + {env: installEnv, cwd: CONFIG.repositoryRootPath, stdio: 'inherit'} + ) +} diff --git a/script/lib/install-script-dependencies.js b/script/lib/install-script-dependencies.js new file mode 100644 index 000000000..461adfff6 --- /dev/null +++ b/script/lib/install-script-dependencies.js @@ -0,0 +1,15 @@ +'use strict' + +const childProcess = require('child_process') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + console.log('Installing script dependencies...') + childProcess.execFileSync( + CONFIG.npmBinPath, + ['--loglevel=error', 'install'], + {env: process.env, cwd: CONFIG.scriptRootPath} + ) +} diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js new file mode 100644 index 000000000..ad34cee97 --- /dev/null +++ b/script/lib/verify-machine-requirements.js @@ -0,0 +1,67 @@ +'use strict' + +const childProcess = require('child_process') +const fs = require('fs') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + verifyNode() + verifyNpm() + if (process.platform === 'win32') { + verifyPython() + } +} + +function verifyNode () { + const fullVersion = process.versions.node + const majorVersion = fullVersion.split('.')[0] + if (majorVersion >= 4) { + console.log(`Node:\tv${fullVersion}`) + } else { + throw new Error(`node v4+ is required to build Atom. node v${fullVersion} is installed.`) + } +} + +function verifyNpm () { + const stdout = childProcess.execFileSync(CONFIG.npmBinPath, ['--version'], {env: process.env}) + const fullVersion = stdout.toString().trim() + const majorVersion = fullVersion.split('.')[0] + if (majorVersion >= 3) { + console.log(`Npm:\tv${fullVersion}`) + } else { + throw new Error(`npm v3+ is required to build Atom. npm v${fullVersion} was detected.`) + } +} + +function verifyPython () { + const systemDrive = process.env.SystemDrive || 'C:\\' + let pythonExecutable + if (process.env.PYTHON) { + pythonExecutable = process.env.PYTHON + } else { + const pythonBinPath = path.join(systemDrive, 'Python27', 'python.exe') + if (fs.existsSync(pythonBinPath)) { + pythonExecutable = pythonBinPath + } else { + pythonExecutable = 'python' + } + } + + const stdout = childProcess.execFileSync(pythonExecutable, ['-c', 'import platform\nprint(platform.python_version())'], {env: process.env}) + if (stdout.indexOf('+') !== -1) stdout = stdout.replace(/\+/g, '') + if (stdout.indexOf('rc') !== -1) stdout = stdout.replace(/rc(.*)$/ig, '') + const fullVersion = stdout.toString().trim() + const versionComponents = fullVersion.split('.') + const majorVersion = Number(versionComponents[0]) + const minorVersion = Number(versionComponents[1]) + if (majorVersion === 2 && minorVersion === 7) { + console.log(`Python:\tv${fullVersion}`) + } else { + throw new Error( + `Python 2.7 is required to build Atom. ${pythonExecutable} returns version ${fullVersion}.\n` + + `Set the PYTHON env var to '/path/to/Python27/python.exe' if your python is installed in a non-default location.` + ) + } +} From 0b6b632af315bf34aeb77277b55275aa41ff50da Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 14:35:58 +0200 Subject: [PATCH 076/221] Move fingerprinting into script/bootstrap.js --- script/bootstrap.js | 9 +++++++ script/build.js | 2 -- script/lib/clean-dependencies.js | 22 +++++++++++++++++ script/lib/dependencies-fingerprint.js | 28 +++++++++++++++++++++ script/lib/fingerprint.js | 34 -------------------------- 5 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 script/lib/clean-dependencies.js create mode 100644 script/lib/dependencies-fingerprint.js delete mode 100644 script/lib/fingerprint.js diff --git a/script/bootstrap.js b/script/bootstrap.js index fe9e8986c..38d7f03ce 100755 --- a/script/bootstrap.js +++ b/script/bootstrap.js @@ -4,12 +4,21 @@ const path = require('path') +const cleanDependencies = require('./lib/clean-dependencies') +const dependenciesFingerprint = require('./lib/dependencies-fingerprint') const installApm = require('./lib/install-apm') const installAtomDependencies = require('./lib/install-atom-dependencies') const installScriptDependencies = require('./lib/install-script-dependencies') const verifyMachineRequirements = require('./lib/verify-machine-requirements') verifyMachineRequirements() + +if (dependenciesFingerprint.isOutdated()) { + cleanDependencies() +} + installScriptDependencies() installApm() installAtomDependencies() + +dependenciesFingerprint.write() diff --git a/script/build.js b/script/build.js index e884d6643..d6cb9c687 100755 --- a/script/build.js +++ b/script/build.js @@ -18,7 +18,6 @@ const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') const transpileCsonPaths = require('./lib/transpile-cson-paths') const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') -const writeFingerprint = require('./lib/fingerprint').writeFingerprint cleanOutputDirectory() copyAssets() @@ -29,7 +28,6 @@ transpilePegJsPaths() generateModuleCache() prebuildLessCache() generateMetadata() -writeFingerprint() dumpSymbols() .then(packageApplication) .then(packagedAppPath => { diff --git a/script/lib/clean-dependencies.js b/script/lib/clean-dependencies.js new file mode 100644 index 000000000..c35afbce3 --- /dev/null +++ b/script/lib/clean-dependencies.js @@ -0,0 +1,22 @@ +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + // We can't require fs-extra if `script/bootstrap` has never been run, because + // it's a third party module. This is okay because cleaning dependencies only + // makes sense if dependencies have been installed at least once. + const fs = require('fs-extra') + + const apmDependenciesPath = path.join(CONFIG.apmRootPath, 'node_modules') + console.log(`Cleaning ${apmDependenciesPath}...`); + fs.removeSync(apmDependenciesPath) + + const atomDependenciesPath = path.join(CONFIG.repositoryRootPath, 'node_modules') + console.log(`Cleaning ${atomDependenciesPath}...`); + fs.removeSync(atomDependenciesPath) + + const scriptDependenciesPath = path.join(CONFIG.scriptRootPath, 'node_modules') + console.log(`Cleaning ${scriptDependenciesPath}...`); + fs.removeSync(scriptDependenciesPath) +} diff --git a/script/lib/dependencies-fingerprint.js b/script/lib/dependencies-fingerprint.js new file mode 100644 index 000000000..650efd99b --- /dev/null +++ b/script/lib/dependencies-fingerprint.js @@ -0,0 +1,28 @@ +const crypto = require('crypto') +const fs = require('fs') +const path = require('path') + +const CONFIG = require('../config') +const FINGERPRINT_PATH = path.join(CONFIG.repositoryRootPath, 'node_modules', '.dependencies-fingerprint') + +module.exports = { + write: function () { + const fingerprint = this.compute() + fs.writeFileSync(FINGERPRINT_PATH, fingerprint) + console.log('Wrote Dependencies Fingerprint:', FINGERPRINT_PATH, fingerprint) + }, + read: function () { + return fs.existsSync(FINGERPRINT_PATH) ? fs.readFileSync(FINGERPRINT_PATH, 'utf8') : null + }, + isOutdated: function () { + const fingerprint = this.read() + return fingerprint ? fingerprint !== this.compute() : false + }, + compute: function () { + // Include the electron minor version in the fingerprint since that changing requires a re-install + const electronVersion = CONFIG.appMetadata.electronVersion.replace(/\.\d+$/, '') + const apmVersion = CONFIG.apmMetadata.dependencies['atom-package-manager'] + const body = electronVersion + apmVersion + process.platform + process.version + return crypto.createHash('sha1').update(body).digest('hex') + } +} diff --git a/script/lib/fingerprint.js b/script/lib/fingerprint.js deleted file mode 100644 index b9848ff5f..000000000 --- a/script/lib/fingerprint.js +++ /dev/null @@ -1,34 +0,0 @@ -const crypto = require('crypto') -const fs = require('fs') -const path = require('path') - -const CONFIG = require('../config') -const FINGERPRINT_PATH = path.join(CONFIG.repositoryRootPath, 'node_modules', '.atom-ci-fingerprint') - -exports.writeFingerprint = function () { - const fingerprint = computeFingerprint() - fs.writeFileSync(FINGERPRINT_PATH, fingerprint) - console.log('Wrote CI fingerprint:', FINGERPRINT_PATH, fingerprint) -}, - -exports.fingerprintMatches = function () { - const oldFingerprint = readFingerprint() - return oldFingerprint && oldFingerprint === computeFingerprint() -} - -function computeFingerprint () { - //Include the electron minor version in the fingerprint since that changing requires a re-install - const electronVersion = CONFIG.appMetadata.electronVersion.replace(/\.\d+$/, '') - const apmVersion = CONFIG.apmMetadata.dependencies['atom-package-manager'] - - const body = electronVersion + apmVersion + process.platform + process.version - return crypto.createHash('sha1').update(body).digest('hex') -} - -function readFingerprint () { - if (fs.existsSync(FINGERPRINT_PATH)) { - return fs.readFileSync(FINGERPRINT_PATH, 'utf8') - } else { - return null - } -} From 354f0d8fa8aa68858c90715c80ed3a8c0ccf6e25 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 14:37:18 +0200 Subject: [PATCH 077/221] Remove .js from scripts --- .travis.yml | 4 ++-- circle.yml | 6 +++--- script/{bootstrap.js => bootstrap} | 0 script/{build.js => build} | 0 script/{test.js => test} | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename script/{bootstrap.js => bootstrap} (100%) rename script/{build.js => build} (100%) rename script/{test.js => test} (100%) diff --git a/.travis.yml b/.travis.yml index 61d3a713d..0a8e422c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,8 @@ install: - source /tmp/.nvm/nvm.sh - nvm install $NODE_VERSION - nvm use --delete-prefix $NODE_VERSION - - script/bootstrap.js - - script/build.js + - script/bootstrap + - script/build script: - echo 'Run tests at some point.' diff --git a/circle.yml b/circle.yml index d84120947..b5de155a3 100644 --- a/circle.yml +++ b/circle.yml @@ -27,8 +27,8 @@ dependencies: - npm install -g npm override: - - script/bootstrap.js - - script/build.js --code-sign + - script/bootstrap + - script/build --code-sign post: - cd out/Atom-darwin-x64 && zip -r ../atom-mac.zip ./Atom.app && cd - @@ -42,4 +42,4 @@ dependencies: test: override: - - script/test.js + - script/test diff --git a/script/bootstrap.js b/script/bootstrap similarity index 100% rename from script/bootstrap.js rename to script/bootstrap diff --git a/script/build.js b/script/build similarity index 100% rename from script/build.js rename to script/build diff --git a/script/test.js b/script/test similarity index 100% rename from script/test.js rename to script/test From 17ec08067bcc189c83ba1ab3f961abc2e8525c39 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 14:43:46 +0200 Subject: [PATCH 078/221] Update npm before building on AppVeyor/Travis --- .travis.yml | 1 + appveyor.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0a8e422c6..6f1db0c3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ install: - source /tmp/.nvm/nvm.sh - nvm install $NODE_VERSION - nvm use --delete-prefix $NODE_VERSION + - npm install -g npm - script/bootstrap - script/build diff --git a/appveyor.yml b/appveyor.yml index aebde2fa3..7eef770b1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,6 +20,7 @@ environment: install: - SET PATH=C:\Program Files\Atom\resources\cli;%PATH% - ps: Install-Product node $env:NODE_VERSION $env:PLATFORM + - npm install -g npm build_script: - cd %APPVEYOR_BUILD_FOLDER% From 5ff7af84b650d2486cacd3bf6dfc1d728bd753d6 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 14:46:03 +0200 Subject: [PATCH 079/221] Set ATOM_RESOURCE_PATH in install-atom-dependencies.js --- script/lib/install-atom-dependencies.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/lib/install-atom-dependencies.js b/script/lib/install-atom-dependencies.js index f6b578c4e..ca2020585 100644 --- a/script/lib/install-atom-dependencies.js +++ b/script/lib/install-atom-dependencies.js @@ -7,6 +7,8 @@ const CONFIG = require('../config') module.exports = function () { const installEnv = Object.assign({}, process.env) + // Set resource path so that apm can load metadata related to Atom. + installEnv.ATOM_RESOURCE_PATH = CONFIG.repositoryRootPath // Set our target (Electron) version so that node-pre-gyp can download the // proper binaries. installEnv.npm_config_target = CONFIG.appMetadata.electronVersion; From 748e61c88f4e688ec139dfe6d9e984f17fdbfcb0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 14:55:34 +0200 Subject: [PATCH 080/221] Fix apm bin path on AppVeyor --- script/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/config.js b/script/config.js index d68b87307..167c7c150 100644 --- a/script/config.js +++ b/script/config.js @@ -49,7 +49,7 @@ function isBuildingPR () { function getApmBinPath () { const apmBinName = process.platform === 'win32' ? 'apm.cmd' : 'apm' - return path.join(apmRootPath, 'node_modules', '.bin', apmBinName) + return path.join(apmRootPath, 'node_modules', 'atom-package-manager', 'bin', apmBinName) } function getNpmBinPath () { From c4e06d941199f4145fb426fc9c89dd183c2abda0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 15:30:35 +0200 Subject: [PATCH 081/221] :art: --- script/lib/clean-output-directory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/clean-output-directory.js b/script/lib/clean-output-directory.js index 56613ed50..9165b0e9f 100644 --- a/script/lib/clean-output-directory.js +++ b/script/lib/clean-output-directory.js @@ -4,7 +4,7 @@ const CONFIG = require('../config') module.exports = function () { if (fs.existsSync(CONFIG.buildOutputPath)) { - console.log(`Cleaning ${CONFIG.buildOutputPath}...`); + console.log(`Cleaning ${CONFIG.buildOutputPath}...`) fs.removeSync(CONFIG.buildOutputPath) } } From e825d8d391aec44058cc5fe3a43443eba01ddffe Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 15:31:05 +0200 Subject: [PATCH 082/221] Add script/clean --- script/clean | 13 +++++++++++ script/lib/clean-caches.js | 27 +++++++++++++++++++++++ script/lib/kill-running-atom-instances.js | 12 ++++++++++ 3 files changed, 52 insertions(+) create mode 100755 script/clean create mode 100644 script/lib/clean-caches.js create mode 100644 script/lib/kill-running-atom-instances.js diff --git a/script/clean b/script/clean new file mode 100755 index 000000000..0e0f90c91 --- /dev/null +++ b/script/clean @@ -0,0 +1,13 @@ +#!/usr/bin/env node + +'use strict' + +const cleanCaches = require('./lib/clean-caches') +const cleanDependencies = require('./lib/clean-dependencies') +const cleanOutputDirectory = require('./lib/clean-output-directory') +const killRunningAtomInstances = require('./lib/kill-running-atom-instances') + +killRunningAtomInstances() +cleanDependencies() +cleanCaches() +cleanOutputDirectory() diff --git a/script/lib/clean-caches.js b/script/lib/clean-caches.js new file mode 100644 index 000000000..7d941e426 --- /dev/null +++ b/script/lib/clean-caches.js @@ -0,0 +1,27 @@ +'use strict' + +const fs = require('fs-extra') +const os = require('os') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + const cachePaths = [ + path.join(CONFIG.repositoryRootPath, 'cache'), + path.join(CONFIG.homeDirPath, '.atom', '.node-gyp'), + path.join(CONFIG.homeDirPath, '.atom', 'storage'), + path.join(CONFIG.homeDirPath, '.atom', '.apm'), + path.join(CONFIG.homeDirPath, '.atom', '.npm'), + path.join(CONFIG.homeDirPath, '.atom', 'compile-cache'), + path.join(CONFIG.homeDirPath, '.atom', 'atom-shell'), + path.join(CONFIG.homeDirPath, '.atom', 'electron'), + path.join(os.tmpdir(), 'atom-build'), + path.join(os.tmpdir(), 'atom-cached-atom-shells') + ] + + for (let path of cachePaths) { + console.log(`Cleaning ${path}...`) + fs.removeSync(path) + } +} diff --git a/script/lib/kill-running-atom-instances.js b/script/lib/kill-running-atom-instances.js new file mode 100644 index 000000000..616ca6060 --- /dev/null +++ b/script/lib/kill-running-atom-instances.js @@ -0,0 +1,12 @@ +const childProcess = require('child_process') + +const CONFIG = require('../config.js') + +module.exports = function () { + if (process.platform === 'win32') { + // Use START as a way to ignore error if Atom.exe isnt running + childProcess.execSync(`START taskkill /F /IM ${CONFIG.appMetadata.productName}.exe`) + } else { + childProcess.execSync(`pkill -9 ${CONFIG.appMetadata.productName} || true`) + } +} From b1dabc1e848c1ecf6e188befb81e19e54dfd24ab Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 Aug 2016 15:55:53 +0200 Subject: [PATCH 083/221] Load metadata._deprecatedPackages via `script/deprecated-packages.json` --- static/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.js b/static/index.js index 7f59fad71..893b50ffe 100644 --- a/static/index.js +++ b/static/index.js @@ -99,7 +99,7 @@ var metadata = require('../package.json') if (!metadata._deprecatedPackages) { try { - metadata._deprecatedPackages = require('../build/deprecated-packages.json') + metadata._deprecatedPackages = require('../script/deprecated-packages.json') } catch (requireError) { console.error('Failed to setup deprecated packages list', requireError.stack) } From e5cafc77cd5eefc8f431accdbb9434f98ab37ae9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 3 Aug 2016 14:36:51 +0200 Subject: [PATCH 084/221] Start on Linux support --- script/lib/package-application.js | 32 ++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 99ddbf82b..19803ebad 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -21,7 +21,7 @@ module.exports = function () { 'build-version': CONFIG.appMetadata.version, 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, - 'icon': path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns'), + 'icon': getIcon(), 'name': appName, 'out': CONFIG.buildOutputPath, 'osx-sign': getSignOptions(), @@ -33,11 +33,14 @@ module.exports = function () { if (process.platform === 'darwin') { packagedAppPath = path.join(packageOutputDirPath, appName + '.app') bundledResourcesPath = path.join(packagedAppPath, 'Contents', 'Resources') + setAtomHelperVersion(packagedAppPath) + } else if (process.platform === 'linux') { + packagedAppPath = packageOutputDirPath + bundledResourcesPath = path.join(packagedAppPath, 'resources') } else { throw new Error('TODO: handle this case!') } - setAtomHelperVersion(packagedAppPath) return copyNonASARResources(bundledResourcesPath).then(() => { console.log(`Application bundle created at ${packagedAppPath}`) return packagedAppPath @@ -70,13 +73,11 @@ function copyNonASARResources (bundledResourcesPath) { } function setAtomHelperVersion (packagedAppPath) { - if (process.platform === 'darwin') { - const frameworksPath = path.join(packagedAppPath, 'Contents', 'Frameworks') - const helperPListPath = path.join(frameworksPath, 'Atom Helper.app', 'Contents', 'Info.plist') - console.log(`Setting Atom Helper Version for ${helperPListPath}...`) - childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleVersion', CONFIG.appMetadata.version, helperPListPath]) - childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleShortVersionString', CONFIG.appMetadata.version, helperPListPath]) - } + const frameworksPath = path.join(packagedAppPath, 'Contents', 'Frameworks') + const helperPListPath = path.join(frameworksPath, 'Atom Helper.app', 'Contents', 'Info.plist') + console.log(`Setting Atom Helper Version for ${helperPListPath}...`) + childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleVersion', CONFIG.appMetadata.version, helperPListPath]) + childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleShortVersionString', CONFIG.appMetadata.version, helperPListPath]) } function buildAsarUnpackGlobExpression () { @@ -101,6 +102,19 @@ function getSignOptions () { } } +function getIcon () { + switch (process.platform) { + case 'darwin': + return path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.icns') + case 'linux': + // Don't pass an icon, as the dock/window list icon is set via the icon + // option in the BrowserWindow constructor in atom-window.coffee. + return null + default: + throw new Error("Handle other plaforms!") + } +} + function runPackager (options) { return new Promise((resolve, reject) => { electronPackager(options, (err, packageOutputDirPaths) => { From 5e27b07820555778f91011e7496beabf911a198d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 3 Aug 2016 14:43:30 +0200 Subject: [PATCH 085/221] Copy 1024.png under packaged app path as atom.png --- script/lib/package-application.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 19803ebad..675c189fd 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -41,14 +41,14 @@ module.exports = function () { throw new Error('TODO: handle this case!') } - return copyNonASARResources(bundledResourcesPath).then(() => { + return copyNonASARResources(packagedAppPath, bundledResourcesPath).then(() => { console.log(`Application bundle created at ${packagedAppPath}`) return packagedAppPath }) }) } -function copyNonASARResources (bundledResourcesPath) { +function copyNonASARResources (packagedAppPath, bundledResourcesPath) { const bundledShellCommandsPath = path.join(bundledResourcesPath, 'app') console.log(`Copying shell commands to ${bundledShellCommandsPath}...`) fs.copySync( @@ -64,6 +64,8 @@ function copyNonASARResources (bundledResourcesPath) { } if (process.platform === 'darwin') { fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'file.icns'), path.join(bundledResourcesPath, 'file.icns')) + } else if (process.platform === 'linux') { + fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), path.join(packagedAppPath, 'atom.png')) } console.log(`Writing LICENSE.md to ${bundledResourcesPath}...`) @@ -111,7 +113,7 @@ function getIcon () { // option in the BrowserWindow constructor in atom-window.coffee. return null default: - throw new Error("Handle other plaforms!") + throw new Error("Handle other platforms!") } } From a3b03f90d0b658ce03edad20ddf1c8715c757808 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 3 Aug 2016 15:14:26 +0200 Subject: [PATCH 086/221] :memo: --- script/lib/package-application.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 675c189fd..1e20c8a90 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -11,8 +11,6 @@ const getLicenseText = require('./get-license-text') const CONFIG = require('../config') module.exports = function () { - const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' - console.log(`Running electron-packager on ${CONFIG.intermediateAppPath} with app name "${appName}"`) return runPackager({ 'app-version': CONFIG.appMetadata.version, @@ -22,7 +20,7 @@ module.exports = function () { 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, 'icon': getIcon(), - 'name': appName, + 'name': getAppName(), 'out': CONFIG.buildOutputPath, 'osx-sign': getSignOptions(), 'overwrite': true, @@ -96,6 +94,17 @@ function buildAsarUnpackGlobExpression () { return `{${unpack.join(',')}}` } +function getAppName () { + if (process.platform === 'darwin') { + return CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' + } else { + // FIXME: the previous script/build used `atom` as the executable name on + // Windows and Linux, independently of the channel being built. Evaluate + // whether to change this, and if it breaks next installations. + throw new Error('Implement this!') + } +} + function getSignOptions () { if (process.env.CI) { return {identity: 'GitHub'} From 518c02e329c04b7d03d8595d0369969f6f357359 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 3 Aug 2016 15:45:57 +0200 Subject: [PATCH 087/221] Log unhandled rejections --- script/build | 7 ++++++- script/lib/dump-symbols.js | 10 ++++++---- script/lib/package-application.js | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/script/build b/script/build index d6cb9c687..42637c21a 100755 --- a/script/build +++ b/script/build @@ -19,6 +19,11 @@ const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths' const transpileCsonPaths = require('./lib/transpile-cson-paths') const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') +process.on('unhandledRejection', function (e) { + console.error(e) + process.exit(1) +}) + cleanOutputDirectory() copyAssets() transpileBabelPaths() @@ -34,6 +39,6 @@ dumpSymbols() if (argv.codeSign) { codeSign(packagedAppPath) } else { - console.log('Skipping code-signing. Specify --code-sign option to perform code-signing...') + console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing...') } }) diff --git a/script/lib/dump-symbols.js b/script/lib/dump-symbols.js index 76971b6bb..1a17723c7 100644 --- a/script/lib/dump-symbols.js +++ b/script/lib/dump-symbols.js @@ -1,10 +1,11 @@ +'use strict' + const fs = require('fs-extra') const glob = require('glob') const minidump = require('minidump') const path = require('path') const CONFIG = require('../config') - module.exports = function () { console.log(`Dumping symbols in ${CONFIG.symbolsPath}...`) const binaryPaths = glob.sync(path.join(CONFIG.intermediateAppPath, 'node_modules', '**', '*.node')) @@ -15,13 +16,14 @@ function dumpSymbol (binaryPath) { return new Promise(function (resolve, reject) { minidump.dumpSymbol(binaryPath, function (error, content) { if (error) { - reject(error) + console.error(error) throw new Error(error) } else { const moduleLine = /MODULE [^ ]+ [^ ]+ ([0-9A-F]+) (.*)\n/.exec(content) if (moduleLine.length !== 3) { - reject() - throw new Error(`Invalid output when dumping symbol for ${binaryPath}`) + const errorMessage = `Invalid output when dumping symbol for ${binaryPath}` + console.error(errorMessage) + throw new Error(errorMessage) } else { const filename = moduleLine[2] const symbolDirPath = path.join(CONFIG.symbolsPath, filename, moduleLine[1]) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 1e20c8a90..95fb9280a 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -11,6 +11,7 @@ const getLicenseText = require('./get-license-text') const CONFIG = require('../config') module.exports = function () { + const appName = getAppName() console.log(`Running electron-packager on ${CONFIG.intermediateAppPath} with app name "${appName}"`) return runPackager({ 'app-version': CONFIG.appMetadata.version, @@ -20,7 +21,7 @@ module.exports = function () { 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, 'icon': getIcon(), - 'name': getAppName(), + 'name': appName, 'out': CONFIG.buildOutputPath, 'osx-sign': getSignOptions(), 'overwrite': true, From af9fd41723e4cee88604c593074dcc4381b3e41f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 3 Aug 2016 15:50:27 +0200 Subject: [PATCH 088/221] Allow Atom to be installed on OS X --- script/build | 7 +++++++ script/lib/install-application.js | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 script/lib/install-application.js diff --git a/script/build b/script/build index 42637c21a..812d785d0 100755 --- a/script/build +++ b/script/build @@ -12,6 +12,7 @@ const copyAssets = require('./lib/copy-assets') const dumpSymbols = require('./lib/dump-symbols') const generateMetadata = require('./lib/generate-metadata') const generateModuleCache = require('./lib/generate-module-cache') +const installApplication = require('./lib/install-application') const packageApplication = require('./lib/package-application') const prebuildLessCache = require('./lib/prebuild-less-cache') const transpileBabelPaths = require('./lib/transpile-babel-paths') @@ -41,4 +42,10 @@ dumpSymbols() } else { console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing...') } + + if (argv.install) { + installApplication(packagedAppPath) + } else { + console.log('Skipping installation. Specify the --install option to install Atom...') + } }) diff --git a/script/lib/install-application.js b/script/lib/install-application.js new file mode 100644 index 000000000..4d45f0f83 --- /dev/null +++ b/script/lib/install-application.js @@ -0,0 +1,19 @@ +'use strict' + +const fs = require('fs-extra') +const path = require('path') + +module.exports = function (packagedAppPath) { + if (process.platform === 'darwin') { + const packagedAppPathFileName = path.basename(packagedAppPath) + const installationDirPath = path.join(path.sep, 'Applications', packagedAppPathFileName) + if (fs.existsSync(installationDirPath)) { + console.log(`Removing previously installed ${packagedAppPathFileName} at ${installationDirPath}...`) + fs.removeSync(installationDirPath) + } + console.log(`Installing ${packagedAppPath} at ${installationDirPath}...`) + fs.copySync(packagedAppPath, installationDirPath) + } else { + throw new Error("Not implemented yet.") + } +} From d9f47b0307f4c991172b577c520548d06795f742 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 3 Aug 2016 15:51:34 +0200 Subject: [PATCH 089/221] Show not executed steps in gray --- script/build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/build b/script/build index 812d785d0..ac2c1e67d 100755 --- a/script/build +++ b/script/build @@ -4,6 +4,7 @@ // Needed so we can require src/module-cache.coffee during generateModuleCache require('coffee-script/register') +require('colors') const argv = require('yargs').argv const cleanOutputDirectory = require('./lib/clean-output-directory') @@ -40,12 +41,12 @@ dumpSymbols() if (argv.codeSign) { codeSign(packagedAppPath) } else { - console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing...') + console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing...'.gray) } if (argv.install) { installApplication(packagedAppPath) } else { - console.log('Skipping installation. Specify the --install option to install Atom...') + console.log('Skipping installation. Specify the --install option to install Atom...'.gray) } }) From 72457d581e8086f568bb9b025e2253b8123b3574 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 2 Aug 2016 16:47:23 -0600 Subject: [PATCH 090/221] Add electron back to .gitignore for now. I'm going crazy w/o it. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5d7bccec3..d7006e284 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ docs/output docs/includes spec/fixtures/evil-files/ out/ +electron/ From e949984fe8f0f9b0dff7ef054bb9a37c590ec0fb Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 3 Aug 2016 09:45:43 -0600 Subject: [PATCH 091/221] Add API docs generation to new build script Signed-off-by: Antonio Scandurra --- circle.yml | 1 + script/build | 2 ++ script/config.js | 4 ++- script/lib/generate-api-docs.js | 53 +++++++++++++++++++++++++++++++++ script/package.json | 3 ++ 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 script/lib/generate-api-docs.js diff --git a/circle.yml b/circle.yml index b5de155a3..3df9d0d02 100644 --- a/circle.yml +++ b/circle.yml @@ -18,6 +18,7 @@ general: artifacts: - out/atom-mac.zip - out/atom-mac-symbols.zip + - docs/output/atom-api.json dependencies: pre: diff --git a/script/build b/script/build index ac2c1e67d..839f0aaf5 100755 --- a/script/build +++ b/script/build @@ -11,6 +11,7 @@ const cleanOutputDirectory = require('./lib/clean-output-directory') const codeSign = require('./lib/code-sign') const copyAssets = require('./lib/copy-assets') const dumpSymbols = require('./lib/dump-symbols') +const generateAPIDocs = require('./lib/generate-api-docs') const generateMetadata = require('./lib/generate-metadata') const generateModuleCache = require('./lib/generate-module-cache') const installApplication = require('./lib/install-application') @@ -35,6 +36,7 @@ transpilePegJsPaths() generateModuleCache() prebuildLessCache() generateMetadata() +generateAPIDocs() dumpSymbols() .then(packageApplication) .then(packagedAppPath => { diff --git a/script/config.js b/script/config.js index 167c7c150..9129dc8c3 100644 --- a/script/config.js +++ b/script/config.js @@ -10,6 +10,7 @@ const repositoryRootPath = path.resolve(__dirname, '..') const apmRootPath = path.join(repositoryRootPath, 'apm') const scriptRootPath = path.join(repositoryRootPath, 'script') const buildOutputPath = path.join(repositoryRootPath, 'out') +const docsOutputPath = path.join(repositoryRootPath, 'docs', 'output') const intermediateAppPath = path.join(buildOutputPath, 'app') const symbolsPath = path.join(buildOutputPath, 'symbols') const cachePath = path.join(repositoryRootPath, 'cache') @@ -24,7 +25,8 @@ const npmBinPath = getNpmBinPath() module.exports = { appMetadata, apmMetadata, channel, - repositoryRootPath, apmRootPath, scriptRootPath, buildOutputPath, intermediateAppPath, symbolsPath, + repositoryRootPath, apmRootPath, scriptRootPath, + buildOutputPath, docsOutputPath, intermediateAppPath, symbolsPath, cachePath, homeDirPath, apmBinPath, npmBinPath } diff --git a/script/lib/generate-api-docs.js b/script/lib/generate-api-docs.js new file mode 100644 index 000000000..30bf3ef77 --- /dev/null +++ b/script/lib/generate-api-docs.js @@ -0,0 +1,53 @@ +'use strict' + +const donna = require('donna') +const tello = require('tello') +const joanna = require('joanna') +const glob = require('glob') +const fs = require('fs-extra') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + const generatedJSONPath = path.join(CONFIG.docsOutputPath, 'atom-api.json') + console.log(`Generating API docs at ${generatedJSONPath}...`) + + // Unfortunately, correct relative paths depend on a specific working + // directory, but this script should be able to run from anywhere, so we + // muck with the cwd temporarily. + const oldWorkingDirectoryPath = process.cwd() + process.chdir(CONFIG.repositoryRootPath) + const coffeeMetadata = donna.generateMetadata(['.'])[0] + const jsMetadata = joanna(glob.sync(`src/**/*.js`)) + process.chdir(oldWorkingDirectoryPath) + + const metadata = { + repository: coffeeMetadata.repository, + version: coffeeMetadata.version, + files: Object.assign(coffeeMetadata.files, jsMetadata.files) + } + + const api = tello.digest([metadata]) + Object.assign(api.classes, getAPIDocsForDependencies()) + api.classes = sortObjectByKey(api.classes) + + fs.mkdirpSync(CONFIG.docsOutputPath) + fs.writeFileSync(generatedJSONPath, JSON.stringify(api, null, 2)) +} + +function getAPIDocsForDependencies () { + const classes = {} + for (let apiJSONPath of glob.sync(`${CONFIG.repositoryRootPath}/node_modules/*/api.json`)) { + Object.assign(classes, require(apiJSONPath).classes) + } + return classes +} + +function sortObjectByKey (object) { + const sortedObject = {} + for (let keyName of Object.keys(object).sort()) { + sortedObject[keyName] = object[keyName] + } + return sortedObject +} diff --git a/script/package.json b/script/package.json index 212ce8467..4091242c2 100644 --- a/script/package.json +++ b/script/package.json @@ -6,9 +6,11 @@ "babel-core": "5.8.38", "coffee-script": "1.8.0", "colors": "1.1.2", + "donna": "1.0.13", "electron-packager": "7.3.0", "fs-extra": "0.30.0", "glob": "7.0.3", + "joanna": "0.0.6", "legal-eagle": "0.13.0", "minidump": "0.9.0", "mkdirp": "0.5.1", @@ -16,6 +18,7 @@ "npm": "3.10.5", "pegjs": "0.9.0", "semver": "5.3.0", + "tello": "1.0.5", "yargs": "4.8.1" } } From f102fcb3065f71f737b78ab72f26ebf079cd0b89 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 3 Aug 2016 10:52:53 -0700 Subject: [PATCH 092/221] Name app executable 'atom' on Windows and Linux --- script/lib/package-application.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 95fb9280a..9a12c732f 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -99,10 +99,7 @@ function getAppName () { if (process.platform === 'darwin') { return CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' } else { - // FIXME: the previous script/build used `atom` as the executable name on - // Windows and Linux, independently of the channel being built. Evaluate - // whether to change this, and if it breaks next installations. - throw new Error('Implement this!') + return 'atom' } } From 210c583d9e26f94af35d0efeb5623103c80c9699 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 3 Aug 2016 12:26:00 -0600 Subject: [PATCH 093/221] Rename packaged application on OS X and Linux - On OS X, eliminate wrapper directory because app bundle is already a directory. - On Linux, rename wrapper directory to include channel, version, and architecture. Signed-off-by: Antonio Scandurra --- circle.yml | 6 ++++-- script/lib/package-application.js | 27 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index 3df9d0d02..dc361da64 100644 --- a/circle.yml +++ b/circle.yml @@ -32,8 +32,10 @@ dependencies: - script/build --code-sign post: - - cd out/Atom-darwin-x64 && zip -r ../atom-mac.zip ./Atom.app && cd - - - cd out && zip -r ./atom-mac-symbols.zip ./symbols && cd - + - cd out + - zip -r ./atom-mac.zip ./Atom.app + - zip -r ./atom-mac-symbols.zip ./symbols + - cd - cache_directories: - cache diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 9a12c732f..9b6981d0e 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -132,8 +132,33 @@ function runPackager (options) { throw new Error(err) } else { assert(packageOutputDirPaths.length === 1, 'Generated more than one electron application!') - resolve(packageOutputDirPaths[0]) + const packagedAppPath = renamePackagedAppDir(packageOutputDirPaths[0]) + resolve(packagedAppPath) } }) }) } + +function renamePackagedAppDir (packageOutputDirPath) { + let packagedAppPath + if (process.platform === 'darwin') { + const appBundleName = getAppName() + '.app' + packagedAppPath = path.join(CONFIG.buildOutputPath, appBundleName) + fs.renameSync(path.join(packageOutputDirPath, appBundleName), packagedAppPath) + } else if (process.platform === 'linux') { + const appName = CONFIG.channel === 'beta' ? 'atom-beta' : 'atom' + let architecture + if (process.arch === 'ia32') { + architecture = 'i386' + } else if (process.arch === 'x64') { + architecture = 'amd64' + } else { + architecture = process.arch + } + packagedAppPath = path.join(CONFIG.buildOutputPath, `${appName}-${CONFIG.appMetadata.version}-${architecture}`) + fs.renameSync(packageOutputDirPath, packagedAppPath) + } else { + throw new Error('Implement this!') + } + return packagedAppPath +} From 4fda832a9c497bfc68ab0b6c0695adc72adc54dc Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 4 Aug 2016 16:06:39 -0600 Subject: [PATCH 094/221] Copy shell commands on Windows in packageApplication step --- script/lib/package-application.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 9b6981d0e..7c81840b7 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -48,23 +48,28 @@ module.exports = function () { } function copyNonASARResources (packagedAppPath, bundledResourcesPath) { - const bundledShellCommandsPath = path.join(bundledResourcesPath, 'app') - console.log(`Copying shell commands to ${bundledShellCommandsPath}...`) + console.log(`Copying non-ASAR resources to ${bundledResourcesPath}...`) fs.copySync( path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), - path.join(bundledShellCommandsPath, 'apm'), + path.join(bundledResourcesPath, 'app', 'apm'), {filter: includePathInPackagedApp} ) if (process.platform !== 'win32') { // Existing symlinks on user systems point to an outdated path, so just symlink it to the real location of the apm binary. // TODO: Change command installer to point to appropriate path and remove this fallback after a few releases. - fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(bundledShellCommandsPath, 'apm', 'node_modules', '.bin', 'apm')) - fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledShellCommandsPath, 'atom.sh')) + fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(bundledResourcesPath, 'app', 'apm', 'node_modules', '.bin', 'apm')) + fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledResourcesPath, 'app', 'atom.sh')) } if (process.platform === 'darwin') { fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'file.icns'), path.join(bundledResourcesPath, 'file.icns')) } else if (process.platform === 'linux') { fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), path.join(packagedAppPath, 'atom.png')) + } else if (process.platform === 'win32') { + fs.copySync(path.join('resources', 'win', 'atom.cmd'), path.join(bundledResourcesPath, 'cli', 'atom.cmd')) + fs.copySync(path.join('resources', 'win', 'atom.sh'), path.join(bundledResourcesPath, 'cli', 'atom.sh')) + fs.copySync(path.join('resources', 'win', 'atom.js'), path.join(bundledResourcesPath, 'cli', 'atom.js')) + fs.copySync(path.join('resources', 'win', 'apm.cmd'), path.join(bundledResourcesPath, 'cli', 'apm.cmd')) + fs.copySync(path.join('resources', 'win', 'apm.sh'), path.join(bundledResourcesPath, 'cli', 'apm.sh')) } console.log(`Writing LICENSE.md to ${bundledResourcesPath}...`) From 683a7a0deda09d3f90e4154c2e14ecd4f30a98a4 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 4 Aug 2016 16:20:44 -0600 Subject: [PATCH 095/221] Skip symbol dumping on Windows --- script/lib/dump-symbols.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/script/lib/dump-symbols.js b/script/lib/dump-symbols.js index 1a17723c7..712924bfc 100644 --- a/script/lib/dump-symbols.js +++ b/script/lib/dump-symbols.js @@ -2,17 +2,23 @@ const fs = require('fs-extra') const glob = require('glob') -const minidump = require('minidump') const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log(`Dumping symbols in ${CONFIG.symbolsPath}...`) - const binaryPaths = glob.sync(path.join(CONFIG.intermediateAppPath, 'node_modules', '**', '*.node')) - return Promise.all(binaryPaths.map(dumpSymbol)) + if (process.platform === 'win32') { + console.log('Skipping symbol dumping because minidump is not supported on Windows...'.gray) + return Promise.resolve() + } else { + console.log(`Dumping symbols in ${CONFIG.symbolsPath}...`) + const binaryPaths = glob.sync(path.join(CONFIG.intermediateAppPath, 'node_modules', '**', '*.node')) + return Promise.all(binaryPaths.map(dumpSymbol)) + } } function dumpSymbol (binaryPath) { + const minidump = require('minidump') + return new Promise(function (resolve, reject) { minidump.dumpSymbol(binaryPath, function (error, content) { if (error) { From 36f842de5d6539f8cbb6998afe8c614292683f1f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 4 Aug 2016 16:23:09 -0600 Subject: [PATCH 096/221] Pass the correct icon path to electron-packager on Windows --- script/lib/package-application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 7c81840b7..579480088 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -125,7 +125,7 @@ function getIcon () { // option in the BrowserWindow constructor in atom-window.coffee. return null default: - throw new Error("Handle other platforms!") + return path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico') } } From 5419bc4eb9c7de6bf4a615912cbcba9bb0e27d31 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 4 Aug 2016 16:36:21 -0600 Subject: [PATCH 097/221] Omit msbuild.exe from the PATH during script/bootstrap on Windows --- script/bootstrap | 5 +++-- script/lib/delete-msbuild-from-path.js | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 script/lib/delete-msbuild-from-path.js diff --git a/script/bootstrap b/script/bootstrap index 38d7f03ce..a24b0a96b 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -2,9 +2,8 @@ 'use strict' -const path = require('path') - const cleanDependencies = require('./lib/clean-dependencies') +const deleteMsbuildFromPath = require('./lib/delete-msbuild-from-path') const dependenciesFingerprint = require('./lib/dependencies-fingerprint') const installApm = require('./lib/install-apm') const installAtomDependencies = require('./lib/install-atom-dependencies') @@ -17,6 +16,8 @@ if (dependenciesFingerprint.isOutdated()) { cleanDependencies() } +if (process.platform === 'win32') deleteMsbuildFromPath() + installScriptDependencies() installApm() installAtomDependencies() diff --git a/script/lib/delete-msbuild-from-path.js b/script/lib/delete-msbuild-from-path.js new file mode 100644 index 000000000..43e7fbb48 --- /dev/null +++ b/script/lib/delete-msbuild-from-path.js @@ -0,0 +1,19 @@ +'use strict' + +const fs = require('fs') +const path = require('path') + +module.exports = function () { + process.env['PATH'] = + process.env['PATH'] + .split(';') + .filter(function(p) { + if (fs.existsSync(path.join(p, 'msbuild.exe'))) { + console.log('Excluding "' + p + '" from PATH to avoid msbuild.exe mismatch that causes errors during module installation') + return false; + } else { + return true; + } + }) + .join(';'); +} From 5eac4abbd37216f0c820b7725084fa263d5e814a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 5 Aug 2016 15:58:20 +0200 Subject: [PATCH 098/221] Include season in script/package.json --- script/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/script/package.json b/script/package.json index 4091242c2..18c93e637 100644 --- a/script/package.json +++ b/script/package.json @@ -17,6 +17,7 @@ "normalize-package-data": "2.3.5", "npm": "3.10.5", "pegjs": "0.9.0", + "season": "5.3.0", "semver": "5.3.0", "tello": "1.0.5", "yargs": "4.8.1" From 24abdc3d5d2e1e9cddb7b45ca4391fc4ba7fc18f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 5 Aug 2016 16:21:48 +0200 Subject: [PATCH 099/221] Rename build output dir on Windows --- script/lib/package-application.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 579480088..975ae56be 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -33,11 +33,9 @@ module.exports = function () { packagedAppPath = path.join(packageOutputDirPath, appName + '.app') bundledResourcesPath = path.join(packagedAppPath, 'Contents', 'Resources') setAtomHelperVersion(packagedAppPath) - } else if (process.platform === 'linux') { + } else { packagedAppPath = packageOutputDirPath bundledResourcesPath = path.join(packagedAppPath, 'resources') - } else { - throw new Error('TODO: handle this case!') } return copyNonASARResources(packagedAppPath, bundledResourcesPath).then(() => { @@ -125,7 +123,7 @@ function getIcon () { // option in the BrowserWindow constructor in atom-window.coffee. return null default: - return path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico') + return path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico') } } @@ -163,7 +161,9 @@ function renamePackagedAppDir (packageOutputDirPath) { packagedAppPath = path.join(CONFIG.buildOutputPath, `${appName}-${CONFIG.appMetadata.version}-${architecture}`) fs.renameSync(packageOutputDirPath, packagedAppPath) } else { - throw new Error('Implement this!') + const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' + packagedAppPath = path.join(CONFIG.buildOutputPath, appName) + fs.renameSync(packageOutputDirPath, packagedAppPath) } return packagedAppPath } From 8697487e3b4feb8494ab81b2b26d7baf848bf279 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 5 Aug 2016 17:13:28 +0200 Subject: [PATCH 100/221] Start on code-signing for Windows --- appveyor.yml | 5 ++++- script/lib/code-sign.js | 47 ++++++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7eef770b1..1ac468b7d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,6 +18,9 @@ environment: - NODE_VERSION: 4.4.5 install: + - choco install curl + - |- # this weird literal syntax allows a : on the next line + curl --header 'Accept: application/vnd.github.v3.raw' --output %WIN_P12KEY_PATH% %WIN_P12KEY_URL% - SET PATH=C:\Program Files\Atom\resources\cli;%PATH% - ps: Install-Product node $env:NODE_VERSION $env:PLATFORM - npm install -g npm @@ -25,7 +28,7 @@ install: build_script: - cd %APPVEYOR_BUILD_FOLDER% - script\bootstrap.cmd - - script\build.cmd + - script\build.cmd --code-sign test: off deploy: off diff --git a/script/lib/code-sign.js b/script/lib/code-sign.js index d6fe553ea..ce38cf0f8 100644 --- a/script/lib/code-sign.js +++ b/script/lib/code-sign.js @@ -1,17 +1,40 @@ const childProcess = require('child_process') module.exports = function (packagedAppPath) { - console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) - childProcess.spawnSync('security', [ - 'unlock-keychain', - '-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD, - process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN - ], {stdio: 'inherit'}) + if (process.platform === 'darwin') { + console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) + childProcess.spawnSync('security', [ + 'unlock-keychain', + '-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD, + process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN + ], {stdio: 'inherit'}) - console.log(`Code-signing application at ${packagedAppPath}`) - childProcess.spawnSync('codesign', [ - '--deep', '--force', '--verbose', - '--keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, - '--sign', 'Developer ID Application: GitHub', packagedAppPath - ], {stdio: 'inherit'}) + console.log(`Code-signing application at ${packagedAppPath}`) + childProcess.spawnSync('codesign', [ + '--deep', '--force', '--verbose', + '--keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, + '--sign', 'Developer ID Application: GitHub', packagedAppPath + ], {stdio: 'inherit'}) + } else if (process.platform === 'win32') { + const signtoolPath = path.join('C:', 'Program Files (x86)', 'Microsoft SDKs', 'Windows', 'v7.1A', 'bin', 'signtool.exe') + + const binToSignPath = path.join(packagedAppPath, 'atom.exe') + console.log(`Signing Windows Binary at ${binToSignPath}`) + childProcess.spawnSync(signtoolPath, [ + 'sign', '/v', + '/f', process.env.WIN_P12KEY_PATH, + '/p', process.env.WIN_P12KEY_PASSWORD + ], {stdio: 'inherit'}) + + // TODO: when we will be able to generate an installer, sign that too! + // const installerToSignPath = computeInstallerPath() + // console.log(`Signing Windows Installer at ${installerToSignPath}`) + // childProcess.spawnSync(signtoolPath, [ + // 'sign', '/v', + // '/f', process.env.WIN_P12KEY_PATH, + // '/p', process.env.WIN_P12KEY_PASSWORD + // ], {stdio: 'inherit'}) + } else { + throw new Error(`Code-signing is not supported for platform ${process.platform}!`) + } } From bc2663ade93826b46bdd529b86ae42641fa6c7c3 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 5 Aug 2016 17:28:39 +0200 Subject: [PATCH 101/221] Fix certificate download on Windows --- appveyor.yml | 2 +- script/lib/code-sign.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1ac468b7d..430bed43d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ environment: install: - choco install curl - |- # this weird literal syntax allows a : on the next line - curl --header 'Accept: application/vnd.github.v3.raw' --output %WIN_P12KEY_PATH% %WIN_P12KEY_URL% + curl --insecure --header "Accept: application/vnd.github.v3.raw" %WIN_P12KEY_URL% > %WIN_P12KEY_PATH% - SET PATH=C:\Program Files\Atom\resources\cli;%PATH% - ps: Install-Product node $env:NODE_VERSION $env:PLATFORM - npm install -g npm diff --git a/script/lib/code-sign.js b/script/lib/code-sign.js index ce38cf0f8..14db358fc 100644 --- a/script/lib/code-sign.js +++ b/script/lib/code-sign.js @@ -1,4 +1,5 @@ const childProcess = require('child_process') +const path = require('path') module.exports = function (packagedAppPath) { if (process.platform === 'darwin') { From 57a0de5b992adc890cec3db51e71d7fa078cd299 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 5 Aug 2016 17:40:45 +0200 Subject: [PATCH 102/221] Add missing flag for signtool.exe --- script/lib/code-sign.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/lib/code-sign.js b/script/lib/code-sign.js index 14db358fc..a0bc13d82 100644 --- a/script/lib/code-sign.js +++ b/script/lib/code-sign.js @@ -24,14 +24,15 @@ module.exports = function (packagedAppPath) { childProcess.spawnSync(signtoolPath, [ 'sign', '/v', '/f', process.env.WIN_P12KEY_PATH, - '/p', process.env.WIN_P12KEY_PASSWORD + '/p', process.env.WIN_P12KEY_PASSWORD, + binToSignPath ], {stdio: 'inherit'}) // TODO: when we will be able to generate an installer, sign that too! // const installerToSignPath = computeInstallerPath() // console.log(`Signing Windows Installer at ${installerToSignPath}`) // childProcess.spawnSync(signtoolPath, [ - // 'sign', '/v', + // 'sign', binToSignPath, '/v', // '/f', process.env.WIN_P12KEY_PATH, // '/p', process.env.WIN_P12KEY_PASSWORD // ], {stdio: 'inherit'}) From 068f18a2617fe95a045e851bd4d46098f14605ee Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 5 Aug 2016 10:31:18 -0600 Subject: [PATCH 103/221] =?UTF-8?q?Don=E2=80=99t=20pass=20signing=20option?= =?UTF-8?q?s=20to=20electron-packager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We do it manually in a later step. --- script/lib/package-application.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 975ae56be..0579b2020 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -23,7 +23,6 @@ module.exports = function () { 'icon': getIcon(), 'name': appName, 'out': CONFIG.buildOutputPath, - 'osx-sign': getSignOptions(), 'overwrite': true, 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion @@ -106,14 +105,6 @@ function getAppName () { } } -function getSignOptions () { - if (process.env.CI) { - return {identity: 'GitHub'} - } else { - return null - } -} - function getIcon () { switch (process.platform) { case 'darwin': From d89896fe20113e40feef21a118e7fbaf40f82eef Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 5 Aug 2016 10:33:02 -0600 Subject: [PATCH 104/221] Remove target of rename during packaging for easier incremental testing --- script/lib/package-application.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 0579b2020..b38f61387 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -138,6 +138,7 @@ function renamePackagedAppDir (packageOutputDirPath) { if (process.platform === 'darwin') { const appBundleName = getAppName() + '.app' packagedAppPath = path.join(CONFIG.buildOutputPath, appBundleName) + if (fs.existsSync(packagedAppPath)) fs.removeSync(packagedAppPath) fs.renameSync(path.join(packageOutputDirPath, appBundleName), packagedAppPath) } else if (process.platform === 'linux') { const appName = CONFIG.channel === 'beta' ? 'atom-beta' : 'atom' @@ -150,10 +151,12 @@ function renamePackagedAppDir (packageOutputDirPath) { architecture = process.arch } packagedAppPath = path.join(CONFIG.buildOutputPath, `${appName}-${CONFIG.appMetadata.version}-${architecture}`) + if (fs.existsSync(packagedAppPath)) fs.removeSync(packagedAppPath) fs.renameSync(packageOutputDirPath, packagedAppPath) } else { const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' packagedAppPath = path.join(CONFIG.buildOutputPath, appName) + if (fs.existsSync(packagedAppPath)) fs.removeSync(packagedAppPath) fs.renameSync(packageOutputDirPath, packagedAppPath) } return packagedAppPath From c6e38708d69169dd3b416af729359ec716cf3b7a Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 5 Aug 2016 11:50:12 -0600 Subject: [PATCH 105/221] Download and import certificate in build script instead of circle.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will make it possible to run the build on Circle instances that don’t define the required environment variables for code signing. We could do some crazy shell scripting in the circle.yml, but this is easier overall. --- circle.yml | 7 ----- script/lib/code-sign.js | 61 +++++++++++++++++++++++++++++++++-------- script/package.json | 1 + 3 files changed, 50 insertions(+), 19 deletions(-) diff --git a/circle.yml b/circle.yml index dc361da64..7a8f487c3 100644 --- a/circle.yml +++ b/circle.yml @@ -7,13 +7,6 @@ machine: xcode: version: 7.3 - post: - - |- # this weird literal syntax allows a : on the next line - curl --header 'Accept: application/vnd.github.v3.raw' --output /tmp/mac.p12 $ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL - - security unlock-keychain -p $ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD $ATOM_MAC_CODE_SIGNING_KEYCHAIN - - security import /tmp/mac.p12 -P $ATOM_MAC_CODE_SIGNING_CERT_PASSWORD -k $ATOM_MAC_CODE_SIGNING_KEYCHAIN -T /usr/bin/codesign - - security find-identity -p codesigning - general: artifacts: - out/atom-mac.zip diff --git a/script/lib/code-sign.js b/script/lib/code-sign.js index a0bc13d82..a00af3a21 100644 --- a/script/lib/code-sign.js +++ b/script/lib/code-sign.js @@ -1,21 +1,45 @@ const childProcess = require('child_process') +const fs = require('fs') +const os = require('os') const path = require('path') +const syncRequest = require('sync-request') module.exports = function (packagedAppPath) { if (process.platform === 'darwin') { - console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) - childProcess.spawnSync('security', [ - 'unlock-keychain', - '-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD, - process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN - ], {stdio: 'inherit'}) + if (!process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL) { + console.log('Skipping code signing because the ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL environment variable is not defined'.gray) + return + } - console.log(`Code-signing application at ${packagedAppPath}`) - childProcess.spawnSync('codesign', [ - '--deep', '--force', '--verbose', - '--keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, - '--sign', 'Developer ID Application: GitHub', packagedAppPath - ], {stdio: 'inherit'}) + const certPath = path.join(os.tmpdir(), 'mac.p12') + downloadCertificate(process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL, certPath) + + try { + console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) + childProcess.spawnSync('security', [ + 'unlock-keychain', + '-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD, + process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN + ], {stdio: 'inherit'}) + + console.log(`Importing certificate at ${certPath} into ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN} keychain`) + childProcess.spawnSync('security', [ + 'import', certPath, + '-P', process.env.ATOM_MAC_CODE_SIGNING_CERT_PASSWORD, + '-k', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, + '-T', '/usr/bin/codesign' + ]) + + console.log(`Code-signing application at ${packagedAppPath}`) + childProcess.spawnSync('codesign', [ + '--deep', '--force', '--verbose', + '--keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, + '--sign', 'Developer ID Application: GitHub', packagedAppPath + ], {stdio: 'inherit'}) + } finally { + console.log(`Deleting certificate at ${certPath}`); + fs.removeSync(certPath) + } } else if (process.platform === 'win32') { const signtoolPath = path.join('C:', 'Program Files (x86)', 'Microsoft SDKs', 'Windows', 'v7.1A', 'bin', 'signtool.exe') @@ -40,3 +64,16 @@ module.exports = function (packagedAppPath) { throw new Error(`Code-signing is not supported for platform ${process.platform}!`) } } + +function downloadCertificate (downloadURL, certificatePath) { + console.log(`Dowloading certificate to ${certificatePath}`) + const response = syncRequest('GET', downloadURL, { + 'headers': {'Accept': 'application/vnd.github.v3.raw', 'User-Agent': 'Atom Build'} + }) + + if (response.statusCode === 200) { + fs.writeFileSync(certificatePath, response.body) + } else { + throw new Error('Error downloading certificate. HTTP Status ' + response.statusCode + '.') + } +} diff --git a/script/package.json b/script/package.json index 18c93e637..7ff50490c 100644 --- a/script/package.json +++ b/script/package.json @@ -19,6 +19,7 @@ "pegjs": "0.9.0", "season": "5.3.0", "semver": "5.3.0", + "sync-request": "^3.0.1", "tello": "1.0.5", "yargs": "4.8.1" } From cd77e3283a233ce6cf79a67b96c18b304eafd966 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 5 Aug 2016 15:56:47 -0600 Subject: [PATCH 106/221] Require fs-extra for removeSync --- script/lib/code-sign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/code-sign.js b/script/lib/code-sign.js index a00af3a21..d1a07929c 100644 --- a/script/lib/code-sign.js +++ b/script/lib/code-sign.js @@ -1,5 +1,5 @@ const childProcess = require('child_process') -const fs = require('fs') +const fs = require('fs-extra') const os = require('os') const path = require('path') const syncRequest = require('sync-request') From 7ba2ae76764626261a166b5bdbdb5098563ff201 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 5 Aug 2016 15:59:24 -0600 Subject: [PATCH 107/221] =?UTF-8?q?Prompt=20for=20password=20when=20code?= =?UTF-8?q?=20signing=20if=20there=E2=80=99s=20no=20password=20env=20var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Max Brunsfeld --- script/lib/code-sign.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/script/lib/code-sign.js b/script/lib/code-sign.js index d1a07929c..56f0b0f15 100644 --- a/script/lib/code-sign.js +++ b/script/lib/code-sign.js @@ -16,11 +16,13 @@ module.exports = function (packagedAppPath) { try { console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) - childProcess.spawnSync('security', [ - 'unlock-keychain', - '-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD, - process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN - ], {stdio: 'inherit'}) + + const unlockArgs = ['unlock-keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN] + // For signing on local workstations, password could be entered interactively + if (process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) { + unlockArgs.push('-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) + } + childProcess.spawnSync('security', unlockArgs, {stdio: 'inherit'}) console.log(`Importing certificate at ${certPath} into ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN} keychain`) childProcess.spawnSync('security', [ From 171c02b56356fd7f35db4c610fe16bb692ca3029 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 5 Aug 2016 16:19:45 -0600 Subject: [PATCH 108/221] =?UTF-8?q?Don=E2=80=99t=20construct=20packagedApp?= =?UTF-8?q?Path=20twice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/lib/package-application.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index b38f61387..5d9581b9d 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -26,14 +26,12 @@ module.exports = function () { 'overwrite': true, 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion - }).then((packageOutputDirPath) => { - let packagedAppPath, bundledResourcesPath + }).then((packagedAppPath) => { + let bundledResourcesPath if (process.platform === 'darwin') { - packagedAppPath = path.join(packageOutputDirPath, appName + '.app') bundledResourcesPath = path.join(packagedAppPath, 'Contents', 'Resources') setAtomHelperVersion(packagedAppPath) } else { - packagedAppPath = packageOutputDirPath bundledResourcesPath = path.join(packagedAppPath, 'resources') } From dc7973f1e7e81240abdd9a2e8aa89ffac9fd7019 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 5 Aug 2016 16:48:04 -0600 Subject: [PATCH 109/221] Pass app bundle identifiers to electron-packager --- script/lib/package-application.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 5d9581b9d..7eb27d342 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -15,11 +15,13 @@ module.exports = function () { console.log(`Running electron-packager on ${CONFIG.intermediateAppPath} with app name "${appName}"`) return runPackager({ 'app-version': CONFIG.appMetadata.version, + 'app-bundle-id': 'com.github.atom', 'arch': process.arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, 'build-version': CONFIG.appMetadata.version, 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, + 'helper-bundle-id': 'com.github.atom.helper', 'icon': getIcon(), 'name': appName, 'out': CONFIG.buildOutputPath, From 7cdf25eb5bedde73fe8ba81921938b5ba3c910dc Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 6 Aug 2016 10:40:47 -0600 Subject: [PATCH 110/221] Start on electron-winstaller --- script/build | 18 ++++-- script/lib/code-sign-on-mac.js | 43 ++++++++++++++ script/lib/code-sign.js | 81 -------------------------- script/lib/create-windows-installer.js | 33 +++++++++++ script/lib/download-github-raw-file.js | 15 +++++ script/package.json | 1 + 6 files changed, 104 insertions(+), 87 deletions(-) create mode 100644 script/lib/code-sign-on-mac.js delete mode 100644 script/lib/code-sign.js create mode 100644 script/lib/create-windows-installer.js create mode 100644 script/lib/download-github-raw-file.js diff --git a/script/build b/script/build index 839f0aaf5..c0c4b2c92 100755 --- a/script/build +++ b/script/build @@ -8,8 +8,9 @@ require('colors') const argv = require('yargs').argv const cleanOutputDirectory = require('./lib/clean-output-directory') -const codeSign = require('./lib/code-sign') +const codeSignOnMac = require('./lib/code-sign-on-mac') const copyAssets = require('./lib/copy-assets') +const createWindowsInstaller = require('./lib/create-windows-installer') const dumpSymbols = require('./lib/dump-symbols') const generateAPIDocs = require('./lib/generate-api-docs') const generateMetadata = require('./lib/generate-metadata') @@ -40,12 +41,17 @@ generateAPIDocs() dumpSymbols() .then(packageApplication) .then(packagedAppPath => { - if (argv.codeSign) { - codeSign(packagedAppPath) - } else { - console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing...'.gray) + if (process.platform === 'darwin') { + if (argv.codeSign) { + codeSignOnMac(packagedAppPath) + } else { + console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing...'.gray) + } + return Promise.resolve(packagedAppPath) + } else if (process.platform === 'win32') { + return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) } - + }).then(packagedAppPath => { if (argv.install) { installApplication(packagedAppPath) } else { diff --git a/script/lib/code-sign-on-mac.js b/script/lib/code-sign-on-mac.js new file mode 100644 index 000000000..036466236 --- /dev/null +++ b/script/lib/code-sign-on-mac.js @@ -0,0 +1,43 @@ +const childProcess = require('child_process') +const downloadGithubRawFile = require('./download-github-raw-file') +const fs = require('fs-extra') +const os = require('os') +const path = require('path') + +module.exports = function (packagedAppPath) { + if (!process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL) { + console.log('Skipping code signing because the ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL environment variable is not defined'.gray) + return + } + + try { + const certPath = path.join(os.tmpdir(), 'mac.p12') + downloadGithubRawFile(process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL, certPath) + + console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) + const unlockArgs = ['unlock-keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN] + // For signing on local workstations, password could be entered interactively + if (process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) { + unlockArgs.push('-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) + } + childProcess.spawnSync('security', unlockArgs, {stdio: 'inherit'}) + + console.log(`Importing certificate at ${certPath} into ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN} keychain`) + childProcess.spawnSync('security', [ + 'import', certPath, + '-P', process.env.ATOM_MAC_CODE_SIGNING_CERT_PASSWORD, + '-k', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, + '-T', '/usr/bin/codesign' + ]) + + console.log(`Code-signing application at ${packagedAppPath}`) + childProcess.spawnSync('codesign', [ + '--deep', '--force', '--verbose', + '--keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, + '--sign', 'Developer ID Application: GitHub', packagedAppPath + ], {stdio: 'inherit'}) + } finally { + console.log(`Deleting certificate at ${certPath}`) + fs.removeSync(certPath) + } +} diff --git a/script/lib/code-sign.js b/script/lib/code-sign.js deleted file mode 100644 index 56f0b0f15..000000000 --- a/script/lib/code-sign.js +++ /dev/null @@ -1,81 +0,0 @@ -const childProcess = require('child_process') -const fs = require('fs-extra') -const os = require('os') -const path = require('path') -const syncRequest = require('sync-request') - -module.exports = function (packagedAppPath) { - if (process.platform === 'darwin') { - if (!process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL) { - console.log('Skipping code signing because the ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL environment variable is not defined'.gray) - return - } - - const certPath = path.join(os.tmpdir(), 'mac.p12') - downloadCertificate(process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL, certPath) - - try { - console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) - - const unlockArgs = ['unlock-keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN] - // For signing on local workstations, password could be entered interactively - if (process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) { - unlockArgs.push('-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) - } - childProcess.spawnSync('security', unlockArgs, {stdio: 'inherit'}) - - console.log(`Importing certificate at ${certPath} into ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN} keychain`) - childProcess.spawnSync('security', [ - 'import', certPath, - '-P', process.env.ATOM_MAC_CODE_SIGNING_CERT_PASSWORD, - '-k', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, - '-T', '/usr/bin/codesign' - ]) - - console.log(`Code-signing application at ${packagedAppPath}`) - childProcess.spawnSync('codesign', [ - '--deep', '--force', '--verbose', - '--keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, - '--sign', 'Developer ID Application: GitHub', packagedAppPath - ], {stdio: 'inherit'}) - } finally { - console.log(`Deleting certificate at ${certPath}`); - fs.removeSync(certPath) - } - } else if (process.platform === 'win32') { - const signtoolPath = path.join('C:', 'Program Files (x86)', 'Microsoft SDKs', 'Windows', 'v7.1A', 'bin', 'signtool.exe') - - const binToSignPath = path.join(packagedAppPath, 'atom.exe') - console.log(`Signing Windows Binary at ${binToSignPath}`) - childProcess.spawnSync(signtoolPath, [ - 'sign', '/v', - '/f', process.env.WIN_P12KEY_PATH, - '/p', process.env.WIN_P12KEY_PASSWORD, - binToSignPath - ], {stdio: 'inherit'}) - - // TODO: when we will be able to generate an installer, sign that too! - // const installerToSignPath = computeInstallerPath() - // console.log(`Signing Windows Installer at ${installerToSignPath}`) - // childProcess.spawnSync(signtoolPath, [ - // 'sign', binToSignPath, '/v', - // '/f', process.env.WIN_P12KEY_PATH, - // '/p', process.env.WIN_P12KEY_PASSWORD - // ], {stdio: 'inherit'}) - } else { - throw new Error(`Code-signing is not supported for platform ${process.platform}!`) - } -} - -function downloadCertificate (downloadURL, certificatePath) { - console.log(`Dowloading certificate to ${certificatePath}`) - const response = syncRequest('GET', downloadURL, { - 'headers': {'Accept': 'application/vnd.github.v3.raw', 'User-Agent': 'Atom Build'} - }) - - if (response.statusCode === 200) { - fs.writeFileSync(certificatePath, response.body) - } else { - throw new Error('Error downloading certificate. HTTP Status ' + response.statusCode + '.') - } -} diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js new file mode 100644 index 000000000..025906ae8 --- /dev/null +++ b/script/lib/create-windows-installer.js @@ -0,0 +1,33 @@ +const downloadCertificate = require('./download-github-raw-file') +const electronInstaller = require('electron-winstaller') +const fs = require('fs-extra') +const os = require('os') +const path = require('path') + +module.exports = function (packagedAppPath, codeSign) { + console.log(`Creating Windows Installer for ${packagedAppPath}`) + const options = { + appDirectory: packagedAppPath, + authors: 'GitHub Inc.', + iconUrl: `https://raw.githubusercontent.com/atom/atom/master/resources/app-icons/${CONFIG.channel}/atom.ico` + loadingGif: path.join(CONFIG.repositoryRootPath, 'resources', 'win', 'loading.gif'), + outputDirectory: CONFIG.buildOutputPath, + remoteReleases: `https://atom.io/api/updates?version=${CONFIG.appMetadata.version}`, + setupIcon: path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico') + } + + if (codeSign && WIN_P12KEY_URL) { + const certPath = path.join(os.tmpdir(), 'win.p12') + downloadGithubRawFile(WIN_P12KEY_URL, certPath) + const deleteCertificate = function () { + console.log(`Deleting certificate at ${certPath}`) + fs.removeSync(certPath) + } + options.certificateFile = certPath + options.certificatePassword = WIN_P12KEY_PASSWORD + return electronInstaller.createWindowsInstaller(options).then(deleteCertificate, deleteCertificate) + } else { + console.log('Skipping code-signing. Specify the --code-sign option and provide a WIN_P12KEY_URL environment variable to perform code-signing'.gray) + return electronInstaller.createWindowsInstaller(options) + } +} diff --git a/script/lib/download-github-raw-file.js b/script/lib/download-github-raw-file.js new file mode 100644 index 000000000..d26b34075 --- /dev/null +++ b/script/lib/download-github-raw-file.js @@ -0,0 +1,15 @@ +const fs = require('fs-extra') +const syncRequest = require('sync-request') + +module.exports = function (downloadURL, destinationPath) { + console.log(`Dowloading raw file from GitHub Repository to ${destinationPath}`) + const response = syncRequest('GET', downloadURL, { + 'headers': {'Accept': 'application/vnd.github.v3.raw', 'User-Agent': 'Atom Build'} + }) + + if (response.statusCode === 200) { + fs.writeFileSync(destinationPath, response.body) + } else { + throw new Error('Error downloading file. HTTP Status ' + response.statusCode + '.') + } +} diff --git a/script/package.json b/script/package.json index 7ff50490c..fe26df694 100644 --- a/script/package.json +++ b/script/package.json @@ -8,6 +8,7 @@ "colors": "1.1.2", "donna": "1.0.13", "electron-packager": "7.3.0", + "electron-winstaller": "^2.3.3", "fs-extra": "0.30.0", "glob": "7.0.3", "joanna": "0.0.6", From d089c94f3ba8cb2b2f197c8385e05bbe6233302a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 15:18:21 +0200 Subject: [PATCH 111/221] Remove trailing `...` in log messages --- script/build | 4 ++-- script/lib/clean-caches.js | 2 +- script/lib/clean-dependencies.js | 6 +++--- script/lib/clean-output-directory.js | 2 +- script/lib/copy-assets.js | 2 +- script/lib/dump-symbols.js | 4 ++-- script/lib/generate-api-docs.js | 2 +- script/lib/generate-metadata.js | 2 +- script/lib/generate-module-cache.js | 2 +- script/lib/install-apm.js | 2 +- script/lib/install-application.js | 4 ++-- script/lib/install-script-dependencies.js | 2 +- script/lib/package-application.js | 6 +++--- script/lib/transpile-babel-paths.js | 2 +- script/lib/transpile-coffee-script-paths.js | 2 +- script/lib/transpile-cson-paths.js | 2 +- script/lib/transpile-peg-js-paths.js | 2 +- script/test | 6 +++--- 18 files changed, 27 insertions(+), 27 deletions(-) diff --git a/script/build b/script/build index c0c4b2c92..c43472171 100755 --- a/script/build +++ b/script/build @@ -45,7 +45,7 @@ dumpSymbols() if (argv.codeSign) { codeSignOnMac(packagedAppPath) } else { - console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing...'.gray) + console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing'.gray) } return Promise.resolve(packagedAppPath) } else if (process.platform === 'win32') { @@ -55,6 +55,6 @@ dumpSymbols() if (argv.install) { installApplication(packagedAppPath) } else { - console.log('Skipping installation. Specify the --install option to install Atom...'.gray) + console.log('Skipping installation. Specify the --install option to install Atom'.gray) } }) diff --git a/script/lib/clean-caches.js b/script/lib/clean-caches.js index 7d941e426..dbcbfb0e8 100644 --- a/script/lib/clean-caches.js +++ b/script/lib/clean-caches.js @@ -21,7 +21,7 @@ module.exports = function () { ] for (let path of cachePaths) { - console.log(`Cleaning ${path}...`) + console.log(`Cleaning ${path}`) fs.removeSync(path) } } diff --git a/script/lib/clean-dependencies.js b/script/lib/clean-dependencies.js index c35afbce3..ac55fdcaa 100644 --- a/script/lib/clean-dependencies.js +++ b/script/lib/clean-dependencies.js @@ -9,14 +9,14 @@ module.exports = function () { const fs = require('fs-extra') const apmDependenciesPath = path.join(CONFIG.apmRootPath, 'node_modules') - console.log(`Cleaning ${apmDependenciesPath}...`); + console.log(`Cleaning ${apmDependenciesPath}`); fs.removeSync(apmDependenciesPath) const atomDependenciesPath = path.join(CONFIG.repositoryRootPath, 'node_modules') - console.log(`Cleaning ${atomDependenciesPath}...`); + console.log(`Cleaning ${atomDependenciesPath}`); fs.removeSync(atomDependenciesPath) const scriptDependenciesPath = path.join(CONFIG.scriptRootPath, 'node_modules') - console.log(`Cleaning ${scriptDependenciesPath}...`); + console.log(`Cleaning ${scriptDependenciesPath}`); fs.removeSync(scriptDependenciesPath) } diff --git a/script/lib/clean-output-directory.js b/script/lib/clean-output-directory.js index 9165b0e9f..560a562ba 100644 --- a/script/lib/clean-output-directory.js +++ b/script/lib/clean-output-directory.js @@ -4,7 +4,7 @@ const CONFIG = require('../config') module.exports = function () { if (fs.existsSync(CONFIG.buildOutputPath)) { - console.log(`Cleaning ${CONFIG.buildOutputPath}...`) + console.log(`Cleaning ${CONFIG.buildOutputPath}`) fs.removeSync(CONFIG.buildOutputPath) } } diff --git a/script/lib/copy-assets.js b/script/lib/copy-assets.js index b6566fc40..3c33ad13a 100644 --- a/script/lib/copy-assets.js +++ b/script/lib/copy-assets.js @@ -10,7 +10,7 @@ const glob = require('glob') const includePathInPackagedApp = require('./include-path-in-packaged-app') module.exports = function () { - console.log(`Copying assets to ${CONFIG.intermediateAppPath}...`); + console.log(`Copying assets to ${CONFIG.intermediateAppPath}`); let srcPaths = [ path.join(CONFIG.repositoryRootPath, 'dot-atom'), path.join(CONFIG.repositoryRootPath, 'exports'), diff --git a/script/lib/dump-symbols.js b/script/lib/dump-symbols.js index 712924bfc..6b0b10bef 100644 --- a/script/lib/dump-symbols.js +++ b/script/lib/dump-symbols.js @@ -7,10 +7,10 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { if (process.platform === 'win32') { - console.log('Skipping symbol dumping because minidump is not supported on Windows...'.gray) + console.log('Skipping symbol dumping because minidump is not supported on Windows'.gray) return Promise.resolve() } else { - console.log(`Dumping symbols in ${CONFIG.symbolsPath}...`) + console.log(`Dumping symbols in ${CONFIG.symbolsPath}`) const binaryPaths = glob.sync(path.join(CONFIG.intermediateAppPath, 'node_modules', '**', '*.node')) return Promise.all(binaryPaths.map(dumpSymbol)) } diff --git a/script/lib/generate-api-docs.js b/script/lib/generate-api-docs.js index 30bf3ef77..6e985edd2 100644 --- a/script/lib/generate-api-docs.js +++ b/script/lib/generate-api-docs.js @@ -11,7 +11,7 @@ const CONFIG = require('../config') module.exports = function () { const generatedJSONPath = path.join(CONFIG.docsOutputPath, 'atom-api.json') - console.log(`Generating API docs at ${generatedJSONPath}...`) + console.log(`Generating API docs at ${generatedJSONPath}`) // Unfortunately, correct relative paths depend on a specific working // directory, but this script should be able to run from anywhere, so we diff --git a/script/lib/generate-metadata.js b/script/lib/generate-metadata.js index 8a7dfc469..842163b02 100644 --- a/script/lib/generate-metadata.js +++ b/script/lib/generate-metadata.js @@ -11,7 +11,7 @@ const semver = require('semver') const CONFIG = require('../config') module.exports = function () { - console.log(`Generating metadata for ${path.join(CONFIG.intermediateAppPath, 'package.json')}...`) + console.log(`Generating metadata for ${path.join(CONFIG.intermediateAppPath, 'package.json')}`) CONFIG.appMetadata._atomPackages = buildBundledPackagesMetadata() CONFIG.appMetadata._atomMenu = buildPlatformMenuMetadata() CONFIG.appMetadata._atomKeymaps = buildPlatformKeymapsMetadata() diff --git a/script/lib/generate-module-cache.js b/script/lib/generate-module-cache.js index 71bf4988c..940dc24a1 100644 --- a/script/lib/generate-module-cache.js +++ b/script/lib/generate-module-cache.js @@ -7,7 +7,7 @@ const ModuleCache = require('../../src/module-cache') const CONFIG = require('../config') module.exports = function () { - console.log(`Generating module cache for ${CONFIG.intermediateAppPath}...`) + console.log(`Generating module cache for ${CONFIG.intermediateAppPath}`) for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) { ModuleCache.create(path.join(CONFIG.intermediateAppPath, 'node_modules', packageName)) } diff --git a/script/lib/install-apm.js b/script/lib/install-apm.js index a4478f8e3..d37217e0d 100644 --- a/script/lib/install-apm.js +++ b/script/lib/install-apm.js @@ -6,7 +6,7 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log('Installing apm...') + console.log('Installing apm') childProcess.execFileSync( CONFIG.npmBinPath, ['--global-style', '--loglevel=error', 'install'], diff --git a/script/lib/install-application.js b/script/lib/install-application.js index 4d45f0f83..5852e6604 100644 --- a/script/lib/install-application.js +++ b/script/lib/install-application.js @@ -8,10 +8,10 @@ module.exports = function (packagedAppPath) { const packagedAppPathFileName = path.basename(packagedAppPath) const installationDirPath = path.join(path.sep, 'Applications', packagedAppPathFileName) if (fs.existsSync(installationDirPath)) { - console.log(`Removing previously installed ${packagedAppPathFileName} at ${installationDirPath}...`) + console.log(`Removing previously installed ${packagedAppPathFileName} at ${installationDirPath}`) fs.removeSync(installationDirPath) } - console.log(`Installing ${packagedAppPath} at ${installationDirPath}...`) + console.log(`Installing ${packagedAppPath} at ${installationDirPath}`) fs.copySync(packagedAppPath, installationDirPath) } else { throw new Error("Not implemented yet.") diff --git a/script/lib/install-script-dependencies.js b/script/lib/install-script-dependencies.js index 461adfff6..12454e517 100644 --- a/script/lib/install-script-dependencies.js +++ b/script/lib/install-script-dependencies.js @@ -6,7 +6,7 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log('Installing script dependencies...') + console.log('Installing script dependencies') childProcess.execFileSync( CONFIG.npmBinPath, ['--loglevel=error', 'install'], diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 7eb27d342..62317754d 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -45,7 +45,7 @@ module.exports = function () { } function copyNonASARResources (packagedAppPath, bundledResourcesPath) { - console.log(`Copying non-ASAR resources to ${bundledResourcesPath}...`) + console.log(`Copying non-ASAR resources to ${bundledResourcesPath}`) fs.copySync( path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), path.join(bundledResourcesPath, 'app', 'apm'), @@ -69,7 +69,7 @@ function copyNonASARResources (packagedAppPath, bundledResourcesPath) { fs.copySync(path.join('resources', 'win', 'apm.sh'), path.join(bundledResourcesPath, 'cli', 'apm.sh')) } - console.log(`Writing LICENSE.md to ${bundledResourcesPath}...`) + console.log(`Writing LICENSE.md to ${bundledResourcesPath}`) return getLicenseText().then((licenseText) => { fs.writeFileSync(path.join(bundledResourcesPath, 'LICENSE.md'), licenseText) }) @@ -78,7 +78,7 @@ function copyNonASARResources (packagedAppPath, bundledResourcesPath) { function setAtomHelperVersion (packagedAppPath) { const frameworksPath = path.join(packagedAppPath, 'Contents', 'Frameworks') const helperPListPath = path.join(frameworksPath, 'Atom Helper.app', 'Contents', 'Info.plist') - console.log(`Setting Atom Helper Version for ${helperPListPath}...`) + console.log(`Setting Atom Helper Version for ${helperPListPath}`) childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleVersion', CONFIG.appMetadata.version, helperPListPath]) childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleShortVersionString', CONFIG.appMetadata.version, helperPListPath]) } diff --git a/script/lib/transpile-babel-paths.js b/script/lib/transpile-babel-paths.js index 51d243991..befea7eec 100644 --- a/script/lib/transpile-babel-paths.js +++ b/script/lib/transpile-babel-paths.js @@ -17,7 +17,7 @@ const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.l const BUFFER = Buffer(PREFIX_LENGTH) module.exports = function () { - console.log(`Transpiling Babel paths in ${CONFIG.intermediateAppPath}...`) + console.log(`Transpiling Babel paths in ${CONFIG.intermediateAppPath}`) for (let path of getPathsToTranspile()) { if (usesBabel(path)) { transpileBabelPath(path) diff --git a/script/lib/transpile-coffee-script-paths.js b/script/lib/transpile-coffee-script-paths.js index b832c1c2e..04820840c 100644 --- a/script/lib/transpile-coffee-script-paths.js +++ b/script/lib/transpile-coffee-script-paths.js @@ -8,7 +8,7 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log(`Transpiling CoffeeScript paths in ${CONFIG.intermediateAppPath}...`) + console.log(`Transpiling CoffeeScript paths in ${CONFIG.intermediateAppPath}`) for (let path of getPathsToTranspile()) { transpileCoffeeScriptPath(path) } diff --git a/script/lib/transpile-cson-paths.js b/script/lib/transpile-cson-paths.js index 524ae544c..2c1a4196e 100644 --- a/script/lib/transpile-cson-paths.js +++ b/script/lib/transpile-cson-paths.js @@ -8,7 +8,7 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log(`Transpiling CSON paths in ${CONFIG.intermediateAppPath}...`) + console.log(`Transpiling CSON paths in ${CONFIG.intermediateAppPath}`) for (let path of getPathsToTranspile()) { transpileCsonPath(path) } diff --git a/script/lib/transpile-peg-js-paths.js b/script/lib/transpile-peg-js-paths.js index 10ef50a9b..b3b68ba59 100644 --- a/script/lib/transpile-peg-js-paths.js +++ b/script/lib/transpile-peg-js-paths.js @@ -8,7 +8,7 @@ const path = require('path') const CONFIG = require('../config') module.exports = function () { - console.log(`Transpiling PEG.js paths in ${CONFIG.intermediateAppPath}...`) + console.log(`Transpiling PEG.js paths in ${CONFIG.intermediateAppPath}`) for (let path of getPathsToTranspile()) { transpilePegJsPath(path) } diff --git a/script/test b/script/test index 106450a29..05509d755 100755 --- a/script/test +++ b/script/test @@ -21,7 +21,7 @@ function runCoreMainProcessTests (callback) { '--test', '--main-process', testPath ] - console.log('Executing core main process tests...'.bold.green) + console.log('Executing core main process tests'.bold.green) const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit'}) cp.on('error', error => { callback(error) }) cp.on('close', exitCode => { callback(null, exitCode) }) @@ -34,7 +34,7 @@ function runCoreRenderProcessTests (callback) { '--test', testPath ] - console.log('Executing core render process tests...'.bold.green) + console.log('Executing core render process tests'.bold.green) const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit'}) cp.on('error', error => { callback(error) }) cp.on('close', exitCode => { callback(null, exitCode) }) @@ -52,7 +52,7 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) { '--test', packageSpecDirPath ] - console.log(`Executing ${packageName} tests...`.bold.green) + console.log(`Executing ${packageName} tests`.bold.green) const cp = childProcess.spawn(executablePath, testArguments) let stderrOutput = '' cp.stderr.on('data', data => stderrOutput += data) From 56ceb40dde7b67e7de438ee2c04e216470bd26a0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 15:22:54 +0200 Subject: [PATCH 112/221] :art: --- script/lib/create-windows-installer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index 025906ae8..8082e717d 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -1,15 +1,19 @@ +'use strict' + const downloadCertificate = require('./download-github-raw-file') const electronInstaller = require('electron-winstaller') const fs = require('fs-extra') const os = require('os') const path = require('path') +const CONFIG = require('../config') + module.exports = function (packagedAppPath, codeSign) { console.log(`Creating Windows Installer for ${packagedAppPath}`) const options = { appDirectory: packagedAppPath, authors: 'GitHub Inc.', - iconUrl: `https://raw.githubusercontent.com/atom/atom/master/resources/app-icons/${CONFIG.channel}/atom.ico` + iconUrl: `https://raw.githubusercontent.com/atom/atom/master/resources/app-icons/${CONFIG.channel}/atom.ico`, loadingGif: path.join(CONFIG.repositoryRootPath, 'resources', 'win', 'loading.gif'), outputDirectory: CONFIG.buildOutputPath, remoteReleases: `https://atom.io/api/updates?version=${CONFIG.appMetadata.version}`, From 33d9f1a5efe5b84c6171cb1e1d611bab44d21b10 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 15:29:18 +0200 Subject: [PATCH 113/221] Fix artifact zipping on CircleCI --- circle.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index 7a8f487c3..77fb547b8 100644 --- a/circle.yml +++ b/circle.yml @@ -25,10 +25,8 @@ dependencies: - script/build --code-sign post: - - cd out - - zip -r ./atom-mac.zip ./Atom.app - - zip -r ./atom-mac-symbols.zip ./symbols - - cd - + - cd out && zip -r ./atom-mac.zip ./Atom.app + - cd out && zip -r ./atom-mac-symbols.zip ./symbols cache_directories: - cache From a9fbc0e3ed613109f99ad7a1d2d9a98031ec6141 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 15:34:20 +0200 Subject: [PATCH 114/221] Add missing requires and statements --- script/lib/create-windows-installer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index 8082e717d..7249e4873 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -1,6 +1,6 @@ 'use strict' -const downloadCertificate = require('./download-github-raw-file') +const downloadGithubRawFile = require('./download-github-raw-file') const electronInstaller = require('electron-winstaller') const fs = require('fs-extra') const os = require('os') @@ -20,15 +20,15 @@ module.exports = function (packagedAppPath, codeSign) { setupIcon: path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico') } - if (codeSign && WIN_P12KEY_URL) { + if (codeSign && process.env.WIN_P12KEY_URL) { const certPath = path.join(os.tmpdir(), 'win.p12') - downloadGithubRawFile(WIN_P12KEY_URL, certPath) + downloadGithubRawFile(process.env.WIN_P12KEY_URL, certPath) const deleteCertificate = function () { console.log(`Deleting certificate at ${certPath}`) fs.removeSync(certPath) } options.certificateFile = certPath - options.certificatePassword = WIN_P12KEY_PASSWORD + options.certificatePassword = process.env.WIN_P12KEY_PASSWORD return electronInstaller.createWindowsInstaller(options).then(deleteCertificate, deleteCertificate) } else { console.log('Skipping code-signing. Specify the --code-sign option and provide a WIN_P12KEY_URL environment variable to perform code-signing'.gray) From c689478d4909db733432a059fcffa220a5cf446d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 15:47:51 +0200 Subject: [PATCH 115/221] Fix running tests on macOS --- script/test | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/test b/script/test index 05509d755..e802c2f04 100755 --- a/script/test +++ b/script/test @@ -10,8 +10,9 @@ const path = require('path') const CONFIG = require('./config') -const packagedAppPath = path.resolve(__dirname, '..', 'out', 'Atom-darwin-x64') -const executablePath = path.join(packagedAppPath, 'Atom.app', 'Contents', 'MacOS', 'Atom') +const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' +const packagedAppPath = path.resolve(__dirname, '..', 'out', `${appName}.app`) +const executablePath = path.join(packagedAppPath, 'Contents', 'MacOS', appName) const resourcePath = CONFIG.repositoryRootPath function runCoreMainProcessTests (callback) { From 0b4d37a6c047ac4dd99314d695d875d52ac11c80 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 16:02:57 +0200 Subject: [PATCH 116/221] Publish all artifacts --- appveyor.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 430bed43d..4e1d71a6b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -33,10 +33,13 @@ build_script: test: off deploy: off artifacts: - - path: out\**\AtomSetup.exe + - path: out\AtomSetup.exe name: AtomSetup.exe - - path: out\**\AtomSetup.msi + - path: out\AtomSetup.msi name: AtomSetup.msi + - path: out\RELEASES + name: RELEASES + - path: out\*.nupkg cache: - '%APPVEYOR_BUILD_FOLDER%\script\node_modules' From 71a606ab3e96fc4baf2aae9b20e8e90ff0c7175c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 16:07:17 +0200 Subject: [PATCH 117/221] Manually set title when running electron-winstaller --- script/lib/create-windows-installer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index 7249e4873..6733b52e9 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -17,7 +17,8 @@ module.exports = function (packagedAppPath, codeSign) { loadingGif: path.join(CONFIG.repositoryRootPath, 'resources', 'win', 'loading.gif'), outputDirectory: CONFIG.buildOutputPath, remoteReleases: `https://atom.io/api/updates?version=${CONFIG.appMetadata.version}`, - setupIcon: path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico') + setupIcon: path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico'), + title: CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' } if (codeSign && process.env.WIN_P12KEY_URL) { From 61f4c9fceb6742fe882bde1c66b4ea9b4bfa6e6c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 16:15:35 +0200 Subject: [PATCH 118/221] :art: --- script/lib/create-windows-installer.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index 6733b52e9..a29352e1a 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -9,7 +9,6 @@ const path = require('path') const CONFIG = require('../config') module.exports = function (packagedAppPath, codeSign) { - console.log(`Creating Windows Installer for ${packagedAppPath}`) const options = { appDirectory: packagedAppPath, authors: 'GitHub Inc.', @@ -24,15 +23,18 @@ module.exports = function (packagedAppPath, codeSign) { if (codeSign && process.env.WIN_P12KEY_URL) { const certPath = path.join(os.tmpdir(), 'win.p12') downloadGithubRawFile(process.env.WIN_P12KEY_URL, certPath) - const deleteCertificate = function () { + options.certificateFile = certPath + options.certificatePassword = process.env.WIN_P12KEY_PASSWORD + } else { + console.log('Skipping code-signing. Specify the --code-sign option and provide a WIN_P12KEY_URL environment variable to perform code-signing'.gray) + } + + const deleteCertificate = function () { + if (fs.existsSync(certPath)) { console.log(`Deleting certificate at ${certPath}`) fs.removeSync(certPath) } - options.certificateFile = certPath - options.certificatePassword = process.env.WIN_P12KEY_PASSWORD - return electronInstaller.createWindowsInstaller(options).then(deleteCertificate, deleteCertificate) - } else { - console.log('Skipping code-signing. Specify the --code-sign option and provide a WIN_P12KEY_URL environment variable to perform code-signing'.gray) - return electronInstaller.createWindowsInstaller(options) } + console.log(`Creating Windows Installer for ${packagedAppPath}`) + return electronInstaller.createWindowsInstaller(options).then(deleteCertificate, deleteCertificate) } From aa5ce7cf8c1a8edd145a9e6e52c4c4eff0a00841 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 16:32:27 +0200 Subject: [PATCH 119/221] Give Nupkg artifacts a name --- appveyor.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4e1d71a6b..0c5f1f3c1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,7 +39,10 @@ artifacts: name: AtomSetup.msi - path: out\RELEASES name: RELEASES - - path: out\*.nupkg + - path: out\atom-*-delta.nupkg + name: atom-delta.nupkg + - path: out\atom-*-full.nupkg + name: atom-full.nupkg cache: - '%APPVEYOR_BUILD_FOLDER%\script\node_modules' From 74a95dceb0de5632870bf53bb1ba8282a1beafa5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 16:35:27 +0200 Subject: [PATCH 120/221] Remove unnecessary build steps on appveyor.yml --- appveyor.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0c5f1f3c1..5d2fbdb74 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,9 +18,6 @@ environment: - NODE_VERSION: 4.4.5 install: - - choco install curl - - |- # this weird literal syntax allows a : on the next line - curl --insecure --header "Accept: application/vnd.github.v3.raw" %WIN_P12KEY_URL% > %WIN_P12KEY_PATH% - SET PATH=C:\Program Files\Atom\resources\cli;%PATH% - ps: Install-Product node $env:NODE_VERSION $env:PLATFORM - npm install -g npm From f1b3fc470575255d0440e0bdc9fcca0f0229bca5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 8 Aug 2016 16:45:46 +0200 Subject: [PATCH 121/221] Always assign certPath --- script/lib/create-windows-installer.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index a29352e1a..32f647ca9 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -16,12 +16,11 @@ module.exports = function (packagedAppPath, codeSign) { loadingGif: path.join(CONFIG.repositoryRootPath, 'resources', 'win', 'loading.gif'), outputDirectory: CONFIG.buildOutputPath, remoteReleases: `https://atom.io/api/updates?version=${CONFIG.appMetadata.version}`, - setupIcon: path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico'), - title: CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' + setupIcon: path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico') } + const certPath = path.join(os.tmpdir(), 'win.p12') if (codeSign && process.env.WIN_P12KEY_URL) { - const certPath = path.join(os.tmpdir(), 'win.p12') downloadGithubRawFile(process.env.WIN_P12KEY_URL, certPath) options.certificateFile = certPath options.certificatePassword = process.env.WIN_P12KEY_PASSWORD From 4a5ccf1c4dcdd110ca76a954e8c99c27457f20b5 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 8 Aug 2016 12:52:01 -0600 Subject: [PATCH 122/221] Pass Windows-specific info to electron-packager --- script/lib/package-application.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 62317754d..954589ab1 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -16,6 +16,7 @@ module.exports = function () { return runPackager({ 'app-version': CONFIG.appMetadata.version, 'app-bundle-id': 'com.github.atom', + 'app-copyright': `Copyright (C) ${(new Date()).getFullYear()} GitHub, Inc. All rights reserved`, 'arch': process.arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, 'build-version': CONFIG.appMetadata.version, @@ -27,7 +28,12 @@ module.exports = function () { 'out': CONFIG.buildOutputPath, 'overwrite': true, 'platform': process.platform, - 'version': CONFIG.appMetadata.electronVersion + 'version': CONFIG.appMetadata.electronVersion, + 'version-string': { + CompanyName: 'GitHub, Inc.', + FileDescription: 'Atom', + ProductName: 'Atom', + } }).then((packagedAppPath) => { let bundledResourcesPath if (process.platform === 'darwin') { From 886faf237da18e823741d7b9cdf0cf85aa91368e Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Mon, 8 Aug 2016 14:34:56 -0700 Subject: [PATCH 123/221] :hammer: Apply filter to dirs as well as files --- script/lib/copy-assets.js | 6 ++-- script/lib/copy-sync.js | 50 +++++++++++++++++++++++++++++++ script/lib/install-application.js | 3 +- script/lib/package-application.js | 19 ++++++------ 4 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 script/lib/copy-sync.js diff --git a/script/lib/copy-assets.js b/script/lib/copy-assets.js index 3c33ad13a..2ddcbe937 100644 --- a/script/lib/copy-assets.js +++ b/script/lib/copy-assets.js @@ -4,7 +4,7 @@ 'use strict' const path = require('path') -const fs = require('fs-extra') +const copySync = require('./copy-sync') const CONFIG = require('../config') const glob = require('glob') const includePathInPackagedApp = require('./include-path-in-packaged-app') @@ -22,10 +22,10 @@ module.exports = function () { ] srcPaths = srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')})) for (let srcPath of srcPaths) { - fs.copySync(srcPath, computeDestinationPath(srcPath), {filter: includePathInPackagedApp}) + copySync(srcPath, computeDestinationPath(srcPath), {filter: includePathInPackagedApp}) } - fs.copySync( + copySync( path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), path.join(CONFIG.intermediateAppPath, 'resources', 'atom.png') ) diff --git a/script/lib/copy-sync.js b/script/lib/copy-sync.js new file mode 100644 index 000000000..67e988c4e --- /dev/null +++ b/script/lib/copy-sync.js @@ -0,0 +1,50 @@ +'use strict' + +const fs = require('fs-extra') +const path = require('path') + +module.exports = copySync + +function copySync(src, dest, options) { + options = options || {} + options.filter = options.filter || () => true + + const destFolder = path.dirname(dest) + const stat = fs.statSync(src) + + if (options.filter(src)) { + if (stat.isFile()) { + if (!fs.existsSync(destFolder)) fs.mkdirsSync(destFolder) + copyFileSync(src, dest, options) + } else if (stat.isDirectory()) { + fs.readdirSync(src).forEach(content => { + copySync(path.join(src, content), path.join(dest, content), options) + }) + } + } +} + +const BUF_LENGTH = 4096 +const _buff = new Buffer(BUF_LENGTH) + +function copyFileSync(srcFile, destFile) { + if (fs.existsSync(destFile)) { + fs.chmodSync(destFile, parseInt('777', 8)) + fs.unlinkSync(destFile) + } + + const fileRead = fs.openSync(srcFile, 'r') + const stat = fs.fstatSync(fileRead) + const fileWrite = fs.openSync(destFile, 'w', stat.mode) + let bytesRead = 1 + let pos = 0 + + while (bytesRead > 0) { + bytesRead = fs.readSync(fileRead, _buff, 0, BUF_LENGTH, pos) + fs.writeSync(fileWrite, _buff, 0, bytesRead) + pos += bytesRead + } + + fs.closeSync(fileRead) + fs.closeSync(fileWrite) +} diff --git a/script/lib/install-application.js b/script/lib/install-application.js index 5852e6604..bc6654050 100644 --- a/script/lib/install-application.js +++ b/script/lib/install-application.js @@ -1,5 +1,6 @@ 'use strict' +const copySync = require('./copy-sync') const fs = require('fs-extra') const path = require('path') @@ -12,7 +13,7 @@ module.exports = function (packagedAppPath) { fs.removeSync(installationDirPath) } console.log(`Installing ${packagedAppPath} at ${installationDirPath}`) - fs.copySync(packagedAppPath, installationDirPath) + copySync(packagedAppPath, installationDirPath) } else { throw new Error("Not implemented yet.") } diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 954589ab1..cd52c3e97 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -1,6 +1,7 @@ 'use strict' const assert = require('assert') +const copySync = require('./copy-sync') const fs = require('fs-extra') const path = require('path') const childProcess = require('child_process') @@ -52,7 +53,7 @@ module.exports = function () { function copyNonASARResources (packagedAppPath, bundledResourcesPath) { console.log(`Copying non-ASAR resources to ${bundledResourcesPath}`) - fs.copySync( + copySync( path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), path.join(bundledResourcesPath, 'app', 'apm'), {filter: includePathInPackagedApp} @@ -61,18 +62,18 @@ function copyNonASARResources (packagedAppPath, bundledResourcesPath) { // Existing symlinks on user systems point to an outdated path, so just symlink it to the real location of the apm binary. // TODO: Change command installer to point to appropriate path and remove this fallback after a few releases. fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(bundledResourcesPath, 'app', 'apm', 'node_modules', '.bin', 'apm')) - fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledResourcesPath, 'app', 'atom.sh')) + copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledResourcesPath, 'app', 'atom.sh')) } if (process.platform === 'darwin') { - fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'file.icns'), path.join(bundledResourcesPath, 'file.icns')) + copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'file.icns'), path.join(bundledResourcesPath, 'file.icns')) } else if (process.platform === 'linux') { - fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), path.join(packagedAppPath, 'atom.png')) + copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), path.join(packagedAppPath, 'atom.png')) } else if (process.platform === 'win32') { - fs.copySync(path.join('resources', 'win', 'atom.cmd'), path.join(bundledResourcesPath, 'cli', 'atom.cmd')) - fs.copySync(path.join('resources', 'win', 'atom.sh'), path.join(bundledResourcesPath, 'cli', 'atom.sh')) - fs.copySync(path.join('resources', 'win', 'atom.js'), path.join(bundledResourcesPath, 'cli', 'atom.js')) - fs.copySync(path.join('resources', 'win', 'apm.cmd'), path.join(bundledResourcesPath, 'cli', 'apm.cmd')) - fs.copySync(path.join('resources', 'win', 'apm.sh'), path.join(bundledResourcesPath, 'cli', 'apm.sh')) + copySync(path.join('resources', 'win', 'atom.cmd'), path.join(bundledResourcesPath, 'cli', 'atom.cmd')) + copySync(path.join('resources', 'win', 'atom.sh'), path.join(bundledResourcesPath, 'cli', 'atom.sh')) + copySync(path.join('resources', 'win', 'atom.js'), path.join(bundledResourcesPath, 'cli', 'atom.js')) + copySync(path.join('resources', 'win', 'apm.cmd'), path.join(bundledResourcesPath, 'cli', 'apm.cmd')) + copySync(path.join('resources', 'win', 'apm.sh'), path.join(bundledResourcesPath, 'cli', 'apm.sh')) } console.log(`Writing LICENSE.md to ${bundledResourcesPath}`) From 56e6bc64e7a6321844839e63a4adfba1ffd6e4bb Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Mon, 8 Aug 2016 14:47:17 -0700 Subject: [PATCH 124/221] :hammer: Windows Clean command --- script/clean.cmd | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 script/clean.cmd diff --git a/script/clean.cmd b/script/clean.cmd new file mode 100644 index 000000000..44a79e1af --- /dev/null +++ b/script/clean.cmd @@ -0,0 +1,5 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\clean" %* +) ELSE ( + node "%~dp0\clean" %* +) From 985edcc50f2183bfad3d8dfb62ff8db7c54edc2e Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 8 Aug 2016 14:07:47 -0600 Subject: [PATCH 125/221] :art: Copyright --- script/lib/package-application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index cd52c3e97..c9986d43f 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -17,7 +17,7 @@ module.exports = function () { return runPackager({ 'app-version': CONFIG.appMetadata.version, 'app-bundle-id': 'com.github.atom', - 'app-copyright': `Copyright (C) ${(new Date()).getFullYear()} GitHub, Inc. All rights reserved`, + 'app-copyright': `Copyright © 2014-${(new Date()).getFullYear()} GitHub, Inc. All rights reserved.`, 'arch': process.arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, 'build-version': CONFIG.appMetadata.version, From 13b2abf29914942523e6da6f90476b210fae3d83 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 8 Aug 2016 22:08:40 -0600 Subject: [PATCH 126/221] Hard code build architecture to ia32 on Windows, x64 on other platforms --- script/lib/package-application.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index c9986d43f..832fe0b79 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -13,12 +13,13 @@ const CONFIG = require('../config') module.exports = function () { const appName = getAppName() + const arch = process.platform === 'win32' ? 'ia32' : 'x64' console.log(`Running electron-packager on ${CONFIG.intermediateAppPath} with app name "${appName}"`) return runPackager({ 'app-version': CONFIG.appMetadata.version, 'app-bundle-id': 'com.github.atom', 'app-copyright': `Copyright © 2014-${(new Date()).getFullYear()} GitHub, Inc. All rights reserved.`, - 'arch': process.arch, + 'arch': arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, 'build-version': CONFIG.appMetadata.version, 'download': {cache: CONFIG.cachePath}, From 31227ddc5525b41f7c24d78460e7c57e97812937 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 Aug 2016 11:38:06 +0200 Subject: [PATCH 127/221] Don't delete keymaps, package.json and menus when generating metadata --- script/lib/generate-metadata.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/script/lib/generate-metadata.js b/script/lib/generate-metadata.js index 842163b02..d54d9f44a 100644 --- a/script/lib/generate-metadata.js +++ b/script/lib/generate-metadata.js @@ -61,12 +61,8 @@ function buildBundledPackagesMetadata () { if (packageKeymapPath.endsWith('.cson') || packageKeymapPath.endsWith('.json')) { const relativePath = path.relative(CONFIG.intermediateAppPath, packageKeymapPath) packageNewMetadata.keymaps[relativePath] = CSON.readFileSync(packageKeymapPath) - fs.removeSync(packageKeymapPath) } } - if (fs.readdirSync(packageKeymapsPath).length === 0) { - fs.removeSync(packageKeymapsPath) - } } const packageMenusPath = path.join(packagePath, 'menus') @@ -76,12 +72,8 @@ function buildBundledPackagesMetadata () { if (packageMenuPath.endsWith('.cson') || packageMenuPath.endsWith('.json')) { const relativePath = path.relative(CONFIG.intermediateAppPath, packageMenuPath) packageNewMetadata.menus[relativePath] = CSON.readFileSync(packageMenuPath) - fs.removeSync(packageMenuPath) } } - if (fs.readdirSync(packageMenusPath).length === 0) { - fs.removeSync(packageMenusPath) - } } packages[packageMetadata.name] = packageNewMetadata @@ -93,8 +85,6 @@ function buildBundledPackagesMetadata () { } } } - - fs.removeSync(packageMetadataPath) } return packages } From 565a7dd1e133a0c0f5f5719d51ba17acb9ff38fb Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 Aug 2016 12:01:11 +0200 Subject: [PATCH 128/221] Remove speakasy.pem from resources/mac/atom-Info.plist --- resources/mac/atom-Info.plist | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/mac/atom-Info.plist b/resources/mac/atom-Info.plist index e6dbdb8a2..c22653622 100644 --- a/resources/mac/atom-Info.plist +++ b/resources/mac/atom-Info.plist @@ -34,8 +34,6 @@ AtomApplication NSSupportsAutomaticGraphicsSwitching - SUPublicDSAKeyFile - speakeasy.pem SUScheduledCheckInterval 3600 CFBundleURLTypes From 2db3ee9ee9b15f5c3a6e7f67a90ee8f693d56c1b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 Aug 2016 12:01:26 +0200 Subject: [PATCH 129/221] Associate file extensions on darwin --- script/lib/package-application.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 832fe0b79..e29798cb4 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -16,14 +16,15 @@ module.exports = function () { const arch = process.platform === 'win32' ? 'ia32' : 'x64' console.log(`Running electron-packager on ${CONFIG.intermediateAppPath} with app name "${appName}"`) return runPackager({ - 'app-version': CONFIG.appMetadata.version, 'app-bundle-id': 'com.github.atom', 'app-copyright': `Copyright © 2014-${(new Date()).getFullYear()} GitHub, Inc. All rights reserved.`, + 'app-version': CONFIG.appMetadata.version, 'arch': arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, 'build-version': CONFIG.appMetadata.version, 'download': {cache: CONFIG.cachePath}, 'dir': CONFIG.intermediateAppPath, + 'extend-info': path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'atom-Info.plist'), 'helper-bundle-id': 'com.github.atom.helper', 'icon': getIcon(), 'name': appName, @@ -32,9 +33,9 @@ module.exports = function () { 'platform': process.platform, 'version': CONFIG.appMetadata.electronVersion, 'version-string': { - CompanyName: 'GitHub, Inc.', - FileDescription: 'Atom', - ProductName: 'Atom', + 'CompanyName': 'GitHub, Inc.', + 'FileDescription': 'Atom', + 'ProductName': 'Atom' } }).then((packagedAppPath) => { let bundledResourcesPath From 6d803ed3a413bce2c3b7b3f0d53af84d1f393528 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 Aug 2016 13:28:59 +0200 Subject: [PATCH 130/221] Compress artifacts when passing --compress-artifacts to script/build --- .travis.yml | 5 ++-- appveyor.yml | 4 ++- circle.yml | 6 +--- script/build | 7 +++++ script/lib/compress-artifacts.js | 47 ++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 script/lib/compress-artifacts.js diff --git a/.travis.yml b/.travis.yml index 6f1db0c3d..860391fbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,10 +25,9 @@ install: - nvm use --delete-prefix $NODE_VERSION - npm install -g npm - script/bootstrap - - script/build + - script/build --compress-artifacts -script: - - echo 'Run tests at some point.' +script: false cache: directories: diff --git a/appveyor.yml b/appveyor.yml index 5d2fbdb74..c07f722a7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,7 +25,7 @@ install: build_script: - cd %APPVEYOR_BUILD_FOLDER% - script\bootstrap.cmd - - script\build.cmd --code-sign + - script\build.cmd --code-sign --compress-artifacts test: off deploy: off @@ -34,6 +34,8 @@ artifacts: name: AtomSetup.exe - path: out\AtomSetup.msi name: AtomSetup.msi + - path: out\atom-windows.zip + name: atom-windows.zip - path: out\RELEASES name: RELEASES - path: out\atom-*-delta.nupkg diff --git a/circle.yml b/circle.yml index 77fb547b8..fd26601f0 100644 --- a/circle.yml +++ b/circle.yml @@ -22,11 +22,7 @@ dependencies: override: - script/bootstrap - - script/build --code-sign - - post: - - cd out && zip -r ./atom-mac.zip ./Atom.app - - cd out && zip -r ./atom-mac-symbols.zip ./symbols + - script/build --code-sign --compress-artifacts cache_directories: - cache diff --git a/script/build b/script/build index c43472171..e8a817ec0 100755 --- a/script/build +++ b/script/build @@ -9,6 +9,7 @@ require('colors') const argv = require('yargs').argv const cleanOutputDirectory = require('./lib/clean-output-directory') const codeSignOnMac = require('./lib/code-sign-on-mac') +const compressArtifacts = require('./lib/compress-artifacts') const copyAssets = require('./lib/copy-assets') const createWindowsInstaller = require('./lib/create-windows-installer') const dumpSymbols = require('./lib/dump-symbols') @@ -52,6 +53,12 @@ dumpSymbols() return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) } }).then(packagedAppPath => { + if (argv.compressArtifacts) { + compressArtifacts(packagedAppPath) + } else { + console.log('Skipping artifacts compression. Specify the --compress-artifacts option to compress Atom binaries (and symbols on macOS)'.gray) + } + if (argv.install) { installApplication(packagedAppPath) } else { diff --git a/script/lib/compress-artifacts.js b/script/lib/compress-artifacts.js new file mode 100644 index 000000000..3552d050d --- /dev/null +++ b/script/lib/compress-artifacts.js @@ -0,0 +1,47 @@ +'use strict' + +const childProcess = require('child_process') +const fs = require('fs-extra') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function (packagedAppPath) { + let appArchiveName + if (process.platform === 'darwin') { + appArchiveName = 'atom-mac.zip' + } else if (process.platform === 'win32') { + appArchiveName = 'atom-windows.zip' + } else { + appArchiveName = 'atom-amd64.tar.gz' + } + const appArchivePath = path.join(CONFIG.buildOutputPath, appArchiveName) + compress(packagedAppPath, appArchivePath) + + if (process.platform === 'darwin') { + const symbolsArchivePath = path.join(CONFIG.buildOutputPath, 'atom-mac-symbols.zip') + compress(CONFIG.symbolsPath, symbolsArchivePath) + } +} + +function compress (inputDirPath, outputArchivePath) { + if (fs.existsSync(outputArchivePath)) { + console.log(`Deleting "${outputArchivePath}"`) + fs.removeSync(outputArchivePath) + } + + console.log(`Compressing "${inputDirPath}" to "${outputArchivePath}"`) + let compressCommand, compressArguments + if (process.platform === 'darwin') { + compressCommand = 'zip' + compressArguments = ['-r', '--symlinks'] + } else if (process.platform === 'win32') { + compressCommand = '7z.exe' + compressArguments = ['a', '-r'] + } else { + compressCommand = 'tar' + compressArguments = ['caf'] + } + compressArguments.push(outputArchivePath, path.basename(inputDirPath)) + childProcess.spawnSync(compressCommand, compressArguments, {cwd: path.dirname(inputDirPath)}) +} From e364ec182598387cfc68d8cd80dbcdb30b0f8e82 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 Aug 2016 14:20:32 +0200 Subject: [PATCH 131/221] Skip copying files or directories that don't exist --- script/lib/copy-sync.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/script/lib/copy-sync.js b/script/lib/copy-sync.js index 67e988c4e..c86555343 100644 --- a/script/lib/copy-sync.js +++ b/script/lib/copy-sync.js @@ -6,21 +6,25 @@ const path = require('path') module.exports = copySync function copySync(src, dest, options) { - options = options || {} - options.filter = options.filter || () => true + if (fs.existsSync(src)) { + options = options || {} + options.filter = options.filter || () => true - const destFolder = path.dirname(dest) - const stat = fs.statSync(src) + const destFolder = path.dirname(dest) + const stat = fs.statSync(src) - if (options.filter(src)) { - if (stat.isFile()) { - if (!fs.existsSync(destFolder)) fs.mkdirsSync(destFolder) - copyFileSync(src, dest, options) - } else if (stat.isDirectory()) { - fs.readdirSync(src).forEach(content => { - copySync(path.join(src, content), path.join(dest, content), options) - }) + if (options.filter(src)) { + if (stat.isFile()) { + if (!fs.existsSync(destFolder)) fs.mkdirsSync(destFolder) + copyFileSync(src, dest, options) + } else if (stat.isDirectory()) { + fs.readdirSync(src).forEach(content => { + copySync(path.join(src, content), path.join(dest, content), options) + }) + } } + } else { + console.log(`Skipping copy of "${src}" because it doesn't exist`.gray) } } From ae8801ad6210e0da96ed8f74c6540179b44cb36b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 Aug 2016 14:23:46 +0200 Subject: [PATCH 132/221] Add missing return --- script/build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/build b/script/build index e8a817ec0..a6fc2d9d1 100755 --- a/script/build +++ b/script/build @@ -51,6 +51,8 @@ dumpSymbols() return Promise.resolve(packagedAppPath) } else if (process.platform === 'win32') { return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) + } else { + return Promise.resolve(packagedAppPath) } }).then(packagedAppPath => { if (argv.compressArtifacts) { From c0857b611ea3f76f9b58d4375a9bdf10a2e200b7 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 9 Aug 2016 16:12:46 -0600 Subject: [PATCH 133/221] Log windows installer creation errors --- script/lib/create-windows-installer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index 32f647ca9..077537ef3 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -35,5 +35,8 @@ module.exports = function (packagedAppPath, codeSign) { } } console.log(`Creating Windows Installer for ${packagedAppPath}`) - return electronInstaller.createWindowsInstaller(options).then(deleteCertificate, deleteCertificate) + return electronInstaller.createWindowsInstaller(options).then(deleteCertificate, function (error) { + console.log(`Windows installer creation failed:\n${error}`) + deleteCertificate() + }) } From 54d2f000b386c5647e9ca1fa8cdaba5059a67c84 Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Wed, 10 Aug 2016 13:15:03 -0700 Subject: [PATCH 134/221] :arrow_up: electron-winstaller to 2.3.4 --- script/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/package.json b/script/package.json index fe26df694..0c3181342 100644 --- a/script/package.json +++ b/script/package.json @@ -8,7 +8,7 @@ "colors": "1.1.2", "donna": "1.0.13", "electron-packager": "7.3.0", - "electron-winstaller": "^2.3.3", + "electron-winstaller": "^2.3.4", "fs-extra": "0.30.0", "glob": "7.0.3", "joanna": "0.0.6", From 3b1d98e4f1386711f0c14b5934bc77996d40957b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 11 Aug 2016 10:52:31 +0200 Subject: [PATCH 135/221] Use a fixed version of electron-winstaller and sync-request --- script/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/package.json b/script/package.json index 0c3181342..c23efd392 100644 --- a/script/package.json +++ b/script/package.json @@ -8,7 +8,7 @@ "colors": "1.1.2", "donna": "1.0.13", "electron-packager": "7.3.0", - "electron-winstaller": "^2.3.4", + "electron-winstaller": "2.3.4", "fs-extra": "0.30.0", "glob": "7.0.3", "joanna": "0.0.6", @@ -20,7 +20,7 @@ "pegjs": "0.9.0", "season": "5.3.0", "semver": "5.3.0", - "sync-request": "^3.0.1", + "sync-request": "3.0.1", "tello": "1.0.5", "yargs": "4.8.1" } From 65b0f7d70ff4f3f798cbcac3340eb7da05428925 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 11 Aug 2016 12:18:33 +0200 Subject: [PATCH 136/221] Rename cachePath to electronDownloadPath --- .gitignore | 3 +-- script/config.js | 4 ++-- script/lib/package-application.js | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d7006e284..3418c7f5d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,8 @@ debug.log /tags /atom-shell/ /out/ -/cache/ docs/output docs/includes spec/fixtures/evil-files/ out/ -electron/ +/electron/ diff --git a/script/config.js b/script/config.js index 9129dc8c3..26c05c217 100644 --- a/script/config.js +++ b/script/config.js @@ -13,7 +13,7 @@ const buildOutputPath = path.join(repositoryRootPath, 'out') const docsOutputPath = path.join(repositoryRootPath, 'docs', 'output') const intermediateAppPath = path.join(buildOutputPath, 'app') const symbolsPath = path.join(buildOutputPath, 'symbols') -const cachePath = path.join(repositoryRootPath, 'cache') +const electronDownloadPath = path.join(repositoryRootPath, 'electron') const homeDirPath = process.env.HOME || process.env.USERPROFILE const appMetadata = require(path.join(repositoryRootPath, 'package.json')) @@ -27,7 +27,7 @@ module.exports = { appMetadata, apmMetadata, channel, repositoryRootPath, apmRootPath, scriptRootPath, buildOutputPath, docsOutputPath, intermediateAppPath, symbolsPath, - cachePath, homeDirPath, + electronDownloadPath, homeDirPath, apmBinPath, npmBinPath } diff --git a/script/lib/package-application.js b/script/lib/package-application.js index e29798cb4..8551974aa 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -22,7 +22,7 @@ module.exports = function () { 'arch': arch, 'asar': {unpack: buildAsarUnpackGlobExpression()}, 'build-version': CONFIG.appMetadata.version, - 'download': {cache: CONFIG.cachePath}, + 'download': {cache: CONFIG.electronDownloadPath}, 'dir': CONFIG.intermediateAppPath, 'extend-info': path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'atom-Info.plist'), 'helper-bundle-id': 'com.github.atom.helper', From 3e42e65b0174fadcd28eb0009a0db762b144973a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 11 Aug 2016 12:19:25 +0200 Subject: [PATCH 137/221] Rename downloadGithubRawFile to downloadFileFromGithub --- script/lib/code-sign-on-mac.js | 4 ++-- script/lib/create-windows-installer.js | 4 ++-- ...wnload-github-raw-file.js => download-file-from-github.js} | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename script/lib/{download-github-raw-file.js => download-file-from-github.js} (85%) diff --git a/script/lib/code-sign-on-mac.js b/script/lib/code-sign-on-mac.js index 036466236..b7fa4831c 100644 --- a/script/lib/code-sign-on-mac.js +++ b/script/lib/code-sign-on-mac.js @@ -1,5 +1,5 @@ const childProcess = require('child_process') -const downloadGithubRawFile = require('./download-github-raw-file') +const downloadFileFromGithub = require('./download-file-from-github') const fs = require('fs-extra') const os = require('os') const path = require('path') @@ -12,7 +12,7 @@ module.exports = function (packagedAppPath) { try { const certPath = path.join(os.tmpdir(), 'mac.p12') - downloadGithubRawFile(process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL, certPath) + downloadFileFromGithub(process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL, certPath) console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) const unlockArgs = ['unlock-keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN] diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index 077537ef3..9d33afaf8 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -1,6 +1,6 @@ 'use strict' -const downloadGithubRawFile = require('./download-github-raw-file') +const downloadFileFromGithub = require('./download-file-from-github') const electronInstaller = require('electron-winstaller') const fs = require('fs-extra') const os = require('os') @@ -21,7 +21,7 @@ module.exports = function (packagedAppPath, codeSign) { const certPath = path.join(os.tmpdir(), 'win.p12') if (codeSign && process.env.WIN_P12KEY_URL) { - downloadGithubRawFile(process.env.WIN_P12KEY_URL, certPath) + downloadFileFromGithub(process.env.WIN_P12KEY_URL, certPath) options.certificateFile = certPath options.certificatePassword = process.env.WIN_P12KEY_PASSWORD } else { diff --git a/script/lib/download-github-raw-file.js b/script/lib/download-file-from-github.js similarity index 85% rename from script/lib/download-github-raw-file.js rename to script/lib/download-file-from-github.js index d26b34075..9a504e9f2 100644 --- a/script/lib/download-github-raw-file.js +++ b/script/lib/download-file-from-github.js @@ -2,7 +2,7 @@ const fs = require('fs-extra') const syncRequest = require('sync-request') module.exports = function (downloadURL, destinationPath) { - console.log(`Dowloading raw file from GitHub Repository to ${destinationPath}`) + console.log(`Dowloading file from GitHub Repository to ${destinationPath}`) const response = syncRequest('GET', downloadURL, { 'headers': {'Accept': 'application/vnd.github.v3.raw', 'User-Agent': 'Atom Build'} }) From 6f9a8208db85ce39c860fe676e81fa853392be79 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 11 Aug 2016 12:40:40 +0200 Subject: [PATCH 138/221] Download chromedriver and run integration tests --- circle.yml | 1 + script/lib/download-chromedriver.js | 56 ++++++++++++++++++++++++++++ script/test | 3 ++ spec/integration/startup-spec.coffee | 3 -- 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 script/lib/download-chromedriver.js diff --git a/circle.yml b/circle.yml index fd26601f0..fc9f44826 100644 --- a/circle.yml +++ b/circle.yml @@ -3,6 +3,7 @@ machine: XCODE_SCHEME: test XCODE_WORKSPACE: test XCODE_PROJECT: test + ATOM_INTEGRATION_TESTS_ENABLED: true xcode: version: 7.3 diff --git a/script/lib/download-chromedriver.js b/script/lib/download-chromedriver.js new file mode 100644 index 000000000..dd003db79 --- /dev/null +++ b/script/lib/download-chromedriver.js @@ -0,0 +1,56 @@ +'use strict' + +const assert = require('assert') +const childProcess = require('child_process') +const downloadFileFromGithub = require('./download-file-from-github') +const fs = require('fs-extra') +const path = require('path') +const semver = require('semver') +const syncRequest = require('sync-request') + +const CONFIG = require('../config') + +module.exports = function () { + if (process.platform === 'darwin') { + // Chromedriver is only distributed with the first patch release for any given + // major and minor version of electron. + const electronVersion = semver.parse(CONFIG.appMetadata.electronVersion) + const electronVersionWithChromedriver = `${electronVersion.major}.${electronVersion.minor}.0` + const electronAssets = getElectronAssetsForVersion(electronVersionWithChromedriver) + const chromedriverAssets = electronAssets.filter(e => /chromedriver.*darwin-x64/.test(e.name)) + assert(chromedriverAssets.length === 1, 'Found more than one chrome driver asset to download!') + const chromedriverAsset = chromedriverAssets[0] + + const chromedriverZipPath = path.join(CONFIG.electronDownloadPath, chromedriverAsset.name) + if (!fs.existsSync(chromedriverZipPath)) { + downloadFileFromGithub(chromedriverAsset.url, chromedriverZipPath) + } + + const chromedriverDirPath = path.join(CONFIG.electronDownloadPath, 'chromedriver') + unzipPath(chromedriverZipPath, chromedriverDirPath) + } else { + throw new Error('Downloading chromedriver for platforms other than macOS is unsupported!') + } +} + +function getElectronAssetsForVersion (version) { + const releaseURL = `https://api.github.com/repos/electron/electron/releases/tags/v${version}` + const response = syncRequest('GET', releaseURL, {'headers': {'User-Agent': 'Atom Build'}}) + + if (response.statusCode === 200) { + const release = JSON.parse(response.body) + return release.assets.map(a => { return {name: a.name, url: a.browser_download_url} }) + } else { + throw new Error(`Error getting assets for ${releaseURL}. HTTP Status ${response.statusCode}.`) + } +} + +function unzipPath (inputPath, outputPath) { + if (fs.existsSync(outputPath)) { + console.log(`Removing "${outputPath}"`) + fs.removeSync(outputPath) + } + + console.log(`Unzipping "${inputPath}" to "${outputPath}"`) + childProcess.spawnSync('unzip', [inputPath, '-d', outputPath]) +} diff --git a/script/test b/script/test index e802c2f04..42612afd2 100755 --- a/script/test +++ b/script/test @@ -5,6 +5,7 @@ require('colors') const async = require('async') const childProcess = require('child_process') +const downloadChromedriver = require('./lib/download-chromedriver') const fs = require('fs') const path = require('path') @@ -15,6 +16,8 @@ const packagedAppPath = path.resolve(__dirname, '..', 'out', `${appName}.app`) const executablePath = path.join(packagedAppPath, 'Contents', 'MacOS', appName) const resourcePath = CONFIG.repositoryRootPath +downloadChromedriver() + function runCoreMainProcessTests (callback) { const testPath = path.join(CONFIG.repositoryRootPath, 'spec', 'main-process') const testArguments = [ diff --git a/spec/integration/startup-spec.coffee b/spec/integration/startup-spec.coffee index b279f2072..fda46042c 100644 --- a/spec/integration/startup-spec.coffee +++ b/spec/integration/startup-spec.coffee @@ -2,9 +2,6 @@ # # ATOM_INTEGRATION_TESTS_ENABLED=true apm test return unless process.env.ATOM_INTEGRATION_TESTS_ENABLED -# Integration tests require a fast machine and, for now, we cannot afford to -# run them on Travis. -return if process.env.CI fs = require 'fs-plus' path = require 'path' From 6a99bb38bad587d37c730c9a718cdc9a323432d7 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 11 Aug 2016 12:44:40 +0200 Subject: [PATCH 139/221] Cache `electron` instead of `cache` on build providers --- .travis.yml | 2 +- appveyor.yml | 2 +- circle.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 860391fbe..ef18c51c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ script: false cache: directories: - - cache + - electron - node_modules - apm/node_modules - script/node_modules diff --git a/appveyor.yml b/appveyor.yml index c07f722a7..98a48e743 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -47,7 +47,7 @@ cache: - '%APPVEYOR_BUILD_FOLDER%\script\node_modules' - '%APPVEYOR_BUILD_FOLDER%\apm\node_modules' - '%APPVEYOR_BUILD_FOLDER%\node_modules' - - '%APPVEYOR_BUILD_FOLDER%\cache' + - '%APPVEYOR_BUILD_FOLDER%\electron' - '%USERPROFILE%\.atom\.apm' - '%USERPROFILE%\.atom\.node-gyp\.atom' - '%USERPROFILE%\.atom\.npm' diff --git a/circle.yml b/circle.yml index fc9f44826..4960a5044 100644 --- a/circle.yml +++ b/circle.yml @@ -26,7 +26,7 @@ dependencies: - script/build --code-sign --compress-artifacts cache_directories: - - cache + - electron - apm/node_modules - script/node_modules - node_modules From ff9fb6edcee06625419eca5567f24343099b1475 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 11 Aug 2016 12:54:30 +0200 Subject: [PATCH 140/221] Download Chromedriver during script/build ...so that we can cache it. --- script/build | 2 ++ script/lib/download-chromedriver.js | 2 +- script/test | 3 --- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/script/build b/script/build index a6fc2d9d1..8d0aafc47 100755 --- a/script/build +++ b/script/build @@ -12,6 +12,7 @@ const codeSignOnMac = require('./lib/code-sign-on-mac') const compressArtifacts = require('./lib/compress-artifacts') const copyAssets = require('./lib/copy-assets') const createWindowsInstaller = require('./lib/create-windows-installer') +const downloadChromedriver = require('./lib/download-chromedriver') const dumpSymbols = require('./lib/dump-symbols') const generateAPIDocs = require('./lib/generate-api-docs') const generateMetadata = require('./lib/generate-metadata') @@ -39,6 +40,7 @@ generateModuleCache() prebuildLessCache() generateMetadata() generateAPIDocs() +downloadChromedriver() dumpSymbols() .then(packageApplication) .then(packagedAppPath => { diff --git a/script/lib/download-chromedriver.js b/script/lib/download-chromedriver.js index dd003db79..57412908b 100644 --- a/script/lib/download-chromedriver.js +++ b/script/lib/download-chromedriver.js @@ -29,7 +29,7 @@ module.exports = function () { const chromedriverDirPath = path.join(CONFIG.electronDownloadPath, 'chromedriver') unzipPath(chromedriverZipPath, chromedriverDirPath) } else { - throw new Error('Downloading chromedriver for platforms other than macOS is unsupported!') + console.log('Skipping Chromedriver download because it is used only on macOS'.gray) } } diff --git a/script/test b/script/test index 42612afd2..e802c2f04 100755 --- a/script/test +++ b/script/test @@ -5,7 +5,6 @@ require('colors') const async = require('async') const childProcess = require('child_process') -const downloadChromedriver = require('./lib/download-chromedriver') const fs = require('fs') const path = require('path') @@ -16,8 +15,6 @@ const packagedAppPath = path.resolve(__dirname, '..', 'out', `${appName}.app`) const executablePath = path.join(packagedAppPath, 'Contents', 'MacOS', appName) const resourcePath = CONFIG.repositoryRootPath -downloadChromedriver() - function runCoreMainProcessTests (callback) { const testPath = path.join(CONFIG.repositoryRootPath, 'spec', 'main-process') const testArguments = [ From 6bd9d1e4bef624538196bd72caa11bf437846a28 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 11 Aug 2016 13:09:24 +0200 Subject: [PATCH 141/221] Install webdriver io in `script/package.json` So that we can control chromedriver without including that dependency in the final bundle. --- script/package.json | 3 ++- spec/integration/helpers/start-atom.coffee | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/script/package.json b/script/package.json index c23efd392..6fc974949 100644 --- a/script/package.json +++ b/script/package.json @@ -22,6 +22,7 @@ "semver": "5.3.0", "sync-request": "3.0.1", "tello": "1.0.5", - "yargs": "4.8.1" + "yargs": "4.8.1", + "webdriverio": "2.4.5" } } diff --git a/spec/integration/helpers/start-atom.coffee b/spec/integration/helpers/start-atom.coffee index 7a9311896..17f11fe2c 100644 --- a/spec/integration/helpers/start-atom.coffee +++ b/spec/integration/helpers/start-atom.coffee @@ -6,7 +6,7 @@ remote = require 'remote' async = require 'async' {map, extend, once, difference} = require 'underscore-plus' {spawn, spawnSync} = require 'child_process' -webdriverio = require '../../../build/node_modules/webdriverio' +webdriverio = require '../../../script/node_modules/webdriverio' AtomPath = remote.process.argv[0] AtomLauncherPath = path.join(__dirname, "..", "helpers", "atom-launcher.sh") From d735f59b75980eedb8e85ce460218f374fd33bb9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 11 Aug 2016 13:50:02 +0200 Subject: [PATCH 142/221] Try running tests serially --- script/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/test b/script/test index e802c2f04..23ecf33a2 100755 --- a/script/test +++ b/script/test @@ -70,7 +70,7 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) { const testSuitesToRun = [runCoreMainProcessTests, runCoreRenderProcessTests].concat(packageTestSuites) -async.parallelLimit(testSuitesToRun, 2, function (err, exitCodes) { +async.series(testSuitesToRun, function (err, exitCodes) { if (err) { console.error(err) process.exit(1) From 89152fbf58a22d46fb88a59096ca8583d141ef6b Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Thu, 11 Aug 2016 11:51:08 -0700 Subject: [PATCH 143/221] Add help, don't build winstaller by default, add skip --- script/build | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/script/build b/script/build index 8d0aafc47..0b046f2fd 100755 --- a/script/build +++ b/script/build @@ -6,7 +6,16 @@ require('coffee-script/register') require('colors') -const argv = require('yargs').argv +const argv = require('yargs') + .usage('Usage: $0 [options]') + .help('help') + .describe('skip-rebuild', 'Skip rebuilding steps (to perform other optional steps)') + .describe('code-sign', 'Sign the executables (key specified in env vars)') + .describe('create-installer', 'Create an installer (Windows only)') + .describe('compress-artifacts', 'Compress Atom binaries (and symbols on macOS)') + .describe('install', 'Install the built version of Atom') + .argv + const cleanOutputDirectory = require('./lib/clean-output-directory') const codeSignOnMac = require('./lib/code-sign-on-mac') const compressArtifacts = require('./lib/compress-artifacts') @@ -30,17 +39,19 @@ process.on('unhandledRejection', function (e) { process.exit(1) }) -cleanOutputDirectory() -copyAssets() -transpileBabelPaths() -transpileCoffeeScriptPaths() -transpileCsonPaths() -transpilePegJsPaths() -generateModuleCache() -prebuildLessCache() -generateMetadata() -generateAPIDocs() -downloadChromedriver() +if (!argv.skipRebuild) { + cleanOutputDirectory() + copyAssets() + transpileBabelPaths() + transpileCoffeeScriptPaths() + transpileCsonPaths() + transpilePegJsPaths() + generateModuleCache() + prebuildLessCache() + generateMetadata() + generateAPIDocs() + downloadChromedriver() +} dumpSymbols() .then(packageApplication) .then(packagedAppPath => { @@ -52,7 +63,12 @@ dumpSymbols() } return Promise.resolve(packagedAppPath) } else if (process.platform === 'win32') { - return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) + if (argv.createInstaller) { + return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) + } + else { + console.log('Skipping installer. Specify the --create-installer option to create a Squirrel-based Windows installer.'.gray) + } } else { return Promise.resolve(packagedAppPath) } From 5a69d0bf4ac9e6587f8a3b321a0c8453c814d421 Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Thu, 11 Aug 2016 14:20:02 -0700 Subject: [PATCH 144/221] Remove skip-rebuild option --- script/build | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/script/build b/script/build index 0b046f2fd..ba13be920 100755 --- a/script/build +++ b/script/build @@ -9,7 +9,6 @@ require('colors') const argv = require('yargs') .usage('Usage: $0 [options]') .help('help') - .describe('skip-rebuild', 'Skip rebuilding steps (to perform other optional steps)') .describe('code-sign', 'Sign the executables (key specified in env vars)') .describe('create-installer', 'Create an installer (Windows only)') .describe('compress-artifacts', 'Compress Atom binaries (and symbols on macOS)') @@ -39,19 +38,18 @@ process.on('unhandledRejection', function (e) { process.exit(1) }) -if (!argv.skipRebuild) { - cleanOutputDirectory() - copyAssets() - transpileBabelPaths() - transpileCoffeeScriptPaths() - transpileCsonPaths() - transpilePegJsPaths() - generateModuleCache() - prebuildLessCache() - generateMetadata() - generateAPIDocs() - downloadChromedriver() -} +cleanOutputDirectory() +copyAssets() +transpileBabelPaths() +transpileCoffeeScriptPaths() +transpileCsonPaths() +transpilePegJsPaths() +generateModuleCache() +prebuildLessCache() +generateMetadata() +generateAPIDocs() +downloadChromedriver() + dumpSymbols() .then(packageApplication) .then(packagedAppPath => { From ad809a8d005ec5ff906c95c5372dd9c196665414 Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Thu, 11 Aug 2016 14:58:08 -0700 Subject: [PATCH 145/221] Wording clarifications for build options --- script/build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/build b/script/build index ba13be920..42130103a 100755 --- a/script/build +++ b/script/build @@ -9,10 +9,10 @@ require('colors') const argv = require('yargs') .usage('Usage: $0 [options]') .help('help') - .describe('code-sign', 'Sign the executables (key specified in env vars)') - .describe('create-installer', 'Create an installer (Windows only)') + .describe('code-sign', 'Code-sign executables (key specified in env vars)') + .describe('create-installer', 'Create installer (Windows only)') .describe('compress-artifacts', 'Compress Atom binaries (and symbols on macOS)') - .describe('install', 'Install the built version of Atom') + .describe('install', 'Install Atom') .argv const cleanOutputDirectory = require('./lib/clean-output-directory') @@ -65,7 +65,7 @@ dumpSymbols() return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) } else { - console.log('Skipping installer. Specify the --create-installer option to create a Squirrel-based Windows installer.'.gray) + console.log('Skipping creating installer. Specify the --create-installer option to create a Squirrel-based Windows installer.'.gray) } } else { return Promise.resolve(packagedAppPath) From df6e0aca1bbfba5aa42a04d1dd5f59a6e820b594 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 13 Aug 2016 10:43:32 +0200 Subject: [PATCH 146/221] Create folder if it doesn't exist when downloading files --- script/build | 1 - script/lib/download-file-from-github.js | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/script/build b/script/build index 42130103a..28dceb3de 100755 --- a/script/build +++ b/script/build @@ -49,7 +49,6 @@ prebuildLessCache() generateMetadata() generateAPIDocs() downloadChromedriver() - dumpSymbols() .then(packageApplication) .then(packagedAppPath => { diff --git a/script/lib/download-file-from-github.js b/script/lib/download-file-from-github.js index 9a504e9f2..2969ea2dc 100644 --- a/script/lib/download-file-from-github.js +++ b/script/lib/download-file-from-github.js @@ -1,4 +1,7 @@ +'use strict' + const fs = require('fs-extra') +const path = require('path') const syncRequest = require('sync-request') module.exports = function (downloadURL, destinationPath) { @@ -8,6 +11,7 @@ module.exports = function (downloadURL, destinationPath) { }) if (response.statusCode === 200) { + fs.mkdirpSync(path.dirname(destinationPath)) fs.writeFileSync(destinationPath, response.body) } else { throw new Error('Error downloading file. HTTP Status ' + response.statusCode + '.') From 5fc240580130f9dfb738f355a635eb21eb8b0e17 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 13 Aug 2016 12:49:46 +0200 Subject: [PATCH 147/221] Compile CSON, Babel and Coffeescript files using CompileCache --- script/build | 5 +++++ script/config.js | 3 ++- script/lib/prebuild-less-cache.js | 2 +- script/lib/transpile-babel-paths.js | 18 +++--------------- script/lib/transpile-coffee-script-paths.js | 5 ++--- script/lib/transpile-cson-paths.js | 5 ++--- src/compile-cache.js | 4 ++-- 7 files changed, 17 insertions(+), 25 deletions(-) diff --git a/script/build b/script/build index 28dceb3de..adf9acbfd 100755 --- a/script/build +++ b/script/build @@ -6,6 +6,7 @@ require('coffee-script/register') require('colors') +const fs = require('fs-extra') const argv = require('yargs') .usage('Usage: $0 [options]') .help('help') @@ -33,11 +34,15 @@ const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths' const transpileCsonPaths = require('./lib/transpile-cson-paths') const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') +const CONFIG = require('./config') + process.on('unhandledRejection', function (e) { console.error(e) process.exit(1) }) +fs.mkdirpSync(CONFIG.atomHomeDirPath) + cleanOutputDirectory() copyAssets() transpileBabelPaths() diff --git a/script/config.js b/script/config.js index 26c05c217..ddac37032 100644 --- a/script/config.js +++ b/script/config.js @@ -15,6 +15,7 @@ const intermediateAppPath = path.join(buildOutputPath, 'app') const symbolsPath = path.join(buildOutputPath, 'symbols') const electronDownloadPath = path.join(repositoryRootPath, 'electron') const homeDirPath = process.env.HOME || process.env.USERPROFILE +const atomHomeDirPath = path.join(homeDirPath, '.atom') const appMetadata = require(path.join(repositoryRootPath, 'package.json')) const apmMetadata = require(path.join(apmRootPath, 'package.json')) @@ -27,7 +28,7 @@ module.exports = { appMetadata, apmMetadata, channel, repositoryRootPath, apmRootPath, scriptRootPath, buildOutputPath, docsOutputPath, intermediateAppPath, symbolsPath, - electronDownloadPath, homeDirPath, + electronDownloadPath, atomHomeDirPath, homeDirPath, apmBinPath, npmBinPath } diff --git a/script/lib/prebuild-less-cache.js b/script/lib/prebuild-less-cache.js index a1119bd6d..8b7499677 100644 --- a/script/lib/prebuild-less-cache.js +++ b/script/lib/prebuild-less-cache.js @@ -35,7 +35,7 @@ module.exports = function () { // Build a LessCache instance with import paths based on the current theme combination const lessCache = new LessCache({ cacheDir: cacheDirPath, - fallbackDir: path.join(CONFIG.homeDirPath, '.atom', 'compile-cache', 'prebuild-less', LESS_CACHE_VERSION), + fallbackDir: path.join(CONFIG.atomHomeDirPath, 'compile-cache', 'prebuild-less', LESS_CACHE_VERSION), syncCaches: true, resourcePath: CONFIG.intermediateAppPath, importPaths: [ diff --git a/script/lib/transpile-babel-paths.js b/script/lib/transpile-babel-paths.js index 4b5c01eb0..0a987e124 100644 --- a/script/lib/transpile-babel-paths.js +++ b/script/lib/transpile-babel-paths.js @@ -1,6 +1,6 @@ 'use strict' -const babel = require('babel-core') +const CompileCache = require('../../src/compile-cache') const fs = require('fs') const glob = require('glob') const path = require('path') @@ -19,9 +19,7 @@ const BUFFER = Buffer(PREFIX_LENGTH) module.exports = function () { console.log(`Transpiling Babel paths in ${CONFIG.intermediateAppPath}`) for (let path of getPathsToTranspile()) { - if (usesBabel(path)) { - transpileBabelPath(path) - } + transpileBabelPath(path) } } @@ -38,16 +36,6 @@ function getPathsToTranspile () { return paths } -function usesBabel (path) { - const file = fs.openSync(path, 'r') - fs.readSync(file, BUFFER, 0, PREFIX_LENGTH) - fs.closeSync(file) - const filePrefix = BUFFER.toString('utf8', 0, PREFIX_LENGTH).trim() - return BABEL_PREFIXES.indexOf(filePrefix) !== -1 -} - function transpileBabelPath (path) { - const options = Object.assign({}, BABEL_OPTIONS) - options.sourceMap = null - fs.writeFileSync(path, babel.transformFileSync(path, options).code) + fs.writeFileSync(path, CompileCache.addPathToCache(path, CONFIG.atomHomeDirPath)) } diff --git a/script/lib/transpile-coffee-script-paths.js b/script/lib/transpile-coffee-script-paths.js index 236393391..3aa7bc8ad 100644 --- a/script/lib/transpile-coffee-script-paths.js +++ b/script/lib/transpile-coffee-script-paths.js @@ -1,6 +1,6 @@ 'use strict' -const coffee = require('coffee-script') +const CompileCache = require('../../src/compile-cache') const fs = require('fs') const glob = require('glob') const path = require('path') @@ -28,8 +28,7 @@ function getPathsToTranspile () { } function transpileCoffeeScriptPath (coffeePath) { - const inputCode = fs.readFileSync(coffeePath, 'utf8') const jsPath = coffeePath.replace(/coffee$/g, 'js') - fs.writeFileSync(jsPath, coffee.compile(inputCode)) + fs.writeFileSync(jsPath, CompileCache.addPathToCache(coffeePath, CONFIG.atomHomeDirPath)) fs.unlinkSync(coffeePath) } diff --git a/script/lib/transpile-cson-paths.js b/script/lib/transpile-cson-paths.js index 2c1a4196e..fb9e588b9 100644 --- a/script/lib/transpile-cson-paths.js +++ b/script/lib/transpile-cson-paths.js @@ -1,6 +1,6 @@ 'use strict' -const CSON = require('season') +const CompileCache = require('../../src/compile-cache') const fs = require('fs') const glob = require('glob') const path = require('path') @@ -26,8 +26,7 @@ function getPathsToTranspile () { } function transpileCsonPath (csonPath) { - const jsonContent = CSON.readFileSync(csonPath) const jsonPath = csonPath.replace(/cson$/g, 'json') - fs.writeFileSync(jsonPath, JSON.stringify(jsonContent)) + fs.writeFileSync(jsonPath, JSON.stringify(CompileCache.addPathToCache(csonPath, CONFIG.atomHomeDirPath))) fs.unlinkSync(csonPath) } diff --git a/src/compile-cache.js b/src/compile-cache.js index 32fa32c34..03d2376bc 100644 --- a/src/compile-cache.js +++ b/src/compile-cache.js @@ -43,11 +43,11 @@ exports.addPathToCache = function (filePath, atomHome) { CSON = require('season') CSON.setCacheDir(this.getCacheDirectory()) } - CSON.readFileSync(filePath) + return CSON.readFileSync(filePath) } else { var compiler = COMPILERS[extension] if (compiler) { - compileFileAtPath(compiler, filePath, extension) + return compileFileAtPath(compiler, filePath, extension) } } } From 4c7b10b06f198f75097f03d6bf7d6d22c66b4b33 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 13 Aug 2016 12:50:01 +0200 Subject: [PATCH 148/221] :fire: ATOM_INTEGRATION_TESTS_ENABLED --- circle.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/circle.yml b/circle.yml index b1f2c8f4d..332897a21 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,6 @@ machine: XCODE_SCHEME: test XCODE_WORKSPACE: test XCODE_PROJECT: test - ATOM_INTEGRATION_TESTS_ENABLED: true xcode: version: 7.3 From 052ce394fe761bacc8204d318aa330a5017d0bae Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 13 Aug 2016 12:56:42 +0200 Subject: [PATCH 149/221] :fire: --- script/build | 5 ----- 1 file changed, 5 deletions(-) diff --git a/script/build b/script/build index adf9acbfd..28dceb3de 100755 --- a/script/build +++ b/script/build @@ -6,7 +6,6 @@ require('coffee-script/register') require('colors') -const fs = require('fs-extra') const argv = require('yargs') .usage('Usage: $0 [options]') .help('help') @@ -34,15 +33,11 @@ const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths' const transpileCsonPaths = require('./lib/transpile-cson-paths') const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') -const CONFIG = require('./config') - process.on('unhandledRejection', function (e) { console.error(e) process.exit(1) }) -fs.mkdirpSync(CONFIG.atomHomeDirPath) - cleanOutputDirectory() copyAssets() transpileBabelPaths() From 445ddb247d6b090599b9de147bfaa568a1b7b612 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 13 Aug 2016 13:13:07 -0600 Subject: [PATCH 150/221] Fight the screen saver on CircleCI --- circle.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 332897a21..2c0958d47 100644 --- a/circle.yml +++ b/circle.yml @@ -7,6 +7,9 @@ machine: xcode: version: 7.3 + post: + - osascript -e 'tell application "System Events" to keystroke "x"' # clear screen saver + general: artifacts: - out/atom-mac.zip @@ -33,4 +36,4 @@ dependencies: test: override: - - script/test + - caffeinate -s script/test # Run with caffeinate to prevent screen saver From 4d3a982400122c381a4c26840292bad5abc2c43f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 10:18:45 +0200 Subject: [PATCH 151/221] Ensure downloading the appropriate chromedriver for the bundled Electron --- script/lib/download-chromedriver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/download-chromedriver.js b/script/lib/download-chromedriver.js index 57412908b..16266b94c 100644 --- a/script/lib/download-chromedriver.js +++ b/script/lib/download-chromedriver.js @@ -21,7 +21,7 @@ module.exports = function () { assert(chromedriverAssets.length === 1, 'Found more than one chrome driver asset to download!') const chromedriverAsset = chromedriverAssets[0] - const chromedriverZipPath = path.join(CONFIG.electronDownloadPath, chromedriverAsset.name) + const chromedriverZipPath = path.join(CONFIG.electronDownloadPath, `electron-${electronVersionWithChromedriver}-${chromedriverAsset.name}`) if (!fs.existsSync(chromedriverZipPath)) { downloadFileFromGithub(chromedriverAsset.url, chromedriverZipPath) } From 9e0d7638e45c2484224ead647375f0eab1d5bbd9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 12:05:50 +0200 Subject: [PATCH 152/221] Create Debian package --- .travis.yml | 2 +- resources/linux/atom.desktop.in | 2 +- script/build | 13 +++- script/lib/create-debian-package.js | 106 ++++++++++++++++++++++++++++ script/package.json | 5 +- 5 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 script/lib/create-debian-package.js diff --git a/.travis.yml b/.travis.yml index ef18c51c5..dd84233ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ install: - nvm use --delete-prefix $NODE_VERSION - npm install -g npm - script/bootstrap - - script/build --compress-artifacts + - script/build --create-debian-package --compress-artifacts script: false diff --git a/resources/linux/atom.desktop.in b/resources/linux/atom.desktop.in index 6fa5d79c8..aa5293e90 100644 --- a/resources/linux/atom.desktop.in +++ b/resources/linux/atom.desktop.in @@ -3,7 +3,7 @@ Name=<%= appName %> Comment=<%= description %> GenericName=Text Editor Exec=<%= installDir %>/share/<%= appFileName %>/atom %F -Icon=<%= iconPath %> +Icon=<%= iconName %> Type=Application StartupNotify=true Categories=GNOME;GTK;Utility;TextEditor;Development; diff --git a/script/build b/script/build index 28dceb3de..30239d666 100755 --- a/script/build +++ b/script/build @@ -11,6 +11,7 @@ const argv = require('yargs') .help('help') .describe('code-sign', 'Code-sign executables (key specified in env vars)') .describe('create-installer', 'Create installer (Windows only)') + .describe('create-debian-package', 'Create .deb package (Windows only)') .describe('compress-artifacts', 'Compress Atom binaries (and symbols on macOS)') .describe('install', 'Install Atom') .argv @@ -19,6 +20,7 @@ const cleanOutputDirectory = require('./lib/clean-output-directory') const codeSignOnMac = require('./lib/code-sign-on-mac') const compressArtifacts = require('./lib/compress-artifacts') const copyAssets = require('./lib/copy-assets') +const createDebianPackage = require('./lib/create-debian-package') const createWindowsInstaller = require('./lib/create-windows-installer') const downloadChromedriver = require('./lib/download-chromedriver') const dumpSymbols = require('./lib/dump-symbols') @@ -58,7 +60,6 @@ dumpSymbols() } else { console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing'.gray) } - return Promise.resolve(packagedAppPath) } else if (process.platform === 'win32') { if (argv.createInstaller) { return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) @@ -66,9 +67,15 @@ dumpSymbols() else { console.log('Skipping creating installer. Specify the --create-installer option to create a Squirrel-based Windows installer.'.gray) } - } else { - return Promise.resolve(packagedAppPath) + } else if (process.platform === 'linux') { + if (argv.createDebianPackage) { + createDebianPackage(packagedAppPath) + } else { + console.log('Skipping creating debian package. Specify the --create-debian-package option to create it.'.gray) + } } + + return Promise.resolve(packagedAppPath) }).then(packagedAppPath => { if (argv.compressArtifacts) { compressArtifacts(packagedAppPath) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js new file mode 100644 index 000000000..fde2cc050 --- /dev/null +++ b/script/lib/create-debian-package.js @@ -0,0 +1,106 @@ +'use strict' + +const childProcess = require('child_process') +const copySync = require('./copy-sync') +const fs = require('fs-extra') +const os = require('os') +const path = require('path') +const template = require('lodash.template') + +const CONFIG = require('../config') + +module.exports = function (packagedAppPath) { + // TODO: this logic here is duplicated (see package-application.js). Pull it + // up in config. + console.log(`Creating Debian package for "${packagedAppPath}"`) + const atomExecutableName = CONFIG.channel === 'beta' ? 'atom-beta' : 'atom' + const apmExecutableName = CONFIG.channel === 'beta' ? 'apm-beta' : 'apm' + const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' + const appDescription = CONFIG.appMetadata.description + let arch + if (process.arch === 'ia32') { + arch = 'i386' + } else if (process.arch === 'x64') { + arch = 'amd64' + } else { + arch = process.arch + } + + const debianPackageName = `${atomExecutableName}-${CONFIG.appMetadata.version}-${arch}` + const debianPackageDirPath = path.join(os.tmpdir(), debianPackageName) + const debianPackageConfigPath = path.join(debianPackageDirPath, 'DEBIAN') + const debianPackageInstallDirPath = path.join(debianPackageDirPath, 'usr') + const debianPackageShareDirPath = path.join(debianPackageInstallDirPath, 'share') + const debianPackageAtomDirPath = path.join(debianPackageShareDirPath, atomExecutableName) + const debianPackageApplicationsDirPath = path.join(debianPackageShareDirPath, 'applications') + const debianPackageIconsDirPath = path.join(debianPackageInstallDirPath, 'pixmaps') + const debianPackageLintianOverridesDirPath = path.join(debianPackageInstallDirPath, 'lintian', 'overrides') + const debianPackageDocsDirPath = path.join(debianPackageInstallDirPath, 'doc', atomExecutableName) + const debianPackageBinDirPath = path.join(debianPackageInstallDirPath, 'bin') + + if (fs.existsSync(debianPackageDirPath)) { + console.log(`Deleting existing build dir for Debian package at "${debianPackageDirPath}"`) + fs.removeSync(debianPackageDirPath) + } + + console.log('Creating Debian package structure') + fs.mkdirpSync(debianPackageDirPath) + fs.mkdirpSync(debianPackageConfigPath) + fs.mkdirpSync(debianPackageInstallDirPath) + fs.mkdirpSync(debianPackageShareDirPath) + fs.mkdirpSync(debianPackageApplicationsDirPath) + fs.mkdirpSync(debianPackageIconsDirPath) + fs.mkdirpSync(debianPackageLintianOverridesDirPath) + fs.mkdirpSync(debianPackageDocsDirPath) + fs.mkdirpSync(debianPackageBinDirPath) + + console.log(`Copying "${packagedAppPath}" to "${debianPackageAtomDirPath}"`) + copySync(packagedAppPath, debianPackageAtomDirPath) + fs.chmodSync(debianPackageAtomDirPath, '755') + + console.log(`Copying binaries into "${debianPackageBinDirPath}"`) + copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(debianPackageBinDirPath, atomExecutableName)) + fs.symlinkSync( + path.join('..', 'share', atomExecutableName, 'resources', 'app', 'apm', 'node_modules', '.bin', 'apm'), + path.join(debianPackageBinDirPath, apmExecutableName) + ) + + console.log(`Writing control file into "${debianPackageConfigPath}"`) + const packageSizeInKilobytes = childProcess.spawnSync('du', ['-sk']).stdout.toString().split(/\s+/)[0] + const controlFileTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'debian', 'control.in')) + const controlFileContents = template(controlFileTemplate)({ + appFileName: atomExecutableName, version: CONFIG.appMetadata.version, arch: arch, + installedSize: packageSizeInKilobytes, description: appDescription + }) + fs.writeFileSync(path.join(debianPackageConfigPath, 'control'), controlFileContents) + + console.log(`Writing desktop entry file into "${debianPackageApplicationsDirPath}"`) + const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in')) + const desktopEntryContents = template(desktopEntryTemplate)({ + appName: appName, appFileName: atomExecutableName, description: appDescription, + installDir: '/usr', iconName: atomExecutableName + }) + fs.writeFileSync(path.join(debianPackageApplicationsDirPath, `${atomExecutableName}.desktop`), desktopEntryContents) + + console.log(`Copying icon into "${debianPackageIconsDirPath}"`) + copySync( + path.join(packagedAppPath, 'resources', 'app.asar.unpacked', 'resources', 'atom.png'), + path.join(debianPackageIconsDirPath, `${atomExecutableName}.png`) + ) + + console.log(`Copying license into "${debianPackageDocsDirPath}"`) + copySync( + path.join(packagedAppPath, 'resources', 'LICENSE.md'), + path.join(debianPackageDocsDirPath, 'copyright') + ) + + console.log(`Copying lintian overrides into "${debianPackageLintianOverridesDirPath}"`) + copySync( + path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'debian', 'lintian-overrides'), + path.join(debianPackageLintianOverridesDirPath, atomExecutableName) + ) + + console.log(`Generating .deb file from ${debianPackageDirPath}`) + childProcess.spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], {stdio: 'inherit'}) + copySync(`${debianPackageDirPath}.deb`, path.join(CONFIG.buildOutputPath, `${debianPackageName}.deb`)) +} diff --git a/script/package.json b/script/package.json index 6fc974949..101f99318 100644 --- a/script/package.json +++ b/script/package.json @@ -13,6 +13,7 @@ "glob": "7.0.3", "joanna": "0.0.6", "legal-eagle": "0.13.0", + "lodash.template": "4.4.0", "minidump": "0.9.0", "mkdirp": "0.5.1", "normalize-package-data": "2.3.5", @@ -22,7 +23,7 @@ "semver": "5.3.0", "sync-request": "3.0.1", "tello": "1.0.5", - "yargs": "4.8.1", - "webdriverio": "2.4.5" + "webdriverio": "2.4.5", + "yargs": "4.8.1" } } From fc95475d6e2ff4bc1a8e0382c11a0eb45a907f25 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 12:06:03 +0200 Subject: [PATCH 153/221] Change permissions to node files on Linux --- script/lib/package-application.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 8551974aa..d56a86935 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -42,6 +42,9 @@ module.exports = function () { if (process.platform === 'darwin') { bundledResourcesPath = path.join(packagedAppPath, 'Contents', 'Resources') setAtomHelperVersion(packagedAppPath) + } else if (process.platform == 'linux') { + bundledResourcesPath = path.join(packagedAppPath, 'resources') + chmodNodeFiles(packagedAppPath) } else { bundledResourcesPath = path.join(packagedAppPath, 'resources') } @@ -92,6 +95,11 @@ function setAtomHelperVersion (packagedAppPath) { childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleShortVersionString', CONFIG.appMetadata.version, helperPListPath]) } +function chmodNodeFiles (packagedAppPath) { + console.log(`Changing permissions for node files in ${packagedAppPath}`) + childProcess.spawnSync('find', [packagedAppPath, '-type', 'f', '-name', '*.node', '-exec chmod a-x {};']) +} + function buildAsarUnpackGlobExpression () { const unpack = [ '*.node', From ffde9b49cf406300ef6a817fa5f2ae4ce63bb239 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 12:09:06 +0200 Subject: [PATCH 154/221] Always name Debian package "atom-amd64.deb" --- script/lib/create-debian-package.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index fde2cc050..bdd1fa7f3 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -26,8 +26,7 @@ module.exports = function (packagedAppPath) { arch = process.arch } - const debianPackageName = `${atomExecutableName}-${CONFIG.appMetadata.version}-${arch}` - const debianPackageDirPath = path.join(os.tmpdir(), debianPackageName) + const debianPackageDirPath = path.join(os.tmpdir(), `${atomExecutableName}-${CONFIG.appMetadata.version}-${arch}`) const debianPackageConfigPath = path.join(debianPackageDirPath, 'DEBIAN') const debianPackageInstallDirPath = path.join(debianPackageDirPath, 'usr') const debianPackageShareDirPath = path.join(debianPackageInstallDirPath, 'share') @@ -102,5 +101,5 @@ module.exports = function (packagedAppPath) { console.log(`Generating .deb file from ${debianPackageDirPath}`) childProcess.spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], {stdio: 'inherit'}) - copySync(`${debianPackageDirPath}.deb`, path.join(CONFIG.buildOutputPath, `${debianPackageName}.deb`)) + copySync(`${debianPackageDirPath}.deb`, path.join(CONFIG.buildOutputPath, `atom-amd64.deb`)) } From 781228e06efedbdbcef71d75c7ecae09b85fd5bf Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 12:19:02 +0200 Subject: [PATCH 155/221] Use the share dir path when copying icons, docs and lintian overrides --- script/lib/create-debian-package.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index bdd1fa7f3..9c4915e9c 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -29,13 +29,13 @@ module.exports = function (packagedAppPath) { const debianPackageDirPath = path.join(os.tmpdir(), `${atomExecutableName}-${CONFIG.appMetadata.version}-${arch}`) const debianPackageConfigPath = path.join(debianPackageDirPath, 'DEBIAN') const debianPackageInstallDirPath = path.join(debianPackageDirPath, 'usr') + const debianPackageBinDirPath = path.join(debianPackageInstallDirPath, 'bin') const debianPackageShareDirPath = path.join(debianPackageInstallDirPath, 'share') const debianPackageAtomDirPath = path.join(debianPackageShareDirPath, atomExecutableName) const debianPackageApplicationsDirPath = path.join(debianPackageShareDirPath, 'applications') - const debianPackageIconsDirPath = path.join(debianPackageInstallDirPath, 'pixmaps') - const debianPackageLintianOverridesDirPath = path.join(debianPackageInstallDirPath, 'lintian', 'overrides') - const debianPackageDocsDirPath = path.join(debianPackageInstallDirPath, 'doc', atomExecutableName) - const debianPackageBinDirPath = path.join(debianPackageInstallDirPath, 'bin') + const debianPackageIconsDirPath = path.join(debianPackageShareDirPath, 'pixmaps') + const debianPackageLintianOverridesDirPath = path.join(debianPackageShareDirPath, 'lintian', 'overrides') + const debianPackageDocsDirPath = path.join(debianPackageShareDirPath, 'doc', atomExecutableName) if (fs.existsSync(debianPackageDirPath)) { console.log(`Deleting existing build dir for Debian package at "${debianPackageDirPath}"`) @@ -101,5 +101,8 @@ module.exports = function (packagedAppPath) { console.log(`Generating .deb file from ${debianPackageDirPath}`) childProcess.spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], {stdio: 'inherit'}) - copySync(`${debianPackageDirPath}.deb`, path.join(CONFIG.buildOutputPath, `atom-amd64.deb`)) + + const outputDebianPackageFilePath = path.join(CONFIG.buildOutputPath, `atom-amd64.deb`) + console.log(`Copying generated package into "${outputDebianPackageFilePath}"`) + copySync(`${debianPackageDirPath}.deb`, outputDebianPackageFilePath) } From 2883970886397c3725c454676ec711c7c8da4977 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 12:21:48 +0200 Subject: [PATCH 156/221] Delete previously created debian artifacts if necessary --- script/lib/create-debian-package.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 9c4915e9c..2fec13770 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -26,6 +26,7 @@ module.exports = function (packagedAppPath) { arch = process.arch } + const outputDebianPackageFilePath = path.join(CONFIG.buildOutputPath, `atom-amd64.deb`) const debianPackageDirPath = path.join(os.tmpdir(), `${atomExecutableName}-${CONFIG.appMetadata.version}-${arch}`) const debianPackageConfigPath = path.join(debianPackageDirPath, 'DEBIAN') const debianPackageInstallDirPath = path.join(debianPackageDirPath, 'usr') @@ -41,6 +42,14 @@ module.exports = function (packagedAppPath) { console.log(`Deleting existing build dir for Debian package at "${debianPackageDirPath}"`) fs.removeSync(debianPackageDirPath) } + if (fs.existsSync(`${debianPackageDirPath}.deb`)) { + console.log(`Deleting existing Debian package at "${debianPackageDirPath}.deb"`) + fs.removeSync(`${debianPackageDirPath}.deb`) + } + if (fs.existsSync(debianPackageDirPath)) { + console.log(`Deleting existing Debian package at "${outputDebianPackageFilePath}"`) + fs.removeSync(debianPackageDirPath) + } console.log('Creating Debian package structure') fs.mkdirpSync(debianPackageDirPath) @@ -102,7 +111,6 @@ module.exports = function (packagedAppPath) { console.log(`Generating .deb file from ${debianPackageDirPath}`) childProcess.spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], {stdio: 'inherit'}) - const outputDebianPackageFilePath = path.join(CONFIG.buildOutputPath, `atom-amd64.deb`) console.log(`Copying generated package into "${outputDebianPackageFilePath}"`) copySync(`${debianPackageDirPath}.deb`, outputDebianPackageFilePath) } From b8e8d17b0bf5b37797b9b96f07f1e3fe3fcc7038 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 12:26:23 +0200 Subject: [PATCH 157/221] Use the correct size for the generated package --- script/lib/create-debian-package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 2fec13770..2cf5fdbe1 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -74,7 +74,7 @@ module.exports = function (packagedAppPath) { ) console.log(`Writing control file into "${debianPackageConfigPath}"`) - const packageSizeInKilobytes = childProcess.spawnSync('du', ['-sk']).stdout.toString().split(/\s+/)[0] + const packageSizeInKilobytes = childProcess.spawnSync('du', ['-sk', packagedAppPath]).stdout.toString().split(/\s+/)[0] const controlFileTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'debian', 'control.in')) const controlFileContents = template(controlFileTemplate)({ appFileName: atomExecutableName, version: CONFIG.appMetadata.version, arch: arch, From a55b54ab29bc399b3b0c452a2e71302bb141abae Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 12:57:29 +0200 Subject: [PATCH 158/221] Try skipping the test phase on Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd84233ba..e86a6b34c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ install: - script/bootstrap - script/build --create-debian-package --compress-artifacts -script: false +script: true cache: directories: From 7cf758051ffb90401796eecb62fb2e9dc957cb19 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 13:00:56 +0200 Subject: [PATCH 159/221] Cache compile-cache on Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e86a6b34c..ea827f768 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,7 @@ cache: - node_modules - apm/node_modules - script/node_modules + - ~/.atom/compile-cache notifications: email: From 0925dd065acb8c8e77fc2547922d4b9d4414b4fb Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 13:06:36 +0200 Subject: [PATCH 160/221] :art: --- script/build | 2 +- script/lib/create-debian-package.js | 4 +--- script/lib/package-application.js | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/script/build b/script/build index 30239d666..5aeba32c0 100755 --- a/script/build +++ b/script/build @@ -11,7 +11,7 @@ const argv = require('yargs') .help('help') .describe('code-sign', 'Code-sign executables (key specified in env vars)') .describe('create-installer', 'Create installer (Windows only)') - .describe('create-debian-package', 'Create .deb package (Windows only)') + .describe('create-debian-package', 'Create .deb package (Linux only)') .describe('compress-artifacts', 'Compress Atom binaries (and symbols on macOS)') .describe('install', 'Install Atom') .argv diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 2cf5fdbe1..4878294d8 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -10,8 +10,6 @@ const template = require('lodash.template') const CONFIG = require('../config') module.exports = function (packagedAppPath) { - // TODO: this logic here is duplicated (see package-application.js). Pull it - // up in config. console.log(`Creating Debian package for "${packagedAppPath}"`) const atomExecutableName = CONFIG.channel === 'beta' ? 'atom-beta' : 'atom' const apmExecutableName = CONFIG.channel === 'beta' ? 'apm-beta' : 'apm' @@ -27,7 +25,7 @@ module.exports = function (packagedAppPath) { } const outputDebianPackageFilePath = path.join(CONFIG.buildOutputPath, `atom-amd64.deb`) - const debianPackageDirPath = path.join(os.tmpdir(), `${atomExecutableName}-${CONFIG.appMetadata.version}-${arch}`) + const debianPackageDirPath = path.join(os.tmpdir(), path.basename(packagedAppPath)) const debianPackageConfigPath = path.join(debianPackageDirPath, 'DEBIAN') const debianPackageInstallDirPath = path.join(debianPackageDirPath, 'usr') const debianPackageBinDirPath = path.join(debianPackageInstallDirPath, 'bin') diff --git a/script/lib/package-application.js b/script/lib/package-application.js index d56a86935..4bd0d40a8 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -13,13 +13,12 @@ const CONFIG = require('../config') module.exports = function () { const appName = getAppName() - const arch = process.platform === 'win32' ? 'ia32' : 'x64' console.log(`Running electron-packager on ${CONFIG.intermediateAppPath} with app name "${appName}"`) return runPackager({ 'app-bundle-id': 'com.github.atom', 'app-copyright': `Copyright © 2014-${(new Date()).getFullYear()} GitHub, Inc. All rights reserved.`, 'app-version': CONFIG.appMetadata.version, - 'arch': arch, + 'arch': process.platform === 'win32' ? 'ia32' : 'x64', 'asar': {unpack: buildAsarUnpackGlobExpression()}, 'build-version': CONFIG.appMetadata.version, 'download': {cache: CONFIG.electronDownloadPath}, From d97edcb8aa3f8ede87d76c8f1a1cfc116a4a0f42 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 14:41:49 +0200 Subject: [PATCH 161/221] :memo: --- script/build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/build b/script/build index 5aeba32c0..bdbd54417 100755 --- a/script/build +++ b/script/build @@ -9,8 +9,8 @@ require('colors') const argv = require('yargs') .usage('Usage: $0 [options]') .help('help') - .describe('code-sign', 'Code-sign executables (key specified in env vars)') - .describe('create-installer', 'Create installer (Windows only)') + .describe('code-sign', 'Code-sign executables (macOS and Windows only)') + .describe('create-windows-installer', 'Create installer (Windows only)') .describe('create-debian-package', 'Create .deb package (Linux only)') .describe('compress-artifacts', 'Compress Atom binaries (and symbols on macOS)') .describe('install', 'Install Atom') From 08dcb39f87f63d220328ff75fbd9ac5ea7abd2fe Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 16:00:33 +0200 Subject: [PATCH 162/221] Start on RPM package creation --- resources/linux/redhat/atom.spec.in | 22 ++++++-- script/build | 8 +++ script/lib/create-rpm-package.js | 87 +++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 script/lib/create-rpm-package.js diff --git a/resources/linux/redhat/atom.spec.in b/resources/linux/redhat/atom.spec.in index 3397135bd..0ee120b35 100644 --- a/resources/linux/redhat/atom.spec.in +++ b/resources/linux/redhat/atom.spec.in @@ -22,10 +22,24 @@ chmod 755 "%{buildroot}/<%= installDir %>/bin/<%= appFileName %>" mkdir -p "%{buildroot}/<%= installDir %>/share/applications/" cp "<%= appFileName %>.desktop" "%{buildroot}/<%= installDir %>/share/applications/" -for i in 1024 512 256 128 64 48 32 24 16; do - mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/${i}x${i}/apps" - cp "icons/${i}.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/${i}x${i}/apps/<%= appFileName %>.png" -done +mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/1024x1024/apps" +cp "icons/1024.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/1024x1024/apps/<%= appFileName %>.png" +mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/512x512/apps" +cp "icons/512.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/512x512/apps/<%= appFileName %>.png" +mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/256x256/apps" +cp "icons/256.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/256x256/apps/<%= appFileName %>.png" +mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/128x128/apps" +cp "icons/128.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/128x128/apps/<%= appFileName %>.png" +mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/64x64/apps" +cp "icons/64.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/64x64/apps/<%= appFileName %>.png" +mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/48x48/apps" +cp "icons/48.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/48x48/apps/<%= appFileName %>.png" +mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/32x32/apps" +cp "icons/32.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/32x32/apps/<%= appFileName %>.png" +mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/24x24/apps" +cp "icons/24.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/24x24/apps/<%= appFileName %>.png" +mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/16x16/apps" +cp "icons/16.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/16x16/apps/<%= appFileName %>.png" %files <%= installDir %>/bin/<%= appFileName %> diff --git a/script/build b/script/build index bdbd54417..527cd1cbb 100755 --- a/script/build +++ b/script/build @@ -12,6 +12,7 @@ const argv = require('yargs') .describe('code-sign', 'Code-sign executables (macOS and Windows only)') .describe('create-windows-installer', 'Create installer (Windows only)') .describe('create-debian-package', 'Create .deb package (Linux only)') + .describe('create-rpm-package', 'Create .rpm package (Linux only)') .describe('compress-artifacts', 'Compress Atom binaries (and symbols on macOS)') .describe('install', 'Install Atom') .argv @@ -21,6 +22,7 @@ const codeSignOnMac = require('./lib/code-sign-on-mac') const compressArtifacts = require('./lib/compress-artifacts') const copyAssets = require('./lib/copy-assets') const createDebianPackage = require('./lib/create-debian-package') +const createRpmPackage = require('./lib/create-rpm-package') const createWindowsInstaller = require('./lib/create-windows-installer') const downloadChromedriver = require('./lib/download-chromedriver') const dumpSymbols = require('./lib/dump-symbols') @@ -73,6 +75,12 @@ dumpSymbols() } else { console.log('Skipping creating debian package. Specify the --create-debian-package option to create it.'.gray) } + + if (argv.createRpmPackage) { + createRpmPackage(packagedAppPath) + } else { + console.log('Skipping creating rpm package. Specify the --create-rpm-package option to create it.'.gray) + } } return Promise.resolve(packagedAppPath) diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js new file mode 100644 index 000000000..85f880319 --- /dev/null +++ b/script/lib/create-rpm-package.js @@ -0,0 +1,87 @@ +'use strict' + +const childProcess = require('child_process') +const copySync = require('./copy-sync') +const fs = require('fs-extra') +const os = require('os') +const path = require('path') +const template = require('lodash.template') + +const CONFIG = require('../config') + +module.exports = function (packagedAppPath) { + console.log(`Creating rpm package for "${packagedAppPath}"`) + const atomExecutableName = CONFIG.channel === 'beta' ? 'atom-beta' : 'atom' + const apmExecutableName = CONFIG.channel === 'beta' ? 'apm-beta' : 'apm' + const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' + const appDescription = CONFIG.appMetadata.description + // RPM versions can't have dashes in them. + // * http://www.rpm.org/max-rpm/ch-rpm-file-format.html + // * https://github.com/mojombo/semver/issues/145 + const appVersion = CONFIG.appMetadata.version.replace(/-beta/, "~beta").replace(/-dev/, "~dev") + let arch + if (process.arch === 'ia32') { + arch = 'i386' + } else if (process.arch === 'x64') { + arch = 'amd64' + } else { + arch = process.arch + } + + const outputRpmPackageFilePath = path.join(CONFIG.buildOutputPath, 'atom.x86_64.rpm') + const rpmPackageDirPath = path.join(CONFIG.homeDirPath, 'rpmbuild') + const rpmPackageBuildDirPath = path.join(rpmPackageDirPath, 'BUILD') + const rpmPackageSourcesDirPath = path.join(rpmPackageDirPath, 'SOURCES') + const rpmPackageSpecsDirPath = path.join(rpmPackageDirPath, 'SPECS') + const rpmPackageRpmsDirPath = path.join(rpmPackageDirPath, 'RPMS') + const rpmPackageApplicationDirPath = path.join(rpmPackageBuildDirPath, appName) + const rpmPackageIconsDirPath = path.join(rpmPackageBuildDirPath, 'icons') + + if (fs.existsSync(rpmPackageBuildDirPath)) { + console.log(`Deleting existing rpm build directory at "${rpmPackageBuildDirPath}"`) + fs.removeSync(rpmPackageBuildDirPath) + } + + console.log(`Creating rpm package directory structure at "${rpmPackageDirPath}"`) + fs.mkdirpSync(rpmPackageBuildDirPath) + fs.mkdirpSync(rpmPackageSourcesDirPath) + fs.mkdirpSync(rpmPackageSpecsDirPath) + + console.log(`Copying "${packagedAppPath}" to "${rpmPackageApplicationDirPath}"`) + copySync(packagedAppPath, rpmPackageApplicationDirPath) + + console.log(`Copying icons into "${rpmPackageIconsDirPath}"`) + copySync( + path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png'), + rpmPackageIconsDirPath + ) + + console.log(`Writing rpm package spec file into "${rpmPackageSpecsDirPath}"`) + const rpmPackageSpecFilePath = path.join(rpmPackageSpecsDirPath, 'atom.spec') + const rpmPackageSpecsTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'redhat', 'atom.spec.in')) + const rpmPackageSpecsContents = template(rpmPackageSpecsTemplate)({ + appName: appName, appFileName: atomExecutableName, apmFileName: apmExecutableName, + description: appDescription, installDir: '/usr', version: appVersion + }) + fs.writeFileSync(rpmPackageSpecFilePath, rpmPackageSpecsContents) + + console.log(`Writing desktop entry file into "${rpmPackageBuildDirPath}"`) + const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in')) + const desktopEntryContents = template(desktopEntryTemplate)({ + appName: appName, appFileName: atomExecutableName, description: appDescription, + installDir: '/usr', iconName: atomExecutableName + }) + fs.writeFileSync(path.join(rpmPackageBuildDirPath, `${atomExecutableName}.desktop`), desktopEntryContents) + + console.log(`Copying atom.sh into "${rpmPackageBuildDirPath}"`) + copySync( + path.join(CONFIG.repositoryRootPath, 'atom.sh'), + path.join(rpmPackageBuildDirPath, 'atom.sh') + ) + + console.log(`Generating .rpm package from "${rpmPackageDirPath}"`) + childProcess.spawnSync('rpmbuild', ['-ba', '--clean', rpmPackageSpecFilePath]) + + // TODO: copy generated package into out/ + // console.log(`Copying generated package into "${outputRpmPackageFilePath}"`) +} From 91732ce753c80d98bc5f12aaf28474aa6f63fa91 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 16:00:44 +0200 Subject: [PATCH 163/221] :art: --- script/lib/create-debian-package.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 4878294d8..10724dce3 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -15,6 +15,7 @@ module.exports = function (packagedAppPath) { const apmExecutableName = CONFIG.channel === 'beta' ? 'apm-beta' : 'apm' const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' const appDescription = CONFIG.appMetadata.description + const appVersion = CONFIG.appMetadata.version let arch if (process.arch === 'ia32') { arch = 'i386' @@ -49,7 +50,7 @@ module.exports = function (packagedAppPath) { fs.removeSync(debianPackageDirPath) } - console.log('Creating Debian package structure') + console.log(`Creating Debian package directory structure at "${debianPackageDirPath}"`) fs.mkdirpSync(debianPackageDirPath) fs.mkdirpSync(debianPackageConfigPath) fs.mkdirpSync(debianPackageInstallDirPath) @@ -75,7 +76,7 @@ module.exports = function (packagedAppPath) { const packageSizeInKilobytes = childProcess.spawnSync('du', ['-sk', packagedAppPath]).stdout.toString().split(/\s+/)[0] const controlFileTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'debian', 'control.in')) const controlFileContents = template(controlFileTemplate)({ - appFileName: atomExecutableName, version: CONFIG.appMetadata.version, arch: arch, + appFileName: atomExecutableName, version: appVersion, arch: arch, installedSize: packageSizeInKilobytes, description: appDescription }) fs.writeFileSync(path.join(debianPackageConfigPath, 'control'), controlFileContents) From c7ab2570c921cefb72b9933a1ff997b96e0b5085 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 15 Aug 2016 16:01:07 +0200 Subject: [PATCH 164/221] Use --create-rpm-package flag on Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ea827f768..505593875 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ install: - nvm use --delete-prefix $NODE_VERSION - npm install -g npm - script/bootstrap - - script/build --create-debian-package --compress-artifacts + - script/build --create-debian-package --create-rpm-package --compress-artifacts script: true From c9de91dc094cce8a8c20cc0faa5e139ff85f588f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 15 Aug 2016 08:05:57 -0600 Subject: [PATCH 165/221] Rename create-installer option to create-windows-installer to match help Signed-off-by: Antonio Scandurra --- script/build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/build b/script/build index 527cd1cbb..3f8a50caa 100755 --- a/script/build +++ b/script/build @@ -63,11 +63,11 @@ dumpSymbols() console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing'.gray) } } else if (process.platform === 'win32') { - if (argv.createInstaller) { + if (argv.createWindowsInstaller) { return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) } else { - console.log('Skipping creating installer. Specify the --create-installer option to create a Squirrel-based Windows installer.'.gray) + console.log('Skipping creating installer. Specify the --create-windows-installer option to create a Squirrel-based Windows installer.'.gray) } } else if (process.platform === 'linux') { if (argv.createDebianPackage) { From 923e5ace0b2ba002c9646fa7a364250dc8f0c018 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 15 Aug 2016 08:06:13 -0600 Subject: [PATCH 166/221] Create Windows installer on AppVeyor Signed-off-by: Antonio Scandurra --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 98a48e743..fdeadd058 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,7 +25,7 @@ install: build_script: - cd %APPVEYOR_BUILD_FOLDER% - script\bootstrap.cmd - - script\build.cmd --code-sign --compress-artifacts + - script\build.cmd --code-sign --create-windows-installer --compress-artifacts test: off deploy: off From 8dddbab3446c12242fd9995a311d0dcede75f2ca Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 11:00:00 +0200 Subject: [PATCH 167/221] Recreate symlinks when calling `copySync` --- script/lib/copy-sync.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/script/lib/copy-sync.js b/script/lib/copy-sync.js index c86555343..717d115ec 100644 --- a/script/lib/copy-sync.js +++ b/script/lib/copy-sync.js @@ -5,26 +5,26 @@ const path = require('path') module.exports = copySync -function copySync(src, dest, options) { - if (fs.existsSync(src)) { - options = options || {} - options.filter = options.filter || () => true - - const destFolder = path.dirname(dest) - const stat = fs.statSync(src) - - if (options.filter(src)) { - if (stat.isFile()) { - if (!fs.existsSync(destFolder)) fs.mkdirsSync(destFolder) - copyFileSync(src, dest, options) - } else if (stat.isDirectory()) { - fs.readdirSync(src).forEach(content => { - copySync(path.join(src, content), path.join(dest, content), options) - }) +function copySync(src, dest, opts) { + const options = Object.assign({filter: () => true}, opts || {}) + const stat = fs.lstatSync(src) + if (options.filter(src)) { + if (stat.isFile()) { + const destDirPath = path.dirname(dest) + if (!fs.existsSync(destDirPath)) { + fs.mkdirpSync(destDirPath) } + copyFileSync(src, dest, options) + } else if (stat.isDirectory()) { + if (!fs.existsSync(dest)) { + fs.mkdirpSync(dest) + } + fs.readdirSync(src).forEach(content => { + copySync(path.join(src, content), path.join(dest, content), options) + }) + } else if (stat.isSymbolicLink()) { + fs.symlinkSync(fs.readlinkSync(src), dest) } - } else { - console.log(`Skipping copy of "${src}" because it doesn't exist`.gray) } } From afb57711d0a0ce1487a58a9cbc497d2fe4f7850c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 12:00:20 +0200 Subject: [PATCH 168/221] :art: --- script/lib/package-application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 4bd0d40a8..22617ae54 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -41,7 +41,7 @@ module.exports = function () { if (process.platform === 'darwin') { bundledResourcesPath = path.join(packagedAppPath, 'Contents', 'Resources') setAtomHelperVersion(packagedAppPath) - } else if (process.platform == 'linux') { + } else if (process.platform === 'linux') { bundledResourcesPath = path.join(packagedAppPath, 'resources') chmodNodeFiles(packagedAppPath) } else { From d7f7f3527e52a7c824c3364a4c4eba84cc82369d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 12:29:42 +0200 Subject: [PATCH 169/221] Extract a spawnSync helper that throws on command errors --- script/lib/code-sign-on-mac.js | 8 ++++---- script/lib/compress-artifacts.js | 4 ++-- script/lib/create-debian-package.js | 6 +++--- script/lib/create-rpm-package.js | 4 ++-- script/lib/download-chromedriver.js | 4 ++-- script/lib/generate-metadata.js | 8 ++++---- script/lib/install-apm.js | 2 +- script/lib/install-atom-dependencies.js | 2 +- script/lib/install-script-dependencies.js | 2 +- script/lib/kill-running-atom-instances.js | 2 +- script/lib/package-application.js | 12 ++++++------ script/lib/spawn-sync.js | 20 ++++++++++++++++++++ script/lib/verify-machine-requirements.js | 2 +- 13 files changed, 48 insertions(+), 28 deletions(-) create mode 100644 script/lib/spawn-sync.js diff --git a/script/lib/code-sign-on-mac.js b/script/lib/code-sign-on-mac.js index b7fa4831c..8326e9f03 100644 --- a/script/lib/code-sign-on-mac.js +++ b/script/lib/code-sign-on-mac.js @@ -1,8 +1,8 @@ -const childProcess = require('child_process') const downloadFileFromGithub = require('./download-file-from-github') const fs = require('fs-extra') const os = require('os') const path = require('path') +const spawnSync = require('./spawn-sync') module.exports = function (packagedAppPath) { if (!process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL) { @@ -20,10 +20,10 @@ module.exports = function (packagedAppPath) { if (process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) { unlockArgs.push('-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) } - childProcess.spawnSync('security', unlockArgs, {stdio: 'inherit'}) + spawnSync('security', unlockArgs, {stdio: 'inherit'}) console.log(`Importing certificate at ${certPath} into ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN} keychain`) - childProcess.spawnSync('security', [ + spawnSync('security', [ 'import', certPath, '-P', process.env.ATOM_MAC_CODE_SIGNING_CERT_PASSWORD, '-k', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, @@ -31,7 +31,7 @@ module.exports = function (packagedAppPath) { ]) console.log(`Code-signing application at ${packagedAppPath}`) - childProcess.spawnSync('codesign', [ + spawnSync('codesign', [ '--deep', '--force', '--verbose', '--keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, '--sign', 'Developer ID Application: GitHub', packagedAppPath diff --git a/script/lib/compress-artifacts.js b/script/lib/compress-artifacts.js index 3552d050d..b4c7c3ba7 100644 --- a/script/lib/compress-artifacts.js +++ b/script/lib/compress-artifacts.js @@ -1,8 +1,8 @@ 'use strict' -const childProcess = require('child_process') const fs = require('fs-extra') const path = require('path') +const spawnSync = require('./spawn-sync') const CONFIG = require('../config') @@ -43,5 +43,5 @@ function compress (inputDirPath, outputArchivePath) { compressArguments = ['caf'] } compressArguments.push(outputArchivePath, path.basename(inputDirPath)) - childProcess.spawnSync(compressCommand, compressArguments, {cwd: path.dirname(inputDirPath)}) + spawnSync(compressCommand, compressArguments, {cwd: path.dirname(inputDirPath)}) } diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 10724dce3..0577f0f2f 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -1,10 +1,10 @@ 'use strict' -const childProcess = require('child_process') const copySync = require('./copy-sync') const fs = require('fs-extra') const os = require('os') const path = require('path') +const spawnSync = require('./spawn-sync') const template = require('lodash.template') const CONFIG = require('../config') @@ -73,7 +73,7 @@ module.exports = function (packagedAppPath) { ) console.log(`Writing control file into "${debianPackageConfigPath}"`) - const packageSizeInKilobytes = childProcess.spawnSync('du', ['-sk', packagedAppPath]).stdout.toString().split(/\s+/)[0] + const packageSizeInKilobytes = spawnSync('du', ['-sk', packagedAppPath]).stdout.toString().split(/\s+/)[0] const controlFileTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'debian', 'control.in')) const controlFileContents = template(controlFileTemplate)({ appFileName: atomExecutableName, version: appVersion, arch: arch, @@ -108,7 +108,7 @@ module.exports = function (packagedAppPath) { ) console.log(`Generating .deb file from ${debianPackageDirPath}`) - childProcess.spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], {stdio: 'inherit'}) + spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], {stdio: 'inherit'}) console.log(`Copying generated package into "${outputDebianPackageFilePath}"`) copySync(`${debianPackageDirPath}.deb`, outputDebianPackageFilePath) diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index 85f880319..002af7e75 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -1,10 +1,10 @@ 'use strict' -const childProcess = require('child_process') const copySync = require('./copy-sync') const fs = require('fs-extra') const os = require('os') const path = require('path') +const spawnSync = require('./spawn-sync') const template = require('lodash.template') const CONFIG = require('../config') @@ -80,7 +80,7 @@ module.exports = function (packagedAppPath) { ) console.log(`Generating .rpm package from "${rpmPackageDirPath}"`) - childProcess.spawnSync('rpmbuild', ['-ba', '--clean', rpmPackageSpecFilePath]) + spawnSync('rpmbuild', ['-ba', '--clean', rpmPackageSpecFilePath]) // TODO: copy generated package into out/ // console.log(`Copying generated package into "${outputRpmPackageFilePath}"`) diff --git a/script/lib/download-chromedriver.js b/script/lib/download-chromedriver.js index 16266b94c..ec52823f9 100644 --- a/script/lib/download-chromedriver.js +++ b/script/lib/download-chromedriver.js @@ -1,11 +1,11 @@ 'use strict' const assert = require('assert') -const childProcess = require('child_process') const downloadFileFromGithub = require('./download-file-from-github') const fs = require('fs-extra') const path = require('path') const semver = require('semver') +const spawnSync = require('./spawn-sync') const syncRequest = require('sync-request') const CONFIG = require('../config') @@ -52,5 +52,5 @@ function unzipPath (inputPath, outputPath) { } console.log(`Unzipping "${inputPath}" to "${outputPath}"`) - childProcess.spawnSync('unzip', [inputPath, '-d', outputPath]) + spawnSync('unzip', [inputPath, '-d', outputPath]) } diff --git a/script/lib/generate-metadata.js b/script/lib/generate-metadata.js index d54d9f44a..89ef04f69 100644 --- a/script/lib/generate-metadata.js +++ b/script/lib/generate-metadata.js @@ -1,12 +1,12 @@ 'use strict' -const childProcess = require('child_process') -const path = require('path') const CSON = require('season') +const deprecatedPackagesMetadata = require('../deprecated-packages') const fs = require('fs-extra') const normalizePackageData = require('normalize-package-data') -const deprecatedPackagesMetadata = require('../deprecated-packages') +const path = require('path') const semver = require('semver') +const spawnSync = require('./spawn-sync') const CONFIG = require('../config') @@ -126,7 +126,7 @@ function checkDeprecatedPackagesMetadata () { function computeAppVersion () { let version = CONFIG.appMetadata.version if (CONFIG.channel === 'dev') { - const result = childProcess.spawnSync('git', ['rev-parse', '--short', 'HEAD'], {cwd: CONFIG.repositoryRootPath}) + const result = spawnSync('git', ['rev-parse', '--short', 'HEAD'], {cwd: CONFIG.repositoryRootPath}) const commitHash = result.stdout.toString().trim() version += '-' + commitHash } diff --git a/script/lib/install-apm.js b/script/lib/install-apm.js index d37217e0d..366941e5e 100644 --- a/script/lib/install-apm.js +++ b/script/lib/install-apm.js @@ -1,6 +1,6 @@ 'use strict' -const childProcess = require('child_process') +const spawnSync = require('./spawn-sync') const path = require('path') const CONFIG = require('../config') diff --git a/script/lib/install-atom-dependencies.js b/script/lib/install-atom-dependencies.js index ca2020585..1ced7c30b 100644 --- a/script/lib/install-atom-dependencies.js +++ b/script/lib/install-atom-dependencies.js @@ -1,6 +1,6 @@ 'use strict' -const childProcess = require('child_process') +const spawnSync = require('./spawn-sync') const path = require('path') const CONFIG = require('../config') diff --git a/script/lib/install-script-dependencies.js b/script/lib/install-script-dependencies.js index 12454e517..81f65d113 100644 --- a/script/lib/install-script-dependencies.js +++ b/script/lib/install-script-dependencies.js @@ -1,6 +1,6 @@ 'use strict' -const childProcess = require('child_process') +const spawnSync = require('./spawn-sync') const path = require('path') const CONFIG = require('../config') diff --git a/script/lib/kill-running-atom-instances.js b/script/lib/kill-running-atom-instances.js index 616ca6060..ce1849016 100644 --- a/script/lib/kill-running-atom-instances.js +++ b/script/lib/kill-running-atom-instances.js @@ -1,4 +1,4 @@ -const childProcess = require('child_process') +const spawnSync = require('./spawn-sync') const CONFIG = require('../config.js') diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 22617ae54..572590102 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -2,12 +2,12 @@ const assert = require('assert') const copySync = require('./copy-sync') -const fs = require('fs-extra') -const path = require('path') -const childProcess = require('child_process') const electronPackager = require('electron-packager') +const fs = require('fs-extra') const includePathInPackagedApp = require('./include-path-in-packaged-app') const getLicenseText = require('./get-license-text') +const path = require('path') +const spawnSync = require('./spawn-sync') const CONFIG = require('../config') @@ -90,13 +90,13 @@ function setAtomHelperVersion (packagedAppPath) { const frameworksPath = path.join(packagedAppPath, 'Contents', 'Frameworks') const helperPListPath = path.join(frameworksPath, 'Atom Helper.app', 'Contents', 'Info.plist') console.log(`Setting Atom Helper Version for ${helperPListPath}`) - childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleVersion', CONFIG.appMetadata.version, helperPListPath]) - childProcess.spawnSync('/usr/libexec/PlistBuddy', ['-c', 'Set CFBundleShortVersionString', CONFIG.appMetadata.version, helperPListPath]) + spawnSync('/usr/libexec/PlistBuddy', ['-c', `Add CFBundleVersion string ${CONFIG.appMetadata.version}`, helperPListPath]) + spawnSync('/usr/libexec/PlistBuddy', ['-c', `Add CFBundleShortVersionString string ${CONFIG.appMetadata.version}`, helperPListPath]) } function chmodNodeFiles (packagedAppPath) { console.log(`Changing permissions for node files in ${packagedAppPath}`) - childProcess.spawnSync('find', [packagedAppPath, '-type', 'f', '-name', '*.node', '-exec chmod a-x {};']) + spawnSync('find', [packagedAppPath, '-type', 'f', '-name', '*.node', '-exec chmod a-x {};']) } function buildAsarUnpackGlobExpression () { diff --git a/script/lib/spawn-sync.js b/script/lib/spawn-sync.js new file mode 100644 index 000000000..261eba11a --- /dev/null +++ b/script/lib/spawn-sync.js @@ -0,0 +1,20 @@ +// This file exports a function that has the same interface as +// `spawnSync`, but it throws if there's an error while executing +// the supplied command or if the exit code is not 0. This is similar to what +// `execSync` does, but we want to use `spawnSync` because it provides automatic +// escaping for the supplied arguments. + +const childProcess = require('child_process') + +module.exports = function () { + const result = childProcess.spawnSync.apply(childProcess, arguments) + if (result.error) { + throw result.error + } else if (result.status !== 0) { + console.error(result.stdout.toString()) + console.error(result.stderr.toString()) + throw new Error(`Command ${result.args.join(' ')} exited with code "${result.status}"`) + } else { + return result + } +} diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index ad34cee97..9300e8c61 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -1,6 +1,6 @@ 'use strict' -const childProcess = require('child_process') +const spawnSync = require('./spawn-sync') const fs = require('fs') const path = require('path') From 62d5af52ae231c8e966836a3e39227a1709ec075 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 12:41:00 +0200 Subject: [PATCH 170/221] Use `execSync` when changing permissions via the `find` command This will prevent the arguments supplied to `-exec` from being escaped incorrectly by `spawnSync`. --- script/lib/package-application.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 572590102..78870939d 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -1,6 +1,7 @@ 'use strict' const assert = require('assert') +const childProcess = require('child_process') const copySync = require('./copy-sync') const electronPackager = require('electron-packager') const fs = require('fs-extra') @@ -96,7 +97,7 @@ function setAtomHelperVersion (packagedAppPath) { function chmodNodeFiles (packagedAppPath) { console.log(`Changing permissions for node files in ${packagedAppPath}`) - spawnSync('find', [packagedAppPath, '-type', 'f', '-name', '*.node', '-exec chmod a-x {};']) + childProcess.execSync(`find "${packagedAppPath}" -type f -name *.node -exec chmod a-x {} \\;`) } function buildAsarUnpackGlobExpression () { From e3e85e47803be3fbb5a6dca90c4384212d411083 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 12:46:37 +0200 Subject: [PATCH 171/221] Put back mistakenly deleted requires --- script/lib/install-apm.js | 2 +- script/lib/install-atom-dependencies.js | 2 +- script/lib/install-script-dependencies.js | 2 +- script/lib/verify-machine-requirements.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/script/lib/install-apm.js b/script/lib/install-apm.js index 366941e5e..d37217e0d 100644 --- a/script/lib/install-apm.js +++ b/script/lib/install-apm.js @@ -1,6 +1,6 @@ 'use strict' -const spawnSync = require('./spawn-sync') +const childProcess = require('child_process') const path = require('path') const CONFIG = require('../config') diff --git a/script/lib/install-atom-dependencies.js b/script/lib/install-atom-dependencies.js index 1ced7c30b..ca2020585 100644 --- a/script/lib/install-atom-dependencies.js +++ b/script/lib/install-atom-dependencies.js @@ -1,6 +1,6 @@ 'use strict' -const spawnSync = require('./spawn-sync') +const childProcess = require('child_process') const path = require('path') const CONFIG = require('../config') diff --git a/script/lib/install-script-dependencies.js b/script/lib/install-script-dependencies.js index 81f65d113..12454e517 100644 --- a/script/lib/install-script-dependencies.js +++ b/script/lib/install-script-dependencies.js @@ -1,6 +1,6 @@ 'use strict' -const spawnSync = require('./spawn-sync') +const childProcess = require('child_process') const path = require('path') const CONFIG = require('../config') diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 9300e8c61..ad34cee97 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -1,6 +1,6 @@ 'use strict' -const spawnSync = require('./spawn-sync') +const childProcess = require('child_process') const fs = require('fs') const path = require('path') From 6afcc7e96bcb8d7f7e5c127aff3846df28d816fd Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 12:49:32 +0200 Subject: [PATCH 172/221] Convert package.json version dashes into tildes for rpm packages --- script/lib/create-rpm-package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index 002af7e75..13b957892 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -18,7 +18,7 @@ module.exports = function (packagedAppPath) { // RPM versions can't have dashes in them. // * http://www.rpm.org/max-rpm/ch-rpm-file-format.html // * https://github.com/mojombo/semver/issues/145 - const appVersion = CONFIG.appMetadata.version.replace(/-beta/, "~beta").replace(/-dev/, "~dev") + const appVersion = CONFIG.appMetadata.version.replace(/-/g, '~') let arch if (process.arch === 'ia32') { arch = 'i386' From 8e1972d8045075c2aa66806a7d70d4157b377525 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 12:53:33 +0200 Subject: [PATCH 173/221] Unlock keychains using the correct format --- script/lib/code-sign-on-mac.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/lib/code-sign-on-mac.js b/script/lib/code-sign-on-mac.js index 8326e9f03..80d316566 100644 --- a/script/lib/code-sign-on-mac.js +++ b/script/lib/code-sign-on-mac.js @@ -15,11 +15,12 @@ module.exports = function (packagedAppPath) { downloadFileFromGithub(process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL, certPath) console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`) - const unlockArgs = ['unlock-keychain', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN] + const unlockArgs = ['unlock-keychain'] // For signing on local workstations, password could be entered interactively if (process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) { unlockArgs.push('-p', process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) } + unlockArgs.push(process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN) spawnSync('security', unlockArgs, {stdio: 'inherit'}) console.log(`Importing certificate at ${certPath} into ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN} keychain`) From 266db1669e6e998c5c0ec6c121978551790f1250 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 12:54:04 +0200 Subject: [PATCH 174/221] Don't stringify stdout/stderr when they don't exist --- script/lib/spawn-sync.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/lib/spawn-sync.js b/script/lib/spawn-sync.js index 261eba11a..a9477e8ea 100644 --- a/script/lib/spawn-sync.js +++ b/script/lib/spawn-sync.js @@ -11,8 +11,8 @@ module.exports = function () { if (result.error) { throw result.error } else if (result.status !== 0) { - console.error(result.stdout.toString()) - console.error(result.stderr.toString()) + if (result.stdout) console.error(result.stdout.toString()) + if (result.stderr) console.error(result.stderr.toString()) throw new Error(`Command ${result.args.join(' ')} exited with code "${result.status}"`) } else { return result From 03045ff2ec2962616843fcbcb5cc977ec22368d1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 13:02:06 +0200 Subject: [PATCH 175/221] Delete ~/rpmbuild entirely before creating a rpm package --- script/lib/create-rpm-package.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index 13b957892..dffd3ec5c 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -37,12 +37,13 @@ module.exports = function (packagedAppPath) { const rpmPackageApplicationDirPath = path.join(rpmPackageBuildDirPath, appName) const rpmPackageIconsDirPath = path.join(rpmPackageBuildDirPath, 'icons') - if (fs.existsSync(rpmPackageBuildDirPath)) { - console.log(`Deleting existing rpm build directory at "${rpmPackageBuildDirPath}"`) - fs.removeSync(rpmPackageBuildDirPath) + if (fs.existsSync(rpmPackageDirPath)) { + console.log(`Deleting existing rpm build directory at "${rpmPackageDirPath}"`) + fs.removeSync(rpmPackageDirPath) } console.log(`Creating rpm package directory structure at "${rpmPackageDirPath}"`) + fs.mkdirpSync(rpmPackageDirPath) fs.mkdirpSync(rpmPackageBuildDirPath) fs.mkdirpSync(rpmPackageSourcesDirPath) fs.mkdirpSync(rpmPackageSpecsDirPath) From 552c02f60fefd393b4356d245d22efb6f0696edb Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 13:14:27 +0200 Subject: [PATCH 176/221] Copy generated packages into buildOutputPath --- script/lib/create-rpm-package.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index dffd3ec5c..7fbc0a8d8 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -1,5 +1,6 @@ 'use strict' +const assert = require('assert') const copySync = require('./copy-sync') const fs = require('fs-extra') const os = require('os') @@ -28,7 +29,6 @@ module.exports = function (packagedAppPath) { arch = process.arch } - const outputRpmPackageFilePath = path.join(CONFIG.buildOutputPath, 'atom.x86_64.rpm') const rpmPackageDirPath = path.join(CONFIG.homeDirPath, 'rpmbuild') const rpmPackageBuildDirPath = path.join(rpmPackageDirPath, 'BUILD') const rpmPackageSourcesDirPath = path.join(rpmPackageDirPath, 'SOURCES') @@ -82,7 +82,13 @@ module.exports = function (packagedAppPath) { console.log(`Generating .rpm package from "${rpmPackageDirPath}"`) spawnSync('rpmbuild', ['-ba', '--clean', rpmPackageSpecFilePath]) - - // TODO: copy generated package into out/ - // console.log(`Copying generated package into "${outputRpmPackageFilePath}"`) + for (let generatedArch of fs.readdirSync(rpmPackageRpmsDirPath)) { + const generatedArchDirPath = path.join(rpmPackageRpmsDirPath, generatedArch) + const generatedPackageFileNames = fs.readdirSync(generatedArchDirPath) + assert(generatedPackageFileNames.length === 1, 'Generated more than one rpm package') + const generatedPackageFilePath = path.join(generatedArchDirPath, generatedPackageFileNames[0]) + const outputRpmPackageFilePath = path.join(CONFIG.buildOutputPath, `atom.${generatedArch}.rpm`) + console.log(`Copying "${generatedPackageFilePath}" into "${outputRpmPackageFilePath}"`) + copySync(generatedPackageFilePath, outputRpmPackageFilePath) + } } From 943df9347df2bbea4b8e44c3dfc7b76e458e8c8e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 13:36:41 +0200 Subject: [PATCH 177/221] Install rpm on Travis to build rpm packages --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 505593875..96161da67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,8 @@ addons: - ubuntu-toolchain-r-test packages: - build-essential - - git - - libgnome-keyring-dev - fakeroot - gcc-multilib + - git + - libgnome-keyring-dev + - rpm From 0189616e123a76abf76daeacf12cff6e4ea16470 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 14:34:16 +0200 Subject: [PATCH 178/221] Use `x.y.z~dev.sha` as the appVersion on rpm packages --- script/lib/create-rpm-package.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index 7fbc0a8d8..3d37a208e 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -19,7 +19,9 @@ module.exports = function (packagedAppPath) { // RPM versions can't have dashes in them. // * http://www.rpm.org/max-rpm/ch-rpm-file-format.html // * https://github.com/mojombo/semver/issues/145 - const appVersion = CONFIG.appMetadata.version.replace(/-/g, '~') + const appVersion = CONFIG.appMetadata.version + .replace(/-/, '~') // replaces the first dash with ~ (`-beta0` -> `~beta0`) + .replace(/-/, '.') // replaces the second dash with . (`~dev-bca231` -> `~dev.bca231`) let arch if (process.arch === 'ia32') { arch = 'i386' From 6439812bf6b3da7f2a9636fcab76c19af4914cd0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 14:43:02 +0200 Subject: [PATCH 179/221] Try replacing dashes with dots --- script/lib/create-rpm-package.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index 3d37a208e..e173db665 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -16,12 +16,9 @@ module.exports = function (packagedAppPath) { const apmExecutableName = CONFIG.channel === 'beta' ? 'apm-beta' : 'apm' const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' const appDescription = CONFIG.appMetadata.description - // RPM versions can't have dashes in them. - // * http://www.rpm.org/max-rpm/ch-rpm-file-format.html - // * https://github.com/mojombo/semver/issues/145 - const appVersion = CONFIG.appMetadata.version - .replace(/-/, '~') // replaces the first dash with ~ (`-beta0` -> `~beta0`) - .replace(/-/, '.') // replaces the second dash with . (`~dev-bca231` -> `~dev.bca231`) + // RPM versions can't have dashes or tildes in them. + // (Ref.: https://twiki.cern.ch/twiki/bin/view/Main/RPMAndDebVersioning) + const appVersion = CONFIG.appMetadata.version.replace(/-/g, '.') let arch if (process.arch === 'ia32') { arch = 'i386' From 061ae3786ac7774f7112284ed5714536d06b5d5f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 16 Aug 2016 18:08:16 +0200 Subject: [PATCH 180/221] Remove custom copySync function Originally we introduced this function because we thought empty directories were causing path length issues on Windows, but it turns out that it was a problem with Squirrel, so we can delete this code path altogether. Signed-off-by: Nathan Sobo --- script/lib/copy-assets.js | 6 ++-- script/lib/copy-sync.js | 54 ----------------------------- script/lib/create-debian-package.js | 13 ++++--- script/lib/create-rpm-package.js | 9 +++-- script/lib/install-application.js | 3 +- script/lib/package-application.js | 19 +++++----- 6 files changed, 23 insertions(+), 81 deletions(-) delete mode 100644 script/lib/copy-sync.js diff --git a/script/lib/copy-assets.js b/script/lib/copy-assets.js index 2ddcbe937..3c33ad13a 100644 --- a/script/lib/copy-assets.js +++ b/script/lib/copy-assets.js @@ -4,7 +4,7 @@ 'use strict' const path = require('path') -const copySync = require('./copy-sync') +const fs = require('fs-extra') const CONFIG = require('../config') const glob = require('glob') const includePathInPackagedApp = require('./include-path-in-packaged-app') @@ -22,10 +22,10 @@ module.exports = function () { ] srcPaths = srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')})) for (let srcPath of srcPaths) { - copySync(srcPath, computeDestinationPath(srcPath), {filter: includePathInPackagedApp}) + fs.copySync(srcPath, computeDestinationPath(srcPath), {filter: includePathInPackagedApp}) } - copySync( + fs.copySync( path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), path.join(CONFIG.intermediateAppPath, 'resources', 'atom.png') ) diff --git a/script/lib/copy-sync.js b/script/lib/copy-sync.js deleted file mode 100644 index 717d115ec..000000000 --- a/script/lib/copy-sync.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict' - -const fs = require('fs-extra') -const path = require('path') - -module.exports = copySync - -function copySync(src, dest, opts) { - const options = Object.assign({filter: () => true}, opts || {}) - const stat = fs.lstatSync(src) - if (options.filter(src)) { - if (stat.isFile()) { - const destDirPath = path.dirname(dest) - if (!fs.existsSync(destDirPath)) { - fs.mkdirpSync(destDirPath) - } - copyFileSync(src, dest, options) - } else if (stat.isDirectory()) { - if (!fs.existsSync(dest)) { - fs.mkdirpSync(dest) - } - fs.readdirSync(src).forEach(content => { - copySync(path.join(src, content), path.join(dest, content), options) - }) - } else if (stat.isSymbolicLink()) { - fs.symlinkSync(fs.readlinkSync(src), dest) - } - } -} - -const BUF_LENGTH = 4096 -const _buff = new Buffer(BUF_LENGTH) - -function copyFileSync(srcFile, destFile) { - if (fs.existsSync(destFile)) { - fs.chmodSync(destFile, parseInt('777', 8)) - fs.unlinkSync(destFile) - } - - const fileRead = fs.openSync(srcFile, 'r') - const stat = fs.fstatSync(fileRead) - const fileWrite = fs.openSync(destFile, 'w', stat.mode) - let bytesRead = 1 - let pos = 0 - - while (bytesRead > 0) { - bytesRead = fs.readSync(fileRead, _buff, 0, BUF_LENGTH, pos) - fs.writeSync(fileWrite, _buff, 0, bytesRead) - pos += bytesRead - } - - fs.closeSync(fileRead) - fs.closeSync(fileWrite) -} diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 0577f0f2f..75cda3c2b 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -1,6 +1,5 @@ 'use strict' -const copySync = require('./copy-sync') const fs = require('fs-extra') const os = require('os') const path = require('path') @@ -62,11 +61,11 @@ module.exports = function (packagedAppPath) { fs.mkdirpSync(debianPackageBinDirPath) console.log(`Copying "${packagedAppPath}" to "${debianPackageAtomDirPath}"`) - copySync(packagedAppPath, debianPackageAtomDirPath) + fs.copySync(packagedAppPath, debianPackageAtomDirPath) fs.chmodSync(debianPackageAtomDirPath, '755') console.log(`Copying binaries into "${debianPackageBinDirPath}"`) - copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(debianPackageBinDirPath, atomExecutableName)) + fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(debianPackageBinDirPath, atomExecutableName)) fs.symlinkSync( path.join('..', 'share', atomExecutableName, 'resources', 'app', 'apm', 'node_modules', '.bin', 'apm'), path.join(debianPackageBinDirPath, apmExecutableName) @@ -90,19 +89,19 @@ module.exports = function (packagedAppPath) { fs.writeFileSync(path.join(debianPackageApplicationsDirPath, `${atomExecutableName}.desktop`), desktopEntryContents) console.log(`Copying icon into "${debianPackageIconsDirPath}"`) - copySync( + fs.copySync( path.join(packagedAppPath, 'resources', 'app.asar.unpacked', 'resources', 'atom.png'), path.join(debianPackageIconsDirPath, `${atomExecutableName}.png`) ) console.log(`Copying license into "${debianPackageDocsDirPath}"`) - copySync( + fs.copySync( path.join(packagedAppPath, 'resources', 'LICENSE.md'), path.join(debianPackageDocsDirPath, 'copyright') ) console.log(`Copying lintian overrides into "${debianPackageLintianOverridesDirPath}"`) - copySync( + fs.copySync( path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'debian', 'lintian-overrides'), path.join(debianPackageLintianOverridesDirPath, atomExecutableName) ) @@ -111,5 +110,5 @@ module.exports = function (packagedAppPath) { spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], {stdio: 'inherit'}) console.log(`Copying generated package into "${outputDebianPackageFilePath}"`) - copySync(`${debianPackageDirPath}.deb`, outputDebianPackageFilePath) + fs.copySync(`${debianPackageDirPath}.deb`, outputDebianPackageFilePath) } diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index e173db665..5698f54a0 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -1,7 +1,6 @@ 'use strict' const assert = require('assert') -const copySync = require('./copy-sync') const fs = require('fs-extra') const os = require('os') const path = require('path') @@ -48,10 +47,10 @@ module.exports = function (packagedAppPath) { fs.mkdirpSync(rpmPackageSpecsDirPath) console.log(`Copying "${packagedAppPath}" to "${rpmPackageApplicationDirPath}"`) - copySync(packagedAppPath, rpmPackageApplicationDirPath) + fs.copySync(packagedAppPath, rpmPackageApplicationDirPath) console.log(`Copying icons into "${rpmPackageIconsDirPath}"`) - copySync( + fs.copySync( path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png'), rpmPackageIconsDirPath ) @@ -74,7 +73,7 @@ module.exports = function (packagedAppPath) { fs.writeFileSync(path.join(rpmPackageBuildDirPath, `${atomExecutableName}.desktop`), desktopEntryContents) console.log(`Copying atom.sh into "${rpmPackageBuildDirPath}"`) - copySync( + fs.copySync( path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(rpmPackageBuildDirPath, 'atom.sh') ) @@ -88,6 +87,6 @@ module.exports = function (packagedAppPath) { const generatedPackageFilePath = path.join(generatedArchDirPath, generatedPackageFileNames[0]) const outputRpmPackageFilePath = path.join(CONFIG.buildOutputPath, `atom.${generatedArch}.rpm`) console.log(`Copying "${generatedPackageFilePath}" into "${outputRpmPackageFilePath}"`) - copySync(generatedPackageFilePath, outputRpmPackageFilePath) + fs.copySync(generatedPackageFilePath, outputRpmPackageFilePath) } } diff --git a/script/lib/install-application.js b/script/lib/install-application.js index bc6654050..5852e6604 100644 --- a/script/lib/install-application.js +++ b/script/lib/install-application.js @@ -1,6 +1,5 @@ 'use strict' -const copySync = require('./copy-sync') const fs = require('fs-extra') const path = require('path') @@ -13,7 +12,7 @@ module.exports = function (packagedAppPath) { fs.removeSync(installationDirPath) } console.log(`Installing ${packagedAppPath} at ${installationDirPath}`) - copySync(packagedAppPath, installationDirPath) + fs.copySync(packagedAppPath, installationDirPath) } else { throw new Error("Not implemented yet.") } diff --git a/script/lib/package-application.js b/script/lib/package-application.js index 78870939d..5c76da9c0 100644 --- a/script/lib/package-application.js +++ b/script/lib/package-application.js @@ -2,7 +2,6 @@ const assert = require('assert') const childProcess = require('child_process') -const copySync = require('./copy-sync') const electronPackager = require('electron-packager') const fs = require('fs-extra') const includePathInPackagedApp = require('./include-path-in-packaged-app') @@ -58,7 +57,7 @@ module.exports = function () { function copyNonASARResources (packagedAppPath, bundledResourcesPath) { console.log(`Copying non-ASAR resources to ${bundledResourcesPath}`) - copySync( + fs.copySync( path.join(CONFIG.repositoryRootPath, 'apm', 'node_modules', 'atom-package-manager'), path.join(bundledResourcesPath, 'app', 'apm'), {filter: includePathInPackagedApp} @@ -67,18 +66,18 @@ function copyNonASARResources (packagedAppPath, bundledResourcesPath) { // Existing symlinks on user systems point to an outdated path, so just symlink it to the real location of the apm binary. // TODO: Change command installer to point to appropriate path and remove this fallback after a few releases. fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(bundledResourcesPath, 'app', 'apm', 'node_modules', '.bin', 'apm')) - copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledResourcesPath, 'app', 'atom.sh')) + fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), path.join(bundledResourcesPath, 'app', 'atom.sh')) } if (process.platform === 'darwin') { - copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'file.icns'), path.join(bundledResourcesPath, 'file.icns')) + fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'mac', 'file.icns'), path.join(bundledResourcesPath, 'file.icns')) } else if (process.platform === 'linux') { - copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), path.join(packagedAppPath, 'atom.png')) + fs.copySync(path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png'), path.join(packagedAppPath, 'atom.png')) } else if (process.platform === 'win32') { - copySync(path.join('resources', 'win', 'atom.cmd'), path.join(bundledResourcesPath, 'cli', 'atom.cmd')) - copySync(path.join('resources', 'win', 'atom.sh'), path.join(bundledResourcesPath, 'cli', 'atom.sh')) - copySync(path.join('resources', 'win', 'atom.js'), path.join(bundledResourcesPath, 'cli', 'atom.js')) - copySync(path.join('resources', 'win', 'apm.cmd'), path.join(bundledResourcesPath, 'cli', 'apm.cmd')) - copySync(path.join('resources', 'win', 'apm.sh'), path.join(bundledResourcesPath, 'cli', 'apm.sh')) + fs.copySync(path.join('resources', 'win', 'atom.cmd'), path.join(bundledResourcesPath, 'cli', 'atom.cmd')) + fs.copySync(path.join('resources', 'win', 'atom.sh'), path.join(bundledResourcesPath, 'cli', 'atom.sh')) + fs.copySync(path.join('resources', 'win', 'atom.js'), path.join(bundledResourcesPath, 'cli', 'atom.js')) + fs.copySync(path.join('resources', 'win', 'apm.cmd'), path.join(bundledResourcesPath, 'cli', 'apm.cmd')) + fs.copySync(path.join('resources', 'win', 'apm.sh'), path.join(bundledResourcesPath, 'cli', 'apm.sh')) } console.log(`Writing LICENSE.md to ${bundledResourcesPath}`) From 3dce1845bd0fbc00834d5288bfc543013e8584f9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 23 Aug 2016 14:45:17 +0200 Subject: [PATCH 181/221] Use Node 4.4.7 on Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 96161da67..428f7e08b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ compiler: clang matrix: include: - os: linux - env: NODE_VERSION=4 + env: NODE_VERSION=4.4.7 sudo: false From a7b56f2497028148cf10f1b89489e5b2eb21a897 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 23 Aug 2016 15:11:39 +0200 Subject: [PATCH 182/221] Build all the branches on Travis --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 428f7e08b..5cc7626a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,6 @@ git: depth: 10 -branches: - only: - - master - env: global: - ATOM_ACCESS_TOKEN=da809a6077bb1b0aa7c5623f7b2d5f1fec2faae4 From 66ab351f74e1de55574b9e60fcbef90b35cab11a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 23 Aug 2016 15:14:33 +0200 Subject: [PATCH 183/221] Upload artifacts to S3 --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5cc7626a6..dd045356c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,11 @@ notifications: on_failure: change addons: + artifacts: + paths: + - out/atom-amd64.deb + - out/atom.x86_64.rpm + - out/atom-amd64.tar.gz apt: sources: - ubuntu-toolchain-r-test From c4e635f7690112fe98847f4c029b66e96334b7cc Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 23 Aug 2016 15:38:34 +0200 Subject: [PATCH 184/221] Try fixing the build on Travis --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd045356c..f303c1ee5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ compiler: clang matrix: include: - os: linux - env: NODE_VERSION=4.4.7 + env: NODE_VERSION=4.4.7 CXX=g++-5 sudo: false @@ -51,6 +51,8 @@ addons: - build-essential - fakeroot - gcc-multilib + - gcc-5 + - g++-5 - git - libgnome-keyring-dev - rpm From e1e89e7930e71946d39316c33d518d807c464ca3 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 23 Aug 2016 16:19:01 +0200 Subject: [PATCH 185/221] Store Travis artifacts under travis-artifacts/BUILD_ID This will make it easier to download artifacts later by extracting the build id from the URL without additional API calls to Travis. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f303c1ee5..132338432 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,7 @@ addons: - out/atom-amd64.deb - out/atom.x86_64.rpm - out/atom-amd64.tar.gz + target_paths: travis-artifacts/$TRAVIS_BUILD_ID apt: sources: - ubuntu-toolchain-r-test From 7d5c8eff55baf05948c7cf4d48da2f05b4ec2a5e Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 25 Aug 2016 07:55:04 -0600 Subject: [PATCH 186/221] Delete downloaded nupkg for previous version after creating windows installer --- script/lib/create-windows-installer.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index 9d33afaf8..ac71c0da3 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -3,6 +3,7 @@ const downloadFileFromGithub = require('./download-file-from-github') const electronInstaller = require('electron-winstaller') const fs = require('fs-extra') +const glob = require('glob') const os = require('os') const path = require('path') @@ -28,15 +29,22 @@ module.exports = function (packagedAppPath, codeSign) { console.log('Skipping code-signing. Specify the --code-sign option and provide a WIN_P12KEY_URL environment variable to perform code-signing'.gray) } - const deleteCertificate = function () { + const cleanUp = function () { if (fs.existsSync(certPath)) { console.log(`Deleting certificate at ${certPath}`) fs.removeSync(certPath) } + + for (let nupkgPath of glob.sync(`${CONFIG.buildOutputPath}/*.nupkg`)) { + if (!nupkgPath.includes(CONFIG.appMetadata.version)) { + console.log(`Deleting downloaded nupkg for previous version at ${nupkgPath} to prevent it from being stored as an artifact`) + fs.removeSync(nupkgPath) + } + } } console.log(`Creating Windows Installer for ${packagedAppPath}`) - return electronInstaller.createWindowsInstaller(options).then(deleteCertificate, function (error) { + return electronInstaller.createWindowsInstaller(options).then(cleanUp, function (error) { console.log(`Windows installer creation failed:\n${error}`) - deleteCertificate() + cleanUp() }) } From f3d05f9adc92314a645ad5f2031f214b6f516353 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 25 Aug 2016 08:21:26 -0600 Subject: [PATCH 187/221] Add temporary no-op cibuild to avoid failure on Janky --- script/cibuild | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 script/cibuild diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 000000000..2c6cb7de5 --- /dev/null +++ b/script/cibuild @@ -0,0 +1,2 @@ +echo "Builds for this version of Atom no longer run on Janky." +echo "See https://github.com/atom/atom/pull/12410 for more information." From 865d9f395b7f5ad2ee7dac694e793b19bfc1aea8 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 25 Aug 2016 08:27:33 -0600 Subject: [PATCH 188/221] Delete old build and script dirs --- build-old/.npmrc | 1 - build-old/Gruntfile.coffee | 334 ---- build-old/README.md | 10 - build-old/certs/windows-dev.p12 | Bin 1765 -> 0 bytes build-old/debian/Dockerfile | 50 - build-old/deprecated-packages.json | 1713 ----------------- build-old/lib/uses-babel.coffee | 19 - build-old/package.json | 50 - build-old/tasks/build-task.coffee | 191 -- build-old/tasks/check-licenses-task.coffee | 27 - build-old/tasks/clean-task.coffee | 22 - build-old/tasks/codesign-task.coffee | 89 - .../tasks/compile-packages-slug-task.coffee | 93 - build-old/tasks/copy-info-plist-task.coffee | 13 - build-old/tasks/docs-task.coffee | 50 - build-old/tasks/dump-symbols-task.coffee | 39 - build-old/tasks/fingerprint-task.js | 7 - build-old/tasks/generate-asar-task.coffee | 37 - build-old/tasks/generate-license-task.coffee | 46 - .../tasks/generate-module-cache-task.coffee | 39 - build-old/tasks/install-task.coffee | 73 - build-old/tasks/license-overrides.coffee | 354 ---- build-old/tasks/mkdeb-task.coffee | 59 - build-old/tasks/mkrpm-task.coffee | 54 - build-old/tasks/mktar-task.coffee | 30 - build-old/tasks/nof-task.coffee | 6 - build-old/tasks/output-build-filetypes.coffee | 34 - build-old/tasks/output-disk-space.coffee | 25 - .../tasks/output-for-loop-returns.coffee | 22 - build-old/tasks/output-long-paths-task.coffee | 18 - build-old/tasks/output-module-counts.coffee | 66 - build-old/tasks/prebuild-less-task.coffee | 87 - build-old/tasks/publish-build-task.coffee | 281 --- build-old/tasks/set-exe-icon-task.coffee | 13 - build-old/tasks/set-version-task.coffee | 57 - build-old/tasks/spec-task.coffee | 158 -- build-old/tasks/task-helpers.coffee | 75 - script-old/bootstrap | 147 -- script-old/bootstrap.cmd | 6 - script-old/build | 27 - script-old/build.cmd | 5 - script-old/cibuild | 116 -- script-old/cibuild-atom-linux | 17 - script-old/cibuild-atom-rpm | 15 - script-old/cibuild.cmd | 5 - script-old/clean | 62 - script-old/clean.cmd | 5 - script-old/copy-folder.cmd | 18 - script-old/fingerprint-clean | 29 - script-old/fingerprint-write | 2 - script-old/grunt | 6 - script-old/grunt.cmd | 5 - script-old/mkdeb | 49 - script-old/mkrpm | 25 - script-old/mktar | 39 - script-old/railcar | 94 - script-old/rpmbuild | 6 - script-old/set-version | 15 - script-old/test | 10 - script-old/utils/child-process-wrapper.js | 46 - script-old/utils/clean-merged-branches | 41 - script-old/utils/clean-open-with-menu | 2 - script-old/utils/compile-main-to-app | 3 - script-old/utils/fingerprint.js | 37 - script-old/utils/fix-author | 17 - script-old/utils/run-grunt.js | 17 - .../translate-crash-log-addresses.coffee | 55 - script-old/utils/verify-requirements.js | 117 -- 68 files changed, 5280 deletions(-) delete mode 100644 build-old/.npmrc delete mode 100644 build-old/Gruntfile.coffee delete mode 100644 build-old/README.md delete mode 100644 build-old/certs/windows-dev.p12 delete mode 100644 build-old/debian/Dockerfile delete mode 100644 build-old/deprecated-packages.json delete mode 100644 build-old/lib/uses-babel.coffee delete mode 100644 build-old/package.json delete mode 100644 build-old/tasks/build-task.coffee delete mode 100644 build-old/tasks/check-licenses-task.coffee delete mode 100644 build-old/tasks/clean-task.coffee delete mode 100644 build-old/tasks/codesign-task.coffee delete mode 100644 build-old/tasks/compile-packages-slug-task.coffee delete mode 100644 build-old/tasks/copy-info-plist-task.coffee delete mode 100644 build-old/tasks/docs-task.coffee delete mode 100644 build-old/tasks/dump-symbols-task.coffee delete mode 100644 build-old/tasks/fingerprint-task.js delete mode 100644 build-old/tasks/generate-asar-task.coffee delete mode 100644 build-old/tasks/generate-license-task.coffee delete mode 100644 build-old/tasks/generate-module-cache-task.coffee delete mode 100644 build-old/tasks/install-task.coffee delete mode 100644 build-old/tasks/license-overrides.coffee delete mode 100644 build-old/tasks/mkdeb-task.coffee delete mode 100644 build-old/tasks/mkrpm-task.coffee delete mode 100644 build-old/tasks/mktar-task.coffee delete mode 100644 build-old/tasks/nof-task.coffee delete mode 100644 build-old/tasks/output-build-filetypes.coffee delete mode 100644 build-old/tasks/output-disk-space.coffee delete mode 100644 build-old/tasks/output-for-loop-returns.coffee delete mode 100644 build-old/tasks/output-long-paths-task.coffee delete mode 100644 build-old/tasks/output-module-counts.coffee delete mode 100644 build-old/tasks/prebuild-less-task.coffee delete mode 100644 build-old/tasks/publish-build-task.coffee delete mode 100644 build-old/tasks/set-exe-icon-task.coffee delete mode 100644 build-old/tasks/set-version-task.coffee delete mode 100644 build-old/tasks/spec-task.coffee delete mode 100644 build-old/tasks/task-helpers.coffee delete mode 100755 script-old/bootstrap delete mode 100644 script-old/bootstrap.cmd delete mode 100755 script-old/build delete mode 100644 script-old/build.cmd delete mode 100755 script-old/cibuild delete mode 100755 script-old/cibuild-atom-linux delete mode 100755 script-old/cibuild-atom-rpm delete mode 100644 script-old/cibuild.cmd delete mode 100755 script-old/clean delete mode 100644 script-old/clean.cmd delete mode 100644 script-old/copy-folder.cmd delete mode 100755 script-old/fingerprint-clean delete mode 100755 script-old/fingerprint-write delete mode 100755 script-old/grunt delete mode 100644 script-old/grunt.cmd delete mode 100755 script-old/mkdeb delete mode 100755 script-old/mkrpm delete mode 100755 script-old/mktar delete mode 100755 script-old/railcar delete mode 100755 script-old/rpmbuild delete mode 100755 script-old/set-version delete mode 100755 script-old/test delete mode 100644 script-old/utils/child-process-wrapper.js delete mode 100755 script-old/utils/clean-merged-branches delete mode 100755 script-old/utils/clean-open-with-menu delete mode 100755 script-old/utils/compile-main-to-app delete mode 100644 script-old/utils/fingerprint.js delete mode 100755 script-old/utils/fix-author delete mode 100644 script-old/utils/run-grunt.js delete mode 100755 script-old/utils/translate-crash-log-addresses.coffee delete mode 100644 script-old/utils/verify-requirements.js diff --git a/build-old/.npmrc b/build-old/.npmrc deleted file mode 100644 index c5ff09782..000000000 --- a/build-old/.npmrc +++ /dev/null @@ -1 +0,0 @@ -cache = ~/.atom/.npm diff --git a/build-old/Gruntfile.coffee b/build-old/Gruntfile.coffee deleted file mode 100644 index 9d753d2bf..000000000 --- a/build-old/Gruntfile.coffee +++ /dev/null @@ -1,334 +0,0 @@ -fs = require 'fs' -path = require 'path' -os = require 'os' -glob = require 'glob' -usesBabel = require './lib/uses-babel' -babelOptions = require '../static/babelrc' - -# Add support for obselete APIs of vm module so we can make some third-party -# modules work under node v0.11.x. -require 'vm-compatibility-layer' - -_ = require 'underscore-plus' - -packageJson = require '../package.json' - -module.exports = (grunt) -> - process.env.ATOM_RESOURCE_PATH ?= path.resolve(__dirname, '..') - - require('time-grunt')(grunt) - - grunt.loadNpmTasks('grunt-babel') - grunt.loadNpmTasks('grunt-coffeelint') - grunt.loadNpmTasks('grunt-lesslint') - grunt.loadNpmTasks('grunt-standard') - grunt.loadNpmTasks('grunt-cson') - grunt.loadNpmTasks('grunt-contrib-csslint') - grunt.loadNpmTasks('grunt-contrib-coffee') - grunt.loadNpmTasks('grunt-contrib-less') - grunt.loadNpmTasks('grunt-shell') - grunt.loadNpmTasks('grunt-download-electron') - grunt.loadNpmTasks('grunt-electron-installer') - grunt.loadNpmTasks('grunt-peg') - grunt.loadTasks('tasks') - - # This allows all subsequent paths to the relative to the root of the repo - grunt.file.setBase(path.resolve('..')) - - # Options - [defaultChannel, releaseBranch] = getDefaultChannelAndReleaseBranch(packageJson.version) - installDir = grunt.option('install-dir') - buildDir = path.resolve(grunt.option('build-dir') ? 'out') - channel = grunt.option('channel') ? defaultChannel - - metadata = packageJson - appName = packageJson.productName - appFileName = packageJson.name - apmFileName = 'apm' - - if channel is 'beta' - appName += ' Beta' - appFileName += '-beta' - apmFileName += '-beta' - - appName += '.app' if process.platform is 'darwin' - shellAppDir = path.join(buildDir, appName) - symbolsDir = path.join(buildDir, 'Atom.breakpad.syms') - - if process.platform is 'win32' - homeDir = process.env.USERPROFILE - contentsDir = shellAppDir - appDir = path.join(shellAppDir, 'resources', 'app') - installDir ?= path.join(process.env.LOCALAPPDATA, appName, 'app-dev') - killCommand = 'taskkill /F /IM atom.exe' - else if process.platform is 'darwin' - homeDir = process.env.HOME - contentsDir = path.join(shellAppDir, 'Contents') - appDir = path.join(contentsDir, 'Resources', 'app') - installDir ?= path.join('/Applications', appName) - killCommand = 'pkill -9 Atom' - else - homeDir = process.env.HOME - contentsDir = shellAppDir - appDir = path.join(shellAppDir, 'resources', 'app') - installDir ?= process.env.INSTALL_PREFIX ? '/usr/local' - killCommand ='pkill -9 atom' - - installDir = path.resolve(installDir) - electronDownloadDir = path.join(homeDir, '.atom', 'electron') - - coffeeConfig = - glob_to_multiple: - expand: true - src: [ - 'src/**/*.coffee' - 'spec/*.coffee' - '!spec/*-spec.coffee' - 'static/**/*.coffee' - ] - dest: appDir - ext: '.js' - - babelConfig = - options: babelOptions - dist: - files: [] - - lessConfig = - options: - paths: [ - 'static/variables' - 'static' - ] - glob_to_multiple: - expand: true - src: [ - 'static/**/*.less' - ] - dest: appDir - ext: '.css' - - prebuildLessConfig = - options: - cachePath: path.join(homeDir, '.atom', 'compile-cache', 'prebuild-less', require('less-cache/package.json').version) - src: [ - 'static/**/*.less' - ] - - csonConfig = - options: - rootObject: true - cachePath: path.join(homeDir, '.atom', 'compile-cache', 'grunt-cson') - - glob_to_multiple: - expand: true - src: [ - 'menus/*.cson' - 'keymaps/*.cson' - 'static/**/*.cson' - ] - dest: appDir - ext: '.json' - - pegConfig = - glob_to_multiple: - expand: true - src: ['src/**/*.pegjs'] - dest: appDir - ext: '.js' - - for jsFile in glob.sync("src/**/*.js") - if usesBabel(jsFile) - babelConfig.dist.files.push({ - src: [jsFile] - dest: path.join(appDir, jsFile) - }) - - for jsFile in glob.sync("exports/**/*.js") - if usesBabel(jsFile) - babelConfig.dist.files.push({ - src: [jsFile] - dest: path.join(appDir, jsFile) - }) - - for child in fs.readdirSync('node_modules') when child isnt '.bin' - directory = path.join('node_modules', child) - metadataPath = path.join(directory, 'package.json') - continue unless grunt.file.isFile(metadataPath) - - {engines, theme} = grunt.file.readJSON(metadataPath) - if engines?.atom? - coffeeConfig.glob_to_multiple.src.push("#{directory}/**/*.coffee") - coffeeConfig.glob_to_multiple.src.push("!#{directory}/spec/**/*.coffee") - - lessConfig.glob_to_multiple.src.push("#{directory}/**/*.less") - lessConfig.glob_to_multiple.src.push("!#{directory}/spec/**/*.less") - - unless theme - prebuildLessConfig.src.push("#{directory}/**/*.less") - prebuildLessConfig.src.push("!#{directory}/spec/**/*.less") - - csonConfig.glob_to_multiple.src.push("#{directory}/**/*.cson") - csonConfig.glob_to_multiple.src.push("!#{directory}/spec/**/*.cson") - - pegConfig.glob_to_multiple.src.push("#{directory}/lib/*.pegjs") - - for jsFile in glob.sync("#{directory}/lib/**/*.js") - if usesBabel(jsFile) - babelConfig.dist.files.push({ - src: [jsFile] - dest: path.join(appDir, jsFile) - }) - - windowsInstallerConfig = - - grunt.initConfig - pkg: grunt.file.readJSON('package.json') - - atom: { - appName, channel, metadata, releaseBranch, - appFileName, apmFileName, - appDir, buildDir, contentsDir, installDir, shellAppDir, symbolsDir, - } - - docsOutputDir: 'docs/output' - - babel: babelConfig - - coffee: coffeeConfig - - less: lessConfig - - 'prebuild-less': prebuildLessConfig - - cson: csonConfig - - peg: pegConfig - - coffeelint: - options: - configFile: 'coffeelint.json' - src: [ - 'dot-atom/**/*.coffee' - 'src/**/*.coffee' - ] - build: [ - 'build/tasks/**/*.coffee' - 'build/Gruntfile.coffee' - ] - test: [ - 'spec/*.coffee' - ] - - standard: - src: [ - 'exports/**/*.js' - 'src/**/*.js' - 'static/*.js' - ] - - csslint: - options: - 'adjoining-classes': false - 'duplicate-background-images': false - 'box-model': false - 'box-sizing': false - 'bulletproof-font-face': false - 'compatible-vendor-prefixes': false - 'display-property-grouping': false - 'fallback-colors': false - 'font-sizes': false - 'gradients': false - 'ids': false - 'important': false - 'known-properties': false - 'outline-none': false - 'overqualified-elements': false - 'qualified-headings': false - 'unique-headings': false - 'universal-selector': false - 'vendor-prefix': false - src: [ - 'static/**/*.css' - ] - - lesslint: - src: [ - 'static/**/*.less' - ] - - 'download-electron': - version: packageJson.electronVersion - outputDir: 'electron' - downloadDir: electronDownloadDir - rebuild: true # rebuild native modules after electron is updated - token: process.env.ATOM_ACCESS_TOKEN ? 'da809a6077bb1b0aa7c5623f7b2d5f1fec2faae4' - - 'create-windows-installer': - installer: - appDirectory: shellAppDir - outputDirectory: path.join(buildDir, 'installer') - authors: 'GitHub Inc.' - loadingGif: path.resolve(__dirname, '..', 'resources', 'win', 'loading.gif') - iconUrl: "https://raw.githubusercontent.com/atom/atom/master/resources/app-icons/#{channel}/atom.ico" - setupIcon: path.resolve(__dirname, '..', 'resources', 'app-icons', channel, 'atom.ico') - remoteReleases: "https://atom.io/api/updates?version=#{metadata.version}" - - shell: - 'kill-atom': - command: killCommand - options: - stdout: false - stderr: false - failOnError: false - - grunt.registerTask('compile', ['babel', 'coffee', 'prebuild-less', 'cson', 'peg']) - grunt.registerTask('lint', ['standard', 'coffeelint', 'csslint', 'lesslint']) - grunt.registerTask('test', ['shell:kill-atom', 'run-specs']) - - ciTasks = [] - ciTasks.push('output-disk-space') unless process.env.CI - ciTasks.push('download-electron') - ciTasks.push('download-electron-chromedriver') - ciTasks.push('build') - ciTasks.push('fingerprint') - ciTasks.push('dump-symbols') if process.platform is 'darwin' - ciTasks.push('set-version', 'check-licenses', 'lint', 'generate-asar') - ciTasks.push('mkdeb') if process.platform is 'linux' - ciTasks.push('mktar') if process.platform is 'linux' - ciTasks.push('test') if process.platform is 'darwin' - ciTasks.push('codesign:app') if process.platform is 'darwin' and not process.env.CI - if process.platform is 'win32' - ciTasks.push('codesign:exe') if process.env.JANKY_SIGNTOOL - ciTasks.push('codesign:installer-deferred') if not process.env.JANKY_SIGNTOOL - ciTasks.push('create-windows-installer:installer') - ciTasks.push('codesign:installer') if process.env.JANKY_SIGNTOOL - ciTasks.push('codesign:cleanup') - - if process.env.ATOM_PUBLISH_REPO or not process.env.CI - ciTasks.push('publish-build') - - grunt.registerTask('ci', ciTasks) - - defaultTasks = ['download-electron', 'download-electron-chromedriver', 'build', 'set-version', 'generate-asar'] - unless process.platform is 'linux' or grunt.option('no-install') - defaultTasks.push 'install' - grunt.registerTask('default', defaultTasks) - grunt.registerTask('build-and-sign', ['download-electron', 'download-electron-chromedriver', 'build', 'set-version', 'generate-asar', 'codesign:app', 'install']) - -getDefaultChannelAndReleaseBranch = (version) -> - if version.match(/dev/) or isBuildingPR() - channel = 'dev' - releaseBranch = null - else - if version.match(/beta/) - channel = 'beta' - else - channel = 'stable' - - minorVersion = version.match(/^\d+\.\d+/)[0] - releaseBranch = "#{minorVersion}-releases" - [channel, releaseBranch] - -isBuildingPR = -> - process.env.APPVEYOR_PULL_REQUEST_NUMBER? or process.env.TRAVIS_PULL_REQUEST? diff --git a/build-old/README.md b/build-old/README.md deleted file mode 100644 index 4ada056f1..000000000 --- a/build-old/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Atom Build - -This folder contains the grunt configuration and tasks to build Atom. - -It was moved from the root of the repository so that any native modules used -would be compiled against node's v8 headers since anything stored in -`node_modules` at the root of the repo is compiled against atom's v8 headers. - -New build dependencies should be added to the `package.json` file located in -this folder. diff --git a/build-old/certs/windows-dev.p12 b/build-old/certs/windows-dev.p12 deleted file mode 100644 index a93e9a9f042a29411a05cdf832c99041fd6d6180..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1765 zcmb7FX;c$e6n--kgF*JN2!|yK2+B4g2@((#0yaktvM6vs!xADON+3jBs7iveDWJuQ ziqXi9R0Tv-tY8rX9wVq&WDBAqu2rcDiWT~>Ew$(Pr{~U_x%a#8yLaZ!d}nY8@d1ip zxP&Mrk`|=1)5p{i6+|W><`N{tYzU|0670%s?L4xjU5^!8sZU|RO&n#=eOfsq7hlf{6-QGPd zN^vc!Deho{doNAf#RQ#~XIp7Y+8y#MRqlJ#@k~9(=3BFrSs$#) zd`02jljrXL(%+Ok-0#^`u^d}9vO^@U?$q;@+In8I=`m4T+c+6{px0}~J+FPmzwWKd zeqEGpwK$VJ=x>-|q7c1Z>Z@?RU+;Qj!l?Sy>E;50oa3e~tZE=*0IBDrJ#O-}|*FF1AK)**vT^=o;o>j|mW?snuqjixmXK+hj zN`w|G?ec{)iIhv?jK*-|9AqM^Vty+n$s*?M^*z01XKSLas@&W;l4t|sxH_ykg=>tq zJauamQN71Cm)ck|s}z;iEmyc*NWY9^=YRI)fgR7S$F-Y{lp@`H_OeBq0@|Ltn-k)* zY|gGPcyIM=vN>qU@9t3+^O`z4l|E8#wm-#l6fPLKK>k$+XUFRb%gxJb=dK=IM?({ReW?q|0{~WUz_};=g+EdmI z%~zF1YgcX0vs|$&wUuEpX4qnt?UI|rxP+=jW?p$3Js4y7v!yUb{fJz!cb_<+>%_rs zzZa!hvWnHpxx-E4f$5{RZ7Dv|P;{C|cVM%XBR%1#4nD zyfS9>7clzBqO!n&>r`+hasWA(R7OfFaA>eEdSwHW}%srI-n5nD~b$d(==!A6P~KbgNlkiZvGR`HWWlz`ai z_}KVpipM5Vj6fJG+KQVRs8gMAnj;Oz=}vU#5Ce4@lj=x=2ZPCAhTsdS44n2?McZ#x zWC^19(`8wFp(u7;EH6UD$Hm9LzByzDz{EKK7iXbjF=&~`>Fe^F`*2|UZnM}0-M1$` z-C>80Z8Tu`sQA51JQq}$U{aEztr3=Z>@;=3HY3}*5)~5z>H0WEuEc^xk87-OXUm39 zI-FX1Ap5$3z;Q4^(OY?A_vmN#4}^St@y>)4JqB})=foL*_Z7tlU$>lR8&*B`ST>;1 znWNM66Q}zziXi|gPQnv$HTY;IWCWQcpg6!IrXqw8f(NH+HQ$wNeG`1b_l=|>53PA0 ze!}tpPgkN9IIoAB_GDron={)vb6_Il>zTk8hQVQwf}aD$Ctgs4^jMjTB9x-aCA>ho zt*I++$>lTUbY-dRWN5h?=_unYJMFDp=aqUgXY}Lz{oV}QXGra6QO7P$M0ZbzfrI@} zx#8^F^6}#|{STkpTccWTF7c+|)+J_FG5*2W(K(vdXj>ugqjGf8CGMcvfboa1uCTo8cd_e`A@*-rK0Jqhg6_rrc^3ot+O=)Q RYtV|ry%{EHmBgtZ&Yvnyq?G^w diff --git a/build-old/debian/Dockerfile b/build-old/debian/Dockerfile deleted file mode 100644 index 5dd5a5eb8..000000000 --- a/build-old/debian/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -# VERSION: 0.1 -# DESCRIPTION: Create the atom editor in a container -# AUTHOR: Jessica Frazelle -# COMMENTS: -# This file describes how to build the atom editor -# in a container with all dependencies installed. -# Tested on Debian Jessie. -# USAGE: -# # Download atom Dockerfile -# wget https://raw.githubusercontent.com/atom/atom/master/Dockerfile -# -# # Build atom image -# docker build -t atom . -# -# docker run -v /tmp/.X11-unix:/tmp/.X11-unix \ -# -e DISPLAY=unix$DISPLAY atom -# - -DOCKER-VERSION 1.3 - -# Base docker image -FROM debian:jessie -MAINTAINER Jessica Frazelle - -# Install dependencies -RUN apt-get update && apt-get install -y \ - build-essential \ - ca-certificates \ - curl \ - git \ - libasound2 \ - libgconf-2-4 \ - libgnome-keyring-dev \ - libgtk2.0-0 \ - libnss3 \ - libxtst6 \ - --no-install-recommends - -# install node -RUN curl -sL https://deb.nodesource.com/setup | bash - -RUN apt-get install -y nodejs - -# clone atom -RUN git clone https://github.com/atom/atom /src -WORKDIR /src -RUN git fetch && git checkout $(git describe --tags `git rev-list --tags --max-count=1`) -RUN script/build && script/grunt install - -# Autorun atom -CMD /usr/local/bin/atom --foreground --log-file /var/log/atom.log && tail -f /var/log/atom.log diff --git a/build-old/deprecated-packages.json b/build-old/deprecated-packages.json deleted file mode 100644 index 08f4d1186..000000000 --- a/build-old/deprecated-packages.json +++ /dev/null @@ -1,1713 +0,0 @@ -{ - "advanced-new-file": { - "version": "<=0.4.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "angularjs-helper": { - "version": "<=0.9.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "apex-ui-personalize": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "api-blueprint-preview": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "asciidoc-preview": { - "version": "<=0.5.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "ask-stack": { - "version": "<=1.1.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "assign-align": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "asteroids": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-2048": { - "version": "<=1.2.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-angularjs": { - "hasAlternative": true, - "alternative": "angularjs" - }, - "atom-beautifier": { - "version": "<=0.5.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-beautify": { - "version": "<=0.27.6", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atom-browser-webview": { - "version": "<=0.6.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-charcode": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-cli-diff": { - "version": "<=0.11.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-compile-coffee": { - "version": "<=1.4.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atom-ctags": { - "version": "<=3.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atom-eslint": { - "hasAlternative": true, - "alternative": "linter" - }, - "atom-faker": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-flake8": { - "hasAlternative": true, - "alternative": "linter" - }, - "atom-go-format": { - "hasAlternative": true, - "alternative": "go-plus" - }, - "atom-grunt-configs": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-html-preview": { - "version": "<=0.1.6", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-html5-boilerplate": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-htmlizer": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-jsfmt": { - "version": "<=0.6.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atom-jshint": { - "version": "<=1.5.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atom-lint": { - "hasAlternative": true, - "alternative": "linter" - }, - "atom-pair": { - "version": "<=1.1.5", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atom-prettify": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-processing": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-python-debugger": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-rails": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-raml-preview": { - "version": "<=0.0.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-runner": { - "version": "<=2.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atom-semicolons": { - "version": "<=0.1.5", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-spotify": { - "version": "<=1.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-terminal-panel": { - "version": "<=4.3.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atom-typescript": { - "version": "<=4.1.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atom-ungit": { - "version": "<=0.4.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "atom-yeoman": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atomatigit": { - "version": "<=1.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atomic-emacs": { - "version": "<=0.5.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "atomic-rest": { - "version": "<=0.2.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "auto-detect-indentation": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "auto-indent": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "auto-replace-in-selection": { - "version": "<=2.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "auto-update-packages": { - "version": "<=0.2.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "autoclose-html": { - "version": "<=0.15.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "autocomplete-haskell": { - "version": "<=0.2.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "autocomplete-jedi": { - "hasAlternative": true, - "alternative": "autocomplete-python" - }, - "autocomplete-paths": { - "version": "<=1.0.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "autocomplete-phpunit": { - "version": "<=1.0.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "autocomplete-plus-async": { - "hasAlternative": true, - "message": "`autocomplete-plus-async` has been replaced by `autocomplete-plus` which is bundled in core", - "alternative": "core" - }, - "autocomplete-plus-jedi": { - "version": "<=0.0.9", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "autocomplete-plus-python-jedi": { - "hasAlternative": true, - "alternative": "autocomplete-python" - }, - "autocomplete-snippets": { - "version": "<=1.0.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "bezier-curve-editor": { - "version": "<=0.6.6", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "big-cursor": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "block-comment": { - "version": "<=0.4.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "browser-refresh": { - "version": "<=0.8.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "cabal": { - "version": "<=0.0.13", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "change-case": { - "version": "<=0.5.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "circle-ci": { - "version": "<=0.9.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "clang-format": { - "version": "<=1.8.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "clipboard-history": { - "version": "<=0.6.5", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "clone-cursor": { - "version": "<=1.0.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "closure-linter": { - "version": "<=0.2.5", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "code-links": { - "version": "<=0.3.8", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "codeship-status": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "coffee-compile": { - "version": "<=0.5.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "coffee-lint": { - "hasAlternative": true, - "alternative": "linter" - }, - "coffee-trace": { - "version": "<=0.2.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "coffeescript-preview": { - "hasAlternative": true, - "alternative": "preview" - }, - "color": { - "version": "<=0.5.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "color-picker": { - "version": "<=1.7.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "command-logger": { - "version": "<=0.20.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "comment": { - "version": "<=0.2.7", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "compass": { - "version": "<=0.8.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "composer": { - "version": "<=0.3.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "convert-to-utf8": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "coverage": { - "version": "<=0.6.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "csscomb": { - "version": "<=0.1.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "ctags-status": { - "version": "<=1.2.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "cucumber-runner": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "cucumber-step": { - "version": "<=0.1.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "custom-title": { - "version": "<=0.7.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "cut-line": { - "hasAlternative": true, - "alternative": "core" - }, - "dash": { - "version": "<=1.0.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "data-atom": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "devdocs": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "django-templates": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "docblockr": { - "version": "<=0.6.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "easy-motion": { - "version": "<=1.1.4", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "editor-stats": { - "version": "<=0.16.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "editorconfig": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "elixir-cmd": { - "version": "<=0.2.6", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "emacs-mode": { - "version": "<=0.0.29", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "ember-cli-helper": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "emmet": { - "version": "<=2.3.7", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "emp-debugger": { - "version": "<=0.6.13", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "emp-template-management": { - "version": "<=0.1.13", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "enhanced-tabs": { - "version": "<=1.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "erb-snippets": { - "version": "<=0.5.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "error-status": { - "version": "<=0.3.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "eslint": { - "version": "<=0.15.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "eval": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "ex-mode": { - "version": "<=0.4.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "execute-as-ruby": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "expand-selection": { - "version": "<=0.2.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "explicit-reload": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "fancy-new-file": { - "version": "<=0.7.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "file-icon-supplement": { - "version": "<=0.7.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "file-icons": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "file-types": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "filetype-color": { - "version": "<=0.1.4", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "firepad": { - "version": "<=0.3.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "flake8": { - "hasAlternative": true, - "alternative": "linter" - }, - "floobits": { - "version": "<=0.4.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "function-name-in-status-bar": { - "version": "<=0.2.6", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "fuzzy-finder": { - "version": "<=0.60.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "get-routes": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "gist-it": { - "version": "<=0.6.10", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "git-blame": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "git-control": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "git-diff": { - "version": "<=0.43.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "git-diff-details": { - "version": "<=0.8.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "git-log": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "git-plus": { - "version": "<=4.5.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "git-review": { - "version": "<=0.2.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "git-tab-status": { - "version": "<=1.5.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "github-issues": { - "version": "<=0.5.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "gitignore-snippets": { - "version": "<=0.2.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "gitter": { - "version": "<=0.6.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "go-oracle": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "go-plus": { - "version": "<=2.0.8", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "go-to-view": { - "version": "<=0.1.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "gocode": { - "version": "<=0.2.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "gradle-ci": { - "version": "<=0.2.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "grunt-runner": { - "version": "<=0.8.2", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "gulp-helper": { - "version": "<=4.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "gutter-shadow": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "hiera-eyaml": { - "version": "<=0.4.7", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "highlight-column": { - "version": "<=0.3.2", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "highlight-cov": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "highlight-css-color": { - "hasAlternative": true, - "alternative": "pigments" - }, - "highlight-line": { - "version": "<=0.9.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "highlight-selected": { - "version": "<=0.7.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "hipster-ipsum": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "html-entities": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "html-helper": { - "version": "<=0.2.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "html-img": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "html2haml": { - "version": "<=0.6.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "html2jade": { - "version": "<=0.7.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "htmlhint": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "icon-font-picker": { - "version": "<=0.0.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "ide-flow": { - "version": "<=0.7.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "ide-haskell": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "import": { - "version": "<=1.3.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "inc-dec-value": { - "version": "<=0.0.7", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "increment-number": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "indent-helper": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "indentation-jumper": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "inline-autocomplete": { - "version": "<=1.0.4", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "ionic-atom": { - "version": "<=0.3.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "japanese-zen-han-convert": { - "version": "<=0.3.2", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "jsdoc": { - "version": "<=0.9.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "jsformat": { - "version": "<=0.8.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "jslint": { - "version": "<=1.2.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "jsonlint": { - "version": "<=1.0.2", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "jsonpp": { - "version": "<=0.0.6", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "keycodes": { - "version": "<=0.1.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "kinetic": { - "version": "<=0.2.5", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "language-javascript-semantic": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "language-jsoniq": { - "version": "<=1.4.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "language-jxa": { - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "language-rspec": { - "version": "<=0.2.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "language-typescript": { - "hasAlternative": true, - "alternative": "atom-typescript" - }, - "laravel-facades": { - "version": "<=1.0.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "last-cursor-position": { - "version": "<=0.6.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "layout-manager": { - "version": "<=0.2.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "less-autocompile": { - "version": "<=0.3.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "letter-spacing": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "line-count": { - "version": "<=0.3.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "line-jumper": { - "version": "<=0.13.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "linter": { - "version": "<=0.11.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "linter-flow": { - "version": "<=0.1.4", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "livereload": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "local-history": { - "version": "<=3.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "local-server": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "local-server-express": { - "version": "<=0.2.2", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "local-settings": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "localization": { - "version": "<=1.16.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "log-console": { - "version": "<=0.1.2", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "lorem-ipsum": { - "version": "<=0.5.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "mark-ring": { - "version": "<=3.0.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "markdown-format": { - "version": "<=2.5.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "markdown-helpers": { - "version": "<=0.2.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "markdown-pdf": { - "version": "<=1.3.6", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "markdown-preview-plus": { - "version": "<=1.4.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "markdown-stream": { - "version": "<=0.6.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "markdown-writer": { - "version": "<=1.3.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "marked": { - "version": "<=0.1.8", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "mate-subword-navigation": { - "version": "<=3.0.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "MavensMate-Atom": { - "version": "<=0.0.20", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "max-tabs": { - "hasAlternative": true, - "alternative": "tidy-tabs" - }, - "maximize-panes": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "mdurl": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "mechanical-keyboard": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "minifier": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "minimap": { - "version": "<=3.5.6", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "minimap-color-highlight": { - "version": "<=4.1.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "minimap-git-diff": { - "version": "<=3.0.4", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "mocha": { - "version": "<=0.0.5", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "mocha-ui": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "nbsp-detect": { - "hasAlternative": true, - "alternative": "core" - }, - "node-debugger": { - "version": "<=0.2.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "npm-autocomplete": { - "version": "<=0.1.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "omni-ruler": { - "version": "<=0.3.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "omnisharp-atom": { - "version": "<=0.4.9", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "open-git-modified-files": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "open-in-github-app": { - "version": "<=0.2.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "open-in-gitx": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "open-in-sourcetree": { - "version": "<=0.1.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "open-last-project": { - "hasAlternative": true, - "alternative": "core" - }, - "open-recent": { - "version": "<=2.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "package-cop": { - "version": "<=0.2.5", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "package-list-downloader": { - "version": "<=0.2.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "pair-programming": { - "version": "<=0.7.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "pane-layout-switcher": { - "version": "<=0.0.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "paredit": { - "version": "<=1.0.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "party-hard": { - "version": "<=0.3.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "path": { - "version": "<=0.4.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "pep8": { - "hasAlternative": true, - "alternative": "linter" - }, - "pepper-autocomplete": { - "version": "<=0.6.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "permute": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "php-documentation-online": { - "version": "<=0.2.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "php-getters-setters": { - "version": "<=0.5.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "php-server": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "phpunit": { - "version": "<=1.0.9", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "playlist": { - "version": "<=0.1.7", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "pretty-json": { - "version": "<=0.3.2", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "preview": { - "version": "<=0.14.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "preview-plus": { - "version": "<=1.1.42", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "project-colorize": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "project-manager": { - "version": "<=1.11.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "project-palette-finder": { - "version": "<=2.4.7", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "project-ring": { - "version": "<=0.20.5", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "python": { - "hasAlternative": true, - "alternative": "script" - }, - "python-coverage": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "python-isort": { - "version": "<=0.0.6", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "python-jedi": { - "version": "<=0.1.7", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "quick-move-file": { - "version": "<=0.7.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "r-exec": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "rails-navigation": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "react": { - "version": "<=0.5.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "recent-projects": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "regex-railroad-diagram": { - "version": "<=0.7.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "related-files": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "remember-session": { - "hasAlternative": true, - "alternative": "core" - }, - "remote-atom": { - "version": "<=1.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "remote-edit": { - "version": "<=1.6.4", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "remote-sync": { - "version": "<=3.1.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "resize-panes": { - "hasAlternative": true, - "alternative": "core" - }, - "rest-client": { - "version": "<=0.3.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "revert-buffer": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "rsense": { - "version": "<=0.6.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "rspec": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "rst-preview-pandoc": { - "version": "<=0.1.6", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "ruby-define-method": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "ruby-hash-rocket": { - "version": "<=1.1.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "ruby-strftime-reference": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "ruby-test": { - "version": "<=0.9.5", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "ruler": { - "version": "<=0.2.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "run-command": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "run-file": { - "version": "<=0.9.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "run-in-browser": { - "version": "<=0.1.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "runcoderun": { - "version": "<=0.5.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "sass-autocompile": { - "version": "<=0.6.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "sassbeautify": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "save-commands": { - "version": "<=0.6.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "save-session": { - "version": "<=0.15.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "scope-inspector": { - "version": "<=0.2.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "script": { - "version": "<=2.20.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "script-runner": { - "version": "<=1.6.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "select-scope": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "selection-count": { - "hasAlternative": true, - "alternative": "core" - }, - "slash-closer": { - "version": "<=0.7.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "sloc": { - "version": "<=0.1.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "smarter-delete-line": { - "version": "<=1.0.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "space-block-jumper": { - "version": "<=0.4.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "space-tab": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "spark-dfu-util": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "status-tab-spacing": { - "version": "<=0.3.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "sublime-tabs": { - "hasAlternative": true, - "message": "`sublime-tabs` has been replaced by the 'Use Preview Tabs' option in the `tabs` package settings.", - "alternative": "core" - }, - "supercollider": { - "version": "<=0.4.2", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "supercopair": { - "version": "<=0.9.34", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "support-gbk": { - "version": "<=1.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "swift-playground": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "symbol-gen": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "synced-sidebar": { - "version": "<=0.2.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "tab-history": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "tab-switcher": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "tabs-to-spaces": { - "version": "<=0.8.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "tag": { - "version": "<=0.2.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "tasks": { - "version": "<=1.0.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "term": { - "version": "<=0.2.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "terminal-panel": { - "version": "<=1.11.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "terminal-status": { - "version": "<=1.6.4", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "ternjs": { - "hasAlternative": true, - "alternative": "atom-ternjs" - }, - "test-status": { - "version": "<=0.27.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "the-closer": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "ti-alloy-related": { - "version": "<=0.8.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "tidal": { - "version": "<=0.6.6", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "tidy-markdown": { - "version": "<=0.2.2", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "timecop": { - "version": "<=0.23.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "timekeeper": { - "version": "<=0.4.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "toggle-tabs": { - "version": "<=0.1.8", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "travis-ci-status": { - "version": "<=0.13.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "true-color": { - "version": "<=0.4.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "turbo-javascript": { - "version": "<=0.0.10", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "turnip-step": { - "version": "<=1.0.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "unity-ui": { - "version": "<=1.0.5", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "update-package-dependencies": { - "version": "<=0.6.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "update-packages": { - "hasAlternative": true, - "alternative": "core" - }, - "vertical-align": { - "version": "<=0.6.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "view-tail-large-files": { - "version": "<=0.1.17", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "vim-mode": { - "version": "<=0.46.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "virtualenv": { - "version": "<=0.6.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "visual-bell": { - "version": "<=0.11.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "vnc": { - "version": "<=0.1.3", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "voicecode": { - "version": "<=0.9.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "w3c-validation": { - "version": "<=0.1.3", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "weather-package": { - "version": "<=1.5.4", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "web-view": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "webbox-color": { - "version": "<=0.5.4", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "webview-pane": { - "version": "<=0.0.1", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "wercker-status": { - "version": "<=0.3.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "white-cursor": { - "version": "<=0.5.1", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "whitespace": { - "version": "<=0.24.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "word-count": { - "version": "<=0.1.0", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "word-jumper": { - "version": "<=0.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "wordcount": { - "version": "<=2.2.0", - "hasDeprecations": true, - "latestHasDeprecations": false - }, - "wrap-lines": { - "hasAlternative": true, - "message": "`wrap-lines` has been replaced by a feature in core. Open the command palette and search for `autoflow`.", - "alternative": "core" - }, - "yosemite-unity-ui": { - "version": "<=0.3.13", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "yuno-commit": { - "version": "<=0.0.2", - "hasDeprecations": true, - "latestHasDeprecations": true - }, - "zentabs": { - "version": "<=0.6.1", - "hasDeprecations": true, - "latestHasDeprecations": false - } -} diff --git a/build-old/lib/uses-babel.coffee b/build-old/lib/uses-babel.coffee deleted file mode 100644 index eebbb6159..000000000 --- a/build-old/lib/uses-babel.coffee +++ /dev/null @@ -1,19 +0,0 @@ -fs = require 'fs' - -BABEL_PREFIXES = [ - "'use babel'" - '"use babel"' - '/** @babel */' - '/* @flow */' -] - -PREFIX_LENGTH = Math.max(BABEL_PREFIXES.map((prefix) -> prefix.length)...) - -buffer = Buffer(PREFIX_LENGTH) - -module.exports = (filename) -> - file = fs.openSync(filename, 'r') - fs.readSync(file, buffer, 0, PREFIX_LENGTH) - fs.closeSync(file) - BABEL_PREFIXES.some (prefix) -> - prefix is buffer.toString('utf8', 0, prefix.length) diff --git a/build-old/package.json b/build-old/package.json deleted file mode 100644 index de84d4dcb..000000000 --- a/build-old/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "atom-build", - "description": "Atom build", - "repository": { - "type": "git", - "url": "https://github.com/atom/atom.git" - }, - "dependencies": { - "asar": "^0.8.0", - "async": "~0.2.9", - "aws-sdk": "^2.2.18", - "babel-eslint": "^5.0.0-beta6", - "donna": "^1.0.13", - "escope": "~3.3.0", - "formidable": "~1.0.14", - "fs-plus": "2.x", - "github-releases": "~0.3.1", - "glob": "^5.0.14", - "grunt": "~0.4.1", - "grunt-babel": "^5.0.1", - "grunt-cli": "~0.1.9", - "grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe", - "grunt-contrib-coffee": "~0.12.0", - "grunt-contrib-csslint": "~0.2.0", - "grunt-contrib-less": "~0.8.0", - "grunt-cson": "0.16.0", - "grunt-download-electron": "^2.1.1", - "grunt-electron-installer": "1.2.2", - "grunt-lesslint": "0.17.0", - "grunt-peg": "~1.1.0", - "grunt-shell": "~0.3.1", - "grunt-standard": "^2.0.0", - "joanna": "0.0.6", - "legal-eagle": "~0.13.0", - "minidump": "~0.9", - "npm": "2.13.3", - "rcedit": "~0.3.0", - "request": "~2.27.0", - "rimraf": "~2.2.2", - "runas": "^3.1", - "standard": "^5.4.1", - "tello": "1.0.5", - "temp": "~0.8.1", - "time-grunt": "1.2.2", - "underscore-plus": "1.x", - "unzip": "~0.1.9", - "vm-compatibility-layer": "~0.1.0", - "webdriverio": "^2.4.5" - } -} diff --git a/build-old/tasks/build-task.coffee b/build-old/tasks/build-task.coffee deleted file mode 100644 index be72d52c1..000000000 --- a/build-old/tasks/build-task.coffee +++ /dev/null @@ -1,191 +0,0 @@ -fs = require 'fs' -path = require 'path' -_ = require 'underscore-plus' - -module.exports = (grunt) -> - {cp, isAtomPackage, mkdir, rm} = require('./task-helpers')(grunt) - - grunt.registerTask 'build', 'Build the application', -> - shellAppDir = grunt.config.get('atom.shellAppDir') - buildDir = grunt.config.get('atom.buildDir') - appDir = grunt.config.get('atom.appDir') - - rm shellAppDir - rm path.join(buildDir, 'installer') - mkdir path.dirname(buildDir) - - if process.platform is 'darwin' - cp 'electron/Electron.app', shellAppDir, filter: /default_app/ - fs.renameSync path.join(shellAppDir, 'Contents', 'MacOS', 'Electron'), path.join(shellAppDir, 'Contents', 'MacOS', 'Atom') - fs.renameSync path.join(shellAppDir, 'Contents', 'Frameworks', 'Electron Helper.app'), path.join(shellAppDir, 'Contents', 'Frameworks', 'Atom Helper.app') - fs.renameSync path.join(shellAppDir, 'Contents', 'Frameworks', 'Atom Helper.app', 'Contents', 'MacOS', 'Electron Helper'), path.join(shellAppDir, 'Contents', 'Frameworks', 'Atom Helper.app', 'Contents', 'MacOS', 'Atom Helper') - else - cp 'electron', shellAppDir, filter: /default_app/ - - if process.platform is 'win32' - fs.renameSync path.join(shellAppDir, 'electron.exe'), path.join(shellAppDir, 'atom.exe') - else - fs.renameSync path.join(shellAppDir, 'electron'), path.join(shellAppDir, 'atom') - - mkdir appDir - - if process.platform isnt 'win32' - cp 'atom.sh', path.resolve(appDir, '..', 'new-app', 'atom.sh') - - cp 'package.json', path.join(appDir, 'package.json') - - packageNames = [] - packageDirectories = [] - nonPackageDirectories = [ - 'dot-atom' - 'vendor' - ] - - {devDependencies} = grunt.file.readJSON('package.json') - for child in fs.readdirSync('node_modules') - directory = path.join('node_modules', child) - if isAtomPackage(directory) - packageDirectories.push(directory) - packageNames.push(child) - else - nonPackageDirectories.push(directory) - - # Put any paths here that shouldn't end up in the built Atom.app - # so that it doesn't becomes larger than it needs to be. - ignoredPaths = [ - path.join('git-utils', 'deps') - path.join('ohnogit', 'node_modules', 'nodegit', 'vendor') - path.join('ohnogit', 'node_modules', 'nodegit', 'node_modules', 'node-pre-gyp') - path.join('ohnogit', 'node_modules', 'nodegit', 'node_modules', '.bin') - path.join('oniguruma', 'deps') - path.join('less', 'dist') - path.join('npm', 'doc') - path.join('npm', 'html') - path.join('npm', 'man') - path.join('npm', 'node_modules', '.bin', 'beep') - path.join('npm', 'node_modules', '.bin', 'clear') - path.join('npm', 'node_modules', '.bin', 'starwars') - path.join('pegjs', 'examples') - path.join('get-parameter-names', 'node_modules', 'testla') - path.join('get-parameter-names', 'node_modules', '.bin', 'testla') - path.join('jasmine-reporters', 'ext') - path.join('jasmine-node', 'node_modules', 'gaze') - path.join('jasmine-node', 'spec') - path.join('node_modules', 'nan') - path.join('node_modules', 'native-mate') - path.join('build', 'binding.Makefile') - path.join('build', 'config.gypi') - path.join('build', 'gyp-mac-tool') - path.join('build', 'Makefile') - path.join('build', 'Release', 'obj.target') - path.join('build', 'Release', 'obj') - path.join('build', 'Release', '.deps') - path.join('vendor', 'apm') - - # These are only require in dev mode when the grammar isn't precompiled - path.join('snippets', 'node_modules', 'loophole') - path.join('snippets', 'node_modules', 'pegjs') - path.join('snippets', 'node_modules', '.bin', 'pegjs') - - '.DS_Store' - '.jshintrc' - '.npmignore' - '.pairs' - '.travis.yml' - 'appveyor.yml' - '.idea' - '.editorconfig' - '.lint' - '.lintignore' - '.eslintrc' - '.jshintignore' - 'coffeelint.json' - '.coffeelintignore' - '.gitattributes' - '.gitkeep' - ] - - packageNames.forEach (packageName) -> ignoredPaths.push(path.join(packageName, 'spec')) - - ignoredPaths = ignoredPaths.map (ignoredPath) -> _.escapeRegExp(ignoredPath) - - # Add .* to avoid matching hunspell_dictionaries. - ignoredPaths.push "#{_.escapeRegExp(path.join('spellchecker', 'vendor', 'hunspell') + path.sep)}.*" - ignoredPaths.push "#{_.escapeRegExp(path.join('build', 'Release') + path.sep)}.*\\.pdb" - - # Ignore *.cc and *.h files from native modules - ignoredPaths.push "#{_.escapeRegExp(path.join('ctags', 'src') + path.sep)}.*\\.(cc|h)*" - ignoredPaths.push "#{_.escapeRegExp(path.join('git-utils', 'src') + path.sep)}.*\\.(cc|h)*" - ignoredPaths.push "#{_.escapeRegExp(path.join('ohnogit', 'node_modules', 'nodegit', 'src') + path.sep)}.*\\.(cc|h)?" - ignoredPaths.push "#{_.escapeRegExp(path.join('ohnogit', 'node_modules', 'nodegit', 'generate') + path.sep)}.*\\.(cc|h)?" - ignoredPaths.push "#{_.escapeRegExp(path.join('ohnogit', 'node_modules', 'nodegit', 'include') + path.sep)}.*\\.(cc|h)?" - ignoredPaths.push "#{_.escapeRegExp(path.join('keytar', 'src') + path.sep)}.*\\.(cc|h)*" - ignoredPaths.push "#{_.escapeRegExp(path.join('nslog', 'src') + path.sep)}.*\\.(cc|h)*" - ignoredPaths.push "#{_.escapeRegExp(path.join('oniguruma', 'src') + path.sep)}.*\\.(cc|h)*" - ignoredPaths.push "#{_.escapeRegExp(path.join('pathwatcher', 'src') + path.sep)}.*\\.(cc|h)*" - ignoredPaths.push "#{_.escapeRegExp(path.join('runas', 'src') + path.sep)}.*\\.(cc|h)*" - ignoredPaths.push "#{_.escapeRegExp(path.join('scrollbar-style', 'src') + path.sep)}.*\\.(cc|h)*" - ignoredPaths.push "#{_.escapeRegExp(path.join('spellchecker', 'src') + path.sep)}.*\\.(cc|h)*" - ignoredPaths.push "#{_.escapeRegExp(path.join('cached-run-in-this-context', 'src') + path.sep)}.*\\.(cc|h)?" - ignoredPaths.push "#{_.escapeRegExp(path.join('keyboard-layout', 'src') + path.sep)}.*\\.(cc|h|mm)*" - - # Ignore build files - ignoredPaths.push "#{_.escapeRegExp(path.sep)}binding\\.gyp$" - ignoredPaths.push "#{_.escapeRegExp(path.sep)}.+\\.target.mk$" - ignoredPaths.push "#{_.escapeRegExp(path.sep)}linker\\.lock$" - ignoredPaths.push "#{_.escapeRegExp(path.join('build', 'Release') + path.sep)}.+\\.node\\.dSYM" - - # Hunspell dictionaries are only not needed on macOS. - if process.platform is 'darwin' - ignoredPaths.push path.join('spellchecker', 'vendor', 'hunspell_dictionaries') - ignoredPaths = ignoredPaths.map (ignoredPath) -> "(#{ignoredPath})" - - testFolderPattern = new RegExp("#{_.escapeRegExp(path.sep)}_*te?sts?_*#{_.escapeRegExp(path.sep)}") - exampleFolderPattern = new RegExp("#{_.escapeRegExp(path.sep)}examples?#{_.escapeRegExp(path.sep)}") - - nodeModulesFilter = new RegExp(ignoredPaths.join('|')) - filterNodeModule = (pathToCopy) -> - pathToCopy = path.resolve(pathToCopy) - nodeModulesFilter.test(pathToCopy) or testFolderPattern.test(pathToCopy) or exampleFolderPattern.test(pathToCopy) - - packageFilter = new RegExp("(#{ignoredPaths.join('|')})|(.+\\.(cson|coffee)$)") - filterPackage = (pathToCopy) -> - pathToCopy = path.resolve(pathToCopy) - packageFilter.test(pathToCopy) or testFolderPattern.test(pathToCopy) or exampleFolderPattern.test(pathToCopy) - - for directory in nonPackageDirectories - cp directory, path.join(appDir, directory), filter: filterNodeModule - - for directory in packageDirectories - cp directory, path.join(appDir, directory), filter: filterPackage - - cp 'src', path.join(appDir, 'src'), filter: /.+\.(cson|coffee)$/ - cp 'static', path.join(appDir, 'static') - - cp path.join('apm', 'node_modules', 'atom-package-manager'), path.resolve(appDir, '..', 'new-app', 'apm'), filter: filterNodeModule - if process.platform isnt 'win32' - fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.resolve(appDir, '..', 'new-app', 'apm', 'node_modules', '.bin', 'apm')) - - channel = grunt.config.get('atom.channel') - - cp path.join('resources', 'app-icons', channel, 'png', '1024.png'), path.join(appDir, 'resources', 'atom.png') - - if process.platform is 'darwin' - cp path.join('resources', 'app-icons', channel, 'atom.icns'), path.resolve(appDir, '..', 'atom.icns') - cp path.join('resources', 'mac', 'file.icns'), path.resolve(appDir, '..', 'file.icns') - cp path.join('resources', 'mac', 'speakeasy.pem'), path.resolve(appDir, '..', 'speakeasy.pem') - - if process.platform is 'win32' - cp path.join('resources', 'win', 'atom.cmd'), path.join(shellAppDir, 'resources', 'cli', 'atom.cmd') - cp path.join('resources', 'win', 'atom.sh'), path.join(shellAppDir, 'resources', 'cli', 'atom.sh') - cp path.join('resources', 'win', 'atom.js'), path.join(shellAppDir, 'resources', 'cli', 'atom.js') - cp path.join('resources', 'win', 'apm.cmd'), path.join(shellAppDir, 'resources', 'cli', 'apm.cmd') - cp path.join('resources', 'win', 'apm.sh'), path.join(shellAppDir, 'resources', 'cli', 'apm.sh') - - if process.platform is 'linux' - cp path.join('resources', 'app-icons', channel, 'png'), path.join(buildDir, 'icons') - - dependencies = ['compile', 'generate-license:save', 'generate-module-cache', 'compile-packages-slug'] - dependencies.push('copy-info-plist') if process.platform is 'darwin' - dependencies.push('set-exe-icon') if process.platform is 'win32' - grunt.task.run(dependencies...) diff --git a/build-old/tasks/check-licenses-task.coffee b/build-old/tasks/check-licenses-task.coffee deleted file mode 100644 index 64e99b2ab..000000000 --- a/build-old/tasks/check-licenses-task.coffee +++ /dev/null @@ -1,27 +0,0 @@ -module.exports = (grunt) -> - grunt.registerTask 'check-licenses', 'Report the licenses of all dependencies', -> - legalEagle = require 'legal-eagle' - {size, keys} = require 'underscore-plus' - done = @async() - - options = - path: process.cwd() - omitPermissive: true - overrides: require './license-overrides' - - legalEagle options, (err, summary) -> - if err? - console.error(err) - process.exit 1 - - for key of summary - delete summary[key] if key.match /^atom@/ - - if size(summary) - console.error "Found dependencies without permissive licenses:" - for name in keys(summary).sort() - console.error "#{name}" - console.error " License: #{summary[name].license}" - console.error " Repository: #{summary[name].repository}" - process.exit 1 - done() diff --git a/build-old/tasks/clean-task.coffee b/build-old/tasks/clean-task.coffee deleted file mode 100644 index 498bf9b4c..000000000 --- a/build-old/tasks/clean-task.coffee +++ /dev/null @@ -1,22 +0,0 @@ -path = require 'path' -os = require 'os' - -module.exports = (grunt) -> - {rm} = require('./task-helpers')(grunt) - - grunt.registerTask 'partial-clean', 'Delete some of the build files', -> - tmpdir = os.tmpdir() - - rm grunt.config.get('atom.buildDir') - rm require('../src/coffee-cache').cacheDir - rm require('../src/less-compile-cache').cacheDir - rm path.join(tmpdir, 'atom-cached-atom-shells') - rm 'atom-shell' - rm 'electron' - - grunt.registerTask 'clean', 'Delete all the build files', -> - homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME'] - - rm 'node_modules' - rm path.join(homeDir, '.atom', '.node-gyp') - grunt.task.run('partial-clean') diff --git a/build-old/tasks/codesign-task.coffee b/build-old/tasks/codesign-task.coffee deleted file mode 100644 index f253210c3..000000000 --- a/build-old/tasks/codesign-task.coffee +++ /dev/null @@ -1,89 +0,0 @@ -path = require 'path' -fs = require 'fs' -request = require 'request' - -module.exports = (grunt) -> - {spawn} = require('./task-helpers')(grunt) - - # macOS code signing - - grunt.registerTask 'codesign:app', 'CodeSign Atom.app', -> - done = @async() - unlockKeychain (error) -> - return done(error) if error? - - args = ['--deep', '--force', '--verbose', '--sign', 'Developer ID Application: GitHub', grunt.config.get('atom.shellAppDir')] - spawn {cmd: 'codesign', args: args}, (error) -> done(error) - - unlockKeychain = (callback) -> - return callback() unless process.env.XCODE_KEYCHAIN - {XCODE_KEYCHAIN_PASSWORD, XCODE_KEYCHAIN} = process.env - args = ['unlock-keychain', '-p', XCODE_KEYCHAIN_PASSWORD, XCODE_KEYCHAIN] - spawn {cmd: 'security', args: args}, (error) -> callback(error) - - # Windows code signing - - grunt.registerTask 'codesign:exe', 'CodeSign Windows binaries', -> - done = @async() - atomExePath = path.join(grunt.config.get('atom.shellAppDir'), 'atom.exe') - signWindowsExecutable atomExePath, (error) -> - return done(error) if error? - updateExePath = path.resolve(__dirname, '..', 'node_modules', 'grunt-electron-installer', 'vendor', 'Update.exe') - signWindowsExecutable updateExePath, (error) -> done(error) - - grunt.registerTask 'codesign:installer', 'CodeSign Windows installer (AtomSetup.exe)', -> - done = @async() - atomSetupExePath = path.resolve(grunt.config.get('atom.buildDir'), 'installer', 'AtomSetup.exe') - signWindowsExecutable atomSetupExePath, (error) -> done(error) - - grunt.registerTask 'codesign:installer-deferred', 'Obtain cert and configure installer to perform CodeSign', -> - done = @async() - getCertificate (file, password) -> - grunt.config('create-windows-installer.installer.certificateFile', file) - grunt.config('create-windows-installer.installer.certificatePassword', password) - grunt.log.ok('Certificate ready for create-windows-installer task') - done() - - grunt.registerTask 'codesign:cleanup', 'Clean up any temporary or downloaded files used for CodeSign', -> - try fs.unlinkSync(downloadedCertificateFile) catch e then return - - downloadedCertificateFile = path.resolve(__dirname, 'DownloadedCertFile.p12') - - signWindowsExecutable = (exeToSign, callback) -> - if process.env.JANKY_SIGNTOOL - signUsingJanky exeToSign, callback - else - signUsingWindowsSDK exeToSign, callback - - signUsingJanky = (exeToSign, callback) -> - grunt.log.ok("Signing #{exeToSign} using Janky SignTool") - spawn {cmd: process.env.JANKY_SIGNTOOL, args: [exeToSign]}, callback - - signUsingWindowsSDK = (exeToSign, callback) -> - getCertificate (file, password) -> - signUsingWindowsSDKTool exeToSign, file, password, callback - - signUsingWindowsSDKTool = (exeToSign, certificateFile, certificatePassword, callback) -> - grunt.log.ok("Signing '#{exeToSign}' using Windows SDK") - args = ['sign', '/v', '/p', certificatePassword, '/f', certificateFile, exeToSign] - spawn {cmd: 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\bin\\signtool.exe', args: args}, callback - - getCertificate = (callback) -> - if process.env.WIN_P12KEY_URL? - grunt.log.ok("Obtaining certificate file") - downloadFile process.env.WIN_P12KEY_URL, downloadedCertificateFile, (done) -> - callback(downloadedCertificateFile, process.env.WIN_P12KEY_PASSWORD ? 'password') - else - callback(path.resolve(__dirname, '..', 'certs', 'windows-dev.p12'), process.env.WIN_P12KEY_PASSWORD ? 'password') - - downloadFile = (sourceUrl, targetPath, callback) -> - options = { - url: sourceUrl - headers: { - 'User-Agent': 'Atom Signing Key build task', - 'Accept': 'application/vnd.github.VERSION.raw' - } - } - request(options) - .pipe(fs.createWriteStream(targetPath)) - .on('finish', callback) diff --git a/build-old/tasks/compile-packages-slug-task.coffee b/build-old/tasks/compile-packages-slug-task.coffee deleted file mode 100644 index a4f9ff072..000000000 --- a/build-old/tasks/compile-packages-slug-task.coffee +++ /dev/null @@ -1,93 +0,0 @@ -path = require 'path' -CSON = require 'season' -fs = require 'fs-plus' -_ = require 'underscore-plus' -normalizePackageData = require 'normalize-package-data' -semver = require 'semver' - -OtherPlatforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32'].filter (platform) -> platform isnt process.platform - -module.exports = (grunt) -> - {spawn} = require('./task-helpers')(grunt) - - getMenu = (appDir) -> - menusPath = path.join(appDir, 'menus') - menuPath = path.join(menusPath, "#{process.platform}.json") - menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath) - menu - - getKeymaps = (appDir) -> - keymapsPath = path.join(appDir, 'keymaps') - keymaps = {} - for keymapPath in fs.listSync(keymapsPath, ['.json']) - name = path.basename(keymapPath, path.extname(keymapPath)) - continue unless OtherPlatforms.indexOf(name) is -1 - - keymap = CSON.readFileSync(keymapPath) - keymaps[path.basename(keymapPath)] = keymap - keymaps - - grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', -> - appDir = fs.realpathSync(grunt.config.get('atom.appDir')) - - modulesDirectory = path.join(appDir, 'node_modules') - packages = {} - invalidPackages = false - - for moduleDirectory in fs.listSync(modulesDirectory) - continue if path.basename(moduleDirectory) is '.bin' - - metadataPath = path.join(moduleDirectory, 'package.json') - continue unless fs.existsSync(metadataPath) - - metadata = grunt.file.readJSON(metadataPath) - continue unless metadata?.engines?.atom? - - reportPackageError = (msg) -> - invalidPackages = true - grunt.log.error("#{metadata.name}: #{msg}") - normalizePackageData metadata, reportPackageError, true - if metadata.repository?.type is 'git' - metadata.repository.url = metadata.repository.url?.replace(/^git\+/, '') - - moduleCache = metadata._atomModuleCache ? {} - - _.remove(moduleCache.extensions?['.json'] ? [], 'package.json') - - for property in ['_from', '_id', 'dist', 'readme', 'readmeFilename'] - delete metadata[property] - - pack = {metadata, keymaps: {}, menus: {}} - - if metadata.main - mainPath = require.resolve(path.resolve(moduleDirectory, metadata.main)) - pack.main = path.relative(appDir, mainPath) - - keymapsPath = path.join(moduleDirectory, 'keymaps') - for keymapPath in fs.listSync(keymapsPath, ['.cson', '.json']) - relativePath = path.relative(appDir, keymapPath) - pack.keymaps[relativePath] = CSON.readFileSync(keymapPath) - - menusPath = path.join(moduleDirectory, 'menus') - for menuPath in fs.listSync(menusPath, ['.cson', '.json']) - relativePath = path.relative(appDir, menuPath) - pack.menus[relativePath] = CSON.readFileSync(menuPath) - - packages[metadata.name] = pack - - for extension, paths of moduleCache.extensions - delete moduleCache.extensions[extension] if paths.length is 0 - - metadata = grunt.file.readJSON(path.join(appDir, 'package.json')) - metadata._atomPackages = packages - metadata._atomMenu = getMenu(appDir) - metadata._atomKeymaps = getKeymaps(appDir) - metadata._deprecatedPackages = require('../deprecated-packages') - - for name, {version} of metadata._deprecatedPackages - if version and not semver.validRange(version) - invalidPackages = true - grunt.log.error("Invalid range: #{version} (#{name})") - - grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata)) - not invalidPackages diff --git a/build-old/tasks/copy-info-plist-task.coffee b/build-old/tasks/copy-info-plist-task.coffee deleted file mode 100644 index cad121a20..000000000 --- a/build-old/tasks/copy-info-plist-task.coffee +++ /dev/null @@ -1,13 +0,0 @@ -path = require 'path' - -module.exports = (grunt) -> - {cp} = require('./task-helpers')(grunt) - - grunt.registerTask 'copy-info-plist', 'Copy plist', -> - contentsDir = grunt.config.get('atom.contentsDir') - plistPath = path.join(contentsDir, 'Info.plist') - helperPlistPath = path.join(contentsDir, 'Frameworks/Atom Helper.app/Contents/Info.plist') - - # Copy custom plist files - cp 'resources/mac/atom-Info.plist', plistPath - cp 'resources/mac/helper-Info.plist', helperPlistPath diff --git a/build-old/tasks/docs-task.coffee b/build-old/tasks/docs-task.coffee deleted file mode 100644 index 1e80eb2ce..000000000 --- a/build-old/tasks/docs-task.coffee +++ /dev/null @@ -1,50 +0,0 @@ -path = require 'path' - -fs = require 'fs-plus' -_ = require 'underscore-plus' - -donna = require 'donna' -joanna = require 'joanna' -tello = require 'tello' -glob = require 'glob' - -module.exports = (grunt) -> - getClassesToInclude = -> - modulesPath = path.resolve(__dirname, '..', '..', 'node_modules') - classes = {} - fs.traverseTreeSync modulesPath, (modulePath) -> - return false if modulePath.match(/node_modules/g).length > 1 # dont need the dependencies of the dependencies - return true unless path.basename(modulePath) is 'package.json' - return true unless fs.isFileSync(modulePath) - - apiPath = path.join(path.dirname(modulePath), 'api.json') - if fs.isFileSync(apiPath) - _.extend(classes, grunt.file.readJSON(apiPath).classes) - true - classes - - sortClasses = (classes) -> - sortedClasses = {} - for className in Object.keys(classes).sort() - sortedClasses[className] = classes[className] - sortedClasses - - grunt.registerTask 'build-docs', 'Builds the API docs in src', -> - docsOutputDir = grunt.config.get('docsOutputDir') - - [coffeeMetadata] = donna.generateMetadata(['.']) - jsMetadata = joanna(glob.sync('src/*.js')) - - metadata = { - repository: coffeeMetadata.repository, - version: coffeeMetadata.version, - files: Object.assign(coffeeMetadata.files, jsMetadata.files) - } - - api = tello.digest([metadata]) - _.extend(api.classes, getClassesToInclude()) - api.classes = sortClasses(api.classes) - - apiJson = JSON.stringify(api, null, 2) - apiJsonPath = path.join(docsOutputDir, 'api.json') - grunt.file.write(apiJsonPath, apiJson) diff --git a/build-old/tasks/dump-symbols-task.coffee b/build-old/tasks/dump-symbols-task.coffee deleted file mode 100644 index a690ba8d4..000000000 --- a/build-old/tasks/dump-symbols-task.coffee +++ /dev/null @@ -1,39 +0,0 @@ -async = require 'async' -fs = require 'fs-plus' -path = require 'path' -minidump = require 'minidump' - -module.exports = (grunt) -> - {mkdir, rm} = require('./task-helpers')(grunt) - - dumpSymbolTo = (binaryPath, targetDirectory, callback) -> - minidump.dumpSymbol binaryPath, (error, content) -> - return callback(error) if error? - - moduleLine = /MODULE [^ ]+ [^ ]+ ([0-9A-F]+) (.*)\n/.exec(content) - if moduleLine.length isnt 3 - return callback("Invalid output when dumping symbol for #{binaryPath}") - - filename = moduleLine[2] - targetPathDirname = path.join(targetDirectory, filename, moduleLine[1]) - mkdir targetPathDirname - - targetPath = path.join(targetPathDirname, "#{filename}.sym") - fs.writeFile(targetPath, content, callback) - - grunt.registerTask 'dump-symbols', 'Dump symbols for native modules', -> - done = @async() - - symbolsDir = grunt.config.get('atom.symbolsDir') - rm symbolsDir - mkdir symbolsDir - - tasks = [] - onFile = (binaryPath) -> - if /.*\.node$/.test(binaryPath) - tasks.push(dumpSymbolTo.bind(this, binaryPath, symbolsDir)) - onDirectory = -> - true - fs.traverseTreeSync 'node_modules', onFile, onDirectory - - async.parallel tasks, done diff --git a/build-old/tasks/fingerprint-task.js b/build-old/tasks/fingerprint-task.js deleted file mode 100644 index 9cfcdae76..000000000 --- a/build-old/tasks/fingerprint-task.js +++ /dev/null @@ -1,7 +0,0 @@ -var fingerprint = require('../../script/utils/fingerprint') - -module.exports = function (grunt) { - grunt.registerTask('fingerprint', 'Fingerpint the node_modules folder for caching on CI', function () { - fingerprint.writeFingerprint() - }) -} diff --git a/build-old/tasks/generate-asar-task.coffee b/build-old/tasks/generate-asar-task.coffee deleted file mode 100644 index 3d28f1cca..000000000 --- a/build-old/tasks/generate-asar-task.coffee +++ /dev/null @@ -1,37 +0,0 @@ -asar = require 'asar' -fs = require 'fs' -path = require 'path' - -module.exports = (grunt) -> - {cp, rm} = require('./task-helpers')(grunt) - - grunt.registerTask 'generate-asar', 'Generate asar archive for the app', -> - done = @async() - - unpack = [ - '*.node' - 'ctags-config' - 'ctags-darwin' - 'ctags-linux' - 'ctags-win32.exe' - '**/node_modules/spellchecker/**' - '**/resources/atom.png' - ] - unpack = "{#{unpack.join(',')}}" - - appDir = grunt.config.get('atom.appDir') - unless fs.existsSync(appDir) - grunt.log.error 'The app has to be built before generating asar archive.' - return done(false) - - asar.createPackageWithOptions appDir, path.resolve(appDir, '..', 'app.asar'), {unpack}, (err) -> - return done(err) if err? - - rm appDir - fs.renameSync path.resolve(appDir, '..', 'new-app'), appDir - - ctagsFolder = path.join("#{appDir}.asar.unpacked", 'node_modules', 'symbols-view', 'vendor') - for ctagsFile in fs.readdirSync(ctagsFolder) - fs.chmodSync(path.join(ctagsFolder, ctagsFile), "755") - - done() diff --git a/build-old/tasks/generate-license-task.coffee b/build-old/tasks/generate-license-task.coffee deleted file mode 100644 index eaf1a9a66..000000000 --- a/build-old/tasks/generate-license-task.coffee +++ /dev/null @@ -1,46 +0,0 @@ -fs = require 'fs' -path = require 'path' - -module.exports = (grunt) -> - grunt.registerTask 'generate-license', 'Generate the license, including the licenses of all dependencies', (mode) -> - legalEagle = require 'legal-eagle' - done = @async() - - options = - path: process.cwd() - overrides: require './license-overrides' - - legalEagle options, (err, dependencyLicenses) -> - if err? - console.error(err) - exit 1 - - licenseText = getLicenseText(dependencyLicenses) - if mode is 'save' - targetPath = path.resolve(grunt.config.get('atom.appDir'), '..', 'LICENSE.md') - fs.writeFileSync(targetPath, licenseText) - else - console.log licenseText - done() - -getLicenseText = (dependencyLicenses) -> - {keys} = require 'underscore-plus' - text = """ - #{fs.readFileSync('LICENSE.md', 'utf8')} - - This application bundles the following third-party packages in accordance - with the following licenses:\n\n - """ - names = keys(dependencyLicenses).sort() - for name in names - {license, source, sourceText} = dependencyLicenses[name] - - text += "-------------------------------------------------------------------------\n\n" - text += "Package: #{name}\n" - text += "License: #{license}\n" - text += "License Source: #{source}\n" if source? - if sourceText? - text += "Source Text:\n\n" - text += sourceText - text += '\n' - text diff --git a/build-old/tasks/generate-module-cache-task.coffee b/build-old/tasks/generate-module-cache-task.coffee deleted file mode 100644 index e2a92981e..000000000 --- a/build-old/tasks/generate-module-cache-task.coffee +++ /dev/null @@ -1,39 +0,0 @@ -path = require 'path' -fs = require 'fs-plus' -ModuleCache = require '../../src/module-cache' - -module.exports = (grunt) -> - grunt.registerTask 'generate-module-cache', 'Generate a module cache for all core modules and packages', -> - appDir = grunt.config.get('atom.appDir') - - {packageDependencies} = grunt.file.readJSON('package.json') - - for packageName, version of packageDependencies - ModuleCache.create(path.join(appDir, 'node_modules', packageName)) - - ModuleCache.create(appDir) - - metadata = grunt.file.readJSON(path.join(appDir, 'package.json')) - - metadata._atomModuleCache.folders.forEach (folder) -> - if '' in folder.paths - folder.paths = [ - '' - 'exports' - 'spec' - 'src' - 'src/main-process' - 'static' - 'vendor' - ] - - # Reactionary does not have an explicit react dependency - metadata._atomModuleCache.folders.push - paths: [ - 'node_modules/reactionary-atom-fork/lib' - ] - dependencies: { - 'react-atom-fork': metadata.dependencies['react-atom-fork'] - } - - grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata)) diff --git a/build-old/tasks/install-task.coffee b/build-old/tasks/install-task.coffee deleted file mode 100644 index 34a7b67a4..000000000 --- a/build-old/tasks/install-task.coffee +++ /dev/null @@ -1,73 +0,0 @@ -path = require 'path' -fs = require 'fs-plus' -runas = null -temp = require 'temp' - -module.exports = (grunt) -> - {cp, fillTemplate, mkdir, rm} = require('./task-helpers')(grunt) - - grunt.registerTask 'install', 'Install the built application', -> - appName = grunt.config.get('atom.appName') - appFileName = grunt.config.get('atom.appFileName') - apmFileName = grunt.config.get('atom.apmFileName') - buildDir = grunt.config.get('atom.buildDir') - installDir = grunt.config.get('atom.installDir') - shellAppDir = grunt.config.get('atom.shellAppDir') - {description} = grunt.config.get('atom.metadata') - - if process.platform is 'win32' - done = @async() - grunt.log.ok("Installing into \"#{installDir}\" from \"#{shellAppDir}\"") - parentInstallDir = path.resolve(installDir, '..') - adminRequired = false - try - rm installDir - mkdir installDir - catch err - grunt.log.ok("Admin elevation required for write access to \"#{installDir}\"") - adminRequired = true - - runas ?= require 'runas' - copyFolder = path.resolve 'script', 'copy-folder.cmd' - if runas('cmd', ['/c', copyFolder, shellAppDir, installDir], admin: adminRequired) isnt 0 - grunt.fail.fatal("Unable to copy files.") - else - grunt.log.ok("Completed successfully.") - - done() - - else if process.platform is 'darwin' - rm installDir - mkdir path.dirname(installDir) - - tempFolder = temp.path() - mkdir tempFolder - cp shellAppDir, tempFolder - fs.renameSync(tempFolder, installDir) - else - shareDir = path.join(installDir, 'share', appFileName) - rm shareDir - mkdir path.dirname(shareDir) - cp shellAppDir, shareDir - - unless installDir.indexOf(process.env.TMPDIR ? '/tmp') is 0 - iconPath = path.join(shareDir, 'resources', 'app.asar.unpacked', 'resources', 'atom.png') - - mkdir path.join(installDir, 'share', 'applications') - fillTemplate( - path.join('resources', 'linux', 'atom.desktop.in'), - path.join(installDir, 'share', 'applications', appFileName + '.desktop'), - {appName, appFileName, description, iconPath, installDir} - ) - - binDir = path.join(installDir, 'bin') - mkdir binDir - cp 'atom.sh', path.join(binDir, appFileName) - - rm(path.join(binDir, apmFileName)) - fs.symlinkSync( - path.join('..', 'share', appFileName, 'resources', 'app', 'apm', 'node_modules', '.bin', 'apm'), - path.join(binDir, apmFileName) - ) - - fs.chmodSync(path.join(shareDir, 'atom'), '755') diff --git a/build-old/tasks/license-overrides.coffee b/build-old/tasks/license-overrides.coffee deleted file mode 100644 index f3838e70c..000000000 --- a/build-old/tasks/license-overrides.coffee +++ /dev/null @@ -1,354 +0,0 @@ -module.exports = - 'aws-sign@0.3.0': - repository: 'https://github.com/mikeal/aws-sign' - license: 'MIT' - source: 'index.js' - sourceText: """ - /*! - * knox - auth - * Copyright(c) 2010 LearnBoost - * MIT Licensed - */ - - """ - 'bufferjs@2.0.0': - repository: 'https://github.com/coolaj86/node-bufferjs' - license: 'MIT' - source: 'LICENSE.MIT' - sourceText: """ - Copyright (c) 2010 AJ ONeal (and Contributors) - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - """ - 'buffers@0.1.1': - repository: "http://github.com/substack/node-buffers" - license: 'MIT' - source: 'README.markdown' - sourceText: """ - - license - ======= - - MIT/X11 - """ - 'cheerio@0.15.0': - repository: "https://github.com/cheeriojs/cheerio" - license: 'MIT' - source: 'https://github.com/cheeriojs/cheerio/blob/master/package.json' - 'specificity@0.1.3': - repository: 'https://github.com/keeganstreet/specificity' - license: 'MIT' - source: 'package.json in repository' - - 'promzard@0.2.0': - license: 'ISC' - source: 'LICENSE in the repository' - sourceText: """ - The ISC License - - Copyright (c) Isaac Z. Schlueter - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - """ - - 'jschardet@1.1.1': - license: 'LGPL' - source: 'README.md in the repository' - sourceText: """ - JsChardet - ========= - - Port of python's chardet (http://chardet.feedparser.org/). - - License - ------- - - LGPL - """ - 'core-js@0.4.10': - license: 'MIT' - source: 'http://rock.mit-license.org linked in source files and bower.json says MIT' - 'log-driver@1.2.4': - license: 'ISC' - source: 'LICENSE file in the repository' - sourceText: """ - Copyright (c) 2014, Gregg Caines, gregg@caines.ca - - Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - """ - 'shelljs@0.3.0': - license: 'BSD' - source: 'LICENSE file in repository - 3-clause BSD (aka BSD-new)' - sourceText: """ - Copyright (c) 2012, Artur Adib - All rights reserved. - - You may use this project under the terms of the New BSD license as follows: - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Artur Adib nor the - names of the contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - """ - 'json-schema@0.2.2': - repository: 'https://github.com/kriszyp/json-schema' - license: 'BSD' - source: 'README links to https://github.com/dojo/dojo/blob/8b6a5e4c42f9cf777dd39eaae8b188e0ebb59a4c/LICENSE' - sourceText: """ - Dojo is available under *either* the terms of the modified BSD license *or* the - Academic Free License version 2.1. As a recipient of Dojo, you may choose which - license to receive this code under (except as noted in per-module LICENSE - files). Some modules may not be the copyright of the Dojo Foundation. These - modules contain explicit declarations of copyright in both the LICENSE files in - the directories in which they reside and in the code itself. No external - contributions are allowed under licenses which are fundamentally incompatible - with the AFL or BSD licenses that Dojo is distributed under. - - The text of the AFL and BSD licenses is reproduced below. - - ------------------------------------------------------------------------------- - The "New" BSD License: - ********************** - - Copyright (c) 2005-2015, The Dojo Foundation - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Dojo Foundation nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ------------------------------------------------------------------------------- - The Academic Free License, v. 2.1: - ********************************** - - This Academic Free License (the "License") applies to any original work of - authorship (the "Original Work") whose owner (the "Licensor") has placed the - following notice immediately following the copyright notice for the Original - Work: - - Licensed under the Academic Free License version 2.1 - - 1) Grant of Copyright License. Licensor hereby grants You a world-wide, - royalty-free, non-exclusive, perpetual, sublicenseable license to do the - following: - - a) to reproduce the Original Work in copies; - - b) to prepare derivative works ("Derivative Works") based upon the Original - Work; - - c) to distribute copies of the Original Work and Derivative Works to the - public; - - d) to perform the Original Work publicly; and - - e) to display the Original Work publicly. - - 2) Grant of Patent License. Licensor hereby grants You a world-wide, - royalty-free, non-exclusive, perpetual, sublicenseable license, under patent - claims owned or controlled by the Licensor that are embodied in the Original - Work as furnished by the Licensor, to make, use, sell and offer for sale the - Original Work and Derivative Works. - - 3) Grant of Source Code License. The term "Source Code" means the preferred - form of the Original Work for making modifications to it and all available - documentation describing how to modify the Original Work. Licensor hereby - agrees to provide a machine-readable copy of the Source Code of the Original - Work along with each copy of the Original Work that Licensor distributes. - Licensor reserves the right to satisfy this obligation by placing a - machine-readable copy of the Source Code in an information repository - reasonably calculated to permit inexpensive and convenient access by You for as - long as Licensor continues to distribute the Original Work, and by publishing - the address of that information repository in a notice immediately following - the copyright notice that applies to the Original Work. - - 4) Exclusions From License Grant. Neither the names of Licensor, nor the names - of any contributors to the Original Work, nor any of their trademarks or - service marks, may be used to endorse or promote products derived from this - Original Work without express prior written permission of the Licensor. Nothing - in this License shall be deemed to grant any rights to trademarks, copyrights, - patents, trade secrets or any other intellectual property of Licensor except as - expressly stated herein. No patent license is granted to make, use, sell or - offer to sell embodiments of any patent claims other than the licensed claims - defined in Section 2. No right is granted to the trademarks of Licensor even if - such marks are included in the Original Work. Nothing in this License shall be - interpreted to prohibit Licensor from licensing under different terms from this - License any Original Work that Licensor otherwise would have a right to - license. - - 5) This section intentionally omitted. - - 6) Attribution Rights. You must retain, in the Source Code of any Derivative - Works that You create, all copyright, patent or trademark notices from the - Source Code of the Original Work, as well as any notices of licensing and any - descriptive text identified therein as an "Attribution Notice." You must cause - the Source Code for any Derivative Works that You create to carry a prominent - Attribution Notice reasonably calculated to inform recipients that You have - modified the Original Work. - - 7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that - the copyright in and to the Original Work and the patent rights granted herein - by Licensor are owned by the Licensor or are sublicensed to You under the terms - of this License with the permission of the contributor(s) of those copyrights - and patent rights. Except as expressly stated in the immediately proceeding - sentence, the Original Work is provided under this License on an "AS IS" BASIS - and WITHOUT WARRANTY, either express or implied, including, without limitation, - the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. - This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No - license to Original Work is granted hereunder except under this disclaimer. - - 8) Limitation of Liability. Under no circumstances and under no legal theory, - whether in tort (including negligence), contract, or otherwise, shall the - Licensor be liable to any person for any direct, indirect, special, incidental, - or consequential damages of any character arising as a result of this License - or the use of the Original Work including, without limitation, damages for loss - of goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses. This limitation of liability shall not - apply to liability for death or personal injury resulting from Licensor's - negligence to the extent applicable law prohibits such limitation. Some - jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - - 9) Acceptance and Termination. If You distribute copies of the Original Work or - a Derivative Work, You must make a reasonable effort under the circumstances to - obtain the express assent of recipients to the terms of this License. Nothing - else but this License (or another written agreement between Licensor and You) - grants You permission to create Derivative Works based upon the Original Work - or to exercise any of the rights granted in Section 1 herein, and any attempt - to do so except under the terms of this License (or another written agreement - between Licensor and You) is expressly prohibited by U.S. copyright law, the - equivalent laws of other countries, and by international treaty. Therefore, by - exercising any of the rights granted to You in Section 1 herein, You indicate - Your acceptance of this License and all of its terms and conditions. - - 10) Termination for Patent Action. This License shall terminate automatically - and You may no longer exercise any of the rights granted to You by this License - as of the date You commence an action, including a cross-claim or counterclaim, - against Licensor or any licensee alleging that the Original Work infringes a - patent. This termination provision shall not apply for an action alleging - patent infringement by combinations of the Original Work with other software or - hardware. - - 11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this - License may be brought only in the courts of a jurisdiction wherein the - Licensor resides or in which Licensor conducts its primary business, and under - the laws of that jurisdiction excluding its conflict-of-law provisions. The - application of the United Nations Convention on Contracts for the International - Sale of Goods is expressly excluded. Any use of the Original Work outside the - scope of this License or after its termination shall be subject to the - requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et - seq., the equivalent laws of other countries, and international treaty. This - section shall survive the termination of this License. - - 12) Attorneys Fees. In any action to enforce the terms of this License or - seeking damages relating thereto, the prevailing party shall be entitled to - recover its costs and expenses, including, without limitation, reasonable - attorneys' fees and costs incurred in connection with such action, including - any appeal of such action. This section shall survive the termination of this - License. - - 13) Miscellaneous. This License represents the complete agreement concerning - the subject matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent necessary to - make it enforceable. - - 14) Definition of "You" in This License. "You" throughout this License, whether - in upper or lower case, means an individual or a legal entity exercising rights - under, and complying with all of the terms of, this License. For legal - entities, "You" includes any entity that controls, is controlled by, or is - under common control with you. For purposes of this definition, "control" means - (i) the power, direct or indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (ii) ownership of fifty percent - (50%) or more of the outstanding shares, or (iii) beneficial ownership of such - entity. - - 15) Right to Use. You may use the Original Work in all ways not otherwise - restricted or conditioned by this License or by law, and Licensor promises not - to interfere with or be responsible for such uses by You. - - This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. - Permission is hereby granted to copy and distribute this license without - modification. This license may not be modified without the express written - permission of its copyright owner. - """ - 'inherit@2.2.2': - license: 'MIT' - repository: 'https://github.com/dfilatov/inherit' - source: 'LICENSE.md' - sourceText: """ - Copyright (c) 2012 Dmitry Filatov - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - """ - 'tweetnacl@0.14.3': - license: 'Public Domain' - repository: 'https://github.com/dchest/tweetnacl' - source: 'COPYING.txt' - sourceText: """ - Public Domain - - The person who associated a work with this deed has dedicated the work to the - public domain by waiving all of his or her rights to the work worldwide under - copyright law, including all related and neighboring rights, to the extent - allowed by law. - - You can copy, modify, distribute and perform the work, even for commercial - purposes, all without asking permission. - """ diff --git a/build-old/tasks/mkdeb-task.coffee b/build-old/tasks/mkdeb-task.coffee deleted file mode 100644 index 5f50122f8..000000000 --- a/build-old/tasks/mkdeb-task.coffee +++ /dev/null @@ -1,59 +0,0 @@ -path = require 'path' - -module.exports = (grunt) -> - {spawn, fillTemplate} = require('./task-helpers')(grunt) - - grunt.registerTask 'mkdeb', 'Create debian package', -> - done = @async() - - appName = grunt.config.get('atom.appName') - appFileName = grunt.config.get('atom.appFileName') - apmFileName = grunt.config.get('atom.apmFileName') - buildDir = grunt.config.get('atom.buildDir') - installDir = '/usr' - shellAppDir = grunt.config.get('atom.shellAppDir') - {version, description} = grunt.config.get('atom.metadata') - channel = grunt.config.get('atom.channel') - - if process.arch is 'ia32' - arch = 'i386' - else if process.arch is 'x64' - arch = 'amd64' - else - return done("Unsupported arch #{process.arch}") - - desktopFilePath = path.join(buildDir, appFileName + '.desktop') - fillTemplate( - path.join('resources', 'linux', 'atom.desktop.in'), - desktopFilePath, - {appName, appFileName, description, installDir, iconPath: appFileName} - ) - - getInstalledSize shellAppDir, (error, installedSize) -> - if error? - return done(error) - - controlFilePath = path.join(buildDir, 'control') - fillTemplate( - path.join('resources', 'linux', 'debian', 'control.in'), - controlFilePath, - {appFileName, version, arch, installedSize, description} - ) - - iconPath = path.join(shellAppDir, 'resources', 'app.asar.unpacked', 'resources', 'atom.png') - - cmd = path.join('script', 'mkdeb') - args = [appFileName, version, channel, arch, controlFilePath, desktopFilePath, iconPath, buildDir] - spawn {cmd, args}, (error) -> - if error? - done(error) - else - grunt.log.ok "Created #{buildDir}/#{appFileName}-#{version}-#{arch}.deb" - done() - - getInstalledSize = (directory, callback) -> - cmd = 'du' - args = ['-sk', directory] - spawn {cmd, args}, (error, {stdout}) -> - installedSize = stdout.split(/\s+/)?[0] or '200000' # default to 200MB - callback(null, installedSize) diff --git a/build-old/tasks/mkrpm-task.coffee b/build-old/tasks/mkrpm-task.coffee deleted file mode 100644 index 641127857..000000000 --- a/build-old/tasks/mkrpm-task.coffee +++ /dev/null @@ -1,54 +0,0 @@ -path = require 'path' - -module.exports = (grunt) -> - {spawn, fillTemplate, rm, mkdir} = require('./task-helpers')(grunt) - - grunt.registerTask 'mkrpm', 'Create rpm package', -> - done = @async() - - appName = grunt.config.get('atom.appName') - appFileName = grunt.config.get('atom.appFileName') - apmFileName = grunt.config.get('atom.apmFileName') - buildDir = grunt.config.get('atom.buildDir') - installDir = '/usr' - {version, description} = grunt.config.get('atom.metadata') - - if process.arch is 'ia32' - arch = 'i386' - else if process.arch is 'x64' - arch = 'amd64' - else - return done("Unsupported arch #{process.arch}") - - desktopFilePath = path.join(buildDir, appFileName + '.desktop') - fillTemplate( - path.join('resources', 'linux', 'atom.desktop.in'), - desktopFilePath, - {appName, appFileName, description, installDir, iconPath: appFileName} - ) - - # RPM versions can't have dashes in them. - # * http://www.rpm.org/max-rpm/ch-rpm-file-format.html - # * https://github.com/mojombo/semver/issues/145 - version = version.replace(/-beta/, "~beta") - version = version.replace(/-dev/, "~dev") - - specFilePath = path.join(buildDir, appFileName + '.spec') - fillTemplate( - path.join('resources', 'linux', 'redhat', 'atom.spec.in'), - specFilePath, - {appName, appFileName, apmFileName, installDir, version, description} - ) - - rpmDir = path.join(buildDir, 'rpm') - rm rpmDir - mkdir rpmDir - - cmd = path.join('script', 'mkrpm') - args = [appName, appFileName, specFilePath, desktopFilePath, buildDir] - spawn {cmd, args}, (error) -> - if error? - done(error) - else - grunt.log.ok "Created rpm package in #{rpmDir}" - done() diff --git a/build-old/tasks/mktar-task.coffee b/build-old/tasks/mktar-task.coffee deleted file mode 100644 index f5edbb4be..000000000 --- a/build-old/tasks/mktar-task.coffee +++ /dev/null @@ -1,30 +0,0 @@ -path = require 'path' - -module.exports = (grunt) -> - {spawn, fillTemplate} = require('./task-helpers')(grunt) - - grunt.registerTask 'mktar', 'Create an archive', -> - done = @async() - - appFileName = grunt.config.get('atom.appFileName') - buildDir = grunt.config.get('atom.buildDir') - shellAppDir = grunt.config.get('atom.shellAppDir') - {version, description} = grunt.config.get('atom.metadata') - - if process.arch is 'ia32' - arch = 'i386' - else if process.arch is 'x64' - arch = 'amd64' - else - return done("Unsupported arch #{process.arch}") - - iconPath = path.join(shellAppDir, 'resources', 'app.asar.unpacked', 'resources', 'atom.png') - - cmd = path.join('script', 'mktar') - args = [appFileName, version, arch, iconPath, buildDir] - spawn {cmd, args}, (error) -> - if error? - done(error) - else - grunt.log.ok "Created " + path.join(buildDir, "#{appFileName}-#{version}-#{arch}.tar.gz") - done() diff --git a/build-old/tasks/nof-task.coffee b/build-old/tasks/nof-task.coffee deleted file mode 100644 index 6eb7623dd..000000000 --- a/build-old/tasks/nof-task.coffee +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = (grunt) -> - {spawn} = require('./task-helpers')(grunt) - - grunt.registerTask 'nof', 'Un-focus all specs', -> - nof = require.resolve('.bin/nof') - spawn({cmd: nof, args: ['spec']}, @async()) diff --git a/build-old/tasks/output-build-filetypes.coffee b/build-old/tasks/output-build-filetypes.coffee deleted file mode 100644 index 1b8aeb330..000000000 --- a/build-old/tasks/output-build-filetypes.coffee +++ /dev/null @@ -1,34 +0,0 @@ -asar = require 'asar' -path = require 'path' - -module.exports = (grunt) -> - grunt.registerTask 'output-build-filetypes', 'Log counts for each filetype in the built application', -> - shellAppDir = grunt.config.get('atom.shellAppDir') - - types = {} - registerFile = (filePath) -> - extension = path.extname(filePath) or path.basename(filePath) - types[extension] ?= [] - types[extension].push(filePath) - - if extension is '.asar' - asar.listPackage(filePath).forEach (archivePath) -> - archivePath = archivePath.substring(1) - unless asar.statFile(filePath, archivePath, true).files - registerFile(archivePath) - - grunt.file.recurse shellAppDir, (absolutePath, rootPath, relativePath, fileName) -> registerFile(absolutePath) - - extensions = Object.keys(types).sort (extension1, extension2) -> - diff = types[extension2].length - types[extension1].length - if diff is 0 - extension1.toLowerCase().localeCompare(extension2.toLowerCase()) - else - diff - - if extension = grunt.option('extension') - types[extension]?.sort().forEach (filePath) -> - grunt.log.error filePath - else - extensions[0...25].forEach (extension) -> - grunt.log.error "#{extension}: #{types[extension].length}" diff --git a/build-old/tasks/output-disk-space.coffee b/build-old/tasks/output-disk-space.coffee deleted file mode 100644 index 372ead672..000000000 --- a/build-old/tasks/output-disk-space.coffee +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = (grunt) -> - {spawn} = require('./task-helpers')(grunt) - - grunt.registerTask 'output-disk-space', 'Print diskspace available', -> - return unless process.platform is 'darwin' - - done = @async() - - cmd = 'df' - args = ['-Hl'] - spawn {cmd, args}, (error, result, code) -> - return done(error) if error? - - lines = result.stdout.split("\n") - - for line in lines[1..] - [filesystem, size, used, avail, capacity, extra] = line.split(/\s+/) - capacity = parseInt(capacity) - - if capacity > 90 - grunt.log.error("#{filesystem} is at #{capacity}% capacity!") - else if capacity > 80 - grunt.log.ok("#{filesystem} is at #{capacity}% capacity.") - - done() diff --git a/build-old/tasks/output-for-loop-returns.coffee b/build-old/tasks/output-for-loop-returns.coffee deleted file mode 100644 index f9b036120..000000000 --- a/build-old/tasks/output-for-loop-returns.coffee +++ /dev/null @@ -1,22 +0,0 @@ -path = require 'path' - -module.exports = (grunt) -> - grunt.registerTask 'output-for-loop-returns', 'Log methods that end with a for loop', -> - appDir = grunt.config.get('atom.appDir') - - jsPaths = [] - grunt.file.recurse path.join(appDir, 'src'), (absolutePath, rootPath, relativePath, fileName) -> - jsPaths.push(absolutePath) if path.extname(fileName) is '.js' - - jsPaths.forEach (jsPath) -> - js = grunt.file.read(jsPath) - method = null - for line, index in js.split('\n') - [match, className, methodName] = /^\s*([a-zA-Z]+)\.(?:prototype\.)?([a-zA-Z]+)\s*=\s*function\(/.exec(line) ? [] - if className and methodName - method = "#{className}::#{methodName}" - else - [match, ctorName] = /^\s*function\s+([a-zA-Z]+)\(/.exec(line) ? [] - - if /^\s*return\s+_results;\s*$/.test(line) - console.log(method ? "#{path.basename(jsPath)}:#{index}") diff --git a/build-old/tasks/output-long-paths-task.coffee b/build-old/tasks/output-long-paths-task.coffee deleted file mode 100644 index ce84d663b..000000000 --- a/build-old/tasks/output-long-paths-task.coffee +++ /dev/null @@ -1,18 +0,0 @@ -path = require 'path' - -module.exports = (grunt) -> - grunt.registerTask 'output-long-paths', 'Log long paths in the built application', -> - shellAppDir = grunt.config.get('atom.shellAppDir') - - longPaths = [] - grunt.file.recurse shellAppDir, (absolutePath, rootPath, relativePath, fileName) -> - if relativePath - fullPath = path.join(relativePath, fileName) - else - fullPath = fileName - longPaths.push(fullPath) if fullPath.length >= 175 - - longPaths.sort (longPath1, longPath2) -> longPath2.length - longPath1.length - - longPaths.forEach (longPath) -> - grunt.log.error "#{longPath.length} character path: #{longPath}" diff --git a/build-old/tasks/output-module-counts.coffee b/build-old/tasks/output-module-counts.coffee deleted file mode 100644 index 643929ff8..000000000 --- a/build-old/tasks/output-module-counts.coffee +++ /dev/null @@ -1,66 +0,0 @@ -fs = require 'fs' -path = require 'path' - -module.exports = (grunt) -> - grunt.registerTask 'output-module-counts', 'Log modules where more than one copy exists in node_modules', -> - nodeModulesDir = path.resolve(__dirname, '..', '..', 'node_modules') - - otherModules = {} - atomModules = {} - - sortModuleNames = (modules) -> - Object.keys(modules).sort (name1, name2) -> - diff = modules[name2].count - modules[name1].count - diff = name1.localeCompare(name2) if diff is 0 - diff - - getAtomTotal = -> - Object.keys(atomModules).length - - getOtherTotal = -> - Object.keys(otherModules).length - - recurseHandler = (absolutePath, rootPath, relativePath, fileName) -> - return if fileName isnt 'package.json' - - {name, version, repository} = grunt.file.readJSON(absolutePath) - return unless name and version - - repository = repository.url if repository?.url - - if /.+\/atom\/.+/.test(repository) - modules = atomModules - else - modules = otherModules - - modules[name] ?= {versions: {}, count: 0} - modules[name].count++ - modules[name].versions[version] = true - - walkNodeModuleDir = -> - grunt.file.recurse(nodeModulesDir, recurseHandler) - - # Handle broken symlinks that grunt.file.recurse fails to handle - loop - try - walkNodeModuleDir() - break - catch error - if error.code is 'ENOENT' - fs.unlinkSync(error.path) - otherModules = {} - atomModules = {} - else - break - - if getAtomTotal() > 0 - console.log "Atom Modules: #{getAtomTotal()}" - sortModuleNames(atomModules).forEach (name) -> - {count, versions, atom} = atomModules[name] - grunt.log.error "#{name}: #{count} (#{Object.keys(versions).join(', ')})" if count > 1 - console.log() - - console.log "Other Modules: #{getOtherTotal()}" - sortModuleNames(otherModules).forEach (name) -> - {count, versions, atom} = otherModules[name] - grunt.log.error "#{name}: #{count} (#{Object.keys(versions).join(', ')})" if count > 1 diff --git a/build-old/tasks/prebuild-less-task.coffee b/build-old/tasks/prebuild-less-task.coffee deleted file mode 100644 index 4ea4dc69e..000000000 --- a/build-old/tasks/prebuild-less-task.coffee +++ /dev/null @@ -1,87 +0,0 @@ -path = require 'path' -fs = require 'fs' -temp = require('temp').track() -LessCache = require 'less-cache' - -module.exports = (grunt) -> - {rm} = require('./task-helpers')(grunt) - cacheMisses = 0 - cacheHits = 0 - - importFallbackVariables = (lessFilePath) -> - if lessFilePath.indexOf('static') is 0 - false - else - true - - grunt.registerMultiTask 'prebuild-less', 'Prebuild cached of compiled Less files', -> - uiThemes = [ - 'atom-dark-ui' - 'atom-light-ui' - 'one-dark-ui' - 'one-light-ui' - ] - - syntaxThemes = [ - 'atom-dark-syntax' - 'atom-light-syntax' - 'one-dark-syntax' - 'one-light-syntax' - 'solarized-dark-syntax' - 'base16-tomorrow-dark-theme' - 'base16-tomorrow-light-theme' - ] - - prebuiltConfigurations = [] - uiThemes.forEach (uiTheme) -> - syntaxThemes.forEach (syntaxTheme) -> - prebuiltConfigurations.push([uiTheme, syntaxTheme]) - - directory = path.join(grunt.config.get('atom.appDir'), 'less-compile-cache') - - for configuration in prebuiltConfigurations - importPaths = grunt.config.get('less.options.paths') - themeMains = [] - for theme in configuration - # TODO Use AtomPackage class once it runs outside of an Atom context - themePath = path.resolve('node_modules', theme) - if fs.existsSync(path.join(themePath, 'stylesheets')) - stylesheetsDir = path.join(themePath, 'stylesheets') - else - stylesheetsDir = path.join(themePath, 'styles') - {main} = grunt.file.readJSON(path.join(themePath, 'package.json')) - main ?= 'index.less' - mainPath = path.join(themePath, main) - themeMains.push(mainPath) if grunt.file.isFile(mainPath) - importPaths.unshift(stylesheetsDir) if grunt.file.isDir(stylesheetsDir) - - grunt.verbose.writeln("Building Less cache for #{configuration.join(', ').yellow}") - lessCache = new LessCache - cacheDir: directory - fallbackDir: grunt.config.get('prebuild-less.options.cachePath') - syncCaches: true - resourcePath: path.resolve('.') - importPaths: importPaths - - cssForFile = (file) -> - less = fs.readFileSync(file, 'utf8') - if importFallbackVariables(file) - baseVarImports = """ - @import "variables/ui-variables"; - @import "variables/syntax-variables"; - """ - less = [baseVarImports, less].join('\n') - lessCache.cssForFile(file, less) - - for file in @filesSrc - grunt.verbose.writeln("File #{file.cyan} created in cache.") - cssForFile(file) - - for file in themeMains - grunt.verbose.writeln("File #{file.cyan} created in cache.") - cssForFile(file) - - cacheMisses += lessCache.stats.misses - cacheHits += lessCache.stats.hits - - grunt.log.ok("#{cacheMisses} files compiled, #{cacheHits} files reused") diff --git a/build-old/tasks/publish-build-task.coffee b/build-old/tasks/publish-build-task.coffee deleted file mode 100644 index ad31c0d8e..000000000 --- a/build-old/tasks/publish-build-task.coffee +++ /dev/null @@ -1,281 +0,0 @@ -child_process = require 'child_process' -path = require 'path' - -_ = require 'underscore-plus' -async = require 'async' -fs = require 'fs-plus' -GitHub = require 'github-releases' -request = require 'request' -AWS = require 'aws-sdk' - -grunt = null - -token = process.env.ATOM_ACCESS_TOKEN -repo = process.env.ATOM_PUBLISH_REPO ? 'atom/atom' -defaultHeaders = - Authorization: "token #{token}" - 'User-Agent': 'Atom' - -module.exports = (gruntObject) -> - grunt = gruntObject - {cp} = require('./task-helpers')(grunt) - - grunt.registerTask 'publish-build', 'Publish the built app', -> - tasks = [] - tasks.push('build-docs', 'prepare-docs') if process.platform is 'darwin' - tasks.push('upload-assets') - grunt.task.run(tasks) - - grunt.registerTask 'prepare-docs', 'Move api.json to atom-api.json', -> - docsOutputDir = grunt.config.get('docsOutputDir') - buildDir = grunt.config.get('atom.buildDir') - cp path.join(docsOutputDir, 'api.json'), path.join(buildDir, 'atom-api.json') - - grunt.registerTask 'upload-assets', 'Upload the assets to a GitHub release', -> - releaseBranch = grunt.config.get('atom.releaseBranch') - isPrerelease = grunt.config.get('atom.channel') is 'beta' - - unless releaseBranch? - grunt.log.ok("Skipping upload-assets to #{repo} repo because this is not a release branch") - return - - grunt.log.ok("Starting upload-assets to #{repo} repo") - - doneCallback = @async() - startTime = Date.now() - done = (args...) -> - elapsedTime = Math.round((Date.now() - startTime) / 100) / 10 - grunt.log.ok("Upload time: #{elapsedTime}s") - doneCallback(args...) - - unless token - return done(new Error('ATOM_ACCESS_TOKEN environment variable not set')) - - buildDir = grunt.config.get('atom.buildDir') - assets = getAssets() - - zipAssets buildDir, assets, (error) -> - return done(error) if error? - getAtomDraftRelease isPrerelease, releaseBranch, (error, release) -> - return done(error) if error? - assetNames = (asset.assetName for asset in assets) - deleteExistingAssets release, assetNames, (error) -> - return done(error) if error? - uploadAssets(release, buildDir, assets, done) - -getAssets = -> - {cp} = require('./task-helpers')(grunt) - - {version} = grunt.file.readJSON('package.json') - buildDir = grunt.config.get('atom.buildDir') - appName = grunt.config.get('atom.appName') - appFileName = grunt.config.get('atom.appFileName') - - switch process.platform - when 'darwin' - [ - {assetName: 'atom-mac.zip', sourcePath: appName} - {assetName: 'atom-mac-symbols.zip', sourcePath: 'Atom.breakpad.syms'} - {assetName: 'atom-api.json', sourcePath: 'atom-api.json'} - ] - when 'win32' - assets = [{assetName: 'atom-windows.zip', sourcePath: appName}] - for squirrelAsset in ['AtomSetup.exe', 'AtomSetup.msi', 'RELEASES', "atom-#{version}-full.nupkg", "atom-#{version}-delta.nupkg"] - cp path.join(buildDir, 'installer', squirrelAsset), path.join(buildDir, squirrelAsset) - assets.push({assetName: squirrelAsset, sourcePath: assetName}) - assets - when 'linux' - if process.arch is 'ia32' - arch = 'i386' - else - arch = 'amd64' - - # Check for a Debian build - sourcePath = path.join(buildDir, "#{appFileName}-#{version}-#{arch}.deb") - assetName = "atom-#{arch}.deb" - - # Check for a Fedora build - unless fs.isFileSync(sourcePath) - rpmName = fs.readdirSync("#{buildDir}/rpm")[0] - sourcePath = path.join(buildDir, "rpm", rpmName) - if process.arch is 'ia32' - arch = 'i386' - else - arch = 'x86_64' - assetName = "atom.#{arch}.rpm" - - cp sourcePath, path.join(buildDir, assetName) - assets = [{assetName, sourcePath}] - - # Check for an archive build on a debian build machine. - # We could provide a Fedora version if some libraries are not compatible - sourcePath = path.join(buildDir, "#{appFileName}-#{version}-#{arch}.tar.gz") - if fs.isFileSync(sourcePath) - assetName = "atom-#{arch}.tar.gz" - cp sourcePath, path.join(buildDir, assetName) - assets.push({assetName, sourcePath}) - - assets - -logError = (message, error, details) -> - grunt.log.error(message) - grunt.log.error(error.message ? error) if error? - grunt.log.error(require('util').inspect(details)) if details - -zipAssets = (buildDir, assets, callback) -> - zip = (directory, sourcePath, assetName, callback) -> - grunt.log.ok("Zipping #{sourcePath} into #{assetName}") - if process.platform is 'win32' - sevenZipPath = if process.env.JANKY_SHA1? then "C:/psmodules/" else "" - zipCommand = "#{sevenZipPath}7z.exe a -r \"#{assetName}\" \"#{sourcePath}\"" - else - zipCommand = "zip -r --symlinks '#{assetName}' '#{sourcePath}'" - options = {cwd: directory, maxBuffer: Infinity} - child_process.exec zipCommand, options, (error, stdout, stderr) -> - logError("Zipping #{sourcePath} failed", error, stderr) if error? - callback(error) - - tasks = [] - for {assetName, sourcePath} in assets when path.extname(assetName) is '.zip' - fs.removeSync(path.join(buildDir, assetName)) - tasks.push(zip.bind(this, buildDir, sourcePath, assetName)) - async.parallel(tasks, callback) - -getAtomDraftRelease = (isPrerelease, branchName, callback) -> - grunt.log.ok("Obtaining GitHub draft release for #{branchName}") - atomRepo = new GitHub({repo: repo, token}) - atomRepo.getReleases {prerelease: isPrerelease}, (error, releases=[]) -> - if error? - logError("Fetching #{repo} #{if isPrerelease then "pre" else "" }releases failed", error, releases) - callback(error) - else - [firstDraft] = releases.filter ({draft}) -> draft - if firstDraft? - options = - uri: firstDraft.assets_url - method: 'GET' - headers: defaultHeaders - json: true - request options, (error, response, assets=[]) -> - if error? or response.statusCode isnt 200 - logError('Fetching draft release assets failed', error, assets) - callback(error ? new Error(response.statusCode)) - else - grunt.log.ok("Using GitHub draft release #{firstDraft.name}") - firstDraft.assets = assets - callback(null, firstDraft) - else - createAtomDraftRelease(isPrerelease, branchName, callback) - -createAtomDraftRelease = (isPrerelease, branchName, callback) -> - grunt.log.ok("Creating GitHub draft release #{branchName}") - {version} = require('../../package.json') - options = - uri: "https://api.github.com/repos/#{repo}/releases" - method: 'POST' - headers: defaultHeaders - json: - tag_name: "v#{version}" - prerelease: isPrerelease - target_commitish: branchName - name: version - draft: true - body: """ - ### Notable Changes - - * Something new - """ - - request options, (error, response, body='') -> - if error? or response.statusCode isnt 201 - logError("Creating #{repo} draft release failed", error, body) - callback(error ? new Error(response.statusCode)) - else - callback(null, body) - -deleteRelease = (release) -> - grunt.log.ok("Deleting GitHub release #{release.tag_name}") - options = - uri: release.url - method: 'DELETE' - headers: defaultHeaders - json: true - request options, (error, response, body='') -> - if error? or response.statusCode isnt 204 - logError('Deleting release failed', error, body) - -deleteExistingAssets = (release, assetNames, callback) -> - grunt.log.ok("Deleting #{assetNames.join(',')} from GitHub release #{release.tag_name}") - [callback, assetNames] = [assetNames, callback] if not callback? - - deleteAsset = (url, callback) -> - options = - uri: url - method: 'DELETE' - headers: defaultHeaders - request options, (error, response, body='') -> - if error? or response.statusCode isnt 204 - logError('Deleting existing release asset failed', error, body) - callback(error ? new Error(response.statusCode)) - else - callback() - - tasks = [] - for asset in release.assets when not assetNames? or asset.name in assetNames - tasks.push(deleteAsset.bind(this, asset.url)) - async.parallel(tasks, callback) - -uploadAssets = (release, buildDir, assets, callback) -> - uploadToReleases = (release, assetName, assetPath, callback) -> - grunt.log.ok("Uploading #{assetName} to GitHub release #{release.tag_name}") - options = - uri: release.upload_url.replace(/\{.*$/, "?name=#{assetName}") - method: 'POST' - headers: _.extend({ - 'Content-Type': 'application/zip' - 'Content-Length': fs.getSizeSync(assetPath) - }, defaultHeaders) - - assetRequest = request options, (error, response, body='') -> - if error? or response.statusCode >= 400 - logError("Upload release asset #{assetName} to Releases failed", error, body) - callback(error ? new Error(response.statusCode)) - else - callback(null, release) - - fs.createReadStream(assetPath).pipe(assetRequest) - - uploadToS3 = (release, assetName, assetPath, callback) -> - s3Key = process.env.BUILD_ATOM_RELEASES_S3_KEY - s3Secret = process.env.BUILD_ATOM_RELEASES_S3_SECRET - s3Bucket = process.env.BUILD_ATOM_RELEASES_S3_BUCKET - - unless s3Key and s3Secret and s3Bucket - callback(new Error('BUILD_ATOM_RELEASES_S3_KEY, BUILD_ATOM_RELEASES_S3_SECRET, and BUILD_ATOM_RELEASES_S3_BUCKET environment variables must be set.')) - return - - s3Info = - accessKeyId: s3Key - secretAccessKey: s3Secret - s3 = new AWS.S3 s3Info - - key = "releases/#{release.tag_name}/#{assetName}" - grunt.log.ok("Uploading to S3 #{key}") - uploadParams = - Bucket: s3Bucket - ACL: 'public-read' - Key: key - Body: fs.createReadStream(assetPath) - s3.upload uploadParams, (error, data) -> - if error? - logError("Upload release asset #{assetName} to S3 failed", error) - callback(error) - else - callback(null, release) - - tasks = [] - for {assetName} in assets - assetPath = path.join(buildDir, assetName) - tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) - tasks.push(uploadToS3.bind(this, release, assetName, assetPath)) - async.parallel(tasks, callback) diff --git a/build-old/tasks/set-exe-icon-task.coffee b/build-old/tasks/set-exe-icon-task.coffee deleted file mode 100644 index f29a19680..000000000 --- a/build-old/tasks/set-exe-icon-task.coffee +++ /dev/null @@ -1,13 +0,0 @@ -path = require 'path' - -module.exports = (grunt) -> - grunt.registerTask 'set-exe-icon', 'Set icon of the exe', -> - done = @async() - - channel = grunt.config.get('atom.channel') - shellAppDir = grunt.config.get('atom.shellAppDir') - shellExePath = path.join(shellAppDir, 'atom.exe') - iconPath = path.resolve('resources', 'app-icons', channel, 'atom.ico') - - rcedit = require('rcedit') - rcedit(shellExePath, {'icon': iconPath}, done) diff --git a/build-old/tasks/set-version-task.coffee b/build-old/tasks/set-version-task.coffee deleted file mode 100644 index c7a29b584..000000000 --- a/build-old/tasks/set-version-task.coffee +++ /dev/null @@ -1,57 +0,0 @@ -fs = require 'fs' -path = require 'path' - -module.exports = (grunt) -> - {spawn} = require('./task-helpers')(grunt) - - getVersion = (callback) -> - shouldUseCommitHash = grunt.config.get('atom.channel') is 'dev' - inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git')) - {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json')) - if shouldUseCommitHash and inRepository - cmd = 'git' - args = ['rev-parse', '--short', 'HEAD'] - spawn {cmd, args}, (error, {stdout}={}, code) -> - commitHash = stdout?.trim?() - combinedVersion = "#{version}-#{commitHash}" - callback(error, combinedVersion) - else - callback(null, version) - - grunt.registerTask 'set-version', 'Set the version in the plist and package.json', -> - done = @async() - - getVersion (error, version) -> - if error? - done(error) - return - - appDir = grunt.config.get('atom.appDir') - shellAppDir = grunt.config.get('atom.shellAppDir') - - # Replace version field of package.json. - packageJsonPath = path.join(appDir, 'package.json') - packageJson = require(packageJsonPath) - packageJson.version = version - packageJsonString = JSON.stringify(packageJson) - fs.writeFileSync(packageJsonPath, packageJsonString) - - if process.platform is 'darwin' - cmd = 'script/set-version' - args = [shellAppDir, version] - spawn {cmd, args}, (error, result, code) -> done(error) - else if process.platform is 'win32' - shellAppDir = grunt.config.get('atom.shellAppDir') - shellExePath = path.join(shellAppDir, 'atom.exe') - - strings = - CompanyName: 'GitHub, Inc.' - FileDescription: 'Atom' - LegalCopyright: 'Copyright (C) 2015 GitHub, Inc. All rights reserved' - ProductName: 'Atom' - ProductVersion: version - - rcedit = require('rcedit') - rcedit(shellExePath, {'version-string': strings}, done) - else - done() diff --git a/build-old/tasks/spec-task.coffee b/build-old/tasks/spec-task.coffee deleted file mode 100644 index 4f92e1020..000000000 --- a/build-old/tasks/spec-task.coffee +++ /dev/null @@ -1,158 +0,0 @@ -fs = require 'fs' -path = require 'path' -temp = require('temp').track() - -_ = require 'underscore-plus' -async = require 'async' - -# Run specs serially on CircleCI -if process.env.CIRCLECI - concurrency = 1 -else - concurrency = 2 - -module.exports = (grunt) -> - {isAtomPackage, spawn} = require('./task-helpers')(grunt) - - packageSpecQueue = null - - getAppPath = -> - contentsDir = grunt.config.get('atom.contentsDir') - switch process.platform - when 'darwin' - path.join(contentsDir, 'MacOS', 'Atom') - when 'linux' - path.join(contentsDir, 'atom') - when 'win32' - path.join(contentsDir, 'atom.exe') - - runPackageSpecs = (callback) -> - failedPackages = [] - rootDir = grunt.config.get('atom.shellAppDir') - resourcePath = process.cwd() - appPath = getAppPath() - - # Ensure application is executable on Linux - fs.chmodSync(appPath, '755') if process.platform is 'linux' - - packageSpecQueue = async.queue (packagePath, callback) -> - if process.platform in ['darwin', 'linux'] - options = - cmd: appPath - args: ['--test', "--resource-path=#{resourcePath}", path.join(packagePath, 'spec')] - opts: - cwd: packagePath - env: _.extend({}, process.env, ELECTRON_ENABLE_LOGGING: true, ATOM_PATH: rootDir) - else if process.platform is 'win32' - options = - cmd: process.env.comspec - args: ['/c', appPath, '--test', "--resource-path=#{resourcePath}", "--log-file=ci.log", path.join(packagePath, 'spec')] - opts: - cwd: packagePath - env: _.extend({}, process.env, ELECTRON_ENABLE_LOGGING: true, ATOM_PATH: rootDir) - - grunt.log.ok "Launching #{path.basename(packagePath)} specs." - spawn options, (error, results, code) -> - if process.platform is 'win32' - if error - process.stderr.write(fs.readFileSync(path.join(packagePath, 'ci.log'))) - fs.unlinkSync(path.join(packagePath, 'ci.log')) - - failedPackages.push path.basename(packagePath) if error - callback() - - modulesDirectory = path.resolve('node_modules') - for packageDirectory in fs.readdirSync(modulesDirectory) - packagePath = path.join(modulesDirectory, packageDirectory) - continue unless grunt.file.isDir(path.join(packagePath, 'spec')) - continue unless isAtomPackage(packagePath) - packageSpecQueue.push(packagePath) - - packageSpecQueue.concurrency = Math.max(1, concurrency - 1) - packageSpecQueue.drain = -> callback(null, failedPackages) - - runRendererProcessSpecs = (callback) -> - appPath = getAppPath() - resourcePath = process.cwd() - coreSpecsPath = path.resolve('spec') - - if process.platform in ['darwin', 'linux'] - options = - cmd: appPath - args: ['--test', "--resource-path=#{resourcePath}", coreSpecsPath, "--user-data-dir=#{temp.mkdirSync('atom-user-data-dir')}"] - opts: - env: _.extend({}, process.env, {ELECTRON_ENABLE_LOGGING: true, ATOM_INTEGRATION_TESTS_ENABLED: true}) - stdio: 'inherit' - - else if process.platform is 'win32' - options = - cmd: process.env.comspec - args: ['/c', appPath, '--test', "--resource-path=#{resourcePath}", '--log-file=ci.log', coreSpecsPath] - opts: - env: _.extend({}, process.env, {ELECTRON_ENABLE_LOGGING: true, ATOM_INTEGRATION_TESTS_ENABLED: true}) - stdio: 'inherit' - - grunt.log.ok "Launching core specs (renderer process)." - spawn options, (error, results, code) -> - if process.platform is 'win32' - process.stderr.write(fs.readFileSync('ci.log')) if error - fs.unlinkSync('ci.log') - else - # TODO: Restore concurrency on Windows - packageSpecQueue?.concurrency = concurrency - - callback(null, error) - - runMainProcessSpecs = (callback) -> - appPath = getAppPath() - resourcePath = process.cwd() - mainProcessSpecsPath = path.resolve('spec/main-process') - - if process.platform in ['darwin', 'linux'] - options = - cmd: appPath - args: ["--test", "--main-process", "--resource-path=#{resourcePath}", mainProcessSpecsPath] - opts: - env: process.env - stdio: 'inherit' - else if process.platform is 'win32' - options = - cmd: process.env.comspec - args: ['/c', appPath, "--test", "--main-process", "--resource-path=#{resourcePath}", mainProcessSpecsPath] - opts: - env: process.env - stdio: 'inherit' - - grunt.log.ok "Launching core specs (main process)." - spawn options, (error, results, code) -> - callback(null, error) - - grunt.registerTask 'run-specs', 'Run the specs', -> - done = @async() - startTime = Date.now() - method = - if concurrency is 1 - async.series - else - async.parallel - - specs = [runRendererProcessSpecs, runMainProcessSpecs, runPackageSpecs] - - method specs, (error, results) -> - failedPackages = [] - coreSpecFailed = null - - [rendererProcessSpecsFailed, mainProcessSpecsFailed, failedPackages] = results - - elapsedTime = Math.round((Date.now() - startTime) / 100) / 10 - grunt.log.ok("Total spec time: #{elapsedTime}s using #{concurrency} cores") - failures = failedPackages - failures.push "atom core (renderer process)" if rendererProcessSpecsFailed - failures.push "atom core (main process)" if mainProcessSpecsFailed - - grunt.log.error("[Error]".red + " #{failures.join(', ')} spec(s) failed") if failures.length > 0 - - if process.platform is 'win32' and process.env.JANKY_SHA1 - done() - else - done(failures.length is 0) diff --git a/build-old/tasks/task-helpers.coffee b/build-old/tasks/task-helpers.coffee deleted file mode 100644 index b42b4dd15..000000000 --- a/build-old/tasks/task-helpers.coffee +++ /dev/null @@ -1,75 +0,0 @@ -fs = require 'fs-plus' -path = require 'path' -_ = require 'underscore-plus' - -module.exports = (grunt) -> - cp: (source, destination, {filter}={}) -> - unless grunt.file.exists(source) - grunt.fatal("Cannot copy non-existent #{source.cyan} to #{destination.cyan}") - - copyFile = (sourcePath, destinationPath) -> - return if filter?(sourcePath) or filter?.test?(sourcePath) - - stats = fs.lstatSync(sourcePath) - if stats.isSymbolicLink() - grunt.file.mkdir(path.dirname(destinationPath)) - fs.symlinkSync(fs.readlinkSync(sourcePath), destinationPath) - else if stats.isFile() - grunt.file.copy(sourcePath, destinationPath) - - if grunt.file.exists(destinationPath) - fs.chmodSync(destinationPath, fs.statSync(sourcePath).mode) - - if grunt.file.isFile(source) - copyFile(source, destination) - else - try - onFile = (sourcePath) -> - destinationPath = path.join(destination, path.relative(source, sourcePath)) - copyFile(sourcePath, destinationPath) - onDirectory = (sourcePath) -> - if fs.isSymbolicLinkSync(sourcePath) - destinationPath = path.join(destination, path.relative(source, sourcePath)) - copyFile(sourcePath, destinationPath) - false - else - true - fs.traverseTreeSync source, onFile, onDirectory - catch error - grunt.fatal(error) - - grunt.verbose.writeln("Copied #{source.cyan} to #{destination.cyan}.") - - mkdir: (args...) -> - grunt.file.mkdir(args...) - - rm: (args...) -> - grunt.file.delete(args..., force: true) if grunt.file.exists(args...) - - spawn: (options, callback) -> - childProcess = require 'child_process' - stdout = [] - stderr = [] - error = null - proc = childProcess.spawn(options.cmd, options.args, options.opts) - if proc.stdout? - proc.stdout.on 'data', (data) -> stdout.push(data.toString()) - if proc.stderr? - proc.stderr.on 'data', (data) -> stderr.push(data.toString()) - proc.on 'error', (processError) -> error ?= processError - proc.on 'close', (exitCode, signal) -> - error ?= new Error(signal) if exitCode isnt 0 - results = {stderr: stderr.join(''), stdout: stdout.join(''), code: exitCode} - grunt.log.error results.stderr if exitCode isnt 0 - callback(error, results, exitCode) - - isAtomPackage: (packagePath) -> - try - {engines} = grunt.file.readJSON(path.join(packagePath, 'package.json')) - engines?.atom? - catch error - false - - fillTemplate: (templatePath, outputPath, data) -> - content = _.template(String(fs.readFileSync(templatePath)))(data) - grunt.file.write(outputPath, content) diff --git a/script-old/bootstrap b/script-old/bootstrap deleted file mode 100755 index 6fcf8fef0..000000000 --- a/script-old/bootstrap +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env node - -var fs = require('fs'); -var verifyRequirements = require('./utils/verify-requirements'); -var safeExec = require('./utils/child-process-wrapper.js').safeExec; -var path = require('path'); - -var t0, t1 - -// Executes an array of commands one by one. -function executeCommands(commands, done, index) { - if (index != undefined) { - t1 = Date.now() - console.log("=> Took " + (t1 - t0) + "ms."); - console.log(); - } - - index = (index == undefined ? 0 : index); - if (index < commands.length) { - var command = commands[index]; - if (command.message) - console.log(command.message); - var options = null; - if (typeof command !== 'string') { - options = command.options; - command = command.command; - } - t0 = Date.now() - safeExec(command, options, executeCommands.bind(this, commands, done, index + 1)); - } - else - done(null); -} - -function bootstrap() { - var apmInstallPath = path.resolve(__dirname, '..', 'apm'); - if (!fs.existsSync(apmInstallPath)) - fs.mkdirSync(apmInstallPath); - if (!fs.existsSync(path.join(apmInstallPath, 'node_modules'))) - fs.mkdirSync(path.join(apmInstallPath, 'node_modules')); - - var apmPath = path.resolve(__dirname, '..', 'apm', 'node_modules', 'atom-package-manager', 'bin', 'apm') - var apmFlags = process.env.JANKY_SHA1 || process.argv.indexOf('--no-color') !== -1 ? ' --no-color' : ''; - - var npmPath = path.resolve(__dirname, '..', 'build', 'node_modules', '.bin', 'npm'); - var initialNpmCommand = fs.existsSync(npmPath) ? npmPath : 'npm'; - var npmFlags = ' --userconfig=' + path.resolve(__dirname, '..', 'build', '.npmrc') + ' '; - - var packagesToDedupe = [ - 'abbrev', - 'amdefine', - 'atom-space-pen-views', - 'cheerio', - 'domelementtype', - 'fs-plus', - 'grim', - 'highlights', - 'humanize-plus', - 'iconv-lite', - 'inherits', - 'loophole', - 'oniguruma', - 'q', - 'request', - 'rimraf', - 'roaster', - 'season', - 'sigmund', - 'semver', - 'through', - 'temp' - ]; - - process.env.ATOM_RESOURCE_PATH = path.resolve(__dirname, '..'); - - var buildInstallCommand = initialNpmCommand + npmFlags + 'install'; - var buildInstallOptions = {cwd: path.resolve(__dirname, '..', 'build')}; - var apmInstallCommand = npmPath + npmFlags + '--target=4.4.5 --global-style ' + 'install'; - var apmInstallOptions = {cwd: apmInstallPath}; - var moduleInstallCommand = apmPath + ' install' + apmFlags; - var dedupeApmCommand = apmPath + ' dedupe' + apmFlags; - - var moduleInstallEnv = {}; - for (var e in process.env) { - moduleInstallEnv[e] = process.env[e]; - } - - // Set our target (Electron) version so that node-pre-gyp can download the - // proper binaries. - var electronVersion = require('../package.json').electronVersion; - moduleInstallEnv.npm_config_target = electronVersion; - - // Force 32-bit modules on Windows. - // /cc https://github.com/atom/atom/issues/10450 - if (process.platform === 'win32') { - moduleInstallEnv.npm_config_target_arch = 'ia32'; - } - var moduleInstallOptions = {env: moduleInstallEnv}; - - if (process.argv.indexOf('--no-quiet') === -1 || process.env.ATOM_NOISY_BUILD) { - buildInstallCommand += ' --loglevel error'; - apmInstallCommand += ' --loglevel error'; - moduleInstallCommand += ' --loglevel error'; - dedupeApmCommand += ' --quiet'; - buildInstallOptions.ignoreStdout = true; - apmInstallOptions.ignoreStdout = true; - } - - // apm ships with 32-bit node so make sure its native modules are compiled - // for a 32-bit target architecture - if (process.env.JANKY_SHA1 && process.platform === 'win32') - apmInstallCommand += ' --arch=ia32'; - - var commands = [ - { - command: buildInstallCommand, - message: 'Installing build modules...', - options: buildInstallOptions - }, - { - command: apmInstallCommand, - message: 'Installing apm...', - options: apmInstallOptions - }, - { - command: moduleInstallCommand, - options: moduleInstallOptions - }, - { - command: dedupeApmCommand + ' ' + packagesToDedupe.join(' '), - options: moduleInstallOptions - } - ]; - - process.chdir(path.dirname(__dirname)); - executeCommands(commands, process.exit); -} - -verifyRequirements(function(error, successMessage) { - if (error) { - console.log(error); - process.exit(1); - } - - console.log(successMessage); - bootstrap(); -}); diff --git a/script-old/bootstrap.cmd b/script-old/bootstrap.cmd deleted file mode 100644 index c9cf66238..000000000 --- a/script-old/bootstrap.cmd +++ /dev/null @@ -1,6 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\bootstrap" %* -) ELSE ( - node "%~dp0\bootstrap" %* -) - diff --git a/script-old/build b/script-old/build deleted file mode 100755 index ca5569d0f..000000000 --- a/script-old/build +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env node -var cp = require('./utils/child-process-wrapper.js'); -var runGrunt = require('./utils/run-grunt.js'); -var path = require('path'); -var fs = require('fs'); - -process.chdir(path.dirname(__dirname)); - -if (process.platform === 'win32') { - process.env['PATH'] = process.env['PATH'] - .split(';') - .filter(function(p) { - if (fs.existsSync(path.resolve(p, 'msbuild.exe'))) { - console.log('Excluding "' + p + '" from PATH to avoid msbuild.exe mismatch') - return false; - } else { - return true; - } - }) - .join(';'); -} - -cp.safeExec('node script/bootstrap', function() { - // build/node_modules/.bin/grunt "$@" - var args = process.argv.slice(2); - runGrunt(args, process.exit); -}); diff --git a/script-old/build.cmd b/script-old/build.cmd deleted file mode 100644 index 8b12f7a47..000000000 --- a/script-old/build.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\build" %* -) ELSE ( - node "%~dp0\build" %* -) diff --git a/script-old/cibuild b/script-old/cibuild deleted file mode 100755 index 6f16ac5cd..000000000 --- a/script-old/cibuild +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env node -var cp = require('./utils/child-process-wrapper.js'); -var crypto = require('crypto') -var fingerprint = require('./utils/fingerprint') -var fs = require('fs'); -var path = require('path'); - -process.chdir(path.dirname(__dirname)); - -var homeDir = process.platform == 'win32' ? process.env.USERPROFILE : process.env.HOME; - -function loadEnvironmentVariables(filePath) { - try { - var lines = fs.readFileSync(filePath, 'utf8').trim().split('\n'); - for (i in lines) { - var parts = lines[i].split('='); - var key = parts[0].trim(); - var value = parts[1].trim().substr(1, parts[1].length - 2); - process.env[key] = value; - } - } catch(error) { - console.error("Failed to load environment variables: " + filePath, error.code); - } -} - -function readEnvironmentVariables() { - if (process.env.JANKY_SHA1) { - if (process.platform === 'win32') { - loadEnvironmentVariables(path.resolve('/jenkins/config/atomcredentials')); - } else if (process.platform === 'darwin') { - loadEnvironmentVariables('/var/lib/jenkins/config/atomcredentials'); - loadEnvironmentVariables('/var/lib/jenkins/config/xcodekeychain'); - } - } -} - -function setEnvironmentVariables() { - if (process.platform === 'linux') { - // Use Clang for building native code, the GCC on Precise is too old. - process.env.CC = 'clang'; - process.env.CXX = 'clang++'; - process.env.npm_config_clang = '1'; - } -} - -function removeNodeModules() { - if (fingerprint.fingerprintMatches()) { - console.log('node_modules matches current fingerprint ' + fingerprint.fingerprint() + ' - not removing') - return - } - - var fsPlus; - try { - fsPlus = require('fs-plus'); - } catch (error) { - return; - } - - try { - fsPlus.removeSync(path.resolve(__dirname, '..', 'node_modules')); - fsPlus.removeSync(path.resolve(__dirname, '..', 'apm', 'node_modules')); - } catch (error) { - console.error(error.message); - process.exit(1); - } -} - -function removeTempFolders() { - var fsPlus; - try { - fsPlus = require('fs-plus'); - } catch (error) { - return; - } - - var temp = require('os').tmpdir(); - if (!fsPlus.isDirectorySync(temp)) - return; - - var deletedFolders = 0; - - fsPlus.readdirSync(temp).filter(function(folderName) { - return folderName.indexOf('npm-') === 0; - }).forEach(function(folderName) { - try { - fsPlus.removeSync(path.join(temp, folderName)); - deletedFolders++; - } catch (error) { - console.error("Failed to delete npm temp folder: " + error.message); - } - }); - - if (deletedFolders > 0) - console.log("Deleted " + deletedFolders + " npm folders from temp directory"); -} - -readEnvironmentVariables(); -setEnvironmentVariables(); -removeNodeModules(); -removeTempFolders(); -cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve(__dirname, '..', 'build')}, function() { - cp.safeExec.bind(global, 'node script/bootstrap', function(error) { - if (error) - process.exit(1); - require('fs-plus').removeSync.bind(global, path.join(homeDir, '.atom')) - var async = require('async'); - var gruntPath = path.join('build', 'node_modules', '.bin', 'grunt') + (process.platform === 'win32' ? '.cmd' : ''); - var tasks = [ - cp.safeExec.bind(global, 'git clean -dff -e node_modules'), // If we left them behind in removeNodeModules() they are OK to use - cp.safeExec.bind(global, gruntPath + ' ci --gruntfile build/Gruntfile.coffee --stack --no-color') - ] - async.series(tasks, function(error) { - process.exit(error ? 1 : 0); - }); - })(); -})(); diff --git a/script-old/cibuild-atom-linux b/script-old/cibuild-atom-linux deleted file mode 100755 index fe79c19fe..000000000 --- a/script-old/cibuild-atom-linux +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -export ATOM_ACCESS_TOKEN=$BUILD_ATOM_LINUX_ACCESS_TOKEN -export BUILD_ATOM_RELEASES_S3_KEY=$BUILD_ATOM_LINUX_RELEASES_S3_KEY -export BUILD_ATOM_RELEASES_S3_SECRET=$BUILD_ATOM_LINUX_RELEASES_S3_SECRET -export BUILD_ATOM_RELEASES_S3_BUCKET=$BUILD_ATOM_LINUX_RELEASES_S3_BUCKET - -rm -rf /tmp/.atom-nvm -git clone https://github.com/creationix/nvm.git /tmp/.atom-nvm -source /tmp/.atom-nvm/nvm.sh -nvm install 4.4.7 -nvm use 4.4.7 -npm install -g npm - -script/cibuild diff --git a/script-old/cibuild-atom-rpm b/script-old/cibuild-atom-rpm deleted file mode 100755 index 2faa89347..000000000 --- a/script-old/cibuild-atom-rpm +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -docker build -t atom-rpm . -docker run \ - --rm \ - --env JANKY_SHA1="$JANKY_SHA1" \ - --env JANKY_BRANCH="$JANKY_BRANCH" \ - --env ATOM_ACCESS_TOKEN="$BUILD_ATOM_RPM_ACCESS_TOKEN" \ - --env BUILD_ATOM_RELEASES_S3_KEY="$BUILD_ATOM_RPM_RELEASES_S3_KEY" \ - --env BUILD_ATOM_RELEASES_S3_SECRET="$BUILD_ATOM_RPM_RELEASES_S3_SECRET" \ - --env BUILD_ATOM_RELEASES_S3_BUCKET="$BUILD_ATOM_RPM_RELEASES_S3_BUCKET" \ - atom-rpm /atom/script/rpmbuild -docker rmi atom-rpm diff --git a/script-old/cibuild.cmd b/script-old/cibuild.cmd deleted file mode 100644 index 79197d1b1..000000000 --- a/script-old/cibuild.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\cibuild" %* -) ELSE ( - node "%~dp0\cibuild" %* -) diff --git a/script-old/clean b/script-old/clean deleted file mode 100755 index 7db4e0c11..000000000 --- a/script-old/clean +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env node -var childProcess = require('./utils/child-process-wrapper.js'); -var fs = require('fs'); -var path = require('path'); -var os = require('os'); - -var isWindows = process.platform === 'win32'; -var productName = require('../package.json').productName; - -process.chdir(path.dirname(__dirname)); -var home = process.env[isWindows ? 'USERPROFILE' : 'HOME']; -var tmpdir = os.tmpdir(); - -// Windows: Use START as a way to ignore error if Atom.exe isnt running -childProcess.safeExec(isWindows ? `START taskkill /F /IM ${productName}.exe` : `pkill -9 ${productName} || true`); - -var pathsToRemove = [ - [__dirname, '..', 'node_modules'], - [__dirname, '..', 'build', 'node_modules'], - [__dirname, '..', 'apm', 'node_modules'], - [__dirname, '..', 'atom-shell'], - [__dirname, '..', 'electron'], - [__dirname, '..', 'out'], - [home, '.atom', '.node-gyp'], - [home, '.atom', 'storage'], - [home, '.atom', '.apm'], - [home, '.atom', '.npm'], - [home, '.atom', 'compile-cache'], - [home, '.atom', 'atom-shell'], - [home, '.atom', 'electron'], - [tmpdir, 'atom-build'], - [tmpdir, 'atom-cached-atom-shells'], -].map(function(pathSegments) { - return path.resolve.apply(null, pathSegments); -}); - -pathsToRemove.forEach(function(pathToRemove) { - if (fs.existsSync(pathToRemove)) { - removePath(pathToRemove); - } -}); - -function removePath(pathToRemove) { - if (isWindows) { - removePathOnWindows(pathToRemove); - } else { - childProcess.safeExec('rm -rf ' + pathToRemove); - } -} - -// Windows has a 260-char path limit for rmdir etc. Just recursively delete in Node. -function removePathOnWindows(folderPath) { - fs.readdirSync(folderPath).forEach(function(entry, index) { - var entryPath = path.join(folderPath, entry); - if (fs.lstatSync(entryPath).isDirectory()) { - removePathOnWindows(entryPath); - } else { - fs.unlinkSync(entryPath); - } - }); - fs.rmdirSync(folderPath); -}; diff --git a/script-old/clean.cmd b/script-old/clean.cmd deleted file mode 100644 index 44a79e1af..000000000 --- a/script-old/clean.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\clean" %* -) ELSE ( - node "%~dp0\clean" %* -) diff --git a/script-old/copy-folder.cmd b/script-old/copy-folder.cmd deleted file mode 100644 index 1021c30f3..000000000 --- a/script-old/copy-folder.cmd +++ /dev/null @@ -1,18 +0,0 @@ -@echo off - -set USAGE=Usage: %0 source destination - -if [%1] == [] ( - echo %USAGE% - exit 1 -) -if [%2] == [] ( - echo %USAGE% - exit 2 -) - -:: rm -rf %2 -if exist %2 rmdir %2 /s /q - -:: cp -rf %1 %2 -(robocopy %1 %2 /e) ^& IF %ERRORLEVEL% LEQ 1 exit 0 diff --git a/script-old/fingerprint-clean b/script-old/fingerprint-clean deleted file mode 100755 index 659395190..000000000 --- a/script-old/fingerprint-clean +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node -var fingerprint = require('./utils/fingerprint') -var fs = require('fs') -var path = require('path') - -if (!fs.existsSync(path.resolve(__dirname, '..', 'node_modules', '.atom-ci-fingerprint'))) { - return -} - -if (fingerprint.fingerprintMatches()) { - console.log('node_modules matches current fingerprint ' + fingerprint.fingerprint() + ' - not removing') - return -} - -var fsPlus -try { - fsPlus = require('fs-plus') -} catch (error) { - console.log(error.message) - return -} - -try { - fsPlus.removeSync(path.resolve(__dirname, '..', 'node_modules')) - fsPlus.removeSync(path.resolve(__dirname, '..', 'apm', 'node_modules')) -} catch (error) { - console.error(error.message) - process.exit(1) -} diff --git a/script-old/fingerprint-write b/script-old/fingerprint-write deleted file mode 100755 index e5fad4d72..000000000 --- a/script-old/fingerprint-write +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('./utils/fingerprint').writeFingerprint() diff --git a/script-old/grunt b/script-old/grunt deleted file mode 100755 index 99f6860d2..000000000 --- a/script-old/grunt +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node -var runGrunt = require('./utils/run-grunt.js'); - -// build/node_modules/.bin/grunt "$@" -var args = process.argv.slice(2); -runGrunt(args, process.exit); diff --git a/script-old/grunt.cmd b/script-old/grunt.cmd deleted file mode 100644 index 854fceb03..000000000 --- a/script-old/grunt.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\grunt" %* -) ELSE ( - node "%~dp0\grunt" %* -) diff --git a/script-old/mkdeb b/script-old/mkdeb deleted file mode 100755 index 22d2c5124..000000000 --- a/script-old/mkdeb +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# mkdeb name version channel arch control-file-path desktop-file-path icon-path deb-file-path - -set -e - -SCRIPT=`readlink -f "$0"` -ROOT=`readlink -f $(dirname $SCRIPT)/..` -cd $ROOT - -NAME="$1" -VERSION="$2" -CHANNEL="$3" -ARCH="$4" -CONTROL_FILE="$5" -DESKTOP_FILE="$6" -ICON_FILE="$7" -DEB_PATH="$8" -FILE_MODE=755 - -TARGET_ROOT="`mktemp -d`" -chmod $FILE_MODE "$TARGET_ROOT" -TARGET="$TARGET_ROOT/$NAME-$VERSION-$ARCH" - -mkdir -m $FILE_MODE -p "$TARGET/usr" -env INSTALL_PREFIX="$TARGET/usr" script/grunt install --channel $CHANNEL - -mkdir -m $FILE_MODE -p "$TARGET/DEBIAN" -cp "$CONTROL_FILE" "$TARGET/DEBIAN/control" - -mkdir -m $FILE_MODE -p "$TARGET/usr/share/applications" -cp "$DESKTOP_FILE" "$TARGET/usr/share/applications" - -mkdir -m $FILE_MODE -p "$TARGET/usr/share/pixmaps" -cp "$ICON_FILE" "$TARGET/usr/share/pixmaps/$NAME.png" - -# Copy generated LICENSE.md to /usr/share/doc/atom/copyright -mkdir -m $FILE_MODE -p "$TARGET/usr/share/doc/$NAME" -cp "$TARGET/usr/share/$NAME/resources/LICENSE.md" "$TARGET/usr/share/doc/$NAME/copyright" - -# Add lintian overrides -mkdir -m $FILE_MODE -p "$TARGET/usr/share/lintian/overrides" -cp "$ROOT/resources/linux/debian/lintian-overrides" "$TARGET/usr/share/lintian/overrides/$NAME" - -# Remove executable bit from .node files -find "$TARGET" -type f -name "*.node" -exec chmod a-x {} \; - -fakeroot dpkg-deb -b "$TARGET" -mv "$TARGET_ROOT/$NAME-$VERSION-$ARCH.deb" "$DEB_PATH" -rm -rf "$TARGET_ROOT" diff --git a/script-old/mkrpm b/script-old/mkrpm deleted file mode 100755 index 0be8cb981..000000000 --- a/script-old/mkrpm +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -APP_NAME="$1" -APP_FILE_NAME="$2" -SPEC_FILE="$3" -DESKTOP_FILE="$4" -BUILD_DIRECTORY="$5" - -RPM_BUILD_ROOT=~/rpmbuild -ARCH=`uname -m` - -rpmdev-setuptree - -cp -r "$BUILD_DIRECTORY/$APP_NAME" "$RPM_BUILD_ROOT/BUILD" -cp -r "$BUILD_DIRECTORY/icons" "$RPM_BUILD_ROOT/BUILD" -cp "$SPEC_FILE" "$RPM_BUILD_ROOT/SPECS" -cp ./atom.sh "$RPM_BUILD_ROOT/BUILD" -cp "$DESKTOP_FILE" "$RPM_BUILD_ROOT/BUILD" - -rpmbuild -ba "$SPEC_FILE" -cp $RPM_BUILD_ROOT/RPMS/$ARCH/$APP_FILE_NAME-*.rpm "$BUILD_DIRECTORY/rpm" - -rm -rf "$RPM_BUILD_ROOT" diff --git a/script-old/mktar b/script-old/mktar deleted file mode 100755 index 986063f9a..000000000 --- a/script-old/mktar +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# mktar name version arch icon-path build-root-path - -set -e - -SCRIPT=`readlink -f "$0"` -ROOT=`readlink -f $(dirname $SCRIPT)/..` -cd $ROOT - -NAME="$1" -VERSION="$2" -ARCH="$3" -ICON_FILE="$4" -BUILD_ROOT_PATH="$5" -FILE_MODE=755 - -TAR_PATH=$BUILD_ROOT_PATH -ATOM_PATH="$BUILD_ROOT_PATH/Atom" - -TARGET_ROOT="`mktemp -d`" -chmod $FILE_MODE "$TARGET_ROOT" -NAME_IN_TAR="$NAME-$VERSION-$ARCH" -TARGET="$TARGET_ROOT/$NAME_IN_TAR" - -# Copy executable and resources -cp -a "$ATOM_PATH" "$TARGET" - -# Copy icon file -cp "$ICON_FILE" "$TARGET/$NAME.png" - -# Remove executable bit from .node files -find "$TARGET" -type f -name "*.node" -exec chmod a-x {} \; - -# Create the archive -pushd "$TARGET_ROOT" -tar caf "$TAR_PATH/$NAME_IN_TAR.tar.gz" "$NAME_IN_TAR" -popd - -rm -rf "$TARGET_ROOT" diff --git a/script-old/railcar b/script-old/railcar deleted file mode 100755 index 573e18b2c..000000000 --- a/script-old/railcar +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env node - -var fs = require('fs') -var exec = require('child_process').exec -var series = require('async').series -var semver = require('semver') - -series([ - section('Preparing to roll the railcars'), - checkCleanWorkingTree, - run('git checkout master'), - run('git pull --ff-only origin master'), - run('git fetch origin beta:beta stable:stable'), - run('git fetch origin --tags'), - - section('Checking that merges will be fast-forwards'), - run('git branch --contains beta | grep master'), - run('git branch --contains stable | grep beta'), - - section('Updating stable branch'), - run('git checkout stable'), - run('git merge --ff-only origin/beta'), - bumpStableVersion, - - section('Updating beta branch'), - run('git checkout beta'), - run('git merge --ff-only origin/master'), - run('git merge --strategy ours origin/stable'), - bumpBetaVersion, - - section('Updating master branch'), - run('git checkout master'), - run('git merge --ff-only origin/master'), - run('git merge --strategy ours origin/beta'), - bumpDevVersion, - - section('Pushing changes upstream'), - run('git push origin master:master beta:beta stable:stable'), - run('git push origin --tags') -], finish) - -function checkCleanWorkingTree (next) { - run('git status --porcelain')(function (error, output) { - if (error) return next(error) - if (output.trim().length > 0) return next(new Error('Cannot run the railcars with a dirty working tree')) - next() - }) -} - -function bumpStableVersion (next) { - var newVersion = getCurrentVersion().replace(/-beta.*$/, '') - run('npm version ' + newVersion)(next) -} - -function bumpBetaVersion (next) { - var newVersion = getCurrentVersion().replace(/-dev$/, '-beta0') - run('npm version ' + newVersion)(next) -} - -function bumpDevVersion (next) { - var newVersion = semver.inc(getCurrentVersion(), 'preminor', 'dev').replace(/\.0$/, '') - series([ - run('npm --no-git-tag-version version ' + newVersion), - run('git commit -am "' + newVersion + '"') - ], next) -} - -function finish (error) { - if (error) { - console.log('Error: ' + error.message) - process.exit(1) - } - - console.log('OK, now just wait for all CI builds to pass on beta and stable') -} - -function getCurrentVersion () { - return JSON.parse(fs.readFileSync(require.resolve('../package.json'))).version -} - -function run (command) { - return function (next) { - console.log('>', command) - exec(command, next) - } -} - -function section (message) { - return function (next) { - console.log() - console.log(message) - next() - } -} diff --git a/script-old/rpmbuild b/script-old/rpmbuild deleted file mode 100755 index 1b33bb86e..000000000 --- a/script-old/rpmbuild +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -set -e - -script/build -script/grunt mkrpm publish-build --stack --no-color --install-dir /usr diff --git a/script-old/set-version b/script-old/set-version deleted file mode 100755 index 33dec9d77..000000000 --- a/script-old/set-version +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -SHELL_APP_DIR=$1 -VERSION=$2 - -PLIST_PATH="$SHELL_APP_DIR/Contents/Info.plist" -HELPER_PLIST_PATH="$SHELL_APP_DIR/Contents/Frameworks/Atom Helper.app/Contents/Info.plist" - -# Update version -/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$PLIST_PATH" -/usr/libexec/PlistBuddy -c "Set CFBundleVersion $VERSION" "$PLIST_PATH" -/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$HELPER_PLIST_PATH" -/usr/libexec/PlistBuddy -c "Set CFBundleVersion $VERSION" "$HELPER_PLIST_PATH" diff --git a/script-old/test b/script-old/test deleted file mode 100755 index e8cb53006..000000000 --- a/script-old/test +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env node -var safeExec = require('./utils/child-process-wrapper.js').safeExec; -var runGrunt = require('./utils/run-grunt.js'); -var path = require('path'); - -process.chdir(path.dirname(__dirname)); - -safeExec('node script/bootstrap', function() { - runGrunt(["ci", "--stack", "--no-color"], process.exit); -}); diff --git a/script-old/utils/child-process-wrapper.js b/script-old/utils/child-process-wrapper.js deleted file mode 100644 index 55e6733d1..000000000 --- a/script-old/utils/child-process-wrapper.js +++ /dev/null @@ -1,46 +0,0 @@ -var childProcess = require('child_process'); - -// Exit the process if the command failed and only call the callback if the -// command succeed, output of the command would also be piped. -exports.safeExec = function(command, options, callback) { - if (!callback) { - callback = options; - options = {}; - } - if (!options) - options = {}; - - // This needed to be increased for `apm test` runs that generate many failures - // The default is 200KB. - options.maxBuffer = 1024 * 1024; - - var child = childProcess.exec(command, options, function(error, stdout, stderr) { - if (error) - process.exit(error.code || 1); - else if (callback) - callback(null); - }); - child.stderr.pipe(process.stderr); - if (!options.ignoreStdout) - child.stdout.pipe(process.stdout); -} - -// Same with safeExec but call child_process.spawn instead. -exports.safeSpawn = function(command, args, options, callback) { - if (!callback) { - callback = options; - options = {}; - } - var child = childProcess.spawn(command, args, options); - child.stderr.pipe(process.stderr); - child.stdout.pipe(process.stdout); - child.on('error', function(error) { - console.error('Command \'' + command + '\' failed: ' + error.message); - }); - child.on('exit', function(code) { - if (code != 0) - process.exit(code); - else - callback(null); - }); -} diff --git a/script-old/utils/clean-merged-branches b/script-old/utils/clean-merged-branches deleted file mode 100755 index 04fbd19c8..000000000 --- a/script-old/utils/clean-merged-branches +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -#/ Usage: clean-merged-branches [-f] -#/ Delete merged branches from the origin remote. -#/ -#/ Options: -#/ -f Really delete the branches. Without this branches are shown -#/ but nothing is deleted. - -set -e - -# show usage maybe -[ "$1" = "--help" ] && { - grep '^#/' <"$0"| cut -c4- - exit 0 -} - -# fetch and prune remote branches -git fetch origin --prune - -# grab list of merged branches -branches=$( - git branch -a --merged origin/master | - grep remotes/origin/ | - grep -v /master | - sed 's@remotes/origin/@@' -) - -# bail out with no branches -[ -z "$branches" ] && { - echo "no merged branches detected" 1>&2 - exit 0 -} - -# delete the branches or just show what would be done without -f -if [ "$1" = -f ]; then - git push origin $(echo "$branches" | sed 's/^ */:/') -else - echo "These branches will be deleted:" 1>&2 - echo "$branches" - echo "Run \`$0 -f' if you're sure." -fi diff --git a/script-old/utils/clean-open-with-menu b/script-old/utils/clean-open-with-menu deleted file mode 100755 index 18d1882ef..000000000 --- a/script-old/utils/clean-open-with-menu +++ /dev/null @@ -1,2 +0,0 @@ -/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user -killall Finder diff --git a/script-old/utils/compile-main-to-app b/script-old/utils/compile-main-to-app deleted file mode 100755 index a24c0c712..000000000 --- a/script-old/utils/compile-main-to-app +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -coffee -c -o /Applications/Atom.app/Contents/Resources/app/src/ src/main.coffee diff --git a/script-old/utils/fingerprint.js b/script-old/utils/fingerprint.js deleted file mode 100644 index e1f6276d2..000000000 --- a/script-old/utils/fingerprint.js +++ /dev/null @@ -1,37 +0,0 @@ -var crypto = require('crypto') -var fs = require('fs') -var path = require('path') - -var fingerprintPath = path.resolve(__dirname, '..', '..', 'node_modules', '.atom-ci-fingerprint') - -module.exports = { - fingerprint: function () { - var atomPackageJson = fs.readFileSync(path.resolve(__dirname, '..', '..', 'package.json')) - var apmPackageJson = fs.readFileSync(path.resolve(__dirname, '..', '..', 'apm', 'package.json')) - - //Include the electron minor version in the fingerprint since that changing requires a re-install - var electronVersion = JSON.parse(atomPackageJson).electronVersion.replace(/\.\d+$/, '') - var apmVersion = JSON.parse(apmPackageJson).dependencies['atom-package-manager'] - - var body = electronVersion + apmVersion + process.platform + process.version - return crypto.createHash('sha1').update(body).digest('hex') - }, - - writeFingerprint: function () { - var fingerprint = this.fingerprint() - fs.writeFileSync(fingerprintPath, fingerprint) - console.log('Wrote ci fingerprint:', fingerprintPath, fingerprint) - }, - - readFingerprint: function() { - if (fs.existsSync(fingerprintPath)) { - return fs.readFileSync(fingerprintPath).toString() - } else { - return null - } - }, - - fingerprintMatches: function () { - return this.readFingerprint() && this.readFingerprint() === this.fingerprint() - } -} diff --git a/script-old/utils/fix-author b/script-old/utils/fix-author deleted file mode 100755 index bbbd3b3da..000000000 --- a/script-old/utils/fix-author +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -usage() { - echo "usage: $0 sha name email" - exit 1 -} - -if [ ! $3 ]; then - usage -fi - -git filter-branch -f --env-filter " -export GIT_AUTHOR_NAME='$2' -export GIT_AUTHOR_EMAIL='$3' -export GIT_COMMITTER_NAME='$2' -export GIT_COMMITTER_EMAIL='$3' -" -- $1..HEAD \ No newline at end of file diff --git a/script-old/utils/run-grunt.js b/script-old/utils/run-grunt.js deleted file mode 100644 index f63d1009a..000000000 --- a/script-old/utils/run-grunt.js +++ /dev/null @@ -1,17 +0,0 @@ -var cp = require('./child-process-wrapper.js'); -var fs = require('fs'); -var path = require('path'); - -module.exports = function(additionalArgs, callback) { - var gruntPath = path.join('build', 'node_modules', '.bin', 'grunt') + (process.platform === 'win32' ? '.cmd' : ''); - - if (!fs.existsSync(gruntPath)) { - console.error('Grunt command does not exist at: ' + gruntPath); - console.error('Run script/bootstrap to install Grunt'); - process.exit(1); - } - - var args = ['--gruntfile', path.resolve('build', 'Gruntfile.coffee')]; - args = args.concat(additionalArgs); - cp.safeSpawn(gruntPath, args, callback); -}; diff --git a/script-old/utils/translate-crash-log-addresses.coffee b/script-old/utils/translate-crash-log-addresses.coffee deleted file mode 100755 index fdb540d64..000000000 --- a/script-old/utils/translate-crash-log-addresses.coffee +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env coffee -# Usage: -# Copy the crash log into pasteboard and then run -# pbpaste | ./script/translate-crash-log-addresses.coffee - -atos = (addresses, callback) -> - path = require 'path' - exec = require('child_process').exec - - cwd = path.join __dirname, '..' - exec 'atos -o cef/Release/libcef.dylib -arch i386 '.concat(addresses...), cwd: cwd, (error, stdout, stderr) -> - throw error if error? - callback stdout.split('\n') - -parse_stack_trace = (raw) -> - lines = {} - addresses = [] - for line in raw - columns = line.split /\ +/ - if columns[1] is 'libcef.dylib' and /0x[a-f0-9]+/.test columns[3] - lines[columns[0]] = addresses.length - addresses.push '0x' + parseInt(columns[5]).toString(16) + ' ' - - atos addresses, (parsed) -> - for line in raw - columns = line.split /\ +/ - frame = columns[0] - if lines[frame]? - console.log frame, parsed[lines[frame]] - else - console.log line - -parse_log_file = (content) -> - state = 'start' - stack_trace = [] - lines = content.split /\r?\n/ - - for line in lines - if state is 'start' - if /Thread \d+ Crashed::/.test line - console.log line - state = 'parse' - else if state is 'parse' - break if line is '' - stack_trace.push line - - parse_stack_trace stack_trace - -input = '' -process.stdin.resume() -process.stdin.setEncoding 'utf8' -process.stdin.on 'data', (chunk) -> - input += chunk -process.stdin.on 'end', -> - parse_log_file input diff --git a/script-old/utils/verify-requirements.js b/script-old/utils/verify-requirements.js deleted file mode 100644 index 890172753..000000000 --- a/script-old/utils/verify-requirements.js +++ /dev/null @@ -1,117 +0,0 @@ -var path = require('path'); -var fs = require('fs'); -var childProcess = require('child_process'); - -var pythonExecutable = process.env.PYTHON; - -module.exports = function(cb) { - verifyNode(function(error, nodeSuccessMessage) { - if (error) { - cb(error); - return; - } - - verifyNpm(function(error, npmSuccessMessage) { - if (error) { - cb(error); - return; - } - - verifyPython27(function(error, pythonSuccessMessage) { - cb(error, (nodeSuccessMessage + "\n" + npmSuccessMessage + "\n" + pythonSuccessMessage).trim()); - }); - }); - }); - -}; - -function verifyNode(cb) { - var nodeVersion = process.versions.node; - var versionArray = nodeVersion.split('.'); - var nodeMajorVersion = +versionArray[0]; - var nodeMinorVersion = +versionArray[1]; - if (nodeMajorVersion === 0 && nodeMinorVersion < 10) { - error = "node v0.10 is required to build Atom, node " + nodeVersion + " is installed."; - cb(error); - } - else { - cb(null, "Node: v" + nodeVersion); - } -} - -function verifyNpm(cb) { - var localNpmPath = path.resolve(__dirname, '..', '..', 'build', 'node_modules', '.bin', 'npm'); - if (process.platform === 'win32') - localNpmPath += ".cmd"; - - var npmCommand = fs.existsSync(localNpmPath) ? localNpmPath : 'npm'; - if (npmCommand === 'npm' && process.platform === 'win32') - npmCommand += ".cmd"; - - childProcess.execFile(npmCommand, ['-v'], { env: process.env }, function(err, stdout) { - if (err) - return cb("npm 1.4 is required to build Atom. An error (" + err + ") occured when checking the version."); - - var npmVersion = stdout ? stdout.trim() : ''; - var versionArray = npmVersion.split('.'); - var npmMajorVersion = +versionArray[0] || 0; - var npmMinorVersion = +versionArray[1] || 0; - if (npmMajorVersion === 1 && npmMinorVersion < 4) - cb("npm v1.4+ is required to build Atom. Version " + npmVersion + " was detected."); - else - cb(null, "npm: v" + npmVersion); - }); -} - - -function verifyPython27(cb) { - if (process.platform == 'win32') { - if (!pythonExecutable) { - var systemDrive = process.env.SystemDrive || 'C:\\'; - pythonExecutable = path.join(systemDrive, 'Python27', 'python.exe'); - - if (!fs.existsSync(pythonExecutable)) { - pythonExecutable = 'python'; - } - } - - checkPythonVersion(pythonExecutable, cb); - } - else { - cb(null, ''); - } -} - -function checkPythonVersion (python, cb) { - var pythonHelpMessage = "Set the PYTHON env var to '/path/to/Python27/python.exe' if your python is installed in a non-default location."; - - childProcess.execFile(python, ['-c', 'import platform; print(platform.python_version());'], { env: process.env }, function (err, stdout) { - if (err) { - error = "Python 2.7 is required to build Atom. An error (" + err + ") occured when checking the version of '" + python + "'. "; - error += pythonHelpMessage; - cb(error); - return; - } - - var version = stdout.trim(); - if (~version.indexOf('+')) { - version = version.replace(/\+/g, ''); - } - if (~version.indexOf('rc')) { - version = version.replace(/rc(.*)$/ig, ''); - } - - // Atom requires python 2.7 or higher (but not python 3) for node-gyp - var versionArray = version.split('.').map(function(num) { return +num; }); - var goodPythonVersion = (versionArray[0] === 2 && versionArray[1] >= 7); - if (!goodPythonVersion) { - error = "Python 2.7 is required to build Atom. '" + python + "' returns version " + version + ". "; - error += pythonHelpMessage; - cb(error); - return; - } - - // Finally, if we've gotten this far, callback to resume the install process. - cb(null, "Python: v" + version); - }); -} From 870b3c832e9c2151a2cc45041797c6c58e80a92e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 27 Aug 2016 20:07:16 +0200 Subject: [PATCH 189/221] Add script/lint --- script/lib/expand-glob-paths.js | 19 ++++++++ script/lib/lint-coffee-script-paths.js | 27 +++++++++++ script/lib/lint-java-script-paths.js | 32 +++++++++++++ script/lib/lint-less-paths.js | 64 ++++++++++++++++++++++++++ script/lib/prebuild-less-cache.js | 2 +- script/lib/read-files.js | 19 ++++++++ script/lint | 35 ++++++++++++++ script/lint.cmd | 5 ++ script/package.json | 5 +- 9 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 script/lib/expand-glob-paths.js create mode 100644 script/lib/lint-coffee-script-paths.js create mode 100644 script/lib/lint-java-script-paths.js create mode 100644 script/lib/lint-less-paths.js create mode 100644 script/lib/read-files.js create mode 100755 script/lint create mode 100644 script/lint.cmd diff --git a/script/lib/expand-glob-paths.js b/script/lib/expand-glob-paths.js new file mode 100644 index 000000000..3d47a6dac --- /dev/null +++ b/script/lib/expand-glob-paths.js @@ -0,0 +1,19 @@ +'use strict' + +const glob = require('glob') + +module.exports = function (globPaths) { + return Promise.all(globPaths.map(g => expandGlobPath(g))).then(paths => paths.reduce((a, b) => a.concat(b), [])) +} + +function expandGlobPath (globPath) { + return new Promise((resolve, reject) => { + glob(globPath, (error, paths) => { + if (error) { + reject(error) + } else { + resolve(paths) + } + }) + }) +} diff --git a/script/lib/lint-coffee-script-paths.js b/script/lib/lint-coffee-script-paths.js new file mode 100644 index 000000000..4acf8ec56 --- /dev/null +++ b/script/lib/lint-coffee-script-paths.js @@ -0,0 +1,27 @@ +'use strict' + +const coffeelint = require('coffeelint') +const expandGlobPaths = require('./expand-glob-paths') +const path = require('path') +const readFiles = require('./read-files') + +const CONFIG = require('../config') + +module.exports = function () { + const globPathsToLint = [ + path.join(CONFIG.repositoryRootPath, 'dot-atom/**/*.coffee'), + path.join(CONFIG.repositoryRootPath, 'src/**/*.coffee'), + path.join(CONFIG.repositoryRootPath, 'spec/*.coffee') + ] + return expandGlobPaths(globPathsToLint).then(readFiles).then((files) => { + const errors = [] + const lintConfiguration = require(path.join(CONFIG.repositoryRootPath, 'coffeelint.json')) + for (let file of files) { + const lintErrors = coffeelint.lint(file.content, lintConfiguration, false) + for (let error of lintErrors) { + errors.push({path: file.path, lineNumber: error.lineNumber, message: error.message, rule: error.rule}) + } + } + return errors + }) +} diff --git a/script/lib/lint-java-script-paths.js b/script/lib/lint-java-script-paths.js new file mode 100644 index 000000000..bb9ef1523 --- /dev/null +++ b/script/lib/lint-java-script-paths.js @@ -0,0 +1,32 @@ +'use strict' + +const expandGlobPaths = require('./expand-glob-paths') +const standard = require('standard') +const path = require('path') + +const CONFIG = require('../config') + +module.exports = function () { + const globPathsToLint = [ + path.join(CONFIG.repositoryRootPath, 'exports', '**', '*.js'), + path.join(CONFIG.repositoryRootPath, 'src', '**', '*.js'), + path.join(CONFIG.repositoryRootPath, 'static', '*.js') + ] + return expandGlobPaths(globPathsToLint).then((paths) => { + return new Promise((resolve, reject) => { + standard.lintFiles(paths, (error, lintOutput) => { + if (error) { + reject(error) + } else { + const errors = [] + for (let result of lintOutput.results) { + for (let message of result.messages) { + errors.push({path: result.filePath, lineNumber: message.line, message: message.message, rule: message.ruleId}) + } + } + resolve(errors) + } + }) + }) + }) +} diff --git a/script/lib/lint-less-paths.js b/script/lib/lint-less-paths.js new file mode 100644 index 000000000..84e6aa3ae --- /dev/null +++ b/script/lib/lint-less-paths.js @@ -0,0 +1,64 @@ +'use strict' + +const csslint = require('csslint').CSSLint +const expandGlobPaths = require('./expand-glob-paths') +const LessCache = require('less-cache') +const path = require('path') +const readFiles = require('./read-files') + +const CONFIG = require('../config') +const LESS_CACHE_VERSION = require('less-cache/package.json').version + +module.exports = function () { + const globPathsToLint = [ + path.join(CONFIG.repositoryRootPath, 'static/**/*.less') + ] + const lintOptions = { + 'adjoining-classes': false, + 'duplicate-background-images': false, + 'box-model': false, + 'box-sizing': false, + 'bulletproof-font-face': false, + 'compatible-vendor-prefixes': false, + 'display-property-grouping': false, + 'duplicate-properties': false, + 'fallback-colors': false, + 'font-sizes': false, + 'gradients': false, + 'ids': false, + 'important': false, + 'known-properties': false, + 'order-alphabetical': false, + 'outline-none': false, + 'overqualified-elements': false, + 'regex-selectors': false, + 'qualified-headings': false, + 'unique-headings': false, + 'universal-selector': false, + 'vendor-prefix': false + } + for (let rule of csslint.getRules()) { + if (!lintOptions.hasOwnProperty(rule.id)) lintOptions[rule.id] = true + } + const lessCache = new LessCache({ + cacheDir: path.join(CONFIG.intermediateAppPath, 'less-compile-cache'), + fallbackDir: path.join(CONFIG.atomHomeDirPath, 'compile-cache', 'prebuild-less', LESS_CACHE_VERSION), + syncCaches: true, + resourcePath: CONFIG.repositoryRootPath, + importPaths: [ + path.join(CONFIG.intermediateAppPath, 'static', 'variables'), + path.join(CONFIG.intermediateAppPath, 'static') + ] + }) + return expandGlobPaths(globPathsToLint).then(readFiles).then((files) => { + const errors = [] + for (let file of files) { + const css = lessCache.cssForFile(file.path, file.content) + const result = csslint.verify(css, lintOptions) + for (let message of result.messages) { + errors.push({path: file.path.replace(/\.less$/, '.css'), lineNumber: message.line, message: message.message, rule: message.rule.id}) + } + } + return errors + }) +} diff --git a/script/lib/prebuild-less-cache.js b/script/lib/prebuild-less-cache.js index 8b7499677..1a1432fc9 100644 --- a/script/lib/prebuild-less-cache.js +++ b/script/lib/prebuild-less-cache.js @@ -6,7 +6,7 @@ const path = require('path') const LessCache = require('less-cache') const CONFIG = require('../config') -const LESS_CACHE_VERSION =require('less-cache/package.json').version +const LESS_CACHE_VERSION = require('less-cache/package.json').version const FALLBACK_VARIABLE_IMPORTS = '@import "variables/ui-variables";\n@import "variables/syntax-variables";\n' module.exports = function () { diff --git a/script/lib/read-files.js b/script/lib/read-files.js new file mode 100644 index 000000000..c360073aa --- /dev/null +++ b/script/lib/read-files.js @@ -0,0 +1,19 @@ +'use strict' + +const fs = require('fs') + +module.exports = function (paths) { + return Promise.all(paths.map(readFile)) +} + +function readFile (path) { + return new Promise((resolve, reject) => { + fs.readFile(path, 'utf8', (error, content) => { + if (error) { + reject(error) + } else { + resolve({path, content}) + } + }) + }) +} diff --git a/script/lint b/script/lint new file mode 100755 index 000000000..fb8792112 --- /dev/null +++ b/script/lint @@ -0,0 +1,35 @@ +#!/usr/bin/env node + +'use strict' + +require('colors') + +const lintCoffeeScriptPaths = require('./lib/lint-coffee-script-paths') +const lintJavaScriptPaths = require('./lib/lint-java-script-paths') +const lintLessPaths = require('./lib/lint-less-paths') +const path = require('path') + +const CONFIG = require('./config') + +process.on('unhandledRejection', function (e) { + console.error(e.stack || e) + process.exit(1) +}) + +Promise.all([lintCoffeeScriptPaths(), lintJavaScriptPaths(), lintLessPaths()]) + .then((lintResults) => { + let hasLintErrors = false + for (let errors of lintResults) { + for (let error of errors) { + hasLintErrors = true + const relativePath = path.relative(CONFIG.repositoryRootPath, error.path) + console.log(`${relativePath}:${error.lineNumber}`.yellow + ` ${error.message} (${error.rule})`.red) + } + } + if (hasLintErrors) { + process.exit(1) + } else { + console.log('No lint errors!'.green) + process.exit(0) + } + }) diff --git a/script/lint.cmd b/script/lint.cmd new file mode 100644 index 000000000..19049318d --- /dev/null +++ b/script/lint.cmd @@ -0,0 +1,5 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\lint" %* +) ELSE ( + node "%~dp0\lint" %* +) diff --git a/script/package.json b/script/package.json index 101f99318..349451629 100644 --- a/script/package.json +++ b/script/package.json @@ -4,8 +4,10 @@ "dependencies": { "async": "2.0.1", "babel-core": "5.8.38", - "coffee-script": "1.8.0", + "babel-eslint": "6.1.2", + "coffeelint": "1.15.7", "colors": "1.1.2", + "csslint": "1.0.2", "donna": "1.0.13", "electron-packager": "7.3.0", "electron-winstaller": "2.3.4", @@ -21,6 +23,7 @@ "pegjs": "0.9.0", "season": "5.3.0", "semver": "5.3.0", + "standard": "6.0.0", "sync-request": "3.0.1", "tello": "1.0.5", "webdriverio": "2.4.5", From 4a940592e69308e1f07e82c97a4d2e30a2f18588 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 10:37:46 +0200 Subject: [PATCH 190/221] Include error stack when logging unhandled rejections --- script/bootstrap | 5 +++++ script/build | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/script/bootstrap b/script/bootstrap index a24b0a96b..da33b2868 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -10,6 +10,11 @@ const installAtomDependencies = require('./lib/install-atom-dependencies') const installScriptDependencies = require('./lib/install-script-dependencies') const verifyMachineRequirements = require('./lib/verify-machine-requirements') +process.on('unhandledRejection', function (e) { + console.error(e.stack || e) + process.exit(1) +}) + verifyMachineRequirements() if (dependenciesFingerprint.isOutdated()) { diff --git a/script/build b/script/build index 3f8a50caa..8d928ad32 100755 --- a/script/build +++ b/script/build @@ -38,7 +38,7 @@ const transpileCsonPaths = require('./lib/transpile-cson-paths') const transpilePegJsPaths = require('./lib/transpile-peg-js-paths') process.on('unhandledRejection', function (e) { - console.error(e) + console.error(e.stack || e) process.exit(1) }) From 880328bf6e1f709373e59e03549da562d4f5f197 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 10:40:07 +0200 Subject: [PATCH 191/221] Fix lint errors --- src/state-store.js | 10 +++++----- src/text-editor-registry.js | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/state-store.js b/src/state-store.js index 1a5892f3c..fe45bc086 100644 --- a/src/state-store.js +++ b/src/state-store.js @@ -20,12 +20,12 @@ class StateStore { } connect () { - return this.dbPromise.then(db => !!db) + return this.dbPromise.then((db) => !!db) } save (key, value) { return new Promise((resolve, reject) => { - this.dbPromise.then(db => { + this.dbPromise.then((db) => { if (db == null) return resolve() var request = db.transaction(['states'], 'readwrite') @@ -39,7 +39,7 @@ class StateStore { } load (key) { - return this.dbPromise.then(db => { + return this.dbPromise.then((db) => { if (!db) return return new Promise((resolve, reject) => { @@ -62,7 +62,7 @@ class StateStore { } clear () { - return this.dbPromise.then(db => { + return this.dbPromise.then((db) => { if (!db) return return new Promise((resolve, reject) => { @@ -77,7 +77,7 @@ class StateStore { } count () { - return this.dbPromise.then(db => { + return this.dbPromise.then((db) => { if (!db) return return new Promise((resolve, reject) => { diff --git a/src/text-editor-registry.js b/src/text-editor-registry.js index 6cf4406d4..2b9494c10 100644 --- a/src/text-editor-registry.js +++ b/src/text-editor-registry.js @@ -267,7 +267,7 @@ export default class TextEditorRegistry { // Private grammarAddedOrUpdated (grammar) { - this.editorsWithMaintainedGrammar.forEach(editor => { + this.editorsWithMaintainedGrammar.forEach((editor) => { if (grammar.injectionSelector) { if (editor.tokenizedBuffer.hasTokenForSelector(grammar.injectionSelector)) { editor.tokenizedBuffer.retokenizeLines() @@ -336,7 +336,7 @@ export default class TextEditorRegistry { for (const [settingKey, paramName] of EDITOR_PARAMS_BY_SETTING_KEY) { this.subscriptions.add( this.config.onDidChange(settingKey, configOptions, ({newValue}) => { - this.editorsWithMaintainedConfig.forEach(editor => { + this.editorsWithMaintainedConfig.forEach((editor) => { if (editor.getRootScopeDescriptor().isEqual(scopeDescriptor)) { editor.update({[paramName]: newValue}) } @@ -348,7 +348,7 @@ export default class TextEditorRegistry { const updateTabTypes = () => { const tabType = this.config.get('editor.tabType', configOptions) const softTabs = this.config.get('editor.softTabs', configOptions) - this.editorsWithMaintainedConfig.forEach(editor => { + this.editorsWithMaintainedConfig.forEach((editor) => { if (editor.getRootScopeDescriptor().isEqual(scopeDescriptor)) { editor.setSoftTabs(shouldEditorUseSoftTabs(editor, tabType, softTabs)) } @@ -419,7 +419,7 @@ class ScopedSettingsDelegate { const commentStartEntries = this.config.getAll('editor.commentStart', {scope}) const commentEndEntries = this.config.getAll('editor.commentEnd', {scope}) const commentStartEntry = commentStartEntries[0] - const commentEndEntry = commentEndEntries.find(entry => { + const commentEndEntry = commentEndEntries.find((entry) => { return entry.scopeSelector === commentStartEntry.scopeSelector }) return { From 9ee9db4dbd18bb0b088a08ba4b2858eee4e9a525 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 10:40:44 +0200 Subject: [PATCH 192/221] Add script/lint to circle.yml --- circle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/circle.yml b/circle.yml index 2cb80f6d4..ba66a66b8 100644 --- a/circle.yml +++ b/circle.yml @@ -36,6 +36,7 @@ dependencies: test: override: + - script/lint - caffeinate -s script/test # Run with caffeinate to prevent screen saver experimental: From 45d37d0a54790066722083d7d741d49754d4fd3a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 10:57:11 +0200 Subject: [PATCH 193/221] Rewrite build documentation --- docs/build-instructions/freebsd.md | 34 ++----- docs/build-instructions/linux.md | 156 +++++++++-------------------- docs/build-instructions/macos.md | 23 +++-- docs/build-instructions/windows.md | 66 +++++------- 4 files changed, 96 insertions(+), 183 deletions(-) diff --git a/docs/build-instructions/freebsd.md b/docs/build-instructions/freebsd.md index 8029aa5f2..107f88ffe 100644 --- a/docs/build-instructions/freebsd.md +++ b/docs/build-instructions/freebsd.md @@ -4,33 +4,17 @@ FreeBSD -RELEASE 64-bit is the recommended platform. ## Requirements - * FreeBSD - * `pkg install node` - * `pkg install npm` - * `pkg install libgnome-keyring` - * `npm config set python /usr/local/bin/python2 -g` to ensure that gyp uses Python 2 +* FreeBSD +* `pkg install node` +* `pkg install npm` +* `pkg install libgnome-keyring` +* `npm config set python /usr/local/bin/python2 -g` to ensure that gyp uses Python 2 ## Instructions - ```sh - git clone https://github.com/atom/atom - cd atom - script/build # Creates application at $TMPDIR/atom-build/Atom - sudo script/grunt install # Installs command to /usr/local/bin/atom - ``` - -## Advanced Options - -### Custom install directory - ```sh -sudo script/grunt install --install-dir /install/atom/here +git clone https://github.com/atom/atom +cd atom +script/bootstrap +script/build ``` - -### Custom build directory - -```sh -script/build --build-dir /build/atom/here -``` - -## Troubleshooting diff --git a/docs/build-instructions/linux.md b/docs/build-instructions/linux.md index d72f4b2c3..4ff2a1541 100644 --- a/docs/build-instructions/linux.md +++ b/docs/build-instructions/linux.md @@ -4,37 +4,51 @@ Ubuntu LTS 12.04 64-bit is the recommended platform. ## Requirements - * OS with 64-bit or 32-bit architecture - * C++11 toolchain - * [Git](https://git-scm.com/) - * Node.js (4.x or above) (Can be installed via [nvm](https://github.com/creationix/nvm)). - * [npm](https://www.npmjs.com/) v3.10.5 or above (automatically bundled with Node.js) - * `npm -v` to check the version. - * `npm install -g npm` to upgrade if necessary. - * `npm config set python /usr/bin/python2 -g` to ensure that gyp uses python2. - * You might need to run this command as `sudo`, depending on how you have set up [npm](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#ubuntu-mint-elementary-os). - * development headers for [GNOME Keyring](https://wiki.gnome.org/Projects/GnomeKeyring) +* OS with 64-bit or 32-bit architecture +* C++11 toolchain +* Git +* Node.js 4.4.x or later (we recommend installing it via [nvm](https://github.com/creationix/nvm)) +* npm 3.10.x or later (run `npm install -g npm`) +* Ensure node-gyp uses python2 (run `npm config set python /usr/bin/python2 -g`, use `sudo` if you didn't install node via nvm) +* Development headers for [GNOME Keyring](https://wiki.gnome.org/Projects/GnomeKeyring). + +For more details, scroll down to find how to setup a specific Linux distro. + +## Instructions + +```sh +git clone https://github.com/atom/atom.git +cd atom +script/bootstrap +script/build +``` + +To also install the newly built application, use `--create-debian-package` or `--create-rpm-package` and then install the generated package via the system package manager. + +### `script/build` Options + +* `--compress-artifacts`: zips the generated application as `out/atom-{arch}.tar.gz`. +* `--create-debian-package`: creates a .deb package as `out/atom-{arch}.deb` +* `--create-rpm-package`: creates a .rpm package as `out/atom-{arch}.rpm` ### Ubuntu / Debian -* `sudo apt-get install build-essential git libgnome-keyring-dev fakeroot` -* Install Node.js and npm: - * Install [nvm](https://github.com/creationix/nvm). - * Run `nvm install 4` to install Node 4.x. - * Run `npm install -g npm` to upgrade to the latest npm. - * You may need to install a newer C++ compiler with C++11 support if script/bootstrap has errors: - ```sh - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install gcc-5 g++-5 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 80 --slave /usr/bin/g++ g++ /usr/bin/g++-5 - sudo update-alternatives --config gcc # choose gcc-5 from the list - ``` +* Install GNOME headers and other basic prerequisites: + ```sh + sudo apt-get install build-essential git libgnome-keyring-dev fakeroot rpm + ``` +* If `script/bootstrap` exits with an error, you may need to install a newer C++ compiler with C++11: + ```sh + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install gcc-5 g++-5 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 80 --slave /usr/bin/g++ g++ /usr/bin/g++-5 + sudo update-alternatives --config gcc # choose gcc-5 from the list + ``` ### Fedora / CentOS / RHEL * `sudo dnf --assumeyes install make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel rpmdevtools` -* Instructions for [Node.js](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora). ### Arch @@ -49,79 +63,6 @@ Ubuntu LTS 12.04 64-bit is the recommended platform. * `sudo zypper install nodejs nodejs-devel make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel rpmdevtools` -## Instructions - -If you have problems with permissions don't forget to prefix with `sudo` - -1. Clone the Atom repository: - - ```sh - git clone https://github.com/atom/atom - cd atom - ``` - -2. Checkout the latest Atom release: - - ```sh - git fetch -p - git checkout $(git describe --tags `git rev-list --tags --max-count=1`) - ``` - -3. Build Atom: - - ```sh - script/build - ``` - - This will create the atom application at `out/Atom`. - -4. Install the `atom` and `apm` commands to `/usr/local/bin` by executing: - - ```sh - sudo script/grunt install - ``` - - To use the newly installed Atom, quit and restart all running Atom instances. - -5. *Optionally*, you may generate distributable packages of Atom at `out`. Currently, `.deb` and `.rpm` package types are supported, as well as a `.tar.gz` archive. To create a `.deb` package run: - - ```sh - script/grunt mkdeb - ``` - - To create a `.rpm` package run - - ```sh - script/grunt mkrpm - ``` - - To create a `.tar.gz` archive run - - ```sh - script/grunt mktar - ``` - -## Advanced Options - -### Custom build directory - -```sh -script/build --build-dir /build/atom/here -``` - -### Custom install directory - -To install to a custom location from the standard build directory: - -```sh -sudo script/grunt install --install-dir /install/atom/here -``` - -If you customized your build directory as described above: - -```sh -sudo script/grunt install --build-dir /build/atom/here --install-dir /install/atom/here -``` ## Troubleshooting @@ -150,15 +91,12 @@ See also [#2082](https://github.com/atom/atom/issues/2082). ### /usr/bin/env: node: No such file or directory -If you get this notice when attempting to `script/build`, you either do not -have Node.js installed, or node isn't identified as Node.js on your machine. -If it's the latter, entering `sudo ln -s /usr/bin/nodejs /usr/bin/node` into -your terminal may fix the issue. - -#### You can also use Alternatives - -On some variants (mostly Debian based distros) it's preferable for you to use -Alternatives so that changes to the binary paths can be fixed or altered easily: +If you get this notice when attempting to run any script, you either do not have +Node.js installed, or node isn't identified as Node.js on your machine. If it's +the latter, this might be caused by installing Node.js via the distro package +manager and not nvm, so entering `sudo ln -s /usr/bin/nodejs /usr/bin/node` into +your terminal may fix the issue. On some variants (mostly Debian based distros) +you can use `update-alternatives` too: ```sh sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 1 --slave /usr/bin/js js /usr/bin/nodejs @@ -176,9 +114,9 @@ you need to uninstall the system version of gyp. On Fedora you would do the following: - ```sh - sudo yum remove gyp - ``` +```sh +sudo yum remove gyp +``` ### Linux build error reports in atom/atom * Use [this search](https://github.com/atom/atom/search?q=label%3Abuild-error+label%3Alinux&type=Issues) diff --git a/docs/build-instructions/macos.md b/docs/build-instructions/macos.md index f829ace26..68b9a89aa 100644 --- a/docs/build-instructions/macos.md +++ b/docs/build-instructions/macos.md @@ -3,21 +3,26 @@ ## Requirements * macOS 10.8 or later - * [Node.js](https://nodejs.org/en/download/) (0.10.x or above) + * Node.js 4.4.x or later (we recommend installing it via [nvm](https://github.com/creationix/nvm)) + * npm 3.10.x or later (run `npm install -g npm`) * Command Line Tools for [Xcode](https://developer.apple.com/xcode/downloads/) (run `xcode-select --install` to install) ## Instructions - ```sh - git clone https://github.com/atom/atom.git - cd atom - script/build # Creates application at /Applications/Atom.app - ``` +```sh +git clone https://github.com/atom/atom.git +cd atom +script/bootstrap +script/build +``` + +To also install the newly built application, use `script/build --install`. ### `script/build` Options - * `--install-dir` - The full path to the final built application (must include `.app` in the path), e.g. `script/build --install-dir /Users/username/full/path/to/Atom.app` - * `--build-dir` - Build the application in this directory. - * `--verbose` - Verbose mode. A lot more information output. + +* `--code-sign`: signs the application with the GitHub certificate specified in `$ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL`. +* `--compress-artifacts`: zips the generated application as `out/atom-mac.zip`. +* `--install`: installs the application at `/Applications/Atom.app`. ## Troubleshooting diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index ab20b49ff..c61aed56a 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -2,53 +2,39 @@ ## Requirements -### General - * [Node.js](https://nodejs.org/en/download/) v4.x - * [Python](https://www.python.org/downloads/) v2.7.x - * The python.exe must be available at `%SystemDrive%\Python27\python.exe`. - If it is installed elsewhere, you can create a symbolic link to the - directory containing the python.exe using: - `mklink /d %SystemDrive%\Python27 D:\elsewhere\Python27` +* Node.js 4.4.x or later +* Python v2.7.x + * The python.exe must be available at `%SystemDrive%\Python27\python.exe`. If it is installed elsewhere, you can create a symbolic link to the directory containing the python.exe using: `mklink /d %SystemDrive%\Python27 D:\elsewhere\Python27` +* Visual Studio, either: + * [Visual C++ Build Tools 2015](http://landinghub.visualstudio.com/visual-cpp-build-tools) + * [Visual Studio 2013 Update 5](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs) (Express Edition or better) + * [Visual Studio 2015](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs) (Community Edition or better) -### Visual Studio - -You can use either: - - * [Visual C++ Build Tools 2015](http://landinghub.visualstudio.com/visual-cpp-build-tools) - * [Visual Studio 2013 Update 5](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs) (Express Edition or better) - * [Visual Studio 2015](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs) (Community Edition or better) - -Whichever version you use, ensure that: - - * The default installation folder is chosen so the build tools can find it - * If using Visual Studio make sure Visual C++ support is selected/installed - * If using Visual C++ Build Tools make sure Windows 8 SDK is selected/installed - * A `git` command is in your path - * Set the `GYP_MSVS_VERSION` environment variable to the Visual Studio/Build Tools version (`2013` or `2015`) e.g. ``[Environment]::SetEnvironmentVariable("GYP_MSVS_VERSION", "2015", "User")`` in PowerShell or set it in Windows advanced system settings control panel. + Whichever version you use, ensure that: + * The default installation folder is chosen so the build tools can find it + * If using Visual Studio make sure Visual C++ support is selected/installed + * If using Visual C++ Build Tools make sure Windows 8 SDK is selected/installed + * A `git` command is in your path + * Set the `GYP_MSVS_VERSION` environment variable to the Visual Studio/Build Tools version (`2013` or `2015`) e.g. ``[Environment]::SetEnvironmentVariable("GYP_MSVS_VERSION", "2015", "User")`` in PowerShell or set it in Windows advanced system settings control panel. ## Instructions -You can run these commands using Command Prompt, PowerShell or Git Shell via [GitHub Desktop](https://desktop.github.com/). These instructions will assume the use of Bash from Git Shell - if you are using Command Prompt use a backslash instead: i.e. `script\build`. +You can run these commands using Command Prompt, PowerShell or Git Shell via [GitHub Desktop](https://desktop.github.com/). These instructions will assume the use of Command Prompt. -```bash +``` cd C:\ -git clone https://github.com/atom/atom/ +git clone https://github.com/atom/atom.git cd atom +script\bootstrap script\build ``` -This will create the Atom application in the `out\Atom` folder as well as copy it to a subfolder of your user profile (e.g. `c:\Users\Bob`) called `AppData\Local\atom\app-dev`. + +To also install the newly built application, use `script/build --create-windows-installer` and launch the generated installers. ### `script\build` Options - * `--install-dir` - Creates the final built application in this directory. Example (trailing slash is optional): -```bash -.\script\build --install-dir Z:\Some\Destination\Directory\ -``` - * `--build-dir` - Build the application in this directory. Example (trailing slash is optional): -```bash -.\script\build --build-dir Z:\Some\Temporary\Directory\ -``` - * `--no-install` - Skips the installation task after building. - * `--verbose` - Verbose mode. A lot more information output. +* `--code-sign`: signs the application with the GitHub certificate specified in `$WIN_P12KEY_URL`. +* `--compress-artifacts`: zips the generated application as `out/atom-windows.zip` (requires 7-zip). +* `--create-windows-installer`: creates an `.msi`, an `.exe` and a `.nupkg` installer in the `out/` directory. ## Do I have to use GitHub Desktop? @@ -70,10 +56,10 @@ If none of this works, do install Github Desktop and use its Git Shell as it mak * `msbuild.exe failed with exit code: 1` * Ensure you have Visual C++ support installed. Go into Add/Remove Programs, select Visual Studio and press Modify and then check the Visual C++ box. -* `script\build` stops with no error or warning shortly after displaying the versions of node, npm and Python +* `script\bootstrap` or `script\build` stop with no error or warning shortly after displaying the versions of node, npm and Python * Make sure that the path where you have checked out Atom does not include a space. e.g. use `c:\atom` and not `c:\my stuff\atom` -* `script\build` outputs only the Node.js and Python versions before returning +* `script\bootstrap` or `script\build` outputs only the Node.js and Python versions before returning * Try moving the repository to `C:\atom`. Most likely, the path is too long. See [issue #2200](https://github.com/atom/atom/issues/2200). @@ -87,7 +73,7 @@ If none of this works, do install Github Desktop and use its Git Shell as it mak * `'node_modules\.bin\npm' is not recognized as an internal or external command, operable program or batch file.` * This occurs if the previous build left things in a bad state. Run `script\clean` and then `script\build` again. -* `script\build` stops at installing runas with `Failed at the runas@x.y.z install script.` +* `script\bootstrap` stops at installing runas with `Failed at the runas@x.y.z install script.` * See the next item. * `error MSB8020: The build tools for Visual Studio 201? (Platform Toolset = 'v1?0') cannot be found.` @@ -101,4 +87,4 @@ If none of this works, do install Github Desktop and use its Git Shell as it mak ### Windows build error reports in atom/atom * If all fails, use [this search](https://github.com/atom/atom/search?q=label%3Abuild-error+label%3Awindows&type=Issues) to get a list of reports about build errors on Windows, and see if yours has already been reported. - * If it hasn't, please open a new issue with your Windows version, architecture (x86 or amd64), and a screenshot of your build output, including the Node.js and Python versions. +* If it hasn't, please open a new issue with your Windows version, architecture (x86 or amd64), and a screenshot of your build output, including the Node.js and Python versions. From b6de97f52f3a53faaf7335939e019ebee2031e7f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 11:42:21 +0200 Subject: [PATCH 194/221] :art: --- script/build | 2 +- script/lib/compress-artifacts.js | 10 +++++++++- script/lib/create-debian-package.js | 2 +- script/lib/create-rpm-package.js | 8 -------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/script/build b/script/build index 8d928ad32..2bc155051 100755 --- a/script/build +++ b/script/build @@ -67,7 +67,7 @@ dumpSymbols() return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath) } else { - console.log('Skipping creating installer. Specify the --create-windows-installer option to create a Squirrel-based Windows installer.'.gray) + console.log('Skipping creating installer. Specify the --create-windows-installer option to create a Squirrel-based Windows installer. Code-signing was skipped too.'.gray) } } else if (process.platform === 'linux') { if (argv.createDebianPackage) { diff --git a/script/lib/compress-artifacts.js b/script/lib/compress-artifacts.js index b4c7c3ba7..5287b64a7 100644 --- a/script/lib/compress-artifacts.js +++ b/script/lib/compress-artifacts.js @@ -13,7 +13,15 @@ module.exports = function (packagedAppPath) { } else if (process.platform === 'win32') { appArchiveName = 'atom-windows.zip' } else { - appArchiveName = 'atom-amd64.tar.gz' + let arch + if (process.arch === 'ia32') { + arch = 'i386' + } else if (process.arch === 'x64') { + arch = 'amd64' + } else { + arch = process.arch + } + appArchiveName = `atom-${arch}.tar.gz` } const appArchivePath = path.join(CONFIG.buildOutputPath, appArchiveName) compress(packagedAppPath, appArchivePath) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 75cda3c2b..553bc749a 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -24,7 +24,7 @@ module.exports = function (packagedAppPath) { arch = process.arch } - const outputDebianPackageFilePath = path.join(CONFIG.buildOutputPath, `atom-amd64.deb`) + const outputDebianPackageFilePath = path.join(CONFIG.buildOutputPath, `atom-${arch}.deb`) const debianPackageDirPath = path.join(os.tmpdir(), path.basename(packagedAppPath)) const debianPackageConfigPath = path.join(debianPackageDirPath, 'DEBIAN') const debianPackageInstallDirPath = path.join(debianPackageDirPath, 'usr') diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index 5698f54a0..76e660a72 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -18,14 +18,6 @@ module.exports = function (packagedAppPath) { // RPM versions can't have dashes or tildes in them. // (Ref.: https://twiki.cern.ch/twiki/bin/view/Main/RPMAndDebVersioning) const appVersion = CONFIG.appMetadata.version.replace(/-/g, '.') - let arch - if (process.arch === 'ia32') { - arch = 'i386' - } else if (process.arch === 'x64') { - arch = 'amd64' - } else { - arch = process.arch - } const rpmPackageDirPath = path.join(CONFIG.homeDirPath, 'rpmbuild') const rpmPackageBuildDirPath = path.join(rpmPackageDirPath, 'BUILD') From df56dbf199858bc507970f51ad5df1d74f7c1cdf Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 12:39:43 +0200 Subject: [PATCH 195/221] Remove unnecessary env variables --- .travis.yml | 4 ---- appveyor.yml | 3 --- 2 files changed, 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 132338432..324bbb4e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,6 @@ git: depth: 10 -env: - global: - - ATOM_ACCESS_TOKEN=da809a6077bb1b0aa7c5623f7b2d5f1fec2faae4 - compiler: clang matrix: diff --git a/appveyor.yml b/appveyor.yml index fdeadd058..c10860421 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,9 +10,6 @@ platform: environment: global: ATOM_DEV_RESOURCE_PATH: c:\projects\atom - ATOM_ACCESS_TOKEN: - secure: Q7vxmSq0bVCLTTRPzXw5ZhPTe7XYhWxX0tQV6neEkddTH6pZkOYNmSCG6VnMX2f+ - ATOM_NOISY_BUILD: 1 matrix: - NODE_VERSION: 4.4.5 From 546e56a5992df18c4d35254550324258d08b5560 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 12:43:34 +0200 Subject: [PATCH 196/221] :racehorse: Cache ~/.atom/compile-cache on AppVeyor --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index c10860421..d3966462a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -48,3 +48,4 @@ cache: - '%USERPROFILE%\.atom\.apm' - '%USERPROFILE%\.atom\.node-gyp\.atom' - '%USERPROFILE%\.atom\.npm' + - '%USERPROFILE%\.atom\compile-cache' From 77cba66c2d95cad54619f5314df22af4f56e4e6d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 13:03:48 +0200 Subject: [PATCH 197/221] Clarify wording and formatting in docs --- docs/build-instructions/linux.md | 3 +++ docs/build-instructions/macos.md | 2 +- docs/build-instructions/windows.md | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/build-instructions/linux.md b/docs/build-instructions/linux.md index 4ff2a1541..c28c7f888 100644 --- a/docs/build-instructions/linux.md +++ b/docs/build-instructions/linux.md @@ -34,10 +34,13 @@ To also install the newly built application, use `--create-debian-package` or `- ### Ubuntu / Debian * Install GNOME headers and other basic prerequisites: + ```sh sudo apt-get install build-essential git libgnome-keyring-dev fakeroot rpm ``` + * If `script/bootstrap` exits with an error, you may need to install a newer C++ compiler with C++11: + ```sh sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update diff --git a/docs/build-instructions/macos.md b/docs/build-instructions/macos.md index 68b9a89aa..bc93dba34 100644 --- a/docs/build-instructions/macos.md +++ b/docs/build-instructions/macos.md @@ -22,7 +22,7 @@ To also install the newly built application, use `script/build --install`. * `--code-sign`: signs the application with the GitHub certificate specified in `$ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL`. * `--compress-artifacts`: zips the generated application as `out/atom-mac.zip`. -* `--install`: installs the application at `/Applications/Atom.app`. +* `--install`: installs the application at `/Applications/Atom.app` for dev and stable versions or at `/Applications/Atom-Beta.app` for beta versions. ## Troubleshooting diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index c61aed56a..87a0d2de2 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -29,7 +29,7 @@ script\bootstrap script\build ``` -To also install the newly built application, use `script/build --create-windows-installer` and launch the generated installers. +To also install the newly built application, use `script\build --create-windows-installer` and launch the generated installers. ### `script\build` Options * `--code-sign`: signs the application with the GitHub certificate specified in `$WIN_P12KEY_URL`. @@ -77,10 +77,10 @@ If none of this works, do install Github Desktop and use its Git Shell as it mak * See the next item. * `error MSB8020: The build tools for Visual Studio 201? (Platform Toolset = 'v1?0') cannot be found.` - * Try setting the `GYP_MSVS_VERSION` environment variable to 2013 or 2015 depending on what version of Visual Studio you are running and then `script\clean` followed by `script\build` (re-open your command prompt or Powershell window if you set it using the GUI) + * Try setting the `GYP_MSVS_VERSION` environment variable to 2013 or 2015 depending on what version of Visual Studio you are running and then `script\clean` followed by `script\bootstrap` (re-open your command prompt or Powershell window if you set it using the GUI) * `'node-gyp' is not recognized as an internal or external command, operable program or batch file.` - * Try running `npm install -g node-gyp`, and run `script/build` again. + * Try running `npm install -g node-gyp`, and run `script\bootstrap` again. * Other `node-gyp` errors on first build attempt, even though the right Node.js and Python versions are installed. * Do try the build command one more time, as experience shows it often works on second try in many of these cases. From 14611926ac66c273196aedcb836d1992980ea111 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 13:40:17 +0200 Subject: [PATCH 198/221] Ensure script/bootstrap works after cleaning dependencies up --- script/config.js | 5 +---- script/lib/install-apm.js | 2 +- script/lib/install-atom-dependencies.js | 2 +- script/lib/install-script-dependencies.js | 2 +- script/lib/verify-machine-requirements.js | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/script/config.js b/script/config.js index ddac37032..d247d25fc 100644 --- a/script/config.js +++ b/script/config.js @@ -21,15 +21,12 @@ const appMetadata = require(path.join(repositoryRootPath, 'package.json')) const apmMetadata = require(path.join(apmRootPath, 'package.json')) const channel = getChannel() -const apmBinPath = getApmBinPath() -const npmBinPath = getNpmBinPath() - module.exports = { appMetadata, apmMetadata, channel, repositoryRootPath, apmRootPath, scriptRootPath, buildOutputPath, docsOutputPath, intermediateAppPath, symbolsPath, electronDownloadPath, atomHomeDirPath, homeDirPath, - apmBinPath, npmBinPath + getApmBinPath, getNpmBinPath } function getChannel () { diff --git a/script/lib/install-apm.js b/script/lib/install-apm.js index d37217e0d..783f135c5 100644 --- a/script/lib/install-apm.js +++ b/script/lib/install-apm.js @@ -8,7 +8,7 @@ const CONFIG = require('../config') module.exports = function () { console.log('Installing apm') childProcess.execFileSync( - CONFIG.npmBinPath, + CONFIG.getNpmBinPath(), ['--global-style', '--loglevel=error', 'install'], {env: process.env, cwd: CONFIG.apmRootPath} ) diff --git a/script/lib/install-atom-dependencies.js b/script/lib/install-atom-dependencies.js index ca2020585..5a66132f7 100644 --- a/script/lib/install-atom-dependencies.js +++ b/script/lib/install-atom-dependencies.js @@ -17,7 +17,7 @@ module.exports = function () { installEnv.npm_config_target_arch = 'ia32' } childProcess.execFileSync( - CONFIG.apmBinPath, + CONFIG.getApmBinPath(), ['--loglevel=error', 'install'], {env: installEnv, cwd: CONFIG.repositoryRootPath, stdio: 'inherit'} ) diff --git a/script/lib/install-script-dependencies.js b/script/lib/install-script-dependencies.js index 12454e517..02f9ffb88 100644 --- a/script/lib/install-script-dependencies.js +++ b/script/lib/install-script-dependencies.js @@ -8,7 +8,7 @@ const CONFIG = require('../config') module.exports = function () { console.log('Installing script dependencies') childProcess.execFileSync( - CONFIG.npmBinPath, + CONFIG.getNpmBinPath(), ['--loglevel=error', 'install'], {env: process.env, cwd: CONFIG.scriptRootPath} ) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index ad34cee97..6ba0044ef 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -25,7 +25,7 @@ function verifyNode () { } function verifyNpm () { - const stdout = childProcess.execFileSync(CONFIG.npmBinPath, ['--version'], {env: process.env}) + const stdout = childProcess.execFileSync(CONFIG.getNpmBinPath(), ['--version'], {env: process.env}) const fullVersion = stdout.toString().trim() const majorVersion = fullVersion.split('.')[0] if (majorVersion >= 3) { From eecf830849e1804db02043bc9924407c2e30dc58 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Mon, 29 Aug 2016 11:58:14 -0400 Subject: [PATCH 199/221] :arrow_up: tree-view@0.209.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f335d19c4..14e35c590 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "symbols-view": "0.113.1", "tabs": "0.101.0", "timecop": "0.33.2", - "tree-view": "0.209.2", + "tree-view": "0.209.3", "update-package-dependencies": "0.10.0", "welcome": "0.35.1", "whitespace": "0.33.0", From 83daa09abc2eccc5aca5256eb1327791a6e06353 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 29 Aug 2016 17:58:38 +0200 Subject: [PATCH 200/221] Remove buffer change event order assertion Signed-off-by: Nathan Sobo --- package.json | 2 +- src/tokenized-buffer.coffee | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/package.json b/package.json index f335d19c4..eb7baeddd 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "sinon": "1.17.4", "source-map-support": "^0.3.2", "temp": "0.8.1", - "text-buffer": "9.2.10", + "text-buffer": "9.2.12", "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6", "winreg": "^1.2.1", diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index b3df82ae4..e04274c66 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -188,17 +188,6 @@ class TokenizedBuffer extends Model row + delta bufferDidChange: (e) -> - if @lastBufferChangeEventId? - @assert( - @lastBufferChangeEventId is e.eventId - 1, - 'Buffer Change Event Ids are not sequential', - (error) => - error.metadata = { - tokenizedBufferEventId: @lastBufferChangeEventId, - nextTokenizedBufferEventId: e.eventId, - } - ) - @lastBufferChangeEventId = e.eventId @changeCount = @buffer.changeCount {oldRange, newRange} = e From 9574a831b19d1203639b9724a01ba2acf7d9d23e Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Mon, 29 Aug 2016 12:38:22 -0700 Subject: [PATCH 201/221] :arrow_up: image-view@0.59.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3f7bd3930..d1d922771 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "git-diff": "1.1.0", "go-to-line": "0.31.0", "grammar-selector": "0.48.2", - "image-view": "0.58.3", + "image-view": "0.59.0", "incompatible-packages": "0.26.1", "keybinding-resolver": "0.35.0", "line-ending-selector": "0.5.0", From c1c40671790a8cd5ea318249577f81f29fcc4238 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 29 Aug 2016 15:33:34 -0600 Subject: [PATCH 202/221] Run script/bootstrap from script/build --- script/build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/build b/script/build index 2bc155051..09c4c5d05 100755 --- a/script/build +++ b/script/build @@ -42,6 +42,8 @@ process.on('unhandledRejection', function (e) { process.exit(1) }) +require('./bootstrap') + cleanOutputDirectory() copyAssets() transpileBabelPaths() From d302fc4fbba6ce1b5221f1e35bb9c489792fae4c Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 29 Aug 2016 15:39:07 -0600 Subject: [PATCH 203/221] Don't bootstrap twice on build providers --- .travis.yml | 1 - appveyor.yml | 1 - circle.yml | 1 - 3 files changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 324bbb4e6..9ca453738 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,6 @@ install: - nvm install $NODE_VERSION - nvm use --delete-prefix $NODE_VERSION - npm install -g npm - - script/bootstrap - script/build --create-debian-package --create-rpm-package --compress-artifacts script: true diff --git a/appveyor.yml b/appveyor.yml index d3966462a..97240a2e4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,7 +21,6 @@ install: build_script: - cd %APPVEYOR_BUILD_FOLDER% - - script\bootstrap.cmd - script\build.cmd --code-sign --create-windows-installer --compress-artifacts test: off diff --git a/circle.yml b/circle.yml index ba66a66b8..0054c4972 100644 --- a/circle.yml +++ b/circle.yml @@ -24,7 +24,6 @@ dependencies: - npm install -g npm override: - - script/bootstrap - script/build --code-sign --compress-artifacts cache_directories: From b60afd36ee46cb9c1292b4e864cd9bf6ab4b91c6 Mon Sep 17 00:00:00 2001 From: Matthew Dapena-Tretter Date: Mon, 29 Aug 2016 17:18:56 -0700 Subject: [PATCH 204/221] Always copy item when splitting from the context menu This updates the context menu so that splitting behaves consistently, regardless of whether the context menu is used from a text editor or not. The current behavior comes from #7953 but, as @maxbrunsfeld pointed out when we talked about this, the purpose of that commit was to simplify the command names, so the UX change probably wasn't intentional. --- menus/darwin.cson | 8 ++++---- menus/linux.cson | 8 ++++---- menus/win32.cson | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/menus/darwin.cson b/menus/darwin.cson index 6fc0ff3d1..ccbb5f7a6 100644 --- a/menus/darwin.cson +++ b/menus/darwin.cson @@ -237,10 +237,10 @@ ] 'atom-pane': [ {type: 'separator'} - {label: 'Split Up', command: 'pane:split-up'} - {label: 'Split Down', command: 'pane:split-down'} - {label: 'Split Left', command: 'pane:split-left'} - {label: 'Split Right', command: 'pane:split-right'} + {label: 'Split Up', command: 'pane:split-up-and-copy-active-item'} + {label: 'Split Down', command: 'pane:split-down-and-copy-active-item'} + {label: 'Split Left', command: 'pane:split-left-and-copy-active-item'} + {label: 'Split Right', command: 'pane:split-right-and-copy-active-item'} {label: 'Close Pane', command: 'pane:close'} {type: 'separator'} ] diff --git a/menus/linux.cson b/menus/linux.cson index 87e6a4acc..3ec2780e1 100644 --- a/menus/linux.cson +++ b/menus/linux.cson @@ -213,10 +213,10 @@ ] 'atom-pane': [ {type: 'separator'} - {label: 'Split Up', command: 'pane:split-up'} - {label: 'Split Down', command: 'pane:split-down'} - {label: 'Split Left', command: 'pane:split-left'} - {label: 'Split Right', command: 'pane:split-right'} + {label: 'Split Up', command: 'pane:split-up-and-copy-active-item'} + {label: 'Split Down', command: 'pane:split-down-and-copy-active-item'} + {label: 'Split Left', command: 'pane:split-left-and-copy-active-item'} + {label: 'Split Right', command: 'pane:split-right-and-copy-active-item'} {label: 'Close Pane', command: 'pane:close'} {type: 'separator'} ] diff --git a/menus/win32.cson b/menus/win32.cson index e7e87a63f..d6b707009 100644 --- a/menus/win32.cson +++ b/menus/win32.cson @@ -216,10 +216,10 @@ ] 'atom-pane': [ {type: 'separator'} - {label: 'Split Up', command: 'pane:split-up'} - {label: 'Split Down', command: 'pane:split-down'} - {label: 'Split Left', command: 'pane:split-left'} - {label: 'Split Right', command: 'pane:split-right'} + {label: 'Split Up', command: 'pane:split-up-and-copy-active-item'} + {label: 'Split Down', command: 'pane:split-down-and-copy-active-item'} + {label: 'Split Left', command: 'pane:split-left-and-copy-active-item'} + {label: 'Split Right', command: 'pane:split-right-and-copy-active-item'} {label: 'Close Pane', command: 'pane:close'} {type: 'separator'} ] From 9030ee59f662045a9fc6c4d4eca6e1c6917fb208 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 30 Aug 2016 08:17:59 +0200 Subject: [PATCH 205/221] Update docs --- docs/build-instructions/freebsd.md | 1 - docs/build-instructions/linux.md | 3 +-- docs/build-instructions/macos.md | 1 - docs/build-instructions/windows.md | 11 +++++------ 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/build-instructions/freebsd.md b/docs/build-instructions/freebsd.md index 107f88ffe..ab07ff529 100644 --- a/docs/build-instructions/freebsd.md +++ b/docs/build-instructions/freebsd.md @@ -15,6 +15,5 @@ FreeBSD -RELEASE 64-bit is the recommended platform. ```sh git clone https://github.com/atom/atom cd atom -script/bootstrap script/build ``` diff --git a/docs/build-instructions/linux.md b/docs/build-instructions/linux.md index c28c7f888..a3346d974 100644 --- a/docs/build-instructions/linux.md +++ b/docs/build-instructions/linux.md @@ -19,7 +19,6 @@ For more details, scroll down to find how to setup a specific Linux distro. ```sh git clone https://github.com/atom/atom.git cd atom -script/bootstrap script/build ``` @@ -39,7 +38,7 @@ To also install the newly built application, use `--create-debian-package` or `- sudo apt-get install build-essential git libgnome-keyring-dev fakeroot rpm ``` -* If `script/bootstrap` exits with an error, you may need to install a newer C++ compiler with C++11: +* If `script/build` exits with an error, you may need to install a newer C++ compiler with C++11: ```sh sudo add-apt-repository ppa:ubuntu-toolchain-r/test diff --git a/docs/build-instructions/macos.md b/docs/build-instructions/macos.md index bc93dba34..f03d0e385 100644 --- a/docs/build-instructions/macos.md +++ b/docs/build-instructions/macos.md @@ -12,7 +12,6 @@ ```sh git clone https://github.com/atom/atom.git cd atom -script/bootstrap script/build ``` diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index 87a0d2de2..41142a526 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -25,7 +25,6 @@ You can run these commands using Command Prompt, PowerShell or Git Shell via [Gi cd C:\ git clone https://github.com/atom/atom.git cd atom -script\bootstrap script\build ``` @@ -56,10 +55,10 @@ If none of this works, do install Github Desktop and use its Git Shell as it mak * `msbuild.exe failed with exit code: 1` * Ensure you have Visual C++ support installed. Go into Add/Remove Programs, select Visual Studio and press Modify and then check the Visual C++ box. -* `script\bootstrap` or `script\build` stop with no error or warning shortly after displaying the versions of node, npm and Python +* `script\build` stop with no error or warning shortly after displaying the versions of node, npm and Python * Make sure that the path where you have checked out Atom does not include a space. e.g. use `c:\atom` and not `c:\my stuff\atom` -* `script\bootstrap` or `script\build` outputs only the Node.js and Python versions before returning +* `script\build` outputs only the Node.js and Python versions before returning * Try moving the repository to `C:\atom`. Most likely, the path is too long. See [issue #2200](https://github.com/atom/atom/issues/2200). @@ -73,14 +72,14 @@ If none of this works, do install Github Desktop and use its Git Shell as it mak * `'node_modules\.bin\npm' is not recognized as an internal or external command, operable program or batch file.` * This occurs if the previous build left things in a bad state. Run `script\clean` and then `script\build` again. -* `script\bootstrap` stops at installing runas with `Failed at the runas@x.y.z install script.` +* `script\build` stops at installing runas with `Failed at the runas@x.y.z install script.` * See the next item. * `error MSB8020: The build tools for Visual Studio 201? (Platform Toolset = 'v1?0') cannot be found.` - * Try setting the `GYP_MSVS_VERSION` environment variable to 2013 or 2015 depending on what version of Visual Studio you are running and then `script\clean` followed by `script\bootstrap` (re-open your command prompt or Powershell window if you set it using the GUI) + * Try setting the `GYP_MSVS_VERSION` environment variable to 2013 or 2015 depending on what version of Visual Studio you are running and then `script\clean` followed by `script\build` (re-open your command prompt or Powershell window if you set it using the GUI) * `'node-gyp' is not recognized as an internal or external command, operable program or batch file.` - * Try running `npm install -g node-gyp`, and run `script\bootstrap` again. + * Try running `npm install -g node-gyp`, and run `script\build` again. * Other `node-gyp` errors on first build attempt, even though the right Node.js and Python versions are installed. * Do try the build command one more time, as experience shows it often works on second try in many of these cases. From d1daef976736b62bacb570d909109606f4696f4c Mon Sep 17 00:00:00 2001 From: simurai Date: Tue, 30 Aug 2016 16:55:18 +0900 Subject: [PATCH 206/221] :arrow_up: one-dark-ui@v1.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d1d922771..15b0ff362 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "atom-light-ui": "0.44.0", "base16-tomorrow-dark-theme": "1.2.0", "base16-tomorrow-light-theme": "1.2.0", - "one-dark-ui": "1.5.0", + "one-dark-ui": "1.6.0", "one-light-ui": "1.5.0", "one-dark-syntax": "1.3.0", "one-light-syntax": "1.3.0", From 795e47f30734ef1c04501cbfe729014afc8e382b Mon Sep 17 00:00:00 2001 From: simurai Date: Tue, 30 Aug 2016 16:55:50 +0900 Subject: [PATCH 207/221] :arrow_up: one-light-ui@v1.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 15b0ff362..69c934496 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "base16-tomorrow-dark-theme": "1.2.0", "base16-tomorrow-light-theme": "1.2.0", "one-dark-ui": "1.6.0", - "one-light-ui": "1.5.0", + "one-light-ui": "1.6.0", "one-dark-syntax": "1.3.0", "one-light-syntax": "1.3.0", "solarized-dark-syntax": "1.0.2", From de3fca49a8cb088b5a273fc6d1c2011ebe2323e2 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 30 Aug 2016 11:48:43 +0200 Subject: [PATCH 208/221] Run script/bootstrap immediately after running script/build This will ensure all the dependencies used later in `script/build` are installed. --- script/build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script/build b/script/build index 09c4c5d05..beab4088a 100755 --- a/script/build +++ b/script/build @@ -2,6 +2,10 @@ 'use strict' +// Run bootstrap first to ensure all the dependencies used later in this script +// are installed. +require('./bootstrap') + // Needed so we can require src/module-cache.coffee during generateModuleCache require('coffee-script/register') require('colors') @@ -42,8 +46,6 @@ process.on('unhandledRejection', function (e) { process.exit(1) }) -require('./bootstrap') - cleanOutputDirectory() copyAssets() transpileBabelPaths() From 5b85e1c797eb862c634fcac40587dcd99780ffc6 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 30 Aug 2016 11:32:22 +0200 Subject: [PATCH 209/221] Allow script/build --install on all platforms --- resources/linux/atom.desktop.in | 2 +- script/copy-folder.cmd | 18 +++++++ script/lib/create-debian-package.js | 2 +- script/lib/create-rpm-package.js | 2 +- script/lib/install-application.js | 83 +++++++++++++++++++++++++++-- script/package.json | 1 + 6 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 script/copy-folder.cmd diff --git a/resources/linux/atom.desktop.in b/resources/linux/atom.desktop.in index aa5293e90..6fa5d79c8 100644 --- a/resources/linux/atom.desktop.in +++ b/resources/linux/atom.desktop.in @@ -3,7 +3,7 @@ Name=<%= appName %> Comment=<%= description %> GenericName=Text Editor Exec=<%= installDir %>/share/<%= appFileName %>/atom %F -Icon=<%= iconName %> +Icon=<%= iconPath %> Type=Application StartupNotify=true Categories=GNOME;GTK;Utility;TextEditor;Development; diff --git a/script/copy-folder.cmd b/script/copy-folder.cmd new file mode 100644 index 000000000..1021c30f3 --- /dev/null +++ b/script/copy-folder.cmd @@ -0,0 +1,18 @@ +@echo off + +set USAGE=Usage: %0 source destination + +if [%1] == [] ( + echo %USAGE% + exit 1 +) +if [%2] == [] ( + echo %USAGE% + exit 2 +) + +:: rm -rf %2 +if exist %2 rmdir %2 /s /q + +:: cp -rf %1 %2 +(robocopy %1 %2 /e) ^& IF %ERRORLEVEL% LEQ 1 exit 0 diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 553bc749a..68a88859b 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -84,7 +84,7 @@ module.exports = function (packagedAppPath) { const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in')) const desktopEntryContents = template(desktopEntryTemplate)({ appName: appName, appFileName: atomExecutableName, description: appDescription, - installDir: '/usr', iconName: atomExecutableName + installDir: '/usr', iconPath: atomExecutableName }) fs.writeFileSync(path.join(debianPackageApplicationsDirPath, `${atomExecutableName}.desktop`), desktopEntryContents) diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index 76e660a72..1c54160fb 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -60,7 +60,7 @@ module.exports = function (packagedAppPath) { const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in')) const desktopEntryContents = template(desktopEntryTemplate)({ appName: appName, appFileName: atomExecutableName, description: appDescription, - installDir: '/usr', iconName: atomExecutableName + installDir: '/usr', iconPath: atomExecutableName }) fs.writeFileSync(path.join(rpmPackageBuildDirPath, `${atomExecutableName}.desktop`), desktopEntryContents) diff --git a/script/lib/install-application.js b/script/lib/install-application.js index 5852e6604..be790b4c5 100644 --- a/script/lib/install-application.js +++ b/script/lib/install-application.js @@ -2,18 +2,91 @@ const fs = require('fs-extra') const path = require('path') +const runas = require('runas') +const template = require('lodash.template') + +const CONFIG = require('../config') module.exports = function (packagedAppPath) { + const packagedAppFileName = path.basename(packagedAppPath) if (process.platform === 'darwin') { - const packagedAppPathFileName = path.basename(packagedAppPath) - const installationDirPath = path.join(path.sep, 'Applications', packagedAppPathFileName) + const installationDirPath = path.join(path.sep, 'Applications', packagedAppFileName) if (fs.existsSync(installationDirPath)) { - console.log(`Removing previously installed ${packagedAppPathFileName} at ${installationDirPath}`) + console.log(`Removing previously installed "${packagedAppFileName}" at "${installationDirPath}"`) fs.removeSync(installationDirPath) } - console.log(`Installing ${packagedAppPath} at ${installationDirPath}`) + console.log(`Installing "${packagedAppPath}" at "${installationDirPath}"`) fs.copySync(packagedAppPath, installationDirPath) + } else if (process.platform === 'win32') { + const installationDirPath = path.join(process.env.LOCALAPPDATA, packagedAppFileName, 'app-dev') + try { + if (fs.existsSync(installationDirPath)) { + console.log(`Removing previously installed "${packagedAppFileName}" at "${installationDirPath}"`) + fs.removeSync(installationDirPath) + } + console.log(`Installing "${packagedAppPath}" at "${installationDirPath}"`) + fs.copySync(packagedAppPath, installationDirPath) + } catch (e) { + console.log(`Administrator elevation required to install into "${installationDirPath}"`) + const copyScriptPath = path.join(CONFIG.repositoryRootPath, 'script', 'copy-folder.cmd') + const exitCode = runas('cmd', ['/c', copyScriptPath, packagedAppPath, installationDirPath], {admin: true}) + if (exitCode !== 0) { + throw new Error(`Installation failed. "${copyScriptPath}" exited with status: ${exitCode}`) + } + } } else { - throw new Error("Not implemented yet.") + const atomExecutableName = CONFIG.channel === 'beta' ? 'atom-beta' : 'atom' + const apmExecutableName = CONFIG.channel === 'beta' ? 'apm-beta' : 'apm' + const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom' + const appDescription = CONFIG.appMetadata.description + const userLocalDirPath = path.join('/usr', 'local') + const shareDirPath = path.join(userLocalDirPath, 'share') + const installationDirPath = path.join(shareDirPath, atomExecutableName) + const applicationsDirPath = path.join(shareDirPath, 'applications') + const desktopEntryPath = path.join(applicationsDirPath, `${atomExecutableName}.desktop`) + const binDirPath = path.join(userLocalDirPath, 'bin') + const atomBinDestinationPath = path.join(binDirPath, atomExecutableName) + const apmBinDestinationPath = path.join(binDirPath, apmExecutableName) + + fs.mkdirpSync(applicationsDirPath) + fs.mkdirpSync(binDirPath) + + if (fs.existsSync(installationDirPath)) { + console.log(`Removing previously installed "${packagedAppFileName}" at "${installationDirPath}"`) + fs.removeSync(installationDirPath) + } + console.log(`Installing "${packagedAppFileName}" at "${installationDirPath}"`) + fs.copySync(packagedAppPath, installationDirPath) + + if (fs.existsSync(desktopEntryPath)) { + console.log(`Removing existing desktop entry file at "${desktopEntryPath}"`) + fs.removeSync(desktopEntryPath) + } + console.log(`Writing desktop entry file at "${desktopEntryPath}"`) + const iconPath = path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png') + const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in')) + const desktopEntryContents = template(desktopEntryTemplate)({ + appName, appFileName: atomExecutableName, description: appDescription, + installDir: '/usr', iconPath + }) + fs.writeFileSync(desktopEntryPath, desktopEntryContents) + + if (fs.existsSync(atomBinDestinationPath)) { + console.log(`Removing existing executable at "${atomBinDestinationPath}"`) + fs.removeSync(atomBinDestinationPath) + } + console.log(`Copying atom.sh to "${atomBinDestinationPath}"`) + fs.copySync(path.join(CONFIG.repositoryRootPath, 'atom.sh'), atomBinDestinationPath) + + try { + fs.lstatSync(apmBinDestinationPath) + console.log(`Removing existing executable at "${apmBinDestinationPath}"`) + fs.removeSync(apmBinDestinationPath) + } catch (e) { } + console.log(`Symlinking apm to "${apmBinDestinationPath}"`) + fs.symlinkSync(path.join('..', 'share', atomExecutableName, 'resources', 'app', 'apm', 'node_modules', '.bin', 'apm'), apmBinDestinationPath) + + console.log(`Changing permissions to 755 for "${installationDirPath}"`) + fs.chmodSync(installationDirPath, '755') } } diff --git a/script/package.json b/script/package.json index 349451629..0ddc54928 100644 --- a/script/package.json +++ b/script/package.json @@ -21,6 +21,7 @@ "normalize-package-data": "2.3.5", "npm": "3.10.5", "pegjs": "0.9.0", + "runas": "3.1.1", "season": "5.3.0", "semver": "5.3.0", "standard": "6.0.0", From ab0a7f8b617aa0820ca411ab66ab6f999437de8c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 30 Aug 2016 12:32:39 +0200 Subject: [PATCH 210/221] Fix outdated code in script/clean --- script/lib/clean-caches.js | 2 +- script/lib/kill-running-atom-instances.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/script/lib/clean-caches.js b/script/lib/clean-caches.js index dbcbfb0e8..fa94333a0 100644 --- a/script/lib/clean-caches.js +++ b/script/lib/clean-caches.js @@ -8,7 +8,7 @@ const CONFIG = require('../config') module.exports = function () { const cachePaths = [ - path.join(CONFIG.repositoryRootPath, 'cache'), + path.join(CONFIG.repositoryRootPath, 'electron'), path.join(CONFIG.homeDirPath, '.atom', '.node-gyp'), path.join(CONFIG.homeDirPath, '.atom', 'storage'), path.join(CONFIG.homeDirPath, '.atom', '.apm'), diff --git a/script/lib/kill-running-atom-instances.js b/script/lib/kill-running-atom-instances.js index ce1849016..616ca6060 100644 --- a/script/lib/kill-running-atom-instances.js +++ b/script/lib/kill-running-atom-instances.js @@ -1,4 +1,4 @@ -const spawnSync = require('./spawn-sync') +const childProcess = require('child_process') const CONFIG = require('../config.js') From 5c3c546f524ad2de21d1ea655509f6d98145212e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 30 Aug 2016 12:50:11 +0200 Subject: [PATCH 211/221] Document the --install flag for other platforms --- docs/build-instructions/linux.md | 1 + docs/build-instructions/windows.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/build-instructions/linux.md b/docs/build-instructions/linux.md index a3346d974..fb7e96bef 100644 --- a/docs/build-instructions/linux.md +++ b/docs/build-instructions/linux.md @@ -29,6 +29,7 @@ To also install the newly built application, use `--create-debian-package` or `- * `--compress-artifacts`: zips the generated application as `out/atom-{arch}.tar.gz`. * `--create-debian-package`: creates a .deb package as `out/atom-{arch}.deb` * `--create-rpm-package`: creates a .rpm package as `out/atom-{arch}.rpm` +* `--install`: installs the application in `/usr/local/`. ### Ubuntu / Debian diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index 41142a526..4c83314e1 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -34,6 +34,7 @@ To also install the newly built application, use `script\build --create-windows- * `--code-sign`: signs the application with the GitHub certificate specified in `$WIN_P12KEY_URL`. * `--compress-artifacts`: zips the generated application as `out/atom-windows.zip` (requires 7-zip). * `--create-windows-installer`: creates an `.msi`, an `.exe` and a `.nupkg` installer in the `out/` directory. +* `--install`: installs the application in `C:\Users\\AppData\Local\`. ## Do I have to use GitHub Desktop? From c66dde094bfee7599038e81322362ad1dfb6ce09 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 30 Aug 2016 16:42:58 +0200 Subject: [PATCH 212/221] :art: :memo: --- docs/build-instructions/windows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index 4c83314e1..4f5113c70 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -34,7 +34,7 @@ To also install the newly built application, use `script\build --create-windows- * `--code-sign`: signs the application with the GitHub certificate specified in `$WIN_P12KEY_URL`. * `--compress-artifacts`: zips the generated application as `out/atom-windows.zip` (requires 7-zip). * `--create-windows-installer`: creates an `.msi`, an `.exe` and a `.nupkg` installer in the `out/` directory. -* `--install`: installs the application in `C:\Users\\AppData\Local\`. +* `--install`: installs the application in `%LOCALAPPDATA%\Atom\app-dev\`. ## Do I have to use GitHub Desktop? From fedf783b6679b99eb023e6b781336299de8075af Mon Sep 17 00:00:00 2001 From: Hubot Date: Tue, 30 Aug 2016 09:47:13 -0500 Subject: [PATCH 213/221] 1.12.0-dev --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 69c934496..451b2cf28 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.11.0-dev", + "version": "1.12.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/main-process/main.js", "repository": { From ce24a2f1cfb5dca3ee8eb0e0637e0a34f576c9f5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 30 Aug 2016 19:25:09 +0200 Subject: [PATCH 214/221] Use the correct Atom executable paths on the beta channel Signed-off-by: Nathan Sobo --- atom.sh | 4 +++- src/buffered-node-process.coffee | 11 ++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/atom.sh b/atom.sh index b68716bf4..0a452c7f9 100755 --- a/atom.sh +++ b/atom.sh @@ -55,8 +55,10 @@ fi if [ $OS == 'Mac' ]; then if [ -n "$BETA_VERSION" ]; then ATOM_APP_NAME="Atom Beta.app" + ATOM_EXECUTABLE_NAME="Atom Beta" else ATOM_APP_NAME="Atom.app" + ATOM_EXECUTABLE_NAME="Atom" fi if [ -z "${ATOM_PATH}" ]; then @@ -78,7 +80,7 @@ if [ $OS == 'Mac' ]; then fi if [ $EXPECT_OUTPUT ]; then - "$ATOM_PATH/$ATOM_APP_NAME/Contents/MacOS/Atom" --executed-from="$(pwd)" --pid=$$ "$@" + "$ATOM_PATH/$ATOM_APP_NAME/Contents/MacOS/$ATOM_EXECUTABLE_NAME" --executed-from="$(pwd)" --pid=$$ "$@" exit $? else open -a "$ATOM_PATH/$ATOM_APP_NAME" -n --args --executed-from="$(pwd)" --pid=$$ --path-environment="$PATH" "$@" diff --git a/src/buffered-node-process.coffee b/src/buffered-node-process.coffee index 406775277..5cab035bc 100644 --- a/src/buffered-node-process.coffee +++ b/src/buffered-node-process.coffee @@ -1,4 +1,5 @@ BufferedProcess = require './buffered-process' +electron = require 'electron' path = require 'path' # Extended: Like {BufferedProcess}, but accepts a Node script as the command @@ -36,14 +37,6 @@ class BufferedNodeProcess extends BufferedProcess # * `exit` The callback {Function} which receives a single argument # containing the exit status (optional). constructor: ({command, args, options, stdout, stderr, exit}) -> - node = - if process.platform is 'darwin' - # Use a helper to prevent an icon from appearing on the Dock - path.resolve(process.resourcesPath, '..', 'Frameworks', - 'Atom Helper.app', 'Contents', 'MacOS', 'Atom Helper') - else - process.execPath - options ?= {} options.env ?= Object.create(process.env) options.env['ELECTRON_RUN_AS_NODE'] = 1 @@ -53,4 +46,4 @@ class BufferedNodeProcess extends BufferedProcess args.unshift(command) args.unshift('--no-deprecation') - super({command: node, args, options, stdout, stderr, exit}) + super({command: process.execPath, args, options, stdout, stderr, exit}) From 059dbba290ab96d16fbf4c889ca7d258bca97b9a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 30 Aug 2016 20:15:22 +0200 Subject: [PATCH 215/221] Remove accidentally committed require Signed-off-by: Nathan Sobo --- src/buffered-node-process.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/buffered-node-process.coffee b/src/buffered-node-process.coffee index 5cab035bc..4987f84a4 100644 --- a/src/buffered-node-process.coffee +++ b/src/buffered-node-process.coffee @@ -1,5 +1,4 @@ BufferedProcess = require './buffered-process' -electron = require 'electron' path = require 'path' # Extended: Like {BufferedProcess}, but accepts a Node script as the command From 9451ca0254f11503682fc82db44c8596dec8dba7 Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Tue, 30 Aug 2016 13:20:17 -0700 Subject: [PATCH 216/221] Fix show/hide line numbers in editor --- spec/text-editor-registry-spec.js | 13 +++++++++++++ src/text-editor-registry.js | 1 + 2 files changed, 14 insertions(+) diff --git a/spec/text-editor-registry-spec.js b/spec/text-editor-registry-spec.js index fc48c101c..812676305 100644 --- a/spec/text-editor-registry-spec.js +++ b/spec/text-editor-registry-spec.js @@ -425,6 +425,19 @@ describe('TextEditorRegistry', function () { expect(editor.hasAtomicSoftTabs()).toBe(true) }) + it('enables or disables line numbers based on the config', async function () { + editor.update({showLineNumbers: true}) + expect(editor.showLineNumbers).toBe(true) + + atom.config.set('editor.showLineNumbers', false) + registry.maintainConfig(editor) + await initialPackageActivation + expect(editor.showLineNumbers).toBe(false) + + atom.config.set('editor.showLineNumbers', true) + expect(editor.showLineNumbers).toBe(true) + }) + it('sets the invisibles based on the config', async function () { const invisibles1 = {'tab': 'a', 'cr': false, eol: false, space: false} const invisibles2 = {'tab': 'b', 'cr': false, eol: false, space: false} diff --git a/src/text-editor-registry.js b/src/text-editor-registry.js index 2b9494c10..bda3712e7 100644 --- a/src/text-editor-registry.js +++ b/src/text-editor-registry.js @@ -12,6 +12,7 @@ const EDITOR_PARAMS_BY_SETTING_KEY = [ ['editor.tabLength', 'tabLength'], ['editor.invisibles', 'invisibles'], ['editor.showIndentGuide', 'showIndentGuide'], + ['editor.showLineNumbers', 'showLineNumbers'], ['editor.softWrap', 'softWrapped'], ['editor.softWrapHangingIndent', 'softWrapHangingIndentLength'], ['editor.softWrapAtPreferredLineLength', 'softWrapAtPreferredLineLength'], From 4ae823f3122a1c1a5d4df41d4d914dc85ef386f0 Mon Sep 17 00:00:00 2001 From: Joe Fitzgerald Date: Wed, 31 Aug 2016 12:46:34 -0600 Subject: [PATCH 217/221] :arrow_up: Marked 0.3.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 451b2cf28..1363cf89a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "key-path-helpers": "^0.4.0", "less-cache": "0.23", "line-top-index": "0.2.0", - "marked": "^0.3.5", + "marked": "^0.3.6", "mocha": "2.5.1", "normalize-package-data": "^2.0.0", "nslog": "^3", From 66dd70d19d8b45b0dd1371cad91efba26b6c60d2 Mon Sep 17 00:00:00 2001 From: bene Date: Wed, 31 Aug 2016 21:16:49 +0200 Subject: [PATCH 218/221] :memo: fix arugments not marked as such [ci skip] --- src/git-repository.coffee | 2 +- src/text-editor-element.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index e0d7dfb25..e9d979171 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -316,7 +316,7 @@ class GitRepository # Public: Get the status of a single path in the repository. # - # `path` A {String} repository-relative path. + # * `path` A {String} repository-relative path. # # Returns a {Number} representing the status. This value can be passed to # {::isStatusModified} or {::isStatusNew} to get more information. diff --git a/src/text-editor-element.coffee b/src/text-editor-element.coffee index 09a1de6bb..5d8254f7c 100644 --- a/src/text-editor-element.coffee +++ b/src/text-editor-element.coffee @@ -177,7 +177,7 @@ class TextEditorElement extends HTMLElement # Extended: Continuously reflows lines and line numbers. (Has performance overhead) # - # `continuousReflow` A {Boolean} indicating whether to keep reflowing or not. + # * `continuousReflow` A {Boolean} indicating whether to keep reflowing or not. setContinuousReflow: (continuousReflow) -> @component?.setContinuousReflow(continuousReflow) From b54952d6e7d20bfbdeb7d2b05435c43fbadbe45a Mon Sep 17 00:00:00 2001 From: Aaron Blakely Date: Wed, 31 Aug 2016 16:46:05 -0500 Subject: [PATCH 219/221] Update create-debian-package.js Added support for building debian powerpc packages. --- script/lib/create-debian-package.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 68a88859b..03196816d 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -20,6 +20,8 @@ module.exports = function (packagedAppPath) { arch = 'i386' } else if (process.arch === 'x64') { arch = 'amd64' + } else if (process.arch === 'ppc') { + arch = 'powerpc' } else { arch = process.arch } From 8249dbbb79a9819247a4724ab523b2da9255f524 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 1 Sep 2016 09:47:42 +0200 Subject: [PATCH 220/221] Fix release channel detection on Travis In the previous build scripts, we were considering all the builds triggered by a pull-request to be part of the dev channel. We adopted the same heuristic for the new build scripts, but didn't notice that Travis always sets the `TRAVIS_PULL_REQUEST` variable to "false" (which causes the `process.env.TRAVIS_PULL_REQUEST` expression to be evaluated as truthy). In the past, this wasn't a problem because we were building artifacts via Janky, but after switching to Travis this makes it generate the wrong assets on stable and beta. To fix this, it seems reasonable to remove the conditional that checks if we are building a pull-request: in the past this could have been problematic because assets could be uploaded inadvertently to S3 or GitHub, but this should be safe now that we rely on the release publisher to perform that task. --- script/config.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/script/config.js b/script/config.js index d247d25fc..293af1136 100644 --- a/script/config.js +++ b/script/config.js @@ -30,7 +30,7 @@ module.exports = { } function getChannel () { - if (appMetadata.version.match(/dev/) || isBuildingPR()) { + if (appMetadata.version.match(/dev/)) { return 'dev' } else if (appMetadata.version.match(/beta/)) { return 'beta' @@ -39,14 +39,6 @@ function getChannel () { } } -function isBuildingPR () { - return ( - process.env.APPVEYOR_PULL_REQUEST_NUMBER || - process.env.TRAVIS_PULL_REQUEST || - process.env.CI_PULL_REQUEST - ) -} - function getApmBinPath () { const apmBinName = process.platform === 'win32' ? 'apm.cmd' : 'apm' return path.join(apmRootPath, 'node_modules', 'atom-package-manager', 'bin', apmBinName) From 9ebde9ccb21d1498234239b8ff9be9229f4b4e8a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 1 Sep 2016 16:43:43 +0200 Subject: [PATCH 221/221] Remove `height: 100%` from atom-text-editor elements Originally, editors with autoHeight set to false had an inline style of 100%. We attempted to retain this behavior while allowing CSS to change the height by applying this styling via a global CSS rule instead: unfortunately, however, this applies to non autoHeight editors as well because due to our deprecated autoHeight detection routine, the height of these editors must be assigned on an internal element and therefore does not override the 100% styling from the stylesheet. Signed-off-by: Nathan Sobo --- static/text-editor-light.less | 1 - 1 file changed, 1 deletion(-) diff --git a/static/text-editor-light.less b/static/text-editor-light.less index b37bc53e2..bc699e698 100644 --- a/static/text-editor-light.less +++ b/static/text-editor-light.less @@ -5,7 +5,6 @@ atom-text-editor { display: block; font-family: Menlo, Consolas, 'DejaVu Sans Mono', monospace; - height: 100%; } atom-text-editor[mini] {