Dump symbols and make them build artifacts

This commit is contained in:
Antonio Scandurra
2016-08-01 17:22:30 +02:00
parent 6e75c99ea2
commit ce8c86362f
5 changed files with 45 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ require('coffee-script/register')
const cleanOutputDirectory = require('./lib/clean-output-directory')
const copyAssets = require('./lib/copy-assets')
const dumpSymbols = require('./lib/dump-symbols')
const generateMetadata = require('./lib/generate-metadata')
const generateModuleCache = require('./lib/generate-module-cache')
const packageApplication = require('./lib/package-application')
@@ -25,5 +26,5 @@ transpilePegJsPaths()
generateModuleCache()
prebuildLessCache()
generateMetadata()
packageApplication()
writeFingerprint()
dumpSymbols().then(packageApplication)

View File

@@ -13,12 +13,13 @@ const channel = getChannel()
const repositoryRootPath = path.resolve(__dirname, '..')
const buildOutputPath = path.join(repositoryRootPath, 'out')
const intermediateAppPath = path.join(buildOutputPath, 'app')
const symbolsPath = path.join(buildOutputPath, 'symbols')
const cachePath = path.join(repositoryRootPath, 'cache')
const homeDirPath = process.env.HOME || process.env.USERPROFILE
module.exports = {
appMetadata, apmMetadata, channel,
repositoryRootPath, buildOutputPath, intermediateAppPath,
repositoryRootPath, buildOutputPath, intermediateAppPath, symbolsPath,
cachePath, homeDirPath
}

36
build/lib/dump-symbols.js Normal file
View File

@@ -0,0 +1,36 @@
const fs = require('fs-extra')
const glob = require('glob')
const minidump = require('minidump')
const path = require('path')
const CONFIG = require('../config')
module.exports = function () {
console.log(`Dumping symbols in ${CONFIG.symbolsPath}...`)
const binaryPaths = glob.sync(path.join(CONFIG.intermediateAppPath, 'node_modules', '**', '*.node'))
return Promise.all(binaryPaths.map(dumpSymbol))
}
function dumpSymbol (binaryPath) {
return new Promise(function (resolve, reject) {
minidump.dumpSymbol(binaryPath, function (error, content) {
if (error) {
reject(error)
throw new Error(error)
} else {
const moduleLine = /MODULE [^ ]+ [^ ]+ ([0-9A-F]+) (.*)\n/.exec(content)
if (moduleLine.length !== 3) {
reject()
throw new Error(`Invalid output when dumping symbol for ${binaryPath}`)
} else {
const filename = moduleLine[2]
const symbolDirPath = path.join(CONFIG.symbolsPath, filename, moduleLine[1])
const symbolFilePath = path.join(symbolDirPath, `${filename}.sym`)
fs.mkdirpSync(symbolDirPath)
fs.writeFileSync(symbolFilePath)
resolve()
}
}
})
})
}

View File

@@ -10,6 +10,7 @@
"fs-extra": "0.30.0",
"glob": "7.0.3",
"legal-eagle": "0.13.0",
"minidump": "0.9.0",
"mkdirp": "0.5.1",
"normalize-package-data": "2.3.5",
"npm": "3.10.5",

View File

@@ -9,7 +9,8 @@ machine:
general:
artifacts:
- out/Atom.zip
- out/atom-mac.zip
- out/atom-mac-symbols.zip
dependencies:
pre:
@@ -23,7 +24,8 @@ dependencies:
- build/build.js
post:
- zip -r out/Atom.zip out/Atom-darwin-x64
- cd out/Atom-darwin-x64 && zip -r ../atom-mac.zip ./Atom.app && cd -
- cd out && zip -r ./atom-mac-symbols.zip ./symbols && cd -
cache_directories:
- cache