Refactor configuration structs to use public mutable fields

We should not be using globals anywhere
main
Joca 2025-11-24 18:35:38 -03:00
parent b8c2099892
commit 63fa9ef0b7
Signed by: jocadbz
GPG Key ID: B1836DCE2F50BDF7
1 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import os
// BuildDirective represents a single build directive found in source files // BuildDirective represents a single build directive found in source files
pub struct BuildDirective { pub struct BuildDirective {
__global: pub mut:
unit_name string // e.g., "tools/arraydump" or "lib/file" unit_name string // e.g., "tools/arraydump" or "lib/file"
depends_units []string // e.g., ["lib/file", "lib/cli"] depends_units []string // e.g., ["lib/file", "lib/cli"]
link_libs []string // e.g., ["file.so", "cli.so"] link_libs []string // e.g., ["file.so", "cli.so"]
@ -19,7 +19,7 @@ pub type TargetConfig = SharedLibConfig | ToolConfig
// SharedLibConfig holds the configuration for a shared library // SharedLibConfig holds the configuration for a shared library
pub struct SharedLibConfig { pub struct SharedLibConfig {
__global: pub mut:
name string // name of the shared library (e.g., "net") name string // name of the shared library (e.g., "net")
output_dir string = 'bin/lib' // where to put .so/.dll files output_dir string = 'bin/lib' // where to put .so/.dll files
sources []string // source files for this library sources []string // source files for this library
@ -34,7 +34,7 @@ __global:
// ToolConfig holds the configuration for a tool/executable // ToolConfig holds the configuration for a tool/executable
pub struct ToolConfig { pub struct ToolConfig {
__global: pub mut:
name string // name of the tool/executable name string // name of the tool/executable
output_dir string = 'bin/tools' // where to put executable output_dir string = 'bin/tools' // where to put executable
sources []string // source files for this tool sources []string // source files for this tool
@ -49,7 +49,7 @@ __global:
// Dependency represents an external dependency to download/extract // Dependency represents an external dependency to download/extract
pub struct Dependency { pub struct Dependency {
__global: pub mut:
name string name string
url string // download URL url string // download URL
archive string // relative archive path to save (under dependencies/tmp) archive string // relative archive path to save (under dependencies/tmp)
@ -60,7 +60,7 @@ __global:
// BuildConfig holds the configuration for the project // BuildConfig holds the configuration for the project
pub struct BuildConfig { pub struct BuildConfig {
__global: pub mut:
project_name string project_name string
src_dir string src_dir string
build_dir string build_dir string