fix
This commit is contained in:
Vendored
+17
-20
@@ -18,18 +18,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.unixInstall = void 0;
|
exports.unixInstall = void 0;
|
||||||
const core_1 = __importDefault(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const exec_1 = require("@actions/exec");
|
const exec_1 = require("@actions/exec");
|
||||||
const io_1 = __importDefault(require("@actions/io"));
|
const io = __importStar(require("@actions/io"));
|
||||||
const tool_cache_1 = __importDefault(require("@actions/tool-cache"));
|
const toolCache = __importStar(require("@actions/tool-cache"));
|
||||||
const os_1 = __importDefault(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path_1 = __importDefault(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const semver_1 = __importDefault(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
const git = __importStar(require("./git"));
|
const git = __importStar(require("./git"));
|
||||||
async function install(sourceDir, binDir) {
|
async function install(sourceDir, binDir) {
|
||||||
await exec_1.exec('make', ['build'], { cwd: sourceDir });
|
await exec_1.exec('make', ['build'], { cwd: sourceDir });
|
||||||
@@ -39,31 +36,31 @@ async function unixInstall(version) {
|
|||||||
let toolDir;
|
let toolDir;
|
||||||
if (version.type !== 'local') {
|
if (version.type !== 'local') {
|
||||||
const ver = version.version;
|
const ver = version.version;
|
||||||
toolDir = tool_cache_1.default.find('xmake', ver);
|
toolDir = toolCache.find('xmake', ver);
|
||||||
if (!toolDir) {
|
if (!toolDir) {
|
||||||
const sourceDir = await core_1.default.group(`download xmake ${String(version)}`, () => git.create(version.repo, version.sha));
|
const sourceDir = await core.group(`download xmake ${String(version)}`, () => git.create(version.repo, version.sha));
|
||||||
toolDir = await core_1.default.group(`install xmake ${String(version)}`, async () => {
|
toolDir = await core.group(`install xmake ${String(version)}`, async () => {
|
||||||
const binDir = path_1.default.join(os_1.default.tmpdir(), `xmake-${version.sha}`);
|
const binDir = path.join(os.tmpdir(), `xmake-${version.sha}`);
|
||||||
await install(sourceDir, binDir);
|
await install(sourceDir, binDir);
|
||||||
const cacheDir = await tool_cache_1.default.cacheDir(binDir, 'xmake', ver);
|
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', ver);
|
||||||
await io_1.default.rmRF(binDir);
|
await io.rmRF(binDir);
|
||||||
await git.cleanup(version.sha);
|
await git.cleanup(version.sha);
|
||||||
return cacheDir;
|
return cacheDir;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
toolDir = await core_1.default.group(`install local xmake at '${version.path}'`, async () => {
|
toolDir = await core.group(`install local xmake at '${version.path}'`, async () => {
|
||||||
const binDir = path_1.default.join(os_1.default.tmpdir(), `xmake-${Date.now()}`);
|
const binDir = path.join(os.tmpdir(), `xmake-${Date.now()}`);
|
||||||
await install(version.path, binDir);
|
await install(version.path, binDir);
|
||||||
return binDir;
|
return binDir;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (version.type !== 'tags' || semver_1.default.gt(version.version, '2.3.1')) {
|
if (version.type !== 'tags' || semver.gt(version.version, '2.3.1')) {
|
||||||
core_1.default.addPath(path_1.default.join(toolDir, 'bin'));
|
core.addPath(path.join(toolDir, 'bin'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core_1.default.addPath(path_1.default.join(toolDir, 'share', 'xmake'));
|
core.addPath(path.join(toolDir, 'share', 'xmake'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.unixInstall = unixInstall;
|
exports.unixInstall = unixInstall;
|
||||||
|
|||||||
Vendored
+6
-9
@@ -31,17 +31,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|||||||
}
|
}
|
||||||
return privateMap.get(receiver);
|
return privateMap.get(receiver);
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
var _string;
|
var _string;
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.selectVersion = void 0;
|
exports.selectVersion = void 0;
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const semver_1 = __importDefault(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
const git_1 = require("./git");
|
const git_1 = require("./git");
|
||||||
const interfaces_1 = require("./interfaces");
|
const interfaces_1 = require("./interfaces");
|
||||||
const path_1 = __importDefault(require("path"));
|
const p = __importStar(require("path"));
|
||||||
const DEFAULT_REPO = interfaces_1.Repo('xmake-io/xmake');
|
const DEFAULT_REPO = interfaces_1.Repo('xmake-io/xmake');
|
||||||
const VERSIONS = new Map();
|
const VERSIONS = new Map();
|
||||||
async function getVersions(repo) {
|
async function getVersions(repo) {
|
||||||
@@ -70,7 +67,7 @@ class LocalVersionImpl {
|
|||||||
constructor(path) {
|
constructor(path) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.type = 'local';
|
this.type = 'local';
|
||||||
this.path = path_1.default.resolve(path);
|
this.path = p.resolve(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function selectBranch(repo, branch) {
|
async function selectBranch(repo, branch) {
|
||||||
@@ -93,12 +90,12 @@ async function selectPr(repo, pr) {
|
|||||||
throw new Error(`Pull requrest #${pr} not found`);
|
throw new Error(`Pull requrest #${pr} not found`);
|
||||||
}
|
}
|
||||||
async function selectSemver(repo, version) {
|
async function selectSemver(repo, version) {
|
||||||
const v = new semver_1.default.Range(version);
|
const v = new semver.Range(version);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
throw new Error(`Invalid semver`);
|
throw new Error(`Invalid semver`);
|
||||||
}
|
}
|
||||||
const versions = await getVersions(repo);
|
const versions = await getVersions(repo);
|
||||||
const ver = semver_1.default.maxSatisfying(Object.keys(versions.tags), v);
|
const ver = semver.maxSatisfying(Object.keys(versions.tags), v);
|
||||||
if (!ver) {
|
if (!ver) {
|
||||||
throw new Error(`No matched releases of xmake-version ${v.format()}`);
|
throw new Error(`No matched releases of xmake-version ${v.format()}`);
|
||||||
}
|
}
|
||||||
@@ -159,7 +156,7 @@ async function selectVersion(version) {
|
|||||||
const sha = version.substr('sha@'.length);
|
const sha = version.substr('sha@'.length);
|
||||||
ret = await selectSha(repo, sha);
|
ret = await selectSha(repo, sha);
|
||||||
}
|
}
|
||||||
if (semver_1.default.validRange(version)) {
|
if (semver.validRange(version)) {
|
||||||
ret = await selectSemver(repo, version);
|
ret = await selectSemver(repo, version);
|
||||||
}
|
}
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|||||||
+6
-6
@@ -1,10 +1,10 @@
|
|||||||
import core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { exec } from '@actions/exec';
|
import { exec } from '@actions/exec';
|
||||||
import io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import toolCache from '@actions/tool-cache';
|
import * as toolCache from '@actions/tool-cache';
|
||||||
import os from 'os';
|
import * as os from 'os';
|
||||||
import path from 'path';
|
import * as path from 'path';
|
||||||
import semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as git from './git';
|
import * as git from './git';
|
||||||
import { Version } from './interfaces';
|
import { Version } from './interfaces';
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import { lsRemote } from './git';
|
import { lsRemote } from './git';
|
||||||
import { RefDic, Sha, Version, Repo, GitVersion, LocalVersion } from './interfaces';
|
import { RefDic, Sha, Version, Repo, GitVersion, LocalVersion } from './interfaces';
|
||||||
import p from 'path';
|
import * as p from 'path';
|
||||||
|
|
||||||
const DEFAULT_REPO = Repo('xmake-io/xmake');
|
const DEFAULT_REPO = Repo('xmake-io/xmake');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user