chore: set install directory for nasm

This commit is contained in:
calebboyd
2019-04-25 11:46:01 -05:00
parent 463595f502
commit a0c648bc8b
5 changed files with 11 additions and 115 deletions
+6 -6
View File
@@ -17,10 +17,12 @@ jobs:
vmImage: $(imageName)
steps:
- task: UsePythonVersion@0
displayName: Setup Python
inputs:
versionSpec: '2.7'
architecture: 'x64'
- task: NodeTool@0
displayName: Install Node
inputs:
versionSpec: '10.x'
- script: sudo apt-get install -y libc6-dev-i386 gcc-multilib g++-multilib
@@ -29,13 +31,11 @@ jobs:
- script: choco install visualcpp-build-tools --version 14.0.25420.1 -fy && npm config set msvs_version 2015
condition: startsWith(variables['Agent.JobName'], 'windows_2015')
displayName: Install Windows Build Dependencies
- script: choco install nasm -fy --dir nasm && cd nasm && dir
- script: choco install nasm -fy
displayName: Install Windows Assembler (NASM)
condition: startsWith(variables['Agent.JobName'], 'windows')
displayName: Install Windows Assembler
- script: echo '##vso[task.prependpath]%AGENT_BUILDDIRECTORY%\nasm' && nasm -v
condition: startsWith(variables['Agent.JobName'], 'windows')
displayName: Add Windows Assembler to PATH
- script: npm install && npm run ci:build
displayName: Install dependencies and build base binaries...
displayName: Build Nexe
env:
GITHUB_TOKEN: $(PersonalGithubToken)
NEXE_VERBOSE: $(NEXE_VERBOSE)
-1
View File
@@ -10,7 +10,6 @@
],
"scripts": {
"ci:build": "ts-node tasks/build",
"asset-compile": "ts-node tasks/asset-compile",
"test": "mocha",
"lint": "tslint \"{src,plugins,tasks}/**/*.ts\" --fix",
"prepare": "npm run lint && npm run build && npm test",
+3
View File
@@ -237,6 +237,9 @@ export class NexeCompiler {
}
private _configureAsync() {
if (isWindows && semverGt(this.target.version, '11.999')) {
return Promise.resolve()
}
return this._runBuildCommandAsync(this.env.PYTHON || 'python', [
this.configureScript,
...this.options.configure
-108
View File
@@ -1,108 +0,0 @@
const huh = require('wtfnode')
import * as nexe from '../lib/nexe'
import { getUnBuiltReleases, getLatestGitRelease } from '../lib/releases'
import * as ci from './ci'
import { runDockerBuild } from './docker'
import { getTarget, targetsEqual } from '../lib/target'
import { pathExistsAsync, readFileAsync, execFileAsync } from '../lib/util'
import got = require('got')
const env = process.env,
branchName = env.CIRCLE_BRANCH || env.APPVEYOR_REPO_BRANCH || env.TRAVIS_BRANCH || '',
isScheduled = Boolean(env.APPVEYOR_SCHEDULED_BUILD || env.NEXE_TRIGGERED),
isWindows = Boolean(env.APPVEYOR),
isPullRequest =
Boolean(env.CIRCLE_PR_NUMBER) ||
Boolean(env.APPVEYOR_PULL_REQUEST_NUMBER) ||
Boolean(env.TRAVIS_PULL_REQUEST_BRANCH),
headers = {
Authorization: 'token ' + env.GITHUB_TOKEN,
'User-Agent': 'nexe (https://www.npmjs.com/package/nexe)'
}
if (require.main === module) {
if (!isPullRequest) {
build().catch(x => {
console.error(x)
process.exit(1)
})
}
}
async function build() {
if (isScheduled) {
const releases = await getUnBuiltReleases({ headers })
if (!releases.length) {
return
}
const windowsBuild = releases.find(x => x.platform === 'windows')
const macBuild = releases.find(x => x.platform === 'mac')
const linuxOrAlpine = releases.find(x => x.platform === 'linux' || x.platform === 'alpine')
if (linuxOrAlpine) {
await ci.triggerDockerBuild(linuxOrAlpine, branchName)
}
if (macBuild) {
await ci.triggerMacBuild(macBuild, branchName)
}
if (windowsBuild) {
await ci.triggerWindowsBuild(windowsBuild)
}
}
if (env.NEXE_VERSION) {
const target = getTarget(env.NEXE_VERSION),
output = isWindows ? './out.exe' : './out',
options = {
empty: true,
build: true,
target,
output
}
console.log('Building: ', target)
const stop = keepalive()
if (['arm7l', 'arm6l', 'arm64', 'alpine'].includes(target.platform)) {
await runDockerBuild(target)
} else {
await nexe.compile(options)
}
stop()
if (await pathExistsAsync(output)) {
await assertNexeBinary(output)
const gitRelease = await getLatestGitRelease({ headers })
const unbuiltReleases = await getUnBuiltReleases({ headers })
if (!unbuiltReleases.some(x => targetsEqual(x, target))) {
console.log(`${target} already uploaded.`)
return
}
await got(gitRelease.upload_url.split('{')[0], {
query: { name: target.toString() },
body: await readFileAsync(output),
headers: {
...headers,
'Content-Type': 'application/octet-stream'
}
}).catch(reason => {
console.log(reason && reason.response && reason.response.body)
throw reason
})
console.log(target + ' uploaded.')
huh.dump()
}
}
}
function keepalive() {
const keepalive = setInterval(() => console.log('Building...'), 300 * 1000)
return () => clearInterval(keepalive)
}
function assertNexeBinary(file: string) {
return execFileAsync(file).catch(e => {
if (e && e.stack && e.stack.includes('Invalid Nexe binary')) {
return
}
throw e
})
}
+2
View File
@@ -1,3 +1,4 @@
const huh = require('wtfnode')
import * as nexe from '../lib/nexe'
import { getUnBuiltReleases, getLatestGitRelease } from '../lib/releases'
import { runDockerBuild } from './docker'
@@ -94,6 +95,7 @@ async function build() {
throw reason
})
console.log(target + ' uploaded.')
huh.dump()
}
}