-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
feat(compilation): compilation directory depends on more cli flags #270
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
#include <jank/native_persistent_string/fmt.hpp> | ||
#include <jank/util/dir.hpp> | ||
#include <jank/util/sha256.hpp> | ||
#include <jank/util/string_builder.hpp> | ||
|
||
namespace jank::util | ||
{ | ||
|
@@ -61,15 +62,20 @@ namespace jank::util | |
return res; | ||
} | ||
|
||
native_persistent_string const &binary_cache_dir() | ||
native_persistent_string const & | ||
binary_cache_dir(native_integer const optimization_level, | ||
native_vector<native_persistent_string> const &includes, | ||
native_vector<native_persistent_string> const &defines) | ||
{ | ||
static native_persistent_string res; | ||
if(!res.empty()) | ||
{ | ||
return res; | ||
} | ||
|
||
return res = fmt::format("{}/{}", user_cache_dir(), binary_version()); | ||
return res = fmt::format("{}/{}", | ||
user_cache_dir(), | ||
binary_version(optimization_level, includes, defines)); | ||
Comment on lines
-72
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, I was wrong, Saket. This is not going to work. If two separate projects both have ns This could work fine for dependencies from maven, but we don't have a good way to distinguish them from project sources right now. To mitigate this, let's put the binary cache dir in |
||
} | ||
|
||
/* The binary version is composed of two things: | ||
|
@@ -83,16 +89,36 @@ namespace jank::util | |
* every module. I think this is much safer than trying to reconcile ABI | ||
* changes more granularly. | ||
*/ | ||
native_persistent_string const &binary_version() | ||
native_persistent_string const & | ||
binary_version(native_integer const optimization_level, | ||
native_vector<native_persistent_string> const &includes, | ||
native_vector<native_persistent_string> const &defines) | ||
{ | ||
static native_persistent_string res; | ||
if(!res.empty()) | ||
{ | ||
return res; | ||
} | ||
|
||
auto const input( | ||
fmt::format("{}.{}.{}", JANK_VERSION, clang::getClangRevision(), JANK_JIT_FLAGS)); | ||
string_builder sb; | ||
for(auto const &inc : includes) | ||
{ | ||
sb(inc); | ||
} | ||
|
||
sb("."); | ||
|
||
for(auto const &def : defines) | ||
{ | ||
sb(def); | ||
} | ||
|
||
auto const input(fmt::format("{}.{}.{}.{}.{}", | ||
JANK_VERSION, | ||
clang::getClangRevision(), | ||
JANK_JIT_FLAGS, | ||
optimization_level, | ||
sb.release())); | ||
res = fmt::format("{}-{}", llvm::sys::getDefaultTargetTriple(), util::sha256(input)); | ||
|
||
//fmt::println("binary_version {}", res); | ||
|
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.
No need for
classes
at all. That's a carry-over from the JVM.