Move core:runtime to base:runtime; keep alias around
This commit is contained in:
1 parent
ddcaa0de53
commit
09fa1c29cd
42 files changed
+53
-6
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+21
-1
@@ -1161,7 +1161,27 @@ gb_internal String get_fullpath_relative(gbAllocator a, String base_dir, String
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gb_internal String get_fullpath_core(gbAllocator a, String path) {
|
gb_internal String get_fullpath_base_collection(gbAllocator a, String path) {
|
||||||
|
String module_dir = odin_root_dir();
|
||||||
|
|
||||||
|
String base = str_lit("base/");
|
||||||
|
|
||||||
|
isize str_len = module_dir.len + base.len + path.len;
|
||||||
|
u8 *str = gb_alloc_array(heap_allocator(), u8, str_len+1);
|
||||||
|
defer (gb_free(heap_allocator(), str));
|
||||||
|
|
||||||
|
isize i = 0;
|
||||||
|
gb_memmove(str+i, module_dir.text, module_dir.len); i += module_dir.len;
|
||||||
|
gb_memmove(str+i, base.text, base.len); i += base.len;
|
||||||
|
gb_memmove(str+i, path.text, path.len); i += path.len;
|
||||||
|
str[i] = 0;
|
||||||
|
|
||||||
|
String res = make_string(str, i);
|
||||||
|
res = string_trim_whitespace(res);
|
||||||
|
return path_to_fullpath(a, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
gb_internal String get_fullpath_core_collection(gbAllocator a, String path) {
|
||||||
String module_dir = odin_root_dir();
|
String module_dir = odin_root_dir();
|
||||||
|
|
||||||
String core = str_lit("core/");
|
String core = str_lit("core/");
|
||||||
|
|||||||
+24
-2
@@ -770,9 +770,11 @@ gb_internal void add_type_info_dependency(CheckerInfo *info, DeclInfo *d, Type *
|
|||||||
rw_mutex_unlock(&d->type_info_deps_mutex);
|
rw_mutex_unlock(&d->type_info_deps_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
gb_internal AstPackage *get_core_package(CheckerInfo *info, String name) {
|
|
||||||
|
gb_internal AstPackage *get_runtime_package(CheckerInfo *info) {
|
||||||
|
String name = str_lit("runtime");
|
||||||
gbAllocator a = heap_allocator();
|
gbAllocator a = heap_allocator();
|
||||||
String path = get_fullpath_core(a, name);
|
String path = get_fullpath_base_collection(a, name);
|
||||||
defer (gb_free(a, path.text));
|
defer (gb_free(a, path.text));
|
||||||
auto found = string_map_get(&info->packages, path);
|
auto found = string_map_get(&info->packages, path);
|
||||||
if (found == nullptr) {
|
if (found == nullptr) {
|
||||||
@@ -787,6 +789,26 @@ gb_internal AstPackage *get_core_package(CheckerInfo *info, String name) {
|
|||||||
return *found;
|
return *found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gb_internal AstPackage *get_core_package(CheckerInfo *info, String name) {
|
||||||
|
if (name == "runtime") {
|
||||||
|
return get_runtime_package(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
gbAllocator a = heap_allocator();
|
||||||
|
String path = get_fullpath_core_collection(a, name);
|
||||||
|
defer (gb_free(a, path.text));
|
||||||
|
auto found = string_map_get(&info->packages, path);
|
||||||
|
if (found == nullptr) {
|
||||||
|
gb_printf_err("Name: %.*s\n", LIT(name));
|
||||||
|
gb_printf_err("Fullpath: %.*s\n", LIT(path));
|
||||||
|
|
||||||
|
for (auto const &entry : info->packages) {
|
||||||
|
gb_printf_err("%.*s\n", LIT(entry.key));
|
||||||
|
}
|
||||||
|
GB_ASSERT_MSG(found != nullptr, "Missing core package %.*s", LIT(name));
|
||||||
|
}
|
||||||
|
return *found;
|
||||||
|
}
|
||||||
|
|
||||||
gb_internal void add_package_dependency(CheckerContext *c, char const *package_name, char const *name) {
|
gb_internal void add_package_dependency(CheckerContext *c, char const *package_name, char const *name) {
|
||||||
String n = make_string_c(name);
|
String n = make_string_c(name);
|
||||||
|
|||||||
@@ -2376,6 +2376,7 @@ int main(int arg_count, char const **arg_ptr) {
|
|||||||
TIME_SECTION("init default library collections");
|
TIME_SECTION("init default library collections");
|
||||||
array_init(&library_collections, heap_allocator());
|
array_init(&library_collections, heap_allocator());
|
||||||
// NOTE(bill): 'core' cannot be (re)defined by the user
|
// NOTE(bill): 'core' cannot be (re)defined by the user
|
||||||
|
add_library_collection(str_lit("base"), get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("base")));
|
||||||
add_library_collection(str_lit("core"), get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("core")));
|
add_library_collection(str_lit("core"), get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("core")));
|
||||||
add_library_collection(str_lit("vendor"), get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("vendor")));
|
add_library_collection(str_lit("vendor"), get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("vendor")));
|
||||||
|
|
||||||
|
|||||||
+7
-3
@@ -5460,6 +5460,11 @@ gb_internal bool determine_path_from_string(BlockingMutex *file_mutex, Ast *node
|
|||||||
|
|
||||||
|
|
||||||
if (collection_name.len > 0) {
|
if (collection_name.len > 0) {
|
||||||
|
// NOTE(bill): `base:runtime` == `core:runtime`
|
||||||
|
if (collection_name == "core" && string_starts_with(file_str, str_lit("runtime"))) {
|
||||||
|
collection_name = str_lit("base");
|
||||||
|
}
|
||||||
|
|
||||||
if (collection_name == "system") {
|
if (collection_name == "system") {
|
||||||
if (node->kind != Ast_ForeignImportDecl) {
|
if (node->kind != Ast_ForeignImportDecl) {
|
||||||
syntax_error(node, "The library collection 'system' is restrict for 'foreign_library'");
|
syntax_error(node, "The library collection 'system' is restrict for 'foreign_library'");
|
||||||
@@ -5489,7 +5494,6 @@ gb_internal bool determine_path_from_string(BlockingMutex *file_mutex, Ast *node
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (is_package_name_reserved(file_str)) {
|
if (is_package_name_reserved(file_str)) {
|
||||||
*path = file_str;
|
*path = file_str;
|
||||||
if (collection_name == "core") {
|
if (collection_name == "core") {
|
||||||
@@ -6133,7 +6137,7 @@ gb_internal ParseFileError parse_packages(Parser *p, String init_filename) {
|
|||||||
{ // Add these packages serially and then process them parallel
|
{ // Add these packages serially and then process them parallel
|
||||||
TokenPos init_pos = {};
|
TokenPos init_pos = {};
|
||||||
{
|
{
|
||||||
String s = get_fullpath_core(permanent_allocator(), str_lit("runtime"));
|
String s = get_fullpath_base_collection(permanent_allocator(), str_lit("runtime"));
|
||||||
try_add_import_path(p, s, s, init_pos, Package_Runtime);
|
try_add_import_path(p, s, s, init_pos, Package_Runtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6141,7 +6145,7 @@ gb_internal ParseFileError parse_packages(Parser *p, String init_filename) {
|
|||||||
p->init_fullpath = init_fullpath;
|
p->init_fullpath = init_fullpath;
|
||||||
|
|
||||||
if (build_context.command_kind == Command_test) {
|
if (build_context.command_kind == Command_test) {
|
||||||
String s = get_fullpath_core(permanent_allocator(), str_lit("testing"));
|
String s = get_fullpath_core_collection(permanent_allocator(), str_lit("testing"));
|
||||||
try_add_import_path(p, s, s, init_pos, Package_Normal);
|
try_add_import_path(p, s, s, init_pos, Package_Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user