fix
This commit is contained in:
Vendored
+4
-3
@@ -9,21 +9,22 @@ const path = require("path");
|
|||||||
const semver = require("semver");
|
const semver = require("semver");
|
||||||
const git = require("./git");
|
const git = require("./git");
|
||||||
async function unixInstall(version) {
|
async function unixInstall(version) {
|
||||||
let toolDir = toolCache.find('xmake', version.version);
|
const ver = version.version;
|
||||||
|
let toolDir = toolCache.find('xmake', ver);
|
||||||
if (!toolDir) {
|
if (!toolDir) {
|
||||||
const sourceDir = await core.group(`download xmake ${version}`, () => git.create(version.sha));
|
const sourceDir = await core.group(`download xmake ${version}`, () => git.create(version.sha));
|
||||||
toolDir = await core.group(`install xmake ${version}`, async () => {
|
toolDir = await core.group(`install xmake ${version}`, async () => {
|
||||||
await exec_1.exec('make', ['build'], { cwd: sourceDir });
|
await exec_1.exec('make', ['build'], { cwd: sourceDir });
|
||||||
const binDir = path.join(os.tmpdir(), `xmake-${version.sha}`);
|
const binDir = path.join(os.tmpdir(), `xmake-${version.sha}`);
|
||||||
await exec_1.exec('make', ['install', `prefix=${binDir}`], { cwd: sourceDir });
|
await exec_1.exec('make', ['install', `prefix=${binDir}`], { cwd: sourceDir });
|
||||||
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', version.version);
|
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', ver);
|
||||||
await io.rmRF(binDir);
|
await io.rmRF(binDir);
|
||||||
await git.cleanup(version.sha);
|
await git.cleanup(version.sha);
|
||||||
return cacheDir;
|
return cacheDir;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// for versions 2.3.2 and above, xmake will be installed directly into the bin directory, and no script will be used to wrap it.
|
// for versions 2.3.2 and above, xmake will be installed directly into the bin directory, and no script will be used to wrap it.
|
||||||
if (version.type !== 'tags' || semver.gt(version.version, '2.3.1')) {
|
if (version.type !== 'tags' || semver.gt(ver, '2.3.1')) {
|
||||||
core.addPath(path.join(toolDir, 'bin'));
|
core.addPath(path.join(toolDir, 'bin'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Vendored
+7
-6
@@ -8,14 +8,15 @@ const os = require("os");
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const semver = require("semver");
|
const semver = require("semver");
|
||||||
async function winInstall(version) {
|
async function winInstall(version) {
|
||||||
let toolDir = toolCache.find('xmake', version.version);
|
const ver = version.version;
|
||||||
|
let toolDir = toolCache.find('xmake', ver);
|
||||||
if (!toolDir) {
|
if (!toolDir) {
|
||||||
const installer = await core.group(`download xmake ${version}`, async () => {
|
const installer = await core.group(`download xmake ${version}`, async () => {
|
||||||
let url = '';
|
let url = '';
|
||||||
if (version.type === 'heads') {
|
if (version.type === 'heads') {
|
||||||
// we only use appveyor ci artifacts for branch version
|
// we only use appveyor ci artifacts for branch version
|
||||||
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
|
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
|
||||||
url = `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${version.version}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`;
|
url = `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${ver}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`;
|
||||||
}
|
}
|
||||||
else if (version.type === 'pull') {
|
else if (version.type === 'pull') {
|
||||||
throw new Error('PR builds for windows is not supported');
|
throw new Error('PR builds for windows is not supported');
|
||||||
@@ -23,9 +24,9 @@ async function winInstall(version) {
|
|||||||
else {
|
else {
|
||||||
// we cannot use appveyor ci artifacts, the old version links may be broken.
|
// we cannot use appveyor ci artifacts, the old version links may be broken.
|
||||||
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
||||||
url = semver.gt(version.version, '2.2.6')
|
url = semver.gt(ver, '2.2.6')
|
||||||
? `https://github.com/xmake-io/xmake/releases/download/v${version}/xmake-v${version}.${arch}.exe`
|
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
||||||
: `https://github.com/xmake-io/xmake/releases/download/v${version}/xmake-v${version}.exe`;
|
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
||||||
}
|
}
|
||||||
core.info(`downloading from ${url}`);
|
core.info(`downloading from ${url}`);
|
||||||
const file = await toolCache.downloadTool(url);
|
const file = await toolCache.downloadTool(url);
|
||||||
@@ -39,7 +40,7 @@ async function winInstall(version) {
|
|||||||
core.info(`installing to ${binDir}`);
|
core.info(`installing to ${binDir}`);
|
||||||
await exec_1.exec(`"${installer}" /NOADMIN /S /D=${binDir}`);
|
await exec_1.exec(`"${installer}" /NOADMIN /S /D=${binDir}`);
|
||||||
core.info(`installed to ${binDir}`);
|
core.info(`installed to ${binDir}`);
|
||||||
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', version.version);
|
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', ver);
|
||||||
await io.rmRF(binDir);
|
await io.rmRF(binDir);
|
||||||
await io.rmRF(installer);
|
await io.rmRF(installer);
|
||||||
return cacheDir;
|
return cacheDir;
|
||||||
|
|||||||
+4
-3
@@ -9,21 +9,22 @@ import * as git from './git';
|
|||||||
import { Version } from './versions';
|
import { Version } from './versions';
|
||||||
|
|
||||||
export async function unixInstall(version: Version): Promise<void> {
|
export async function unixInstall(version: Version): Promise<void> {
|
||||||
let toolDir = toolCache.find('xmake', version.version);
|
const ver = version.version;
|
||||||
|
let toolDir = toolCache.find('xmake', ver);
|
||||||
if (!toolDir) {
|
if (!toolDir) {
|
||||||
const sourceDir = await core.group(`download xmake ${version}`, () => git.create(version.sha));
|
const sourceDir = await core.group(`download xmake ${version}`, () => git.create(version.sha));
|
||||||
toolDir = await core.group(`install xmake ${version}`, async () => {
|
toolDir = await core.group(`install xmake ${version}`, async () => {
|
||||||
await exec('make', ['build'], { cwd: sourceDir });
|
await exec('make', ['build'], { cwd: sourceDir });
|
||||||
const binDir = path.join(os.tmpdir(), `xmake-${version.sha}`);
|
const binDir = path.join(os.tmpdir(), `xmake-${version.sha}`);
|
||||||
await exec('make', ['install', `prefix=${binDir}`], { cwd: sourceDir });
|
await exec('make', ['install', `prefix=${binDir}`], { cwd: sourceDir });
|
||||||
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', version.version);
|
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', ver);
|
||||||
await io.rmRF(binDir);
|
await io.rmRF(binDir);
|
||||||
await git.cleanup(version.sha);
|
await git.cleanup(version.sha);
|
||||||
return cacheDir;
|
return cacheDir;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// for versions 2.3.2 and above, xmake will be installed directly into the bin directory, and no script will be used to wrap it.
|
// for versions 2.3.2 and above, xmake will be installed directly into the bin directory, and no script will be used to wrap it.
|
||||||
if (version.type !== 'tags' || semver.gt(version.version, '2.3.1')) {
|
if (version.type !== 'tags' || semver.gt(ver, '2.3.1')) {
|
||||||
core.addPath(path.join(toolDir, 'bin'));
|
core.addPath(path.join(toolDir, 'bin'));
|
||||||
} else {
|
} else {
|
||||||
core.addPath(path.join(toolDir, 'share', 'xmake')); // only for <= 2.3.1
|
core.addPath(path.join(toolDir, 'share', 'xmake')); // only for <= 2.3.1
|
||||||
|
|||||||
+7
-6
@@ -8,22 +8,23 @@ import * as semver from 'semver';
|
|||||||
import { Version } from './versions';
|
import { Version } from './versions';
|
||||||
|
|
||||||
export async function winInstall(version: Version): Promise<void> {
|
export async function winInstall(version: Version): Promise<void> {
|
||||||
let toolDir = toolCache.find('xmake', version.version);
|
const ver = version.version;
|
||||||
|
let toolDir = toolCache.find('xmake', ver);
|
||||||
if (!toolDir) {
|
if (!toolDir) {
|
||||||
const installer = await core.group(`download xmake ${version}`, async () => {
|
const installer = await core.group(`download xmake ${version}`, async () => {
|
||||||
let url = '';
|
let url = '';
|
||||||
if (version.type === 'heads') {
|
if (version.type === 'heads') {
|
||||||
// we only use appveyor ci artifacts for branch version
|
// we only use appveyor ci artifacts for branch version
|
||||||
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
|
const arch = os.arch() === 'x64' ? 'x64' : 'x86';
|
||||||
url = `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${version.version}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`;
|
url = `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${ver}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`;
|
||||||
} else if (version.type === 'pull') {
|
} else if (version.type === 'pull') {
|
||||||
throw new Error('PR builds for windows is not supported');
|
throw new Error('PR builds for windows is not supported');
|
||||||
} else {
|
} else {
|
||||||
// we cannot use appveyor ci artifacts, the old version links may be broken.
|
// we cannot use appveyor ci artifacts, the old version links may be broken.
|
||||||
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
||||||
url = semver.gt(version.version, '2.2.6')
|
url = semver.gt(ver, '2.2.6')
|
||||||
? `https://github.com/xmake-io/xmake/releases/download/v${version}/xmake-v${version}.${arch}.exe`
|
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
||||||
: `https://github.com/xmake-io/xmake/releases/download/v${version}/xmake-v${version}.exe`;
|
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
||||||
}
|
}
|
||||||
core.info(`downloading from ${url}`);
|
core.info(`downloading from ${url}`);
|
||||||
const file = await toolCache.downloadTool(url);
|
const file = await toolCache.downloadTool(url);
|
||||||
@@ -37,7 +38,7 @@ export async function winInstall(version: Version): Promise<void> {
|
|||||||
core.info(`installing to ${binDir}`);
|
core.info(`installing to ${binDir}`);
|
||||||
await exec(`"${installer}" /NOADMIN /S /D=${binDir}`);
|
await exec(`"${installer}" /NOADMIN /S /D=${binDir}`);
|
||||||
core.info(`installed to ${binDir}`);
|
core.info(`installed to ${binDir}`);
|
||||||
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', version.version);
|
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', ver);
|
||||||
await io.rmRF(binDir);
|
await io.rmRF(binDir);
|
||||||
await io.rmRF(installer);
|
await io.rmRF(installer);
|
||||||
return cacheDir;
|
return cacheDir;
|
||||||
|
|||||||
Reference in New Issue
Block a user