diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-30 09:44:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-30 09:44:45 -0400 |
| commit | 3be6671f8c471a2adb0c5b0f4277d08332dddff4 (patch) | |
| tree | b3c50c8a1fa2ef9c12d9580ff605ba9aee43ce51 | |
| parent | 059ea9abcf1b7cd972da8e5fa395285d50e398cb (diff) | |
| parent | 20087ade0a4c93b3fa236af1ad179ce8f959e3d1 (diff) | |
Merge pull request #1071 from BradLewis/fix/os-names
Add more names for comparison when checking whether to collect a file
| -rw-r--r-- | src/server/build.odin | 33 | ||||
| -rw-r--r-- | src/server/when.odin | 2 |
2 files changed, 25 insertions, 10 deletions
diff --git a/src/server/build.odin b/src/server/build.odin index df66be2..59dc63d 100644 --- a/src/server/build.odin +++ b/src/server/build.odin @@ -61,10 +61,13 @@ os_string_to_enum: map[string]runtime.Odin_OS_Type = { "essence" = .Essence, "Freebsd" = .FreeBSD, "freebsd" = .FreeBSD, + "FreeBSD" = .FreeBSD, "Wasi" = .WASI, "wasi" = .WASI, + "WASI" = .WASI, "Js" = .JS, "js" = .JS, + "JS" = .JS, "Freestanding" = .Freestanding, "freestanding" = .Freestanding, "Wasm" = .JS, @@ -73,8 +76,10 @@ os_string_to_enum: map[string]runtime.Odin_OS_Type = { "haiku" = .Haiku, "Openbsd" = .OpenBSD, "openbsd" = .OpenBSD, + "OpenBSD" = .OpenBSD, "Netbsd" = .NetBSD, "netbsd" = .NetBSD, + "NetBSD" = .NetBSD, "Orca" = .Orca, "orca" = .Orca, "Unknown" = .Unknown, @@ -127,17 +132,27 @@ should_collect_file :: proc(file_tags: parser.File_Tags) -> bool { } if len(file_tags.build) > 0 { - 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 + 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 !found { - return false - } } } return true diff --git a/src/server/when.odin b/src/server/when.odin index 1059594..20ef128 100644 --- a/src/server/when.odin +++ b/src/server/when.odin @@ -30,7 +30,7 @@ convert_os_string: map[string]string = { "haiku" = "Haiku", "openbsd" = "OpenBSD", "netbsd" = "NetBSD", - "freebsd" = "FreeBSD", + "orca" = "Orca", } resolve_when_ident :: proc(when_expr_map: map[string]When_Expr, ident: string) -> (When_Expr, bool) { |