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(install): handle transitive folder dependencies #10445

Merged
merged 46 commits into from
Jun 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
663a513
symlink transitive folder dependencies
dylan-conway Apr 17, 2024
1b06662
add test
dylan-conway Apr 17, 2024
20c60be
one more test
dylan-conway Apr 17, 2024
86c4e3b
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Apr 17, 2024
aaf90dd
fix memory issue and windows
dylan-conway Apr 18, 2024
96fa411
fix reinstalls
dylan-conway Apr 18, 2024
2577659
reinstall tests
dylan-conway Apr 18, 2024
452aed7
installWithSymlink
dylan-conway Apr 19, 2024
02d355c
dont ignore node_modules
dylan-conway Apr 19, 2024
4e5be96
revert, update tests
dylan-conway Apr 19, 2024
e3f5267
one more test
dylan-conway Apr 19, 2024
7f18f61
unused
dylan-conway Apr 19, 2024
1980182
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Apr 20, 2024
9f4ea30
use isRootDependency
dylan-conway Apr 20, 2024
a2cf449
handle windows abs paths
dylan-conway Apr 20, 2024
7324b3d
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Apr 22, 2024
73685dc
match npm folder resolving
dylan-conway Apr 22, 2024
9fc25e6
windows abs paths and more test
dylan-conway Apr 22, 2024
13f1f7a
logic
dylan-conway Apr 22, 2024
ed51e0d
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Apr 22, 2024
25e30a9
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Apr 23, 2024
170b756
Merge branch 'main' into dylan/link-transitive-folder-dep
Jarred-Sumner Apr 23, 2024
0d96fac
Apply formatting changes
Jarred-Sumner Apr 23, 2024
3ea4eb5
check for destination directory
dylan-conway Apr 23, 2024
e5b0b2e
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Apr 23, 2024
a0fd526
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Jun 6, 2024
50d7b47
fix merge
dylan-conway Jun 6, 2024
ac16065
fix merge
dylan-conway Jun 6, 2024
06f7b1f
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Jun 11, 2024
6a59760
maybe fix merge
dylan-conway Jun 11, 2024
df6704f
test for transitive self file dependency
dylan-conway Jun 11, 2024
b2b4140
remove only
dylan-conway Jun 11, 2024
8693e10
fix windows
dylan-conway Jun 11, 2024
c9f2ae2
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Jun 11, 2024
8dfc685
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Jun 13, 2024
6651c6e
test for hoisted and unhoisted workspace file deps
dylan-conway Jun 13, 2024
effe1b6
update
dylan-conway Jun 13, 2024
87ee712
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Jun 14, 2024
8e5ff64
use index
dylan-conway Jun 14, 2024
9610eb6
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Jun 14, 2024
ca33606
uupdate
dylan-conway Jun 14, 2024
62979d7
Merge branch 'main' into dylan/link-transitive-folder-dep
dylan-conway Jun 14, 2024
cabe0f1
windows fixup
dylan-conway Jun 15, 2024
4cf0f67
ebusy
dylan-conway Jun 15, 2024
27ff236
readlink
dylan-conway Jun 15, 2024
75ccb61
err
dylan-conway Jun 15, 2024
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
Prev Previous commit
Next Next commit
ebusy
dylan-conway committed Jun 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 4cf0f67dcc207b2ec2ec91c75b3e07e912b84a6b
6 changes: 6 additions & 0 deletions src/bun.zig
Original file line number Diff line number Diff line change
@@ -748,6 +748,12 @@ pub fn openDir(dir: std.fs.Dir, path_: [:0]const u8) !std.fs.Dir {
}
}

pub fn openDirNoRenamingOrDeletingWindows(dir: std.fs.Dir, path_: [:0]const u8) !std.fs.Dir {
if (comptime !Environment.isWindows) @compileError("use openDir!");
const res = try sys.openDirAtWindowsA(toFD(dir.fd), path_, .{ .iterable = true, .can_rename_or_delete = false, .read_only = true }).unwrap();
return res.asDir();
}

pub fn openDirA(dir: std.fs.Dir, path_: []const u8) !std.fs.Dir {
if (comptime Environment.isWindows) {
const res = try sys.openDirAtWindowsA(toFD(dir.fd), path_, .{ .iterable = true, .can_rename_or_delete = true, .read_only = true }).unwrap();
21 changes: 12 additions & 9 deletions src/install/install.zig
Original file line number Diff line number Diff line change
@@ -1454,7 +1454,14 @@ pub fn NewPackageInstall(comptime kind: PkgInstallKind) type {
const destbase = destination_dir;
const destpath = this.destination_dir_subpath;

state.cached_package_dir = bun.openDir(this.cache_dir, this.cache_dir_subpath) catch |err| return Result.fail(err, .opening_cache_dir);
state.cached_package_dir = (if (comptime Environment.isWindows)
if (method == .symlink)
bun.openDirNoRenamingOrDeletingWindows(this.cache_dir, this.cache_dir_subpath)
else
bun.openDir(this.cache_dir, this.cache_dir_subpath)
else
bun.openDir(this.cache_dir, this.cache_dir_subpath)) catch |err| return Result.fail(err, .opening_cache_dir);

state.walker = Walker.walk(
state.cached_package_dir,
this.allocator,
@@ -10877,15 +10884,11 @@ pub const PackageManager = struct {
LifecycleScriptSubprocess.alive_count.load(.Monotonic) < this.manager.options.max_concurrent_lifecycle_scripts;
}

/// If all parents of the tree have finished installing their packages, the package can be installed
/// A tree can start installing packages when the parent has installed all its packages. If the parent
/// isn't finished, we need to wait because it's possible a package installed in this tree will be deleted by the parent.
pub fn canInstallPackageForTree(this: *const PackageInstaller, trees: []Lockfile.Tree, package_tree_id: Lockfile.Tree.Id) bool {
var curr_tree_id = trees[package_tree_id].parent;
while (curr_tree_id != Lockfile.Tree.invalid_id) {
if (!this.completed_trees.isSet(curr_tree_id)) return false;
curr_tree_id = trees[curr_tree_id].parent;
}

return true;
const parent_id = trees[package_tree_id].parent;
return parent_id == Lockfile.Tree.invalid_id or this.completed_trees.isSet(parent_id);
}

pub fn deinit(this: *PackageInstaller) void {