Delete old build and script dirs

This commit is contained in:
Nathan Sobo
2016-08-25 08:27:33 -06:00
parent f3d05f9adc
commit 865d9f395b
68 changed files with 0 additions and 5280 deletions

View File

@@ -1 +0,0 @@
cache = ~/.atom/.npm

View File

@@ -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?

View File

@@ -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.

Binary file not shown.

View File

@@ -1,50 +0,0 @@
# VERSION: 0.1
# DESCRIPTION: Create the atom editor in a container
# AUTHOR: Jessica Frazelle <jessie@docker.com>
# 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 <jessie@docker.com>
# 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

File diff suppressed because it is too large Load Diff

View File

@@ -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)

View File

@@ -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"
}
}

View File

@@ -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...)

View File

@@ -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()

View File

@@ -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')

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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()
})
}

View File

@@ -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()

View File

@@ -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

View File

@@ -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))

View File

@@ -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')

View File

@@ -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 <dev@learnboost.com>
* MIT Licensed
*/
<content omitted>
"""
'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: """
<content omitted>
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 <arturadib@gmail.com>
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.
"""

View File

@@ -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)

View File

@@ -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()

View File

@@ -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()

View File

@@ -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())

View File

@@ -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}"

View File

@@ -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()

View File

@@ -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}")

View File

@@ -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}"

View File

@@ -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

View File

@@ -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")

View File

@@ -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)

View File

@@ -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)

View File

@@ -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()

View File

@@ -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)

View File

@@ -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)

View File

@@ -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();
});

View File

@@ -1,6 +0,0 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\bootstrap" %*
) ELSE (
node "%~dp0\bootstrap" %*
)

View File

@@ -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);
});

View File

@@ -1,5 +0,0 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\build" %*
) ELSE (
node "%~dp0\build" %*
)

View File

@@ -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);
});
})();
})();

View File

@@ -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

View File

@@ -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

View File

@@ -1,5 +0,0 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\cibuild" %*
) ELSE (
node "%~dp0\cibuild" %*
)

View File

@@ -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);
};

View File

@@ -1,5 +0,0 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\clean" %*
) ELSE (
node "%~dp0\clean" %*
)

View File

@@ -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

View File

@@ -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)
}

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env node
require('./utils/fingerprint').writeFingerprint()

View File

@@ -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);

View File

@@ -1,5 +0,0 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\grunt" %*
) ELSE (
node "%~dp0\grunt" %*
)

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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()
}
}

View File

@@ -1,6 +0,0 @@
#!/bin/sh
set -e
script/build
script/grunt mkrpm publish-build --stack --no-color --install-dir /usr

View File

@@ -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"

View File

@@ -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);
});

View File

@@ -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);
});
}

View File

@@ -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

View File

@@ -1,2 +0,0 @@
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
killall Finder

View File

@@ -1,3 +0,0 @@
#!/bin/sh
coffee -c -o /Applications/Atom.app/Contents/Resources/app/src/ src/main.coffee

View File

@@ -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()
}
}

View File

@@ -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

View File

@@ -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);
};

View File

@@ -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

View File

@@ -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);
});
}