-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
chore(compile): prefer denort binary in target/ directory when available #27052
Conversation
Enhances the deno compile workflow for denort development by automatically checking for a denort binary in the same directory as the deno binary, provided both are located within a target/ directory. If found, this denort binary will be used. Key points: - The DENORT_BIN environment variable remains supported for explicitly specifying a custom denort binary path. - Includes additional logic to verify if the deno binary is a symlink pointing to an executable in the target/ directory.
57a4b18
to
f6197fc
Compare
cli/standalone/binary.rs
Outdated
env::current_exe().ok().and_then(|exec_path| { | ||
if is_in_target(&exec_path) { | ||
get_denort(exec_path) | ||
} else if exec_path.is_symlink() { | ||
fs::read_link(&exec_path).ok().and_then(|target_path| { | ||
if is_in_target(&target_path) { | ||
get_denort(target_path) | ||
} else { | ||
None | ||
} | ||
}) | ||
} else { | ||
None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should only do this for "debug" builds, or check that the path includes target/debug? Or is there value in providing this for release builds too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I sometimes do it for performance related stuff. I kind of wonder if we should do this even when not in the target directory, but this will be a nice change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it for target/
for now and see how it works. We could broaden this in the future to always check for denort
next to the deno executable.
Can you test this on Windows? I guess the rt file is called denort
there too (without a file extension).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Thanks! Just one question left in a comment.
cli/standalone/binary.rs
Outdated
fs::read_link(&exec_path).ok().and_then(|target_path| { | ||
if is_in_target(&target_path) { | ||
get_denort(target_path) | ||
} else { | ||
None | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the value of the symlink check? Maybe let's remove this symlink branch to keep it simpler (less things that can go wrong)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The symlink check determines if the deno
executable is in fact just a sym link and if so, it checks that the symbolic link points to an executable in a target/
directory. This is useful if you link your deno executable from your cargo/bin
directory to your target directory.
But you're right, a lot more can go wrong including file handling on different platforms. I've removed this check.
cli/standalone/binary.rs
Outdated
env::current_exe().ok().and_then(|exec_path| { | ||
if is_in_target(&exec_path) { | ||
get_denort(exec_path) | ||
} else if exec_path.is_symlink() { | ||
fs::read_link(&exec_path).ok().and_then(|target_path| { | ||
if is_in_target(&target_path) { | ||
get_denort(target_path) | ||
} else { | ||
None | ||
} | ||
}) | ||
} else { | ||
None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I sometimes do it for performance related stuff. I kind of wonder if we should do this even when not in the target directory, but this will be a nice change.
Co-authored-by: David Sherret <[email protected]> Signed-off-by: Ian Bull <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
…ble (#27052) Enhances the deno compile workflow for denort development by automatically checking for a denort binary in the same directory as the deno binary, provided both are located within a target/ directory. If found, this denort binary will be used. Key points: - The DENORT_BIN environment variable remains supported for explicitly specifying a custom denort binary path. - Includes additional logic to verify if the deno binary is a symlink pointing to an executable in the target/ directory. --------- Signed-off-by: Ian Bull <[email protected]>
Enhances the deno compile workflow for denort development by automatically checking for a denort binary in the same directory as the deno binary, provided both are located within a target/ directory. If found, this denort binary will be used.
Key points: