Merge branch 'master' into ns-modernize-build

This commit is contained in:
Antonio Scandurra
2016-07-27 15:18:10 +02:00
18 changed files with 125 additions and 51 deletions

View File

@@ -13,14 +13,8 @@ compiler: clang
matrix:
include:
- os: linux
env: NODE_VERSION=0.12
- os: linux
env: NODE_VERSION=4
- os: osx
env: ATOM_SPECS_TASK=core NODE_VERSION=0.12
- os: osx
env: ATOM_SPECS_TASK=packages NODE_VERSION=0.12
sudo: false
@@ -28,16 +22,15 @@ install:
- git clone https://github.com/creationix/nvm.git /tmp/.nvm
- source /tmp/.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- nvm use --delete-prefix $NODE_VERSION
script: script/cibuild
cache:
directories:
- node_modules
- build/node_modules
- apm/node_modules
- $HOME/.atom/compile-cache
- build/node_modules
notifications:
email:
@@ -46,8 +39,11 @@ notifications:
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- build-essential
- git
- libgnome-keyring-dev
- fakeroot
- gcc-multilib

View File

@@ -2,7 +2,7 @@
# DESCRIPTION: Image to build Atom and create a .rpm file
# Base docker image
FROM fedora:21
FROM nodesource/fedora21:4.2.6
# Install dependencies
RUN yum install -y \
@@ -12,11 +12,9 @@ RUN yum install -y \
glibc-devel \
git-core \
libgnome-keyring-devel \
rpmdevtools \
nodejs \
npm
rpmdevtools
RUN npm install -g npm@1.4.28 --loglevel error
RUN npm install -g npm --loglevel error
ADD . /atom
WORKDIR /atom

View File

@@ -1,6 +1,6 @@
![Atom](https://cloud.githubusercontent.com/assets/72919/2874231/3af1db48-d3dd-11e3-98dc-6066f8bc766f.png)
[![macOS Build Status](https://travis-ci.org/atom/atom.svg?branch=master)](https://travis-ci.org/atom/atom) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/1tkktwh654w07eim?svg=true)](https://ci.appveyor.com/project/Atom/atom)
[![macOS Build Status](https://circleci.com/gh/atom/atom.svg?style=svg)](https://circleci.com/gh/atom/atom) [![Linux Build Status](https://travis-ci.org/atom/atom.svg?branch=master)](https://travis-ci.org/atom/atom) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/1tkktwh654w07eim?svg=true)](https://ci.appveyor.com/project/Atom/atom)
[![Dependency Status](https://david-dm.org/atom/atom.svg)](https://david-dm.org/atom/atom)
[![Join the Atom Community on Slack](http://atom-slack.herokuapp.com/badge.svg)](http://atom-slack.herokuapp.com/)

View File

@@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "1.10.0"
"atom-package-manager": "1.12.5"
}
}

View File

@@ -1,9 +1,5 @@
version: "{build}"
branches:
only:
- master
skip_tags: true
clone_folder: c:\projects\atom
clone_depth: 10
@@ -16,9 +12,10 @@ environment:
ATOM_DEV_RESOURCE_PATH: c:\projects\atom
ATOM_ACCESS_TOKEN:
secure: Q7vxmSq0bVCLTTRPzXw5ZhPTe7XYhWxX0tQV6neEkddTH6pZkOYNmSCG6VnMX2f+
ATOM_NOISY_BUILD: 1
matrix:
- NODE_VERSION: 0.10.35
- NODE_VERSION: 4.4.5
install:
- SET PATH=C:\Program Files\Atom\resources\cli;%PATH%
@@ -37,6 +34,9 @@ artifacts:
name: AtomSetup.msi
cache:
- '%APPVEYOR_BUILD_FOLDER%\build\node_modules'
- '%APPVEYOR_BUILD_FOLDER%\apm\node_modules'
- '%APPVEYOR_BUILD_FOLDER%\node_modules'
- '%USERPROFILE%\.atom\.apm'
- '%USERPROFILE%\.atom\.node-gyp\.atom'
- '%USERPROFILE%\.atom\.npm'

View File

@@ -14,6 +14,8 @@ _ = 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')

View File

@@ -40,6 +40,8 @@ module.exports = (grunt) ->
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?

View File

@@ -34,7 +34,12 @@ module.exports = (gruntObject) ->
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'
return unless releaseBranch?
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()
@@ -119,6 +124,7 @@ logError = (message, error, 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}\""
@@ -136,6 +142,7 @@ zipAssets = (buildDir, assets, callback) ->
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?
@@ -154,12 +161,14 @@ getAtomDraftRelease = (isPrerelease, branchName, callback) ->
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"
@@ -185,6 +194,7 @@ createAtomDraftRelease = (isPrerelease, branchName, callback) ->
callback(null, body)
deleteRelease = (release) ->
grunt.log.ok("Deleting GitHub release #{release.tag_name}")
options =
uri: release.url
method: 'DELETE'
@@ -195,6 +205,7 @@ deleteRelease = (release) ->
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) ->
@@ -216,6 +227,7 @@ deleteExistingAssets = (release, assetNames, 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'
@@ -248,6 +260,7 @@ uploadAssets = (release, buildDir, assets, callback) ->
s3 = new AWS.S3 s3Info
key = "releases/#{release.tag_name}/#{assetName}"
grunt.log.ok("Uploading to S3 #{key}")
uploadParams =
Bucket: s3Bucket
ACL: 'public-read'

View File

@@ -1,4 +1,38 @@
machine:
environment:
XCODE_SCHEME: test
XCODE_WORKSPACE: test
XCODE_PROJECT: test
xcode:
version: 7.3
general:
branches:
only:
- io-circle-ci
artifacts:
- out/Atom.zip
dependencies:
pre:
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
- nvm install 4.4.7
- nvm use 4.4.7
- npm install -g npm
- script/fingerprint-clean
override:
- script/bootstrap
post:
- script/fingerprint-write
cache_directories:
- apm/node_modules
- build/node_modules
- node_modules
test:
override:
- script/grunt ci
post:
- zip -r out/Atom.zip out/Atom.app

View File

@@ -75,7 +75,7 @@ function bootstrap() {
var buildInstallCommand = initialNpmCommand + npmFlags + 'install';
var buildInstallOptions = {cwd: path.resolve(__dirname, '..', 'build')};
var apmInstallCommand = npmPath + npmFlags + '--target=0.10.40 ' + 'install';
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;
@@ -97,7 +97,7 @@ function bootstrap() {
}
var moduleInstallOptions = {env: moduleInstallEnv};
if (process.argv.indexOf('--no-quiet') === -1) {
if (process.argv.indexOf('--no-quiet') === -1 || process.env.ATOM_NOISY_BUILD) {
buildInstallCommand += ' --loglevel error';
apmInstallCommand += ' --loglevel error';
moduleInstallCommand += ' --loglevel error';
@@ -122,11 +122,6 @@ function bootstrap() {
message: 'Installing apm...',
options: apmInstallOptions
},
{
command: apmPath + ' clean' + apmFlags,
message: 'Deleting old packages...',
options: moduleInstallOptions
},
{
command: moduleInstallCommand,
options: moduleInstallOptions

View File

@@ -40,10 +40,6 @@ function setEnvironmentVariables() {
process.env.CC = 'clang';
process.env.CXX = 'clang++';
process.env.npm_config_clang = '1';
} else if (process.platform === 'win32') {
process.env.BUILD_ATOM_RELEASES_S3_KEY = process.env.BUILD_ATOM_WIN_RELEASES_S3_KEY
process.env.BUILD_ATOM_RELEASES_S3_SECRET = process.env.BUILD_ATOM_WIN_RELEASES_S3_SECRET
process.env.BUILD_ATOM_RELEASES_S3_BUCKET = process.env.BUILD_ATOM_WIN_RELEASES_S3_BUCKET
}
}

View File

@@ -7,10 +7,11 @@ 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
if [ -d /usr/local/share/nodenv ]; then
export NODENV_ROOT=/usr/local/share/nodenv
export PATH=/usr/local/share/nodenv/bin:/usr/local/share/nodenv/shims:$PATH
export NODENV_VERSION="v0.10.21"
fi
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

29
script/fingerprint-clean Executable file
View File

@@ -0,0 +1,29 @@
#!/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)
}

2
script/fingerprint-write Executable file
View File

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

View File

@@ -6,12 +6,14 @@ var fingerprintPath = path.resolve(__dirname, '..', '..', 'node_modules', '.atom
module.exports = {
fingerprint: function () {
var packageJson = fs.readFileSync(path.resolve(__dirname, '..', '..', 'package.json'))
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(packageJson).electronVersion.replace(/\.\d+$/, '')
var electronVersion = JSON.parse(atomPackageJson).electronVersion.replace(/\.\d+$/, '')
var apmVersion = JSON.parse(apmPackageJson).dependencies['atom-package-manager']
var body = electronVersion + process.platform + process.version
var body = electronVersion + apmVersion + process.platform + process.version
return crypto.createHash('sha1').update(body).digest('hex')
},

View File

@@ -786,9 +786,10 @@ class Config
rootSchema = properties[key]
Object.assign rootSchema, schema
@setDefaults(keyPath, @extractDefaultsFromSchema(schema))
@setScopedDefaultsFromSchema(keyPath, schema)
@resetSettingsForSchemaChange()
@transact =>
@setDefaults(keyPath, @extractDefaultsFromSchema(schema))
@setScopedDefaultsFromSchema(keyPath, schema)
@resetSettingsForSchemaChange()
load: ->
@initializeConfigDirectory()
@@ -958,9 +959,10 @@ class Config
setDefaults: (keyPath, defaults) ->
if defaults? and isPlainObject(defaults)
keys = splitKeyPath(keyPath)
for key, childValue of defaults
continue unless defaults.hasOwnProperty(key)
@setDefaults(keys.concat([key]).join('.'), childValue)
@transact =>
for key, childValue of defaults
continue unless defaults.hasOwnProperty(key)
@setDefaults(keys.concat([key]).join('.'), childValue)
else
try
defaults = @makeValueConformToSchema(keyPath, defaults)

View File

@@ -4,6 +4,7 @@ module.exports = (extra) ->
crashReporter.start({
productName: 'Atom',
companyName: 'GitHub',
submitURL: 'http://54.249.141.255:1127/post'
submitURL: 'https://crashreporter.atom.io',
autoSubmit: false,
extra: extra
})

View File

@@ -159,6 +159,7 @@ class Package
# TODO: Remove. Settings view calls this method currently.
activateConfig: ->
return if @configSchemaRegisteredOnLoad
@requireMainModule()
@registerConfigSchemaFromMainModule()