Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

depstar doesn't respect tools.deps with-dir context #101

Closed
seancorfield opened this issue Sep 8, 2021 · 2 comments
Closed

depstar doesn't respect tools.deps with-dir context #101

seancorfield opened this issue Sep 8, 2021 · 2 comments
Assignees
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@seancorfield
Copy link
Owner

It's not entirely clear to me where the breakdown happens, but if you run depstar's build-jar function inside tools.deps's with-dir, you get a classpath relative to user.dir instead -- it reads the correct deps.edn, but the :paths in that file are treated as relative -- to user.dir, not the context directory.

It's likely that this is a bug in both how AOT is handled (unknown -- need to see what :compile-ns :all does) and in the JAR file copying logic that doesn't "fix" relative entries on the classpath.

@seancorfield seancorfield added the bug Something isn't working label Sep 8, 2021
@seancorfield seancorfield self-assigned this Sep 8, 2021
@seancorfield
Copy link
Owner Author

Some more context on this: https://ask.clojure.org/index.php/11027/should-tools-build-functions-respect-with-from-tools-alpha

TL;DR: tools.build uses a *project-root* dynamic var and when it calls down into t.d.a to calculate a basis, it uses with-dir to pass that context on, so using with-dir in build.clj is... questionable practice. However, that means that depstar's t.b.a-compatible functions jar and uber are not entire compatible since they don't resolve paths via that *project-root* and that still leaves the problem that non-tools.build code that invokes depstar programmatically could use with-dir and mess with depstar's handling of paths.

Probably the "right" solution here is for depstar to also have a "project root" concept and to ensure everything is correctly resolved based on that and then for it to use with-dir to bind that context when calling into t.d.a to calculate a basis and for the t.b.a-compatible API to bind depstar's project root to t.b.a's *project-root*... Potentially a lot of work (for a project that I really want to retire once tools.build has its uber task sorted out!).

@seancorfield seancorfield added the wontfix This will not be worked on label Sep 15, 2021
@seancorfield
Copy link
Owner Author

Since this pretty much only affected me and I have a workaround, I'm closing this out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant