From a0c648bc8bbc12d9193edfba46db9a81111b0892 Mon Sep 17 00:00:00 2001 From: calebboyd Date: Thu, 25 Apr 2019 11:46:01 -0500 Subject: [PATCH] chore: set install directory for nasm --- azure-pipelines.yml | 12 ++--- package.json | 1 - src/compiler.ts | 3 ++ tasks/asset-compile.ts | 108 ----------------------------------------- tasks/build.ts | 2 + 5 files changed, 11 insertions(+), 115 deletions(-) delete mode 100644 tasks/asset-compile.ts diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4901af2..f7c3433 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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) diff --git a/package.json b/package.json index 59831e5..115238d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/compiler.ts b/src/compiler.ts index f258928..23f54f7 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -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 diff --git a/tasks/asset-compile.ts b/tasks/asset-compile.ts deleted file mode 100644 index b3880fd..0000000 --- a/tasks/asset-compile.ts +++ /dev/null @@ -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 - }) -} diff --git a/tasks/build.ts b/tasks/build.ts index 905668f..6dee803 100644 --- a/tasks/build.ts +++ b/tasks/build.ts @@ -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() } }