mirror of
https://github.com/atom/atom.git
synced 2026-02-03 03:05:05 -05:00
Merge branch 'master' into ns-use-display-layers
This commit is contained in:
30
build/tasks/mktar-task.coffee
Normal file
30
build/tasks/mktar-task.coffee
Normal file
@@ -0,0 +1,30 @@
|
||||
path = require 'path'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
{spawn, fillTemplate} = require('./task-helpers')(grunt)
|
||||
|
||||
grunt.registerTask 'mktar', 'Create an archive', ->
|
||||
done = @async()
|
||||
|
||||
appFileName = grunt.config.get('atom.appFileName')
|
||||
buildDir = grunt.config.get('atom.buildDir')
|
||||
shellAppDir = grunt.config.get('atom.shellAppDir')
|
||||
{version, description} = grunt.config.get('atom.metadata')
|
||||
|
||||
if process.arch is 'ia32'
|
||||
arch = 'i386'
|
||||
else if process.arch is 'x64'
|
||||
arch = 'amd64'
|
||||
else
|
||||
return done("Unsupported arch #{process.arch}")
|
||||
|
||||
iconPath = path.join(shellAppDir, 'resources', 'app.asar.unpacked', 'resources', 'atom.png')
|
||||
|
||||
cmd = path.join('script', 'mktar')
|
||||
args = [appFileName, version, arch, iconPath, buildDir]
|
||||
spawn {cmd, args}, (error) ->
|
||||
if error?
|
||||
done(error)
|
||||
else
|
||||
grunt.log.ok "Created " + path.join(buildDir, "#{appFileName}-#{version}-#{arch}.tar.gz")
|
||||
done()
|
||||
@@ -85,13 +85,13 @@ getAssets = ->
|
||||
arch = 'amd64'
|
||||
|
||||
# Check for a Debian build
|
||||
sourcePath = "#{buildDir}/#{appFileName}-#{version}-#{arch}.deb"
|
||||
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 = "#{buildDir}/rpm/#{rpmName}"
|
||||
sourcePath = path.join(buildDir, "rpm", rpmName)
|
||||
if process.arch is 'ia32'
|
||||
arch = 'i386'
|
||||
else
|
||||
@@ -99,10 +99,17 @@ getAssets = ->
|
||||
assetName = "atom.#{arch}.rpm"
|
||||
|
||||
cp sourcePath, path.join(buildDir, assetName)
|
||||
assets = [{assetName, sourcePath}]
|
||||
|
||||
[
|
||||
{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)
|
||||
|
||||
Reference in New Issue
Block a user