From cec1ed90383eed139a007cd75e40df781ceade31 Mon Sep 17 00:00:00 2001 From: kp2pml30 Date: Wed, 4 Sep 2024 17:57:35 +0400 Subject: [PATCH] make config more usable --- ya-build | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ya-build b/ya-build index 0d77332..e468cd2 100755 --- a/ya-build +++ b/ya-build @@ -58,6 +58,12 @@ class Hash end end +class OpenStruct + def to_json(options=nil) + @table.to_json(options) + end +end + def escape_args_to(buf, args) args.each { |a| buf << ' ' @@ -220,7 +226,7 @@ class Configurator end if not extra_conf.nil? - cnf = Pathname.new(extra_conf) + cnf = Pathname.new(extra_conf).realpath if cnf.exist? @ya_files.push(cnf) self.instance_eval(cnf.read, cnf.to_s) @@ -316,6 +322,8 @@ EOF run_last_stack() + File.write(root_build.join('config.json'), @config.to_json) + File.write(root_build.join('rules.ninja'), rules_str) build_str = String.new()