Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Workaround for long paths in MSBuild #3

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/enforce-linking-issues.yml

This file was deleted.

10 changes: 9 additions & 1 deletion dist/build-crates-standalone-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128497,7 +128497,15 @@ async function main(input) {
try {
await installBinaryCached("cross");
const repo = input.repo.split("/")[1];
cloneFromGitHub(input.repo, { branch: input.branch, token: input.githubToken });
cloneFromGitHub(input.repo, {
branch: input.branch,
token: input.githubToken,
// NOTE(fuzzypixelz): We clone the repository into the current directory
// to avoid long paths on Windows, where MSBuild fails on the windows-2019
// GitHub-hosted runner because it doesn't support paths longer than 260
// characters.
path: process.env["GITHUB_ACTIONS"] != undefined ? process.cwd() : undefined,
});
input.version ??= describe(repo);
input.target ??= hostTarget();
await build(repo, input.target);
Expand Down
10 changes: 7 additions & 3 deletions dist/publish-crates-cargo-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82401,7 +82401,7 @@ async function publishToEstuary(input, repo, registry, registryDepsRegExp, branc
CARGO_REGISTRY_DEFAULT: registry.name,
[`CARGO_REGISTRIES_${registry.name.toUpperCase()}_TOKEN`]: registry.token,
};
publish(path, env);
publish(path, env, true);
}
function publishToCratesIo(input, repo, branch) {
clone(input, repo, branch);
Expand All @@ -82411,15 +82411,19 @@ function publishToCratesIo(input, repo, branch) {
};
publish(path, env);
}
function publish(path, env) {
function publish(path, env, allowDirty = false) {
const options = {
env,
cwd: path,
check: true,
};
for (const package_ of packagesOrdered(path)) {
if (package_.publish == undefined || package_.publish) {
command_sh(`cargo publish --manifest-path ${package_.manifestPath}`, options);
const command = ["cargo", "publish", "--manifest-path", package_.manifestPath];
if (allowDirty) {
command.push("--allow-dirty");
}
command_sh(command.join(" "), options);
}
}
command_sh("cargo clean", options);
Expand Down
10 changes: 9 additions & 1 deletion dist/publish-crates-eclipse-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128517,7 +128517,15 @@ async function main(input) {
try {
await cargo.installBinaryCached("cross");
const repo = input.repo.split("/")[1];
git.cloneFromGitHub(input.repo, { branch: input.branch, token: input.githubToken });
git.cloneFromGitHub(input.repo, {
branch: input.branch,
token: input.githubToken,
// NOTE(fuzzypixelz): We clone the repository into the current directory
// to avoid long paths on Windows, where MSBuild fails on the windows-2019
// GitHub-hosted runner because it doesn't support paths longer than 260
// characters.
path: process.env["GITHUB_ACTIONS"] != undefined ? process.cwd() : undefined,
});
input.version ??= git.describe(repo);
input.target ??= cargo.hostTarget();
await cargo.build(repo, input.target);
Expand Down
10 changes: 9 additions & 1 deletion dist/publish-crates-github-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128574,7 +128574,15 @@ async function build_crates_standalone_main(input) {
try {
await cargo.installBinaryCached("cross");
const repo = input.repo.split("/")[1];
git.cloneFromGitHub(input.repo, { branch: input.branch, token: input.githubToken });
git.cloneFromGitHub(input.repo, {
branch: input.branch,
token: input.githubToken,
// NOTE(fuzzypixelz): We clone the repository into the current directory
// to avoid long paths on Windows, where MSBuild fails on the windows-2019
// GitHub-hosted runner because it doesn't support paths longer than 260
// characters.
path: process.env["GITHUB_ACTIONS"] != undefined ? process.cwd() : undefined,
});
input.version ??= git.describe(repo);
input.target ??= cargo.hostTarget();
await cargo.build(repo, input.target);
Expand Down
10 changes: 9 additions & 1 deletion dist/publish-crates-homebrew-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128519,7 +128519,15 @@ async function main(input) {
try {
await cargo.installBinaryCached("cross");
const repo = input.repo.split("/")[1];
git.cloneFromGitHub(input.repo, { branch: input.branch, token: input.githubToken });
git.cloneFromGitHub(input.repo, {
branch: input.branch,
token: input.githubToken,
// NOTE(fuzzypixelz): We clone the repository into the current directory
// to avoid long paths on Windows, where MSBuild fails on the windows-2019
// GitHub-hosted runner because it doesn't support paths longer than 260
// characters.
path: process.env["GITHUB_ACTIONS"] != undefined ? process.cwd() : undefined,
});
input.version ??= git.describe(repo);
input.target ??= cargo.hostTarget();
await cargo.build(repo, input.target);
Expand Down
10 changes: 9 additions & 1 deletion src/build-crates-standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ export async function main(input: Input) {

const repo = input.repo.split("/")[1];

git.cloneFromGitHub(input.repo, { branch: input.branch, token: input.githubToken });
git.cloneFromGitHub(input.repo, {
branch: input.branch,
token: input.githubToken,
// NOTE(fuzzypixelz): We clone the repository into the current directory
// to avoid long paths on Windows, where MSBuild fails on the windows-2019
// GitHub-hosted runner because it doesn't support paths longer than 260
// characters.
path: process.env["GITHUB_ACTIONS"] != undefined ? process.cwd() : undefined,
});

input.version ??= git.describe(repo);
input.target ??= cargo.hostTarget();
Expand Down
10 changes: 7 additions & 3 deletions src/publish-crates-cargo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function publishToEstuary(
[`CARGO_REGISTRIES_${registry.name.toUpperCase()}_TOKEN`]: registry.token,
};

publish(path, env);
publish(path, env, true);
}

function publishToCratesIo(input: Input, repo: string, branch?: string) {
Expand All @@ -136,7 +136,7 @@ function publishToCratesIo(input: Input, repo: string, branch?: string) {
publish(path, env);
}

function publish(path: string, env: NodeJS.ProcessEnv) {
function publish(path: string, env: NodeJS.ProcessEnv, allowDirty: boolean = false) {
const options = {
env,
cwd: path,
Expand All @@ -145,7 +145,11 @@ function publish(path: string, env: NodeJS.ProcessEnv) {

for (const package_ of cargo.packagesOrdered(path)) {
if (package_.publish == undefined || package_.publish) {
sh(`cargo publish --manifest-path ${package_.manifestPath}`, options);
const command = ["cargo", "publish", "--manifest-path", package_.manifestPath];
if (allowDirty) {
command.push("--allow-dirty");
}
sh(command.join(" "), options);
}
}

Expand Down