From 5def10f81d9bcd831ff7283902827e9b23cb2f36 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Tue, 30 Sep 2025 09:18:51 -0400 Subject: Infer used os better when collecting globals in a file --- src/server/build.odin | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/server/build.odin b/src/server/build.odin index a0ba276..df66be2 100644 --- a/src/server/build.odin +++ b/src/server/build.odin @@ -52,19 +52,33 @@ os_enum_to_string: [runtime.Odin_OS_Type]string = { os_string_to_enum: map[string]runtime.Odin_OS_Type = { "Windows" = .Windows, + "windows" = .Windows, "Darwin" = .Darwin, + "darwin" = .Darwin, "Linux" = .Linux, + "linux" = .Linux, "Essence" = .Essence, + "essence" = .Essence, "Freebsd" = .FreeBSD, + "freebsd" = .FreeBSD, "Wasi" = .WASI, + "wasi" = .WASI, "Js" = .JS, + "js" = .JS, "Freestanding" = .Freestanding, + "freestanding" = .Freestanding, "Wasm" = .JS, + "wasm" = .JS, "Haiku" = .Haiku, + "haiku" = .Haiku, "Openbsd" = .OpenBSD, + "openbsd" = .OpenBSD, "Netbsd" = .NetBSD, + "netbsd" = .NetBSD, "Orca" = .Orca, + "orca" = .Orca, "Unknown" = .Unknown, + "unknown" = .Unknown, } @(private = "file") @@ -113,27 +127,17 @@ should_collect_file :: proc(file_tags: parser.File_Tags) -> bool { } if len(file_tags.build) > 0 { - when_expr_map := make(map[string]When_Expr, context.temp_allocator) - - for key, value in common.config.profile.defines { - when_expr_map[key] = resolve_when_ident(when_expr_map, value) or_continue - } - - if when_expr, ok := resolve_when_ident(when_expr_map, "ODIN_OS"); ok { - if s, ok := when_expr.(string); ok { - if used_os, ok := os_string_to_enum[when_expr.(string)]; ok { - found := false - for tag in file_tags.build { - if used_os in tag.os { - found = true - break - } - } - if !found { - return false - } + if used_os, ok := os_string_to_enum[common.config.profile.os]; ok { + found := false + for tag in file_tags.build { + if used_os in tag.os { + found = true + break } } + if !found { + return false + } } } return true -- cgit v1.2.3