Skip to content

Commit

Permalink
fix: Use push instead of concat for building commands
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Mar 27, 2024
1 parent c40a28b commit e2aa60e
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 77 deletions.
10 changes: 3 additions & 7 deletions dist/build-crates-debian-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128404,14 +128404,10 @@ async function installBinaryCached(name) {
async function build(path, target) {
const crossContents = await fs.readFile(join(path, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents);
if (target == undefined) {
target ??= hostTarget();
}
else {
sh(`rustup target add ${target}`, { cwd: path });
}
target ??= hostTarget();
sh(`rustup target add ${target}`, { cwd: path });
const command = target in crossManifest ? ["cross"] : ["cargo"];
command.concat("cross", "build", "--release", "--bins", "--lib", "--target", target);
command.push("build", "--release", "--bins", "--lib", "--target", target);
sh(command.join(" "), { cwd: path });
}
function hostTarget() {
Expand Down
16 changes: 6 additions & 10 deletions dist/build-crates-standalone-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128403,14 +128403,10 @@ async function installBinaryCached(name) {
async function build(path, target) {
const crossContents = await promises_.readFile((0,external_path_.join)(path, "Cross.toml"), "utf-8");
const crossManifest = parse(crossContents);
if (target == undefined) {
target ??= hostTarget();
}
else {
command_sh(`rustup target add ${target}`, { cwd: path });
}
target ??= hostTarget();
command_sh(`rustup target add ${target}`, { cwd: path });
const command = target in crossManifest ? ["cross"] : ["cargo"];
command.concat("cross", "build", "--release", "--bins", "--lib", "--target", target);
command.push("build", "--release", "--bins", "--lib", "--target", target);
command_sh(command.join(" "), { cwd: path });
}
function hostTarget() {
Expand Down Expand Up @@ -128458,11 +128454,11 @@ function cloneFromGitHub(repo, options) {
const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`;
const command = ["git", "clone", "--recursive", "--single-branch"];
if (options.branch != undefined) {
command.concat("--branch", options.branch);
command.push("--branch", options.branch);
}
command.concat(remote);
command.push(remote);
if (options.path != undefined) {
command.concat(options.path);
command.push(options.path);
}
command_sh(command.join(" "));
}
Expand Down
10 changes: 3 additions & 7 deletions dist/bump-crates-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82262,14 +82262,10 @@ async function installBinaryCached(name) {
async function build(path, target) {
const crossContents = await fs.readFile(join(path, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents);
if (target == undefined) {
target ??= hostTarget();
}
else {
sh(`rustup target add ${target}`, { cwd: path });
}
target ??= hostTarget();
sh(`rustup target add ${target}`, { cwd: path });
const command = target in crossManifest ? ["cross"] : ["cargo"];
command.concat("cross", "build", "--release", "--bins", "--lib", "--target", target);
command.push("build", "--release", "--bins", "--lib", "--target", target);
sh(command.join(" "), { cwd: path });
}
function hostTarget() {
Expand Down
10 changes: 3 additions & 7 deletions dist/publish-crates-cargo-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82262,14 +82262,10 @@ async function installBinaryCached(name) {
async function build(path, target) {
const crossContents = await fs.readFile(join(path, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents);
if (target == undefined) {
target ??= hostTarget();
}
else {
sh(`rustup target add ${target}`, { cwd: path });
}
target ??= hostTarget();
sh(`rustup target add ${target}`, { cwd: path });
const command = target in crossManifest ? ["cross"] : ["cargo"];
command.concat("cross", "build", "--release", "--bins", "--lib", "--target", target);
command.push("build", "--release", "--bins", "--lib", "--target", target);
sh(command.join(" "), { cwd: path });
}
function hostTarget() {
Expand Down
10 changes: 3 additions & 7 deletions dist/publish-crates-debian-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128426,14 +128426,10 @@ async function installBinaryCached(name) {
async function build(path, target) {
const crossContents = await fs.readFile(join(path, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents);
if (target == undefined) {
target ??= hostTarget();
}
else {
sh(`rustup target add ${target}`, { cwd: path });
}
target ??= hostTarget();
sh(`rustup target add ${target}`, { cwd: path });
const command = target in crossManifest ? ["cross"] : ["cargo"];
command.concat("cross", "build", "--release", "--bins", "--lib", "--target", target);
command.push("build", "--release", "--bins", "--lib", "--target", target);
sh(command.join(" "), { cwd: path });
}
function hostTarget() {
Expand Down
16 changes: 6 additions & 10 deletions dist/publish-crates-eclipse-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128423,14 +128423,10 @@ async function installBinaryCached(name) {
async function build(path, target) {
const crossContents = await fs.readFile(join(path, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents);
if (target == undefined) {
target ??= hostTarget();
}
else {
sh(`rustup target add ${target}`, { cwd: path });
}
target ??= hostTarget();
sh(`rustup target add ${target}`, { cwd: path });
const command = target in crossManifest ? ["cross"] : ["cargo"];
command.concat("cross", "build", "--release", "--bins", "--lib", "--target", target);
command.push("build", "--release", "--bins", "--lib", "--target", target);
sh(command.join(" "), { cwd: path });
}
function hostTarget() {
Expand Down Expand Up @@ -128478,11 +128474,11 @@ function cloneFromGitHub(repo, options) {
const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`;
const command = ["git", "clone", "--recursive", "--single-branch"];
if (options.branch != undefined) {
command.concat("--branch", options.branch);
command.push("--branch", options.branch);
}
command.concat(remote);
command.push(remote);
if (options.path != undefined) {
command.concat(options.path);
command.push(options.path);
}
sh(command.join(" "));
}
Expand Down
16 changes: 6 additions & 10 deletions dist/publish-crates-github-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128404,14 +128404,10 @@ async function installBinaryCached(name) {
async function build(path, target) {
const crossContents = await fs.readFile(join(path, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents);
if (target == undefined) {
target ??= hostTarget();
}
else {
sh(`rustup target add ${target}`, { cwd: path });
}
target ??= hostTarget();
sh(`rustup target add ${target}`, { cwd: path });
const command = target in crossManifest ? ["cross"] : ["cargo"];
command.concat("cross", "build", "--release", "--bins", "--lib", "--target", target);
command.push("build", "--release", "--bins", "--lib", "--target", target);
sh(command.join(" "), { cwd: path });
}
function hostTarget() {
Expand Down Expand Up @@ -128535,11 +128531,11 @@ function cloneFromGitHub(repo, options) {
const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`;
const command = ["git", "clone", "--recursive", "--single-branch"];
if (options.branch != undefined) {
command.concat("--branch", options.branch);
command.push("--branch", options.branch);
}
command.concat(remote);
command.push(remote);
if (options.path != undefined) {
command.concat(options.path);
command.push(options.path);
}
sh(command.join(" "));
}
Expand Down
16 changes: 6 additions & 10 deletions dist/publish-crates-homebrew-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128425,14 +128425,10 @@ async function installBinaryCached(name) {
async function build(path, target) {
const crossContents = await fs.readFile(join(path, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents);
if (target == undefined) {
target ??= hostTarget();
}
else {
sh(`rustup target add ${target}`, { cwd: path });
}
target ??= hostTarget();
sh(`rustup target add ${target}`, { cwd: path });
const command = target in crossManifest ? ["cross"] : ["cargo"];
command.concat("cross", "build", "--release", "--bins", "--lib", "--target", target);
command.push("build", "--release", "--bins", "--lib", "--target", target);
sh(command.join(" "), { cwd: path });
}
function hostTarget() {
Expand Down Expand Up @@ -128480,11 +128476,11 @@ function cloneFromGitHub(repo, options) {
const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`;
const command = ["git", "clone", "--recursive", "--single-branch"];
if (options.branch != undefined) {
command.concat("--branch", options.branch);
command.push("--branch", options.branch);
}
command.concat(remote);
command.push(remote);
if (options.path != undefined) {
command.concat(options.path);
command.push(options.path);
}
sh(command.join(" "));
}
Expand Down
10 changes: 4 additions & 6 deletions src/cargo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,12 @@ export async function build(path: string, target?: string) {
const crossContents = await fs.readFile(join(path, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents) as CrossManifest;

if (target == undefined) {
target ??= hostTarget();
} else {
sh(`rustup target add ${target}`, { cwd: path });
}
target ??= hostTarget();

sh(`rustup target add ${target}`, { cwd: path });

const command = target in crossManifest ? ["cross"] : ["cargo"];
command.concat("cross", "build", "--release", "--bins", "--lib", "--target", target);
command.push("build", "--release", "--bins", "--lib", "--target", target);
sh(command.join(" "), { cwd: path });
}

Expand Down
6 changes: 3 additions & 3 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export function cloneFromGitHub(repo: string, options: CloneFromGitHubOptions) {

const command = ["git", "clone", "--recursive", "--single-branch"];
if (options.branch != undefined) {
command.concat("--branch", options.branch);
command.push("--branch", options.branch);
}
command.concat(remote);
command.push(remote);
if (options.path != undefined) {
command.concat(options.path);
command.push(options.path);
}

sh(command.join(" "));
Expand Down

0 comments on commit e2aa60e

Please sign in to comment.