This commit is contained in:
Wliu
2017-01-25 11:13:42 -05:00
parent c76d8cd034
commit 20635a4f4f
8 changed files with 116 additions and 91 deletions

View File

@@ -22,11 +22,21 @@ const apmMetadata = require(path.join(apmRootPath, 'package.json'))
const channel = getChannel()
module.exports = {
appMetadata, apmMetadata, channel,
repositoryRootPath, apmRootPath, scriptRootPath,
buildOutputPath, docsOutputPath, intermediateAppPath, symbolsPath,
electronDownloadPath, atomHomeDirPath, homeDirPath,
getApmBinPath, getNpmBinPath
appMetadata,
apmMetadata,
channel,
repositoryRootPath,
apmRootPath,
scriptRootPath,
buildOutputPath,
docsOutputPath,
intermediateAppPath,
symbolsPath,
electronDownloadPath,
atomHomeDirPath,
homeDirPath,
getApmBinPath,
getNpmBinPath
}
function getChannel () {

View File

@@ -1,5 +1,4 @@
const fs = require('fs-extra')
const path = require('path')
const CONFIG = require('../config')
module.exports = function () {

View File

@@ -18,17 +18,17 @@ module.exports = function (packagedAppPath) {
function getArchiveName () {
switch (process.platform) {
case 'darwin': return 'atom-mac.zip'
case 'win32': return `atom-windows.zip`
default: return `atom-${getLinuxArchiveArch()}.tar.gz`
case 'darwin': return 'atom-mac.zip'
case 'win32': return 'atom-windows.zip'
default: return `atom-${getLinuxArchiveArch()}.tar.gz`
}
}
function getLinuxArchiveArch () {
switch (process.arch) {
case 'ia32': return 'i386'
case 'x64' : return 'amd64'
default: return process.arch
case 'ia32': return 'i386'
case 'x64' : return 'amd64'
default: return process.arch
}
}

View File

@@ -77,16 +77,22 @@ module.exports = function (packagedAppPath) {
const packageSizeInKilobytes = spawnSync('du', ['-sk', packagedAppPath]).stdout.toString().split(/\s+/)[0]
const controlFileTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'debian', 'control.in'))
const controlFileContents = template(controlFileTemplate)({
appFileName: atomExecutableName, version: appVersion, arch: arch,
installedSize: packageSizeInKilobytes, description: appDescription
appFileName: atomExecutableName,
version: appVersion,
arch: arch,
installedSize: packageSizeInKilobytes,
description: appDescription
})
fs.writeFileSync(path.join(debianPackageConfigPath, 'control'), controlFileContents)
console.log(`Writing desktop entry file into "${debianPackageApplicationsDirPath}"`)
const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in'))
const desktopEntryContents = template(desktopEntryTemplate)({
appName: appName, appFileName: atomExecutableName, description: appDescription,
installDir: '/usr', iconPath: atomExecutableName
appName: appName,
appFileName: atomExecutableName,
description: appDescription,
installDir: '/usr',
iconPath: atomExecutableName
})
fs.writeFileSync(path.join(debianPackageApplicationsDirPath, `${atomExecutableName}.desktop`), desktopEntryContents)

View File

@@ -50,16 +50,23 @@ module.exports = function (packagedAppPath) {
const rpmPackageSpecFilePath = path.join(rpmPackageSpecsDirPath, 'atom.spec')
const rpmPackageSpecsTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'redhat', 'atom.spec.in'))
const rpmPackageSpecsContents = template(rpmPackageSpecsTemplate)({
appName: appName, appFileName: atomExecutableName, apmFileName: apmExecutableName,
description: appDescription, installDir: '/usr', version: appVersion
appName: appName,
appFileName: atomExecutableName,
apmFileName: apmExecutableName,
description: appDescription,
installDir: '/usr',
version: appVersion
})
fs.writeFileSync(rpmPackageSpecFilePath, rpmPackageSpecsContents)
console.log(`Writing desktop entry file into "${rpmPackageBuildDirPath}"`)
const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in'))
const desktopEntryContents = template(desktopEntryTemplate)({
appName: appName, appFileName: atomExecutableName, description: appDescription,
installDir: '/usr', iconPath: atomExecutableName
appName: appName,
appFileName: atomExecutableName,
description: appDescription,
installDir: '/usr',
iconPath: atomExecutableName
})
fs.writeFileSync(path.join(rpmPackageBuildDirPath, `${atomExecutableName}.desktop`), desktopEntryContents)

View File

@@ -66,8 +66,11 @@ module.exports = function (packagedAppPath) {
const iconPath = path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'png', '1024.png')
const desktopEntryTemplate = fs.readFileSync(path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.desktop.in'))
const desktopEntryContents = template(desktopEntryTemplate)({
appName, appFileName: atomExecutableName, description: appDescription,
installDir: '/usr', iconPath
appName,
appFileName: atomExecutableName,
description: appDescription,
installDir: '/usr',
iconPath
})
fs.writeFileSync(desktopEntryPath, desktopEntryContents)

View File

@@ -46,33 +46,33 @@ module.exports = function () {
]
})
function cacheCompiledCSS (lessFilePath, importFallbackVariables) {
let lessSource = fs.readFileSync(lessFilePath, 'utf8')
if (importFallbackVariables) {
lessSource = FALLBACK_VARIABLE_IMPORTS + lessSource
}
lessCache.cssForFile(lessFilePath, lessSource)
}
// Cache all styles in static; don't append variable imports
for (let lessFilePath of glob.sync(path.join(CONFIG.intermediateAppPath, 'static', '**', '*.less'))) {
cacheCompiledCSS(lessFilePath, false)
cacheCompiledCSS(lessCache, lessFilePath, false)
}
// Cache styles for all bundled non-theme packages
for (let nonThemePackage of nonThemePackages) {
for (let lessFilePath of glob.sync(path.join(CONFIG.intermediateAppPath, 'node_modules', nonThemePackage, '**', '*.less'))) {
cacheCompiledCSS(lessFilePath, true)
cacheCompiledCSS(lessCache, lessFilePath, true)
}
}
// Cache styles for this UI theme
const uiThemeMainPath = path.join(CONFIG.intermediateAppPath, 'node_modules', uiTheme, 'index.less')
cacheCompiledCSS(uiThemeMainPath, true)
cacheCompiledCSS(lessCache, uiThemeMainPath, true)
// Cache styles for this syntax theme
const syntaxThemeMainPath = path.join(CONFIG.intermediateAppPath, 'node_modules', syntaxTheme, 'index.less')
cacheCompiledCSS(syntaxThemeMainPath, true)
cacheCompiledCSS(lessCache, syntaxThemeMainPath, true)
}
}
function cacheCompiledCSS (lessCache, lessFilePath, importFallbackVariables) {
let lessSource = fs.readFileSync(lessFilePath, 'utf8')
if (importFallbackVariables) {
lessSource = FALLBACK_VARIABLE_IMPORTS + lessSource
}
lessCache.cssForFile(lessFilePath, lessSource)
}
}

File diff suppressed because one or more lines are too long