From 125ab4c171ea153323b6f56d7c7f1a0bd22f0d04 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 23 Jan 2022 16:44:18 -0500 Subject: [PATCH] Checkpoint --- build_tests/cfile/Rsconscript | 2 +- build_tests/cfile/error_unknown_extension.rb | 2 +- build_tests/clone_env/Rsconscript | 2 +- build_tests/clone_env/clone_all.rb | 2 +- build_tests/configure/autoconf_rebuild.rb | 2 +- .../configure/check_c_header_cpppath.rb | 2 +- .../check_c_header_no_fail_set_define.rb | 2 +- .../check_c_header_success_set_define.rb | 2 +- build_tests/configure/check_cfg.rb | 2 +- build_tests/configure/check_cfg_package.rb | 2 +- build_tests/configure/check_cfg_use.rb | 2 +- .../configure/check_cxx_header_cpppath.rb | 2 +- .../configure/check_d_import_d_import_path.rb | 2 +- build_tests/configure/check_lib_libpath1.rb | 2 +- build_tests/configure/check_lib_libpath2.rb | 2 +- build_tests/configure/check_lib_success.rb | 2 +- build_tests/configure/check_lib_use.rb | 2 +- build_tests/configure/check_lib_use_false.rb | 2 +- build_tests/configure/custom_config_check.rb | 2 +- build_tests/configure/multiple_set_define.rb | 2 +- build_tests/custom_builder/Rsconscript | 2 +- build_tests/custom_builder/build_after.rb | 2 +- build_tests/custom_builder/cvar_expansion.rb | 2 +- build_tests/custom_builder/cvar_lambda.rb | 2 +- .../custom_builder/error_run_return_value.rb | 2 +- build_tests/custom_builder/error_wait_for.rb | 2 +- .../custom_builder/multiple_targets.rb | 2 +- build_tests/custom_builder/produces.rb | 2 +- build_tests/custom_builder/produces_env.rb | 2 +- build_tests/custom_builder/wait_for_thread.rb | 2 +- build_tests/d/Rsconscript | 2 +- build_tests/d/build-ldc2.rb | 2 +- build_tests/d/link_objects.rb | 2 +- build_tests/direct/c_program.rb | 2 +- build_tests/direct/c_shared_library.rb | 2 +- build_tests/header/Rsconscript | 2 +- build_tests/json_to_yaml/Rsconscript | 2 +- build_tests/library/Rsconscript | 2 +- build_tests/library/library_from_object.rb | 2 +- build_tests/library/override_arcmd.rb | 2 +- build_tests/multiple_basename/Rsconscript | 2 +- build_tests/preprocess/Rsconscript | 2 +- build_tests/sh/sh.rb | 2 +- build_tests/sh/sh_fail.rb | 2 +- build_tests/sh/sh_fail_continue.rb | 2 +- build_tests/shared_library/Rsconscript | 2 +- .../shared_library/error_unknown_suffix.rb | 2 +- .../shared_library/shared_library_as.rb | 2 +- .../shared_library/shared_library_cxx.rb | 2 +- .../shared_library/shared_library_d.rb | 2 +- .../shared_library_from_object.rb | 2 +- .../shared_library/shared_library_set_shld.rb | 2 +- build_tests/simple/Rsconscript | 2 +- build_tests/simple/absolute_source_path.rb | 2 +- build_tests/simple/barrier.rb | 2 +- build_tests/simple/builder_as_source.rb | 2 +- build_tests/simple/builder_no_sources.rb | 2 +- .../simple/builder_wait_for_builder.rb | 2 +- build_tests/simple/cache_command_change.rb | 2 +- build_tests/simple/cache_debugging.rb | 2 +- .../simple/cache_dep_checksum_change.rb | 2 +- build_tests/simple/cache_new_dep1.rb | 2 +- build_tests/simple/cache_new_dep2.rb | 2 +- .../cache_successful_builds_when_one_fails.rb | 2 +- build_tests/simple/cache_user_dep.rb | 2 +- build_tests/simple/cache_varset.rb | 2 +- build_tests/simple/clear_targets.rb | 2 +- build_tests/simple/clone_n_threads.rb | 2 +- build_tests/simple/command.rb | 2 +- build_tests/simple/command_builder.rb | 2 +- build_tests/simple/command_redirect.rb | 2 +- build_tests/simple/cvar_array.rb | 2 +- build_tests/simple/directory.rb | 2 +- build_tests/simple/disassemble.rb | 2 +- build_tests/simple/distclean.rb | 2 +- build_tests/simple/dump.rb | 2 +- .../simple/error_circular_dependency.rb | 2 +- .../simple/error_circular_dependency2.rb | 2 +- .../error_produces_nonexistent_target.rb | 2 +- build_tests/simple/error_unknown_suffix.rb | 2 +- build_tests/simple/link_flag_change.rb | 2 +- build_tests/simple/override_cccmd.rb | 2 +- build_tests/simple/override_depfilesuffix.rb | 2 +- build_tests/simple/pathing.rb | 2 +- build_tests/simple/phony_target.rb | 2 +- build_tests/simple/preprocess.rb | 2 +- build_tests/simple/progsuffix.rb | 2 +- build_tests/simple/progsuffix2.rb | 2 +- build_tests/simple/progsuffix3.rb | 2 +- .../simple/register_target_in_build_hook.rb | 2 +- build_tests/simple/size.rb | 2 +- build_tests/simple/threading.rb | 2 +- build_tests/simple/user_dep_build_order.rb | 2 +- build_tests/simple/user_dependencies.rb | 2 +- build_tests/simple/user_dependencies_carat.rb | 2 +- .../simple/wait_for_builds_on_failure.rb | 2 +- build_tests/simple_cc/Rsconscript | 2 +- build_tests/simple_cc/cxxsuffix.rb | 2 +- build_tests/simple_cc/link_objects.rb | 2 +- build_tests/simple_cc/preprocess.rb | 2 +- build_tests/subsidiary/Rsconscript | 2 +- build_tests/subsidiary/Rsconscript_dir | 2 +- build_tests/subsidiary/Rsconscript_fail | 2 +- build_tests/subsidiary/Rsconscript_samedir | 2 +- build_tests/subsidiary/second | 2 +- build_tests/subsidiary/sub/Rsconscript | 2 +- build_tests/subsidiary/sub/Rsconscript2 | 2 +- build_tests/subsidiary/sub/Rsconscript_fail | 2 +- build_tests/two_sources/Rsconscript | 2 +- build_tests/two_sources/assuffix.rb | 2 +- build_tests/two_sources/cache_strict_deps.rb | 2 +- build_tests/two_sources/libsuffix.rb | 2 +- build_tests/two_sources/objsuffix.rb | 2 +- build_tests/typical/Rsconscript | 2 +- build_tests/typical/build_hooks.rb | 2 +- .../typical/build_hooks_override_vars.rb | 2 +- build_tests/typical/carat.rb | 2 +- build_tests/typical/clone_and_name.rb | 2 +- build_tests/typical/copy.rb | 2 +- build_tests/typical/copy_directory.rb | 2 +- build_tests/typical/copy_multiple.rb | 2 +- build_tests/typical/csuffix.rb | 2 +- .../typical/echo_command_ruby_builder.rb | 2 +- build_tests/typical/echo_command_string.rb | 2 +- build_tests/typical/fileutils_methods.rb | 2 +- build_tests/typical/install.rb | 2 +- build_tests/typical/multiple_environments.rb | 2 +- .../typical/multiple_targets_same_name.rb | 2 +- .../typical/post_build_hook_expansion.rb | 2 +- lib/rscons.rb | 1 + lib/rscons/application.rb | 141 ++--- lib/rscons/cli.rb | 110 ++-- lib/rscons/environment.rb | 10 + lib/rscons/script.rb | 100 ++-- lib/rscons/task.rb | 143 +++++ spec/build_tests_spec.rb | 559 +++++++++--------- 136 files changed, 707 insertions(+), 615 deletions(-) create mode 100644 lib/rscons/task.rb diff --git a/build_tests/cfile/Rsconscript b/build_tests/cfile/Rsconscript index e383baa..96818d0 100644 --- a/build_tests/cfile/Rsconscript +++ b/build_tests/cfile/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.CFile("lexer.c", "lexer.l") env.CFile("parser.c", "parser.y") diff --git a/build_tests/cfile/error_unknown_extension.rb b/build_tests/cfile/error_unknown_extension.rb index 05cceb7..af5b2b1 100644 --- a/build_tests/cfile/error_unknown_extension.rb +++ b/build_tests/cfile/error_unknown_extension.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.CFile("file.c", "foo.bar") end diff --git a/build_tests/clone_env/Rsconscript b/build_tests/clone_env/Rsconscript index 9df798d..fe88c89 100644 --- a/build_tests/clone_env/Rsconscript +++ b/build_tests/clone_env/Rsconscript @@ -1,4 +1,4 @@ -build do +default do debug = Environment.new(echo: :command) do |env| env['CFLAGS'] = '-O2' env['CPPFLAGS'] = '-DSTRING="Debug Version"' diff --git a/build_tests/clone_env/clone_all.rb b/build_tests/clone_env/clone_all.rb index 6da6e39..08eebd1 100644 --- a/build_tests/clone_env/clone_all.rb +++ b/build_tests/clone_env/clone_all.rb @@ -1,4 +1,4 @@ -build do +default do env1 = Environment.new(echo: :command) do |env| env['CFLAGS'] = '-O2' env.add_build_hook do |builder| diff --git a/build_tests/configure/autoconf_rebuild.rb b/build_tests/configure/autoconf_rebuild.rb index 381b6f1..38731d9 100644 --- a/build_tests/configure/autoconf_rebuild.rb +++ b/build_tests/configure/autoconf_rebuild.rb @@ -3,7 +3,7 @@ configure do check_c_header "stdio.h" end -build do +default do Environment.new do |env| env.Program("simple.exe", "simple.c") end diff --git a/build_tests/configure/check_c_header_cpppath.rb b/build_tests/configure/check_c_header_cpppath.rb index c3fd28c..6e6cf72 100644 --- a/build_tests/configure/check_c_header_cpppath.rb +++ b/build_tests/configure/check_c_header_cpppath.rb @@ -3,7 +3,7 @@ configure do check_c_header "frobulous.h", check_cpppath: ["./usr2"] end -build do +default do Environment.new do |env| env.Object("test.o", "test.c") end diff --git a/build_tests/configure/check_c_header_no_fail_set_define.rb b/build_tests/configure/check_c_header_no_fail_set_define.rb index 79bb8ff..16a5f61 100644 --- a/build_tests/configure/check_c_header_no_fail_set_define.rb +++ b/build_tests/configure/check_c_header_no_fail_set_define.rb @@ -2,7 +2,7 @@ configure do check_c_header "not___found.h", set_define: "HAVE_NOT___FOUND_H" end -build do +default do Environment.new(echo: :command) do |env| env.Object("simple.o", "simple.c") end diff --git a/build_tests/configure/check_c_header_success_set_define.rb b/build_tests/configure/check_c_header_success_set_define.rb index 8e82084..59a4b8c 100644 --- a/build_tests/configure/check_c_header_success_set_define.rb +++ b/build_tests/configure/check_c_header_success_set_define.rb @@ -2,7 +2,7 @@ configure do check_c_header "string.h", set_define: "HAVE_STRING_H" end -build do +default do Environment.new(echo: :command) do |env| env.Object("simple.o", "simple.c") end diff --git a/build_tests/configure/check_cfg.rb b/build_tests/configure/check_cfg.rb index 4187ba0..fcf40e4 100644 --- a/build_tests/configure/check_cfg.rb +++ b/build_tests/configure/check_cfg.rb @@ -2,7 +2,7 @@ configure do check_cfg program: "my-config" end -build do +default do Environment.new(echo: :command) do |env| env.Program("myconfigtest", "simple.c") end diff --git a/build_tests/configure/check_cfg_package.rb b/build_tests/configure/check_cfg_package.rb index 6b63385..26ccfde 100644 --- a/build_tests/configure/check_cfg_package.rb +++ b/build_tests/configure/check_cfg_package.rb @@ -2,7 +2,7 @@ configure do check_cfg package: "mypackage" end -build do +default do Environment.new(echo: :command) do |env| env.Program("myconfigtest", "simple.c") end diff --git a/build_tests/configure/check_cfg_use.rb b/build_tests/configure/check_cfg_use.rb index 7403b76..1a7bb9f 100644 --- a/build_tests/configure/check_cfg_use.rb +++ b/build_tests/configure/check_cfg_use.rb @@ -2,7 +2,7 @@ configure do check_cfg package: "mypackage", use: "myp" end -build do +default do Environment.new(echo: :command) do |env| env.Copy("myconfigtest1.c", "simple.c") env.Program("myconfigtest1.exe", "myconfigtest1.c") diff --git a/build_tests/configure/check_cxx_header_cpppath.rb b/build_tests/configure/check_cxx_header_cpppath.rb index 242e919..5650389 100644 --- a/build_tests/configure/check_cxx_header_cpppath.rb +++ b/build_tests/configure/check_cxx_header_cpppath.rb @@ -3,7 +3,7 @@ configure do check_cxx_header "frobulous.h", check_cpppath: ["./usr2"] end -build do +default do Environment.new do |env| env.Object("test.o", "test.cc") end diff --git a/build_tests/configure/check_d_import_d_import_path.rb b/build_tests/configure/check_d_import_d_import_path.rb index 58bb313..012a428 100644 --- a/build_tests/configure/check_d_import_d_import_path.rb +++ b/build_tests/configure/check_d_import_d_import_path.rb @@ -4,7 +4,7 @@ configure do check_d_import "frobulous", check_d_import_path: ["./usr2"] end -build do +default do Environment.new do |env| env.Object("test.o", "test.d") end diff --git a/build_tests/configure/check_lib_libpath1.rb b/build_tests/configure/check_lib_libpath1.rb index c5897ce..2e6aa30 100644 --- a/build_tests/configure/check_lib_libpath1.rb +++ b/build_tests/configure/check_lib_libpath1.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env.Library("usr2/libfrobulous.a", "two.c") end diff --git a/build_tests/configure/check_lib_libpath2.rb b/build_tests/configure/check_lib_libpath2.rb index c0998c2..96534ce 100644 --- a/build_tests/configure/check_lib_libpath2.rb +++ b/build_tests/configure/check_lib_libpath2.rb @@ -3,7 +3,7 @@ configure do check_lib "frobulous", check_libpath: ["./usr2"] end -build do +default do Environment.new(echo: :command) do |env| env.Program("simple.exe", "simple.c") end diff --git a/build_tests/configure/check_lib_success.rb b/build_tests/configure/check_lib_success.rb index 92dbe8a..ad5b7ae 100644 --- a/build_tests/configure/check_lib_success.rb +++ b/build_tests/configure/check_lib_success.rb @@ -2,7 +2,7 @@ configure do check_lib "m" end -build do +default do Environment.new(echo: :command) do |env| env.Program("simple.exe", "simple.c") end diff --git a/build_tests/configure/check_lib_use.rb b/build_tests/configure/check_lib_use.rb index 0638d41..d198332 100644 --- a/build_tests/configure/check_lib_use.rb +++ b/build_tests/configure/check_lib_use.rb @@ -2,7 +2,7 @@ configure do check_lib "m", use: :m end -build do +default do Environment.new(echo: :command) do |env| env.Copy("test1.c", "simple.c") env.Program("test2.exe", "test1.c") diff --git a/build_tests/configure/check_lib_use_false.rb b/build_tests/configure/check_lib_use_false.rb index 75f03ac..b9cf3bc 100644 --- a/build_tests/configure/check_lib_use_false.rb +++ b/build_tests/configure/check_lib_use_false.rb @@ -2,7 +2,7 @@ configure do check_lib "m", use: false end -build do +default do Environment.new(echo: :command) do |env| env.Copy("test1.c", "simple.c") env.Program("test2.exe", "test1.c") diff --git a/build_tests/configure/custom_config_check.rb b/build_tests/configure/custom_config_check.rb index a110626..487859a 100644 --- a/build_tests/configure/custom_config_check.rb +++ b/build_tests/configure/custom_config_check.rb @@ -23,7 +23,7 @@ configure do end end -build do +default do Environment.new do |env| puts env["CPPDEFINES"] end diff --git a/build_tests/configure/multiple_set_define.rb b/build_tests/configure/multiple_set_define.rb index da7bf2f..eefedc8 100644 --- a/build_tests/configure/multiple_set_define.rb +++ b/build_tests/configure/multiple_set_define.rb @@ -3,7 +3,7 @@ configure do check_c_header "stdio.h", set_define: "HAVE_STDIO_H" end -build do +default do Environment.new(echo: :command) do |env| env.Object("simple.o", "simple.c") end diff --git a/build_tests/custom_builder/Rsconscript b/build_tests/custom_builder/Rsconscript index 73e9a89..99a461c 100644 --- a/build_tests/custom_builder/Rsconscript +++ b/build_tests/custom_builder/Rsconscript @@ -9,7 +9,7 @@ EOF end end -build do +default do Environment.new do |env| env.add_builder(MySource) env.MySource('inc.h', []) diff --git a/build_tests/custom_builder/build_after.rb b/build_tests/custom_builder/build_after.rb index 3cbbad0..3c40645 100644 --- a/build_tests/custom_builder/build_after.rb +++ b/build_tests/custom_builder/build_after.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Command("inc.c", [], diff --git a/build_tests/custom_builder/cvar_expansion.rb b/build_tests/custom_builder/cvar_expansion.rb index ef8cc48..07f55aa 100644 --- a/build_tests/custom_builder/cvar_expansion.rb +++ b/build_tests/custom_builder/cvar_expansion.rb @@ -9,7 +9,7 @@ EOF end end -build do +default do env = Environment.new do |env| env["hdr"] = "inc.h" env["src"] = "program.c" diff --git a/build_tests/custom_builder/cvar_lambda.rb b/build_tests/custom_builder/cvar_lambda.rb index 33e341b..96affd7 100644 --- a/build_tests/custom_builder/cvar_lambda.rb +++ b/build_tests/custom_builder/cvar_lambda.rb @@ -9,7 +9,7 @@ EOF end end -build do +default do e1 = Environment.new do |env| env.add_builder(MySource) env["one"] = "5" diff --git a/build_tests/custom_builder/error_run_return_value.rb b/build_tests/custom_builder/error_run_return_value.rb index bae5ef7..6abd8ce 100644 --- a/build_tests/custom_builder/error_run_return_value.rb +++ b/build_tests/custom_builder/error_run_return_value.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.add_builder(:MyBuilder) do |options| "hi" diff --git a/build_tests/custom_builder/error_wait_for.rb b/build_tests/custom_builder/error_wait_for.rb index da93ec9..1fb605f 100644 --- a/build_tests/custom_builder/error_wait_for.rb +++ b/build_tests/custom_builder/error_wait_for.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.add_builder(:MyBuilder) do |options| wait_for(1) diff --git a/build_tests/custom_builder/multiple_targets.rb b/build_tests/custom_builder/multiple_targets.rb index 73267dd..292bb2e 100644 --- a/build_tests/custom_builder/multiple_targets.rb +++ b/build_tests/custom_builder/multiple_targets.rb @@ -12,7 +12,7 @@ class CHGen < Rscons::Builder end end -build do +default do Environment.new do |env| env.add_builder(CHGen) env.CHGen("inc.c", ["program.c"]) diff --git a/build_tests/custom_builder/produces.rb b/build_tests/custom_builder/produces.rb index 98e9c4c..552b94c 100644 --- a/build_tests/custom_builder/produces.rb +++ b/build_tests/custom_builder/produces.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["build_root"] = env.build_root env["inc_h"] = "inc.h" diff --git a/build_tests/custom_builder/produces_env.rb b/build_tests/custom_builder/produces_env.rb index 9bd9a64..727f66e 100644 --- a/build_tests/custom_builder/produces_env.rb +++ b/build_tests/custom_builder/produces_env.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["build_root"] = env.build_root env["inc_h"] = "inc.h" diff --git a/build_tests/custom_builder/wait_for_thread.rb b/build_tests/custom_builder/wait_for_thread.rb index ffb422f..dbfb2c1 100644 --- a/build_tests/custom_builder/wait_for_thread.rb +++ b/build_tests/custom_builder/wait_for_thread.rb @@ -13,7 +13,7 @@ class MyBuilder < Rscons::Builder end end -build do +default do Environment.new do |env| env.add_builder(MyBuilder) env.MyBuilder("foo") diff --git a/build_tests/d/Rsconscript b/build_tests/d/Rsconscript index 0a9e126..046b8b5 100644 --- a/build_tests/d/Rsconscript +++ b/build_tests/d/Rsconscript @@ -2,7 +2,7 @@ configure do check_d_compiler "gdc" end -build do +default do Environment.new(echo: :command) do |env| env.Program("hello-d.exe", glob("*.d")) end diff --git a/build_tests/d/build-ldc2.rb b/build_tests/d/build-ldc2.rb index 0d1c7a5..a435d40 100644 --- a/build_tests/d/build-ldc2.rb +++ b/build_tests/d/build-ldc2.rb @@ -2,7 +2,7 @@ configure do check_d_compiler "ldc2" end -build do +default do Environment.new(echo: :command) do |env| env.Program("hello-d.exe", glob("*.d")) end diff --git a/build_tests/d/link_objects.rb b/build_tests/d/link_objects.rb index 0b8178b..69fba89 100644 --- a/build_tests/d/link_objects.rb +++ b/build_tests/d/link_objects.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env.Object("main.o", "main.d") env.Object("mod.o", "mod.d") diff --git a/build_tests/direct/c_program.rb b/build_tests/direct/c_program.rb index cddff17..ffcfe82 100644 --- a/build_tests/direct/c_program.rb +++ b/build_tests/direct/c_program.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program("test.exe", glob("*.c"), direct: true) end diff --git a/build_tests/direct/c_shared_library.rb b/build_tests/direct/c_shared_library.rb index 12d5c94..fa257b2 100644 --- a/build_tests/direct/c_shared_library.rb +++ b/build_tests/direct/c_shared_library.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| lib = env.SharedLibrary("mylib", ["two.c", "three.c"], direct: true) program = env.Program("test.exe", "main.c", "LIBS" => ["mylib"], "LIBPATH" => ["."]) diff --git a/build_tests/header/Rsconscript b/build_tests/header/Rsconscript index 27fb446..d3dbd70 100644 --- a/build_tests/header/Rsconscript +++ b/build_tests/header/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program('header.exe', Dir['*.c']) end diff --git a/build_tests/json_to_yaml/Rsconscript b/build_tests/json_to_yaml/Rsconscript index f1bba01..f3e3a31 100644 --- a/build_tests/json_to_yaml/Rsconscript +++ b/build_tests/json_to_yaml/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| require 'json' require 'yaml' diff --git a/build_tests/library/Rsconscript b/build_tests/library/Rsconscript index c6a8df5..b0bc5fd 100644 --- a/build_tests/library/Rsconscript +++ b/build_tests/library/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env.Program('library.exe', ['lib.a', 'three.c']) env.Library("lib.a", ['one.c', 'two.c'], 'CPPFLAGS' => ['-Dmake_lib']) diff --git a/build_tests/library/library_from_object.rb b/build_tests/library/library_from_object.rb index 367203d..fe39fa4 100644 --- a/build_tests/library/library_from_object.rb +++ b/build_tests/library/library_from_object.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program("library.exe", ["lib.a", "three.c"]) env.Object("two.o", "two.c") diff --git a/build_tests/library/override_arcmd.rb b/build_tests/library/override_arcmd.rb index f14f9d8..efa72cf 100644 --- a/build_tests/library/override_arcmd.rb +++ b/build_tests/library/override_arcmd.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}] env.Library("lib.a", glob("*.c")) diff --git a/build_tests/multiple_basename/Rsconscript b/build_tests/multiple_basename/Rsconscript index ad7f7b8..c35302f 100644 --- a/build_tests/multiple_basename/Rsconscript +++ b/build_tests/multiple_basename/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program("foo.exe", glob("*.cc", "*.c")) end diff --git a/build_tests/preprocess/Rsconscript b/build_tests/preprocess/Rsconscript index 020419a..793d6d3 100644 --- a/build_tests/preprocess/Rsconscript +++ b/build_tests/preprocess/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Preprocess("pp", "foo.h") end diff --git a/build_tests/sh/sh.rb b/build_tests/sh/sh.rb index 90b2082..59704e1 100644 --- a/build_tests/sh/sh.rb +++ b/build_tests/sh/sh.rb @@ -1,4 +1,4 @@ -build do +default do sh "echo", "hi there" sh(["echo 1 2"]) end diff --git a/build_tests/sh/sh_fail.rb b/build_tests/sh/sh_fail.rb index 230c2dd..e3052e4 100644 --- a/build_tests/sh/sh_fail.rb +++ b/build_tests/sh/sh_fail.rb @@ -1,4 +1,4 @@ -build do +default do sh "foobar42" sh "echo", "continued" end diff --git a/build_tests/sh/sh_fail_continue.rb b/build_tests/sh/sh_fail_continue.rb index b5c25bd..dd9724d 100644 --- a/build_tests/sh/sh_fail_continue.rb +++ b/build_tests/sh/sh_fail_continue.rb @@ -1,4 +1,4 @@ -build do +default do sh "foobar42", continue: true sh "echo", "continued" end diff --git a/build_tests/shared_library/Rsconscript b/build_tests/shared_library/Rsconscript index 746d1cc..1e46959 100644 --- a/build_tests/shared_library/Rsconscript +++ b/build_tests/shared_library/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CPPPATH"] << "src/lib" libmine = env.SharedLibrary("mine", glob("src/lib/*.c")) diff --git a/build_tests/shared_library/error_unknown_suffix.rb b/build_tests/shared_library/error_unknown_suffix.rb index 3552069..49dfb09 100644 --- a/build_tests/shared_library/error_unknown_suffix.rb +++ b/build_tests/shared_library/error_unknown_suffix.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| File.open("foo.xyz", "wb") do |fh| fh.puts("hi") diff --git a/build_tests/shared_library/shared_library_as.rb b/build_tests/shared_library/shared_library_as.rb index c24f4a5..7b54422 100644 --- a/build_tests/shared_library/shared_library_as.rb +++ b/build_tests/shared_library/shared_library_as.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CPPPATH"] << "src/lib" env.Object("file.S", "src/lib/one.c", "CFLAGS" => env["CFLAGS"] + ["-S"]) diff --git a/build_tests/shared_library/shared_library_cxx.rb b/build_tests/shared_library/shared_library_cxx.rb index c148ac3..97f5c5d 100644 --- a/build_tests/shared_library/shared_library_cxx.rb +++ b/build_tests/shared_library/shared_library_cxx.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CPPPATH"] << "src/lib" libmine = env.SharedLibrary("mine", glob("src/lib/*.cc")) diff --git a/build_tests/shared_library/shared_library_d.rb b/build_tests/shared_library/shared_library_d.rb index 50e5a93..36c6352 100644 --- a/build_tests/shared_library/shared_library_d.rb +++ b/build_tests/shared_library/shared_library_d.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CPPPATH"] << "src/lib" libmine = env.SharedLibrary("mine", glob("src/lib/*.d")) diff --git a/build_tests/shared_library/shared_library_from_object.rb b/build_tests/shared_library/shared_library_from_object.rb index 1322b96..9df7d4d 100644 --- a/build_tests/shared_library/shared_library_from_object.rb +++ b/build_tests/shared_library/shared_library_from_object.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CPPPATH"] << "src/lib" env.SharedObject("one.o", "src/lib/one.c") diff --git a/build_tests/shared_library/shared_library_set_shld.rb b/build_tests/shared_library/shared_library_set_shld.rb index 3c44570..54d7a3e 100644 --- a/build_tests/shared_library/shared_library_set_shld.rb +++ b/build_tests/shared_library/shared_library_set_shld.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CPPPATH"] << "src/lib" env["SHLD"] = "gcc" diff --git a/build_tests/simple/Rsconscript b/build_tests/simple/Rsconscript index b679de6..d80cb69 100644 --- a/build_tests/simple/Rsconscript +++ b/build_tests/simple/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program('simple.exe', Dir['*.c']) end diff --git a/build_tests/simple/absolute_source_path.rb b/build_tests/simple/absolute_source_path.rb index 3358796..08d8b5c 100644 --- a/build_tests/simple/absolute_source_path.rb +++ b/build_tests/simple/absolute_source_path.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| tempdir = ENV["TEMP"] || ENV["TMP"] || "/tmp" source_file = File.join(tempdir, "abs.c") diff --git a/build_tests/simple/barrier.rb b/build_tests/simple/barrier.rb index 2be4b6e..aed2974 100644 --- a/build_tests/simple/barrier.rb +++ b/build_tests/simple/barrier.rb @@ -10,7 +10,7 @@ class ThreadedTestBuilder < Rscons::Builder end end -build do +default do Environment.new do |env| env.add_builder(ThreadedTestBuilder) env.ThreadedTestBuilder("T3", [], "delay" => 3) diff --git a/build_tests/simple/builder_as_source.rb b/build_tests/simple/builder_as_source.rb index 953fcad..46a7a41 100644 --- a/build_tests/simple/builder_as_source.rb +++ b/build_tests/simple/builder_as_source.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| object = env.Object("simple.o", "simple.c") env.Program("simple.exe", object) diff --git a/build_tests/simple/builder_no_sources.rb b/build_tests/simple/builder_no_sources.rb index 4c3b7c1..16c4fe8 100644 --- a/build_tests/simple/builder_no_sources.rb +++ b/build_tests/simple/builder_no_sources.rb @@ -3,7 +3,7 @@ class TestBuilder < Rscons::Builder true end end -build do +default do Environment.new do |env| env.add_builder(TestBuilder) env.TestBuilder("file") diff --git a/build_tests/simple/builder_wait_for_builder.rb b/build_tests/simple/builder_wait_for_builder.rb index 5266987..c0cc255 100644 --- a/build_tests/simple/builder_wait_for_builder.rb +++ b/build_tests/simple/builder_wait_for_builder.rb @@ -14,7 +14,7 @@ class MyObject < Rscons::Builder end end -build do +default do Environment.new do |env| env.add_builder(MyObject) env.MyObject("simple.o", "simple.c") diff --git a/build_tests/simple/cache_command_change.rb b/build_tests/simple/cache_command_change.rb index 7a00743..d39ea04 100644 --- a/build_tests/simple/cache_command_change.rb +++ b/build_tests/simple/cache_command_change.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["LIBS"] += ["m"] env.Program('simple.exe', Dir['*.c']) diff --git a/build_tests/simple/cache_debugging.rb b/build_tests/simple/cache_debugging.rb index df58ff3..fc0699d 100644 --- a/build_tests/simple/cache_debugging.rb +++ b/build_tests/simple/cache_debugging.rb @@ -27,7 +27,7 @@ class DebugBuilder < Rscons::Builder end end -build do +default do Environment.new do |env| env.add_builder(DebugBuilder) if Rscons.vars["new_user_dep"] diff --git a/build_tests/simple/cache_dep_checksum_change.rb b/build_tests/simple/cache_dep_checksum_change.rb index 2328628..6ac75b7 100644 --- a/build_tests/simple/cache_dep_checksum_change.rb +++ b/build_tests/simple/cache_dep_checksum_change.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Copy("simple.copy", "simple.c") end diff --git a/build_tests/simple/cache_new_dep1.rb b/build_tests/simple/cache_new_dep1.rb index f9e45c4..381d5ec 100644 --- a/build_tests/simple/cache_new_dep1.rb +++ b/build_tests/simple/cache_new_dep1.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Object("simple.o", "simple.c") env.process diff --git a/build_tests/simple/cache_new_dep2.rb b/build_tests/simple/cache_new_dep2.rb index b3467d5..d21029f 100644 --- a/build_tests/simple/cache_new_dep2.rb +++ b/build_tests/simple/cache_new_dep2.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Object("simple.o", "simple.c") env["LDCMD"] = %w[gcc -o ${_TARGET} simple.o] diff --git a/build_tests/simple/cache_successful_builds_when_one_fails.rb b/build_tests/simple/cache_successful_builds_when_one_fails.rb index 3213e69..f7a700a 100644 --- a/build_tests/simple/cache_successful_builds_when_one_fails.rb +++ b/build_tests/simple/cache_successful_builds_when_one_fails.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Object("simple.o", "simple.c") env.Object("two.o", "two.c") diff --git a/build_tests/simple/cache_user_dep.rb b/build_tests/simple/cache_user_dep.rb index 85f60c6..4ba98f1 100644 --- a/build_tests/simple/cache_user_dep.rb +++ b/build_tests/simple/cache_user_dep.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| target = env.Program("simple.exe", "simple.c") user_deps = File.read("user_deps", mode: "rb").split(" ") diff --git a/build_tests/simple/cache_varset.rb b/build_tests/simple/cache_varset.rb index 5a4bde9..85b8c77 100644 --- a/build_tests/simple/cache_varset.rb +++ b/build_tests/simple/cache_varset.rb @@ -13,7 +13,7 @@ class TestBuilder < Rscons::Builder end end -build do +default do Environment.new do |env| env.add_builder(TestBuilder) env.TestBuilder("foo") diff --git a/build_tests/simple/clear_targets.rb b/build_tests/simple/clear_targets.rb index dbacdf4..101fb47 100644 --- a/build_tests/simple/clear_targets.rb +++ b/build_tests/simple/clear_targets.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program("simple.exe", "simple.c") env.clear_targets diff --git a/build_tests/simple/clone_n_threads.rb b/build_tests/simple/clone_n_threads.rb index 2b6b5fc..17e7f09 100644 --- a/build_tests/simple/clone_n_threads.rb +++ b/build_tests/simple/clone_n_threads.rb @@ -1,4 +1,4 @@ -build do +default do base_env = Environment.new do |env| env.n_threads = 165 end diff --git a/build_tests/simple/command.rb b/build_tests/simple/command.rb index d9f1d18..cfa2c81 100644 --- a/build_tests/simple/command.rb +++ b/build_tests/simple/command.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env["LD"] = "gcc" env.Program('simple.exe', Dir['*.c']) diff --git a/build_tests/simple/command_builder.rb b/build_tests/simple/command_builder.rb index 1530f1b..c9bbe50 100644 --- a/build_tests/simple/command_builder.rb +++ b/build_tests/simple/command_builder.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| command = %W[gcc -o ${_TARGET} ${_SOURCES}] env.Command("simple.exe", diff --git a/build_tests/simple/command_redirect.rb b/build_tests/simple/command_redirect.rb index 6ce5f05..fe201cb 100644 --- a/build_tests/simple/command_redirect.rb +++ b/build_tests/simple/command_redirect.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Object("simple.o", "simple.c") env.Command("simple.txt", diff --git a/build_tests/simple/cvar_array.rb b/build_tests/simple/cvar_array.rb index f27fc45..3335f5a 100644 --- a/build_tests/simple/cvar_array.rb +++ b/build_tests/simple/cvar_array.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["sources"] = glob("*.c") env.Program("simple.exe", "${sources}") diff --git a/build_tests/simple/directory.rb b/build_tests/simple/directory.rb index bcafece..d6b6659 100644 --- a/build_tests/simple/directory.rb +++ b/build_tests/simple/directory.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Directory("teh_dir") end diff --git a/build_tests/simple/disassemble.rb b/build_tests/simple/disassemble.rb index 3c5e8c2..743bdc9 100644 --- a/build_tests/simple/disassemble.rb +++ b/build_tests/simple/disassemble.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Object("simple.o", "simple.c") env.Disassemble("simple.txt", "simple.o") diff --git a/build_tests/simple/distclean.rb b/build_tests/simple/distclean.rb index 7cdfc1c..f353e3e 100644 --- a/build_tests/simple/distclean.rb +++ b/build_tests/simple/distclean.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Object("simple.o", "simple.c") end diff --git a/build_tests/simple/dump.rb b/build_tests/simple/dump.rb index 959f168..eab53ce 100644 --- a/build_tests/simple/dump.rb +++ b/build_tests/simple/dump.rb @@ -1,4 +1,4 @@ -build do +default do env = Environment.new do |env| env["CFLAGS"] += %w[-O2 -fomit-frame-pointer] env[:foo] = :bar diff --git a/build_tests/simple/error_circular_dependency.rb b/build_tests/simple/error_circular_dependency.rb index 4684d31..a579a3c 100644 --- a/build_tests/simple/error_circular_dependency.rb +++ b/build_tests/simple/error_circular_dependency.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Command("foo", "bar") env.Command("bar", "baz") diff --git a/build_tests/simple/error_circular_dependency2.rb b/build_tests/simple/error_circular_dependency2.rb index 997f053..3d3e6c9 100644 --- a/build_tests/simple/error_circular_dependency2.rb +++ b/build_tests/simple/error_circular_dependency2.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Command("foo", "foo") end diff --git a/build_tests/simple/error_produces_nonexistent_target.rb b/build_tests/simple/error_produces_nonexistent_target.rb index 2a35557..5d246e3 100644 --- a/build_tests/simple/error_produces_nonexistent_target.rb +++ b/build_tests/simple/error_produces_nonexistent_target.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.produces("foo", "bar") end diff --git a/build_tests/simple/error_unknown_suffix.rb b/build_tests/simple/error_unknown_suffix.rb index 76f3657..bd1817d 100644 --- a/build_tests/simple/error_unknown_suffix.rb +++ b/build_tests/simple/error_unknown_suffix.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| File.open("foo.xyz", "wb") do |fh| fh.puts("hi") diff --git a/build_tests/simple/link_flag_change.rb b/build_tests/simple/link_flag_change.rb index 5e9a752..bae47f5 100644 --- a/build_tests/simple/link_flag_change.rb +++ b/build_tests/simple/link_flag_change.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env["LD"] = "gcc" env["LIBPATH"] += ["libdir"] diff --git a/build_tests/simple/override_cccmd.rb b/build_tests/simple/override_cccmd.rb index 767b943..59cbd93 100644 --- a/build_tests/simple/override_cccmd.rb +++ b/build_tests/simple/override_cccmd.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env.Object("simple.o", "simple.c", "CCCMD" => %w[${CC} -c -o ${_TARGET} -Dfoobar ${_SOURCES}]) diff --git a/build_tests/simple/override_depfilesuffix.rb b/build_tests/simple/override_depfilesuffix.rb index 4cedf4c..80e1b25 100644 --- a/build_tests/simple/override_depfilesuffix.rb +++ b/build_tests/simple/override_depfilesuffix.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env["DEPFILESUFFIX"] = ".deppy" env.Object("simple.o", "simple.c") diff --git a/build_tests/simple/pathing.rb b/build_tests/simple/pathing.rb index 47a8039..58f7c55 100644 --- a/build_tests/simple/pathing.rb +++ b/build_tests/simple/pathing.rb @@ -1,7 +1,7 @@ path_prepend "path_prepend" path_append "path_append" -build do +default do Environment.new do |env| system("flex") system("foobar") diff --git a/build_tests/simple/phony_target.rb b/build_tests/simple/phony_target.rb index 4263a7c..77484c7 100644 --- a/build_tests/simple/phony_target.rb +++ b/build_tests/simple/phony_target.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.add_builder(:Checker) do |params| unless @cache.up_to_date?(@target, :Checker, @sources, @env) diff --git a/build_tests/simple/preprocess.rb b/build_tests/simple/preprocess.rb index 9e6191d..030ab4c 100644 --- a/build_tests/simple/preprocess.rb +++ b/build_tests/simple/preprocess.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Preprocess("simplepp.c", "simple.c") env.Program("simple.exe", "simplepp.c") diff --git a/build_tests/simple/progsuffix.rb b/build_tests/simple/progsuffix.rb index 29ad125..6bec0d0 100644 --- a/build_tests/simple/progsuffix.rb +++ b/build_tests/simple/progsuffix.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["PROGSUFFIX"] = ".out" env.Program("simple", Dir["*.c"]) diff --git a/build_tests/simple/progsuffix2.rb b/build_tests/simple/progsuffix2.rb index e1ca8e4..7e9788d 100644 --- a/build_tests/simple/progsuffix2.rb +++ b/build_tests/simple/progsuffix2.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["MYSUFFIX"] = ".out" env.Program("simple${MYSUFFIX}", Dir["*.c"]) diff --git a/build_tests/simple/progsuffix3.rb b/build_tests/simple/progsuffix3.rb index 91ff076..6aed2cf 100644 --- a/build_tests/simple/progsuffix3.rb +++ b/build_tests/simple/progsuffix3.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program("simple", Dir["*.c"], "PROGSUFFIX" => ".xyz") end diff --git a/build_tests/simple/register_target_in_build_hook.rb b/build_tests/simple/register_target_in_build_hook.rb index 6366a98..0ad4ee4 100644 --- a/build_tests/simple/register_target_in_build_hook.rb +++ b/build_tests/simple/register_target_in_build_hook.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program("simple.exe", Dir["*.c"]) env.add_build_hook do |builder| diff --git a/build_tests/simple/size.rb b/build_tests/simple/size.rb index cf978f0..bfa4efa 100644 --- a/build_tests/simple/size.rb +++ b/build_tests/simple/size.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program("simple.exe", glob("*.c")) env.Size("simple.size", "simple.exe") diff --git a/build_tests/simple/threading.rb b/build_tests/simple/threading.rb index 65f88a4..f42d3db 100644 --- a/build_tests/simple/threading.rb +++ b/build_tests/simple/threading.rb @@ -17,7 +17,7 @@ class NonThreadedTestBuilder < Rscons::Builder end end -build do +default do Environment.new do |env| env.add_builder(ThreadedTestBuilder) env.add_builder(NonThreadedTestBuilder) diff --git a/build_tests/simple/user_dep_build_order.rb b/build_tests/simple/user_dep_build_order.rb index 1fe62ac..43965f4 100644 --- a/build_tests/simple/user_dep_build_order.rb +++ b/build_tests/simple/user_dep_build_order.rb @@ -13,7 +13,7 @@ class TestBuilder < Rscons::Builder end end -build do +default do Environment.new do |env| env.add_builder(TestBuilder) one = env.TestBuilder("one", [], "wait_time" => "3") diff --git a/build_tests/simple/user_dependencies.rb b/build_tests/simple/user_dependencies.rb index 63537e3..04ae089 100644 --- a/build_tests/simple/user_dependencies.rb +++ b/build_tests/simple/user_dependencies.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| program = env.Program("simple.exe", Dir["*.c"]) env.depends(program, "program.ld") diff --git a/build_tests/simple/user_dependencies_carat.rb b/build_tests/simple/user_dependencies_carat.rb index 0e08f2d..dddf9da 100644 --- a/build_tests/simple/user_dependencies_carat.rb +++ b/build_tests/simple/user_dependencies_carat.rb @@ -8,7 +8,7 @@ class FileBuilder < Builder true end end -build do +default do Environment.new do |env| env.add_builder(FileBuilder) env.File("^/file.txt") diff --git a/build_tests/simple/wait_for_builds_on_failure.rb b/build_tests/simple/wait_for_builds_on_failure.rb index 7e8025b..c491d64 100644 --- a/build_tests/simple/wait_for_builds_on_failure.rb +++ b/build_tests/simple/wait_for_builds_on_failure.rb @@ -11,7 +11,7 @@ class Fail < Rscons::Builder end end -build do +default do Environment.new do |env| env.add_builder(Fail) 4.times do |i| diff --git a/build_tests/simple_cc/Rsconscript b/build_tests/simple_cc/Rsconscript index 2bd2d8a..bd0600e 100644 --- a/build_tests/simple_cc/Rsconscript +++ b/build_tests/simple_cc/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Program('simple.exe', Dir['*.cc']) end diff --git a/build_tests/simple_cc/cxxsuffix.rb b/build_tests/simple_cc/cxxsuffix.rb index 8b3e3c1..a6659af 100644 --- a/build_tests/simple_cc/cxxsuffix.rb +++ b/build_tests/simple_cc/cxxsuffix.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CXXSUFFIX"] = %w[.cccc .cc] env["CXXFLAGS"] += %w[-x c++] diff --git a/build_tests/simple_cc/link_objects.rb b/build_tests/simple_cc/link_objects.rb index 9173eba..8eccca2 100644 --- a/build_tests/simple_cc/link_objects.rb +++ b/build_tests/simple_cc/link_objects.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Object("simple.o", "simple.cc") env.Program("simple.exe", "simple.o") diff --git a/build_tests/simple_cc/preprocess.rb b/build_tests/simple_cc/preprocess.rb index 1d2100d..ac18dca 100644 --- a/build_tests/simple_cc/preprocess.rb +++ b/build_tests/simple_cc/preprocess.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Preprocess("simplepp.cc", "simple.cc") env.Program("simple.exe", "simplepp.cc") diff --git a/build_tests/subsidiary/Rsconscript b/build_tests/subsidiary/Rsconscript index 2d402d5..def3bcb 100644 --- a/build_tests/subsidiary/Rsconscript +++ b/build_tests/subsidiary/Rsconscript @@ -4,7 +4,7 @@ configure do puts "top configure" end -build do +default do rscons "sub/Rsconscript2", "build" puts "top build" end diff --git a/build_tests/subsidiary/Rsconscript_dir b/build_tests/subsidiary/Rsconscript_dir index e149536..5381970 100644 --- a/build_tests/subsidiary/Rsconscript_dir +++ b/build_tests/subsidiary/Rsconscript_dir @@ -4,7 +4,7 @@ configure do puts "top configure" end -build do +default do rscons "sub", "-f", "Rsconscript2", "build" puts "top build" end diff --git a/build_tests/subsidiary/Rsconscript_fail b/build_tests/subsidiary/Rsconscript_fail index 26a7dc2..1bcf3da 100644 --- a/build_tests/subsidiary/Rsconscript_fail +++ b/build_tests/subsidiary/Rsconscript_fail @@ -3,7 +3,7 @@ configure do puts "top configure" end -build do +default do rscons "sub/Rsconscript2", "build" puts "top build" end diff --git a/build_tests/subsidiary/Rsconscript_samedir b/build_tests/subsidiary/Rsconscript_samedir index 1ff8f9d..141f1ea 100644 --- a/build_tests/subsidiary/Rsconscript_samedir +++ b/build_tests/subsidiary/Rsconscript_samedir @@ -1,4 +1,4 @@ -build do +default do rscons "second", "build" puts "top build" end diff --git a/build_tests/subsidiary/second b/build_tests/subsidiary/second index 33c102b..9896dcb 100644 --- a/build_tests/subsidiary/second +++ b/build_tests/subsidiary/second @@ -1,3 +1,3 @@ -build do +default do puts "second build" end diff --git a/build_tests/subsidiary/sub/Rsconscript b/build_tests/subsidiary/sub/Rsconscript index 93ee01b..742e699 100644 --- a/build_tests/subsidiary/sub/Rsconscript +++ b/build_tests/subsidiary/sub/Rsconscript @@ -2,6 +2,6 @@ configure do puts "sub Rsconscript configure" end -build do +default do puts "sub Rsconscript build" end diff --git a/build_tests/subsidiary/sub/Rsconscript2 b/build_tests/subsidiary/sub/Rsconscript2 index d201857..2ea32d4 100644 --- a/build_tests/subsidiary/sub/Rsconscript2 +++ b/build_tests/subsidiary/sub/Rsconscript2 @@ -2,6 +2,6 @@ configure do puts "sub Rsconscript2 configure" end -build do +default do puts "sub Rsconscript2 build" end diff --git a/build_tests/subsidiary/sub/Rsconscript_fail b/build_tests/subsidiary/sub/Rsconscript_fail index baae3c9..b680bfe 100644 --- a/build_tests/subsidiary/sub/Rsconscript_fail +++ b/build_tests/subsidiary/sub/Rsconscript_fail @@ -3,6 +3,6 @@ configure do check_program "foobarfailure" end -build do +default do puts "sub Rsconscript build" end diff --git a/build_tests/two_sources/Rsconscript b/build_tests/two_sources/Rsconscript index 34db499..f2baeee 100644 --- a/build_tests/two_sources/Rsconscript +++ b/build_tests/two_sources/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env.Object("one.o", "one.c", 'CPPFLAGS' => ['-DONE']) env.Program('two_sources.exe', ['one.o', 'two.c']) diff --git a/build_tests/two_sources/assuffix.rb b/build_tests/two_sources/assuffix.rb index e3959bd..2a57161 100644 --- a/build_tests/two_sources/assuffix.rb +++ b/build_tests/two_sources/assuffix.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["ASSUFFIX"] = %w[.ssss .sss] env["CFLAGS"] += %w[-S] diff --git a/build_tests/two_sources/cache_strict_deps.rb b/build_tests/two_sources/cache_strict_deps.rb index 045d45e..b052497 100644 --- a/build_tests/two_sources/cache_strict_deps.rb +++ b/build_tests/two_sources/cache_strict_deps.rb @@ -13,7 +13,7 @@ class StrictBuilder < Rscons::Builder end end -build do +default do Environment.new(echo: :command) do |env| env.add_builder(StrictBuilder) env.Object("one.o", "one.c", "CCFLAGS" => %w[-DONE]) diff --git a/build_tests/two_sources/libsuffix.rb b/build_tests/two_sources/libsuffix.rb index dd2a3de..cc5c648 100644 --- a/build_tests/two_sources/libsuffix.rb +++ b/build_tests/two_sources/libsuffix.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new() do |env| env["LIBSUFFIX"] = %w[.aaaa .aaa] env.Library("one.aaaa", "one.c", "CPPFLAGS" => ["-DONE"]) diff --git a/build_tests/two_sources/objsuffix.rb b/build_tests/two_sources/objsuffix.rb index af366a6..203d1dd 100644 --- a/build_tests/two_sources/objsuffix.rb +++ b/build_tests/two_sources/objsuffix.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["OBJSUFFIX"] = %w[.oooo .ooo] env.Object("one.oooo", "one.c", "CPPFLAGS" => ["-DONE"]) diff --git a/build_tests/typical/Rsconscript b/build_tests/typical/Rsconscript index 32ef1d5..46cada8 100644 --- a/build_tests/typical/Rsconscript +++ b/build_tests/typical/Rsconscript @@ -1,4 +1,4 @@ -build do +default do Environment.new(name: "typical") do |env| env["CPPPATH"] += glob("src/**") env.Program("^/typical.exe", glob("src/**/*.c")) diff --git a/build_tests/typical/build_hooks.rb b/build_tests/typical/build_hooks.rb index d477c46..6b67f9d 100644 --- a/build_tests/typical/build_hooks.rb +++ b/build_tests/typical/build_hooks.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env.append('CPPPATH' => glob('src/**/*/')) env.add_build_hook do |builder| diff --git a/build_tests/typical/build_hooks_override_vars.rb b/build_tests/typical/build_hooks_override_vars.rb index 3dda2cf..5d8eada 100644 --- a/build_tests/typical/build_hooks_override_vars.rb +++ b/build_tests/typical/build_hooks_override_vars.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env.append('CPPPATH' => glob('src/**')) env.add_build_hook do |builder| diff --git a/build_tests/typical/carat.rb b/build_tests/typical/carat.rb index 604ed2b..a8a5361 100644 --- a/build_tests/typical/carat.rb +++ b/build_tests/typical/carat.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new(echo: :command) do |env| env.append("CPPPATH" => glob("src/**")) FileUtils.mkdir_p(env.build_root) diff --git a/build_tests/typical/clone_and_name.rb b/build_tests/typical/clone_and_name.rb index ab4b28d..01e8b58 100644 --- a/build_tests/typical/clone_and_name.rb +++ b/build_tests/typical/clone_and_name.rb @@ -1,4 +1,4 @@ -build do +default do base_env = Environment.new do |env| env["CPPPATH"] += glob("src/**") end diff --git a/build_tests/typical/copy.rb b/build_tests/typical/copy.rb index 3629a76..23775b6 100644 --- a/build_tests/typical/copy.rb +++ b/build_tests/typical/copy.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Copy("inst.exe", "copy.rb") end diff --git a/build_tests/typical/copy_directory.rb b/build_tests/typical/copy_directory.rb index a873c7a..f586d4e 100644 --- a/build_tests/typical/copy_directory.rb +++ b/build_tests/typical/copy_directory.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Directory("copy") env.Copy("copy", "copy_directory.rb") diff --git a/build_tests/typical/copy_multiple.rb b/build_tests/typical/copy_multiple.rb index 91aa97f..2c34ebe 100644 --- a/build_tests/typical/copy_multiple.rb +++ b/build_tests/typical/copy_multiple.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.Copy("dest", ["copy.rb", "copy_multiple.rb"]) end diff --git a/build_tests/typical/csuffix.rb b/build_tests/typical/csuffix.rb index 0c3b30d..b4beaa9 100644 --- a/build_tests/typical/csuffix.rb +++ b/build_tests/typical/csuffix.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CSUFFIX"] = %w[.yargh .c] env["CFLAGS"] += %w[-x c] diff --git a/build_tests/typical/echo_command_ruby_builder.rb b/build_tests/typical/echo_command_ruby_builder.rb index 3e4fdf9..bc9192e 100644 --- a/build_tests/typical/echo_command_ruby_builder.rb +++ b/build_tests/typical/echo_command_ruby_builder.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env.echo = :command env.Copy("copy.rb", "echo_command_ruby_builder.rb") diff --git a/build_tests/typical/echo_command_string.rb b/build_tests/typical/echo_command_string.rb index 016f203..76358ac 100644 --- a/build_tests/typical/echo_command_string.rb +++ b/build_tests/typical/echo_command_string.rb @@ -5,7 +5,7 @@ class MyBuilder < Rscons::Builder end end -build do +default do Environment.new do |env| env.echo = :command env.add_builder(MyBuilder) diff --git a/build_tests/typical/fileutils_methods.rb b/build_tests/typical/fileutils_methods.rb index e5f5459..8096d7a 100644 --- a/build_tests/typical/fileutils_methods.rb +++ b/build_tests/typical/fileutils_methods.rb @@ -1,4 +1,4 @@ -build do +default do mkdir "foo" cd "foo" do mkdir_p ["bar/baz", "bar/booz"] diff --git a/build_tests/typical/install.rb b/build_tests/typical/install.rb index 4cc3ad0..628baee 100644 --- a/build_tests/typical/install.rb +++ b/build_tests/typical/install.rb @@ -1,6 +1,6 @@ project_name "install_test" -build do +default do Environment.new do |env| env["CPPPATH"] += glob("src/**") env.Program("^/program.exe", glob("src/**/*.c")) diff --git a/build_tests/typical/multiple_environments.rb b/build_tests/typical/multiple_environments.rb index 2a8d679..83609d4 100644 --- a/build_tests/typical/multiple_environments.rb +++ b/build_tests/typical/multiple_environments.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CPPPATH"] += glob("src/**") env.Program("^/prog.exe", glob("src/**/*.c")) diff --git a/build_tests/typical/multiple_targets_same_name.rb b/build_tests/typical/multiple_targets_same_name.rb index 96405a8..137822d 100644 --- a/build_tests/typical/multiple_targets_same_name.rb +++ b/build_tests/typical/multiple_targets_same_name.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CPPPATH"] << "src/two" env.Object("one.o", "src/one/one.c") diff --git a/build_tests/typical/post_build_hook_expansion.rb b/build_tests/typical/post_build_hook_expansion.rb index ffac3c1..528e03c 100644 --- a/build_tests/typical/post_build_hook_expansion.rb +++ b/build_tests/typical/post_build_hook_expansion.rb @@ -1,4 +1,4 @@ -build do +default do Environment.new do |env| env["CPPPATH"] << "src/two" env.Object("one.o", "src/one/one.c") diff --git a/lib/rscons.rb b/lib/rscons.rb index fd70a72..c11e645 100644 --- a/lib/rscons.rb +++ b/lib/rscons.rb @@ -10,6 +10,7 @@ require_relative "rscons/configure_op" require_relative "rscons/default_construction_variables" require_relative "rscons/environment" require_relative "rscons/script" +require_relative "rscons/task" require_relative "rscons/util" require_relative "rscons/varset" require_relative "rscons/version" diff --git a/lib/rscons/application.rb b/lib/rscons/application.rb index d0050c0..860244f 100644 --- a/lib/rscons/application.rb +++ b/lib/rscons/application.rb @@ -31,29 +31,19 @@ module Rscons ENV.delete("RSCONS_BUILD_DIR") @n_threads = Util.determine_n_threads @vars = VarSet.new - @operations = Set.new @build_step = 0 end - # Check whether a requested operation is active. + # Run the application. # - # @param op [String] - # Operation name. + # Execute user-specified tasks. # - # @return [Boolean] - # Whether the requested operation is active. - def operation(op) - @operations.include?(op) - end - - # Run the specified operation. + # @api private # - # @param operation [String] - # The operation to perform (e.g. "clean", "configure", "build", etc...) # @param script [Script] # The script. - # @param operation_options [Hash] - # Option values from the CLI for the operation. + # @param tasks_and_params [Array>] + # List of task(s) to execute and possibly parameter(s) for them. # @param options [Hash] # Optional parameters. # @option sub_op [Boolean] @@ -61,49 +51,30 @@ module Rscons # # @return [Integer] # Process exit code (0 on success). - def run(operation, script, operation_options, options = {}) - @start_time = Time.new + def run(script, tasks_and_params, options = {}) @script = script - @operations << operation - puts "Starting '#{operation}' at #{Time.new}" if verbose - rv = - case operation - when "build" - rv = 0 - unless Cache.instance["configuration_data"]["configured"] - rv = - if @script.autoconf - run("configure", script, operation_options, sub_op: false) - else - $stderr.puts "Project must be configured first, and autoconf is disabled" - 1 - end - end - if rv == 0 - build(operation_options) - else - rv - end - when "clean" - clean - when "configure" - configure(operation_options) - when "distclean" - distclean - when "install" - run("build", script, operation_options, sub_op: false) - when "uninstall" - uninstall - else - $stderr.puts "Unknown operation: #{operation}" - 1 + Cache.instance["failed_commands"] = [] + begin + tasks_and_params.each do |task_and_params| + task_name, *task_params = task_and_params + Task[task_name].check_execute end - if verbose and options[:sub_op].nil? - time = Time.new - elapsed = time - @start_time - puts "'#{operation}' complete at #{time} (#{Util.format_elapsed_time(elapsed)})" + 0 + rescue RsconsError => e + Ansi.write($stderr, :red, e.message, :reset, "\n") + 1 + end + end + + # Show the last failures. + # + # @return [void] + def show_failure + failed_commands = Cache.instance["failed_commands"] + failed_commands.each_with_index do |command, i| + Ansi.write($stdout, :red, "Failed command (#{i + 1}/#{failed_commands.size}):", :reset, "\n") + $stdout.puts Util.command_to_s(command) end - rv end # Get the next build step number. @@ -125,33 +96,11 @@ module Rscons end end - private - - # Build the project. - # - # @param options [Hash] - # Options. - # - # @return [Integer] - # Exit code. - def build(options) - begin - Cache.instance["failed_commands"] = [] - @script.build - Environment.environments.each do |env| - env.process - end - 0 - rescue RsconsError => e - Ansi.write($stderr, :red, e.message, :reset, "\n") - 1 - end - end - # Remove all generated files. # - # @return [Integer] - # Exit code. + # @api private + # + # @return [void] def clean cache = Cache.instance # remove all built files @@ -168,49 +117,48 @@ module Rscons end end cache.write - 0 end # Remove the build directory and clear the cache. # - # @return [Integer] - # Exit code. + # @api private + # + # @return [void] def distclean cache = Cache.instance clean FileUtils.rm_rf(@build_dir) cache.clear - 0 end # Configure the project. # + # @api private + # # @param options [Hash] # Options. # - # @return [Integer] - # Exit code. - def configure(options) - rv = 0 - options = options.merge(project_name: @script.project_name) + # @return [void] + def configure + options = {project_name: @script.project_name} co = ConfigureOp.new(options) begin @script.configure(co) rescue RsconsError => e - if e.message and e.message != "" - $stderr.puts e.message - end - Ansi.write($stderr, :red, "Configuration failed", :reset, "\n") - rv = 1 + co.close(false) + raise e end - co.close(rv == 0) - rv + co.close(true) end # Remove installed files. # + # @api private + # # @return [Integer] # Exit code. + # + # @return [void] def uninstall cache = Cache.instance cache.targets(true).each do |target| @@ -229,7 +177,6 @@ module Rscons end end cache.write - 0 end end diff --git a/lib/rscons/cli.rb b/lib/rscons/cli.rb index e651bcc..03ed9c1 100644 --- a/lib/rscons/cli.rb +++ b/lib/rscons/cli.rb @@ -3,7 +3,7 @@ require "optparse" # CLI usage string. USAGE = <] + # Task dependencies. + attr_reader :deps + + # @return [String, nil] + # Task description, if given. + attr_reader :desc + + # @return [String] + # Task name. + attr_reader :name + + # Construct a task. + # + # @param name [String] + # Task name. + # @param options [Hash] + # Task options. + # @option options [Boolean] :autoconf + # Whether to automatically configure before running this task (default + # true). + def initialize(name, options, &block) + @name = name + @actions = [] + @deps = [] + @autoconf = true + Task.register(self) + modify(options, &block) + end + + # Execute a task's actions. + # + # @return [void] + def execute + @executed = true + if @autoconf + unless Cache.instance["configuration_data"]["configured"] + Task["configure"].check_execute + end + end + @deps.each do |dep| + end + @actions.each do |action| + action[] + end + end + + # Check if the task has been executed, and if not execute it. + # + # @return [void] + def check_execute + unless executed? + execute + end + end + + # Check if the task has been executed. + # + # @return [Boolean] + # Whether the task has been executed. + def executed? + @executed + end + + # Modify a task. + # + # @api private + # + # @return [void] + def modify(options, &block) + if options.include?(:autoconf) + @autoconf = options[:autoconf] + end + if block + if env = Environment.open_environment + @actions << proc do + block[] + env.process + end + else + @actions << block + end + end + end + + end + +end diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index ad95cfb..63815a7 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -89,26 +89,13 @@ describe Rscons do end def run_rscons(options = {}) - operation = options[:op] || "build" - if operation.is_a?(Symbol) - operation = operation.to_s - end - unless operation.is_a?(Array) - operation = [operation] - end - rsconscript_args = - if options[:rsconscript] - %W[-f #{options[:rsconscript]}] - else - [] - end - rscons_args = options[:rscons_args] || [] + args = options[:args] || [] if ENV["dist_specs"] exe = "#{@owd}/test/rscons.rb" else exe = "#{@owd}/bin/rscons" end - command = %W[ruby -I. -r _simplecov_setup #{exe}] + rsconscript_args + rscons_args + operation + command = %W[ruby -I. -r _simplecov_setup #{exe}] + args @statics[:build_test_id] ||= 0 @statics[:build_test_id] += 1 command_prefix = @@ -210,7 +197,7 @@ EOF it "uses the build directory specified with -b" do test_dir("simple") - result = run_rscons(rscons_args: %w[-b b]) + result = run_rscons(args: %w[-b b]) expect(result.stderr).to eq "" expect(Dir.exist?("build")).to be_falsey expect(File.exists?("b/e.1/simple.c.o")).to be_truthy @@ -227,7 +214,7 @@ EOF it "allows specifying a Builder object as the source to another build target" do test_dir("simple") - result = run_rscons(rsconscript: "builder_as_source.rb") + result = run_rscons(args: %w[-f builder_as_source.rb]) expect(result.stderr).to eq "" expect(File.exists?("simple.o")).to be_truthy expect(nr(`./simple.exe`)).to eq "This is a simple C program\n" @@ -235,7 +222,7 @@ EOF it 'prints commands as they are executed' do test_dir('simple') - result = run_rscons(rsconscript: "command.rb") + result = run_rscons(args: %w[-f command.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{gcc -c -o build/e.1/simple.c.o -MMD -MF build/e.1/simple.c.o.mf simple.c}, @@ -304,13 +291,13 @@ EOF it 're-links a program when the link flags have changed' do test_dir('simple') - result = run_rscons(rsconscript: "command.rb") + result = run_rscons(args: %w[-f command.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{gcc -c -o build/e.1/simple.c.o -MMD -MF build/e.1/simple.c.o.mf simple.c}, %r{gcc -o simple.exe build/e.1/simple.c.o}, ]) - result = run_rscons(rsconscript: "link_flag_change.rb") + result = run_rscons(args: %w[-f link_flag_change.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{gcc -o simple.exe build/e.1/simple.c.o -Llibdir}, @@ -319,7 +306,7 @@ EOF it "supports barriers and prevents parallelizing builders across them" do test_dir "simple" - result = run_rscons(rsconscript: "barrier.rb", rscons_args: %w[-j 3]) + result = run_rscons(args: %w[-f barrier.rb -j 3]) expect(result.stderr).to eq "" slines = lines(result.stdout).select {|line| line =~ /T\d/} expect(slines).to eq [ @@ -340,7 +327,7 @@ EOF it "expands target and source paths starting with ^/ and ^^/" do test_dir("typical") - result = run_rscons(rsconscript: "carat.rb", rscons_args: %w[-b bld]) + result = run_rscons(args: %w[-f carat.rb -b bld]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{gcc -c -o bld/e.1/one.o -MMD -MF bld/e.1/one.o.mf -Isrc -Isrc/one -Isrc/two bld/e.1/one.c}, @@ -359,7 +346,7 @@ EOF it "raises an error when a side-effect file is registered for a build target that is not registered" do test_dir "simple" - result = run_rscons(rsconscript: "error_produces_nonexistent_target.rb") + result = run_rscons(args: %w[-f error_produces_nonexistent_target.rb]) expect(result.stderr).to match /Could not find a registered build target "foo"/ end @@ -370,7 +357,7 @@ EOF expect(result.stderr).to eq "" expect(`./simple.exe`).to match /This is a simple C program/ expect(File.exists?('build/e.1/simple.c.o')).to be_truthy - result = run_rscons(op: %w[clean]) + result = run_rscons(args: %w[clean]) expect(File.exists?('build/e.1/simple.c.o')).to be_falsey expect(File.exists?('build/e.1')).to be_falsey expect(File.exists?('simple.exe')).to be_falsey @@ -384,7 +371,7 @@ EOF expect(`./simple.exe`).to match /This is a simple C program/ expect(File.exists?('build/e.1/simple.c.o')).to be_truthy File.open('build/e.1/dum', 'w') { |fh| fh.puts "dum" } - result = run_rscons(op: %w[clean]) + result = run_rscons(args: %w[clean]) expect(File.exists?('build/e.1')).to be_truthy expect(File.exists?('build/e.1/dum')).to be_truthy end @@ -393,15 +380,15 @@ EOF test_dir "typical" Dir.mktmpdir do |prefix| - result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}]) + result = run_rscons(args: %W[-f install.rb configure --prefix=#{prefix}]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" expect(File.exists?("#{prefix}/bin/program.exe")).to be_truthy expect(File.exists?("build/e.1/src/one/one.c.o")).to be_truthy - result = run_rscons(rsconscript: "install.rb", op: %W[clean]) + result = run_rscons(args: %w[-f install.rb clean]) expect(result.stderr).to eq "" expect(File.exists?("#{prefix}/bin/program.exe")).to be_truthy expect(File.exists?("build/e.1/src/one/one.c.o")).to be_falsey @@ -412,18 +399,18 @@ EOF test_dir "typical" Dir.mktmpdir do |prefix| - result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}]) + result = run_rscons(args: %W[-f install.rb configure --prefix=#{prefix}]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[clean]) + result = run_rscons(args: %w[-f install.rb clean]) expect(result.stderr).to eq "" expect(File.exists?("#{prefix}/bin/program.exe")).to be_truthy expect(File.exists?("build/e.1/src/one/one.c.o")).to be_falsey - result = run_rscons(rsconscript: "install.rb", op: %W[uninstall -v]) + result = run_rscons(args: %w[-f install.rb uninstall -v]) expect(result.stderr).to eq "" expect(result.stdout).to match %r{Removing #{prefix}/bin/program.exe} expect(Dir.entries(prefix)).to match_array %w[. ..] @@ -445,7 +432,7 @@ EOF it 'supports custom builders with multiple targets' do test_dir('custom_builder') - result = run_rscons(rsconscript: "multiple_targets.rb") + result = run_rscons(args: %w[-f multiple_targets.rb]) expect(result.stderr).to eq "" slines = lines(result.stdout) verify_lines(slines, [ @@ -459,7 +446,7 @@ EOF expect(nr(`./program.exe`)).to eq "The value is 42\n" File.open("inc.c", "w") {|fh| fh.puts "int THE_VALUE = 33;"} - result = run_rscons(rsconscript: "multiple_targets.rb") + result = run_rscons(args: %w[-f multiple_targets.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{CHGen inc.c}]) expect(nr(`./program.exe`)).to eq "The value is 42\n" @@ -467,21 +454,21 @@ EOF it 'raises an error when a custom builder returns an invalid value from #run' do test_dir("custom_builder") - result = run_rscons(rsconscript: "error_run_return_value.rb") + result = run_rscons(args: %w[-f error_run_return_value.rb]) expect(result.stderr).to match /Unrecognized MyBuilder builder return value: "hi"/ expect(result.status).to_not eq 0 end it 'raises an error when a custom builder returns an invalid value using Builder#wait_for' do test_dir("custom_builder") - result = run_rscons(rsconscript: "error_wait_for.rb") + result = run_rscons(args: %w[-f error_wait_for.rb]) expect(result.stderr).to match /Unrecognized MyBuilder builder return item: 1/ expect(result.status).to_not eq 0 end it 'supports a Builder waiting for a custom Thread object' do test_dir "custom_builder" - result = run_rscons(rsconscript: "wait_for_thread.rb") + result = run_rscons(args: %w[-f wait_for_thread.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 verify_lines(lines(result.stdout), [%r{MyBuilder foo}]) @@ -490,7 +477,7 @@ EOF it 'supports a Builder waiting for another Builder' do test_dir "simple" - result = run_rscons(rsconscript: "builder_wait_for_builder.rb") + result = run_rscons(args: %w[-f builder_wait_for_builder.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 verify_lines(lines(result.stdout), [%r{MyObject simple.o}]) @@ -512,7 +499,7 @@ EOF it 'clones all attributes of an Environment object by default' do test_dir('clone_env') - result = run_rscons(rsconscript: "clone_all.rb") + result = run_rscons(args: %w[-f clone_all.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{gcc -c -o build/e.1/src/program.c.o -MMD -MF build/e.1/src/program.c.o.mf -DSTRING="Hello" -O2 src/program.c}, @@ -535,7 +522,7 @@ EOF it "links with the C++ linker when object files were built from C++ sources" do test_dir("simple_cc") - result = run_rscons(rsconscript: "link_objects.rb") + result = run_rscons(args: %w[-f link_objects.rb]) expect(result.stderr).to eq "" expect(File.exists?("simple.o")).to be_truthy expect(nr(`./simple.exe`)).to eq "This is a simple C++ program\n" @@ -571,7 +558,7 @@ EOF it 'supports build hooks to override construction variables' do test_dir("typical") - result = run_rscons(rsconscript: "build_hooks.rb") + result = run_rscons(args: %w[-f build_hooks.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{gcc -c -o build/e.1/src/one/one.c.o -MMD -MF build/e.1/src/one/one.c.o.mf -Isrc/one -Isrc/two -O1 src/one/one.c}, @@ -583,7 +570,7 @@ EOF it 'supports build hooks to override the entire vars hash' do test_dir("typical") - result = run_rscons(rsconscript: "build_hooks_override_vars.rb") + result = run_rscons(args: %w[-f build_hooks_override_vars.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{gcc -c -o one.o -MMD -MF build/e.1/one.o.mf -Isrc -Isrc/one -Isrc/two -O1 src/two/two.c}, @@ -597,7 +584,7 @@ EOF test_dir('simple') File.open("program.ld", "w") {|fh| fh.puts("1")} - result = run_rscons(rsconscript: "user_dependencies.rb") + result = run_rscons(args: %w[-f user_dependencies.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, @@ -607,16 +594,16 @@ EOF expect(nr(`./simple.exe`)).to eq "This is a simple C program\n" File.open("program.ld", "w") {|fh| fh.puts("2")} - result = run_rscons(rsconscript: "user_dependencies.rb") + result = run_rscons(args: %w[-f user_dependencies.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Linking simple.exe}]) File.unlink("program.ld") - result = run_rscons(rsconscript: "user_dependencies.rb") + result = run_rscons(args: %w[-f user_dependencies.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Linking simple.exe}]) - result = run_rscons(rsconscript: "user_dependencies.rb") + result = run_rscons(args: %w[-f user_dependencies.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" end @@ -625,7 +612,7 @@ EOF test_dir("simple") passenv["file_contents"] = "1" - result = run_rscons(rsconscript: "user_dependencies_carat.rb") + result = run_rscons(args: %w[-f user_dependencies_carat.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, @@ -633,11 +620,11 @@ EOF ]) passenv["file_contents"] = "2" - result = run_rscons(rsconscript: "user_dependencies_carat.rb") + result = run_rscons(args: %w[-f user_dependencies_carat.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Linking .*simple.exe}]) - result = run_rscons(rsconscript: "user_dependencies_carat.rb") + result = run_rscons(args: %w[-f user_dependencies_carat.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" end @@ -657,7 +644,7 @@ EOF it "supports building D sources with ldc2" do test_dir("d") - result = run_rscons(rsconscript: "build-ldc2.rb") + result = run_rscons(args: %w[-f build-ldc2.rb]) expect(result.stderr).to eq "" slines = lines(result.stdout) verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.d.o(bj)? -deps=build/e.1/main.d.o(bj)?.mf main.d}]) @@ -668,7 +655,7 @@ EOF it "rebuilds D modules with ldc2 when deep dependencies change" do test_dir("d") - result = run_rscons(rsconscript: "build-ldc2.rb") + result = run_rscons(args: %w[-f build-ldc2.rb]) expect(result.stderr).to eq "" slines = lines(result.stdout) verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.d.o(bj)? -deps=build/e.1/main.d.o(bj)?.mf main.d}]) @@ -679,7 +666,7 @@ EOF File.open("mod.d", "wb") do |fh| fh.write(contents) end - result = run_rscons(rsconscript: "build-ldc2.rb") + result = run_rscons(args: %w[-f build-ldc2.rb]) expect(result.stderr).to eq "" slines = lines(result.stdout) verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.d.o(bj)? -deps=build/e.1/main.d.o(bj)?.mf main.d}]) @@ -691,7 +678,7 @@ EOF unless RUBY_PLATFORM =~ /mingw|msys/ it "links with the D linker when object files were built from D sources" do test_dir("d") - result = run_rscons(rsconscript: "link_objects.rb") + result = run_rscons(args: %w[-f link_objects.rb]) expect(result.stderr).to eq "" expect(File.exists?("main.o")).to be_truthy expect(File.exists?("mod.o")).to be_truthy @@ -721,7 +708,7 @@ EOF it "creates shared libraries using D" do test_dir("shared_library") - result = run_rscons(rsconscript: "shared_library_d.rb") + result = run_rscons(args: %w[-f shared_library_d.rb]) expect(result.stderr).to eq "" slines = lines(result.stdout) if RUBY_PLATFORM =~ /mingw|msys/ @@ -735,19 +722,19 @@ EOF it "supports disassembling object files" do test_dir("simple") - result = run_rscons(rsconscript: "disassemble.rb") + result = run_rscons(args: %w[-f disassemble.rb]) expect(result.stderr).to eq "" expect(File.exists?("simple.txt")).to be_truthy expect(File.read("simple.txt")).to match /Disassembly of section .text:/ - result = run_rscons(rsconscript: "disassemble.rb") + result = run_rscons(args: %w[-f disassemble.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" end it "supports preprocessing C sources" do test_dir("simple") - result = run_rscons(rsconscript: "preprocess.rb") + result = run_rscons(args: %w[-f preprocess.rb]) expect(result.stderr).to eq "" expect(File.read("simplepp.c")).to match /# \d+ "simple.c"/ expect(nr(`./simple.exe`)).to eq "This is a simple C program\n" @@ -755,7 +742,7 @@ EOF it "supports preprocessing C++ sources" do test_dir("simple_cc") - result = run_rscons(rsconscript: "preprocess.rb") + result = run_rscons(args: %w[-f preprocess.rb]) expect(result.stderr).to eq "" expect(File.read("simplepp.cc")).to match /# \d+ "simple.cc"/ expect(nr(`./simple.exe`)).to eq "This is a simple C++ program\n" @@ -763,13 +750,13 @@ EOF it "supports invoking builders with no sources" do test_dir("simple") - result = run_rscons(rsconscript: "builder_no_sources.rb") + result = run_rscons(args: %w[-f builder_no_sources.rb]) expect(result.stderr).to eq "" end it "expands construction variables in builder target and sources before invoking the builder" do test_dir('custom_builder') - result = run_rscons(rsconscript: "cvar_expansion.rb") + result = run_rscons(args: %w[-f cvar_expansion.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling program.c}, @@ -781,14 +768,14 @@ EOF it "supports lambdas as construction variable values" do test_dir "custom_builder" - result = run_rscons(rsconscript: "cvar_lambda.rb") + result = run_rscons(args: %w[-f cvar_lambda.rb]) expect(result.stderr).to eq "" expect(nr(`./program.exe`)).to eq "The value is 5678\n" end it "supports registering build targets from within a build hook" do test_dir("simple") - result = run_rscons(rsconscript: "register_target_in_build_hook.rb") + result = run_rscons(args: %w[-f register_target_in_build_hook.rb]) expect(result.stderr).to eq "" expect(File.exists?("build/e.1/simple.c.o")).to be_truthy expect(File.exists?("build/e.1/simple.c.o.txt")).to be_truthy @@ -798,7 +785,7 @@ EOF it "supports multiple values for CXXSUFFIX" do test_dir("simple_cc") File.open("other.cccc", "w") {|fh| fh.puts} - result = run_rscons(rsconscript: "cxxsuffix.rb") + result = run_rscons(args: %w[-f cxxsuffix.rb]) expect(result.stderr).to eq "" expect(File.exists?("build/e.1/simple.cc.o")).to be_truthy expect(File.exists?("build/e.1/other.cccc.o")).to be_truthy @@ -808,7 +795,7 @@ EOF it "supports multiple values for CSUFFIX" do test_dir("typical") FileUtils.mv("src/one/one.c", "src/one/one.yargh") - result = run_rscons(rsconscript: "csuffix.rb") + result = run_rscons(args: %w[-f csuffix.rb]) expect(result.stderr).to eq "" expect(File.exists?("build/e.1/src/one/one.yargh.o")).to be_truthy expect(File.exists?("build/e.1/src/two/two.c.o")).to be_truthy @@ -817,7 +804,7 @@ EOF it "supports multiple values for OBJSUFFIX" do test_dir("two_sources") - result = run_rscons(rsconscript: "objsuffix.rb") + result = run_rscons(args: %w[-f objsuffix.rb]) expect(result.stderr).to eq "" expect(File.exists?("two_sources.exe")).to be_truthy expect(File.exists?("one.oooo")).to be_truthy @@ -827,7 +814,7 @@ EOF it "supports multiple values for LIBSUFFIX" do test_dir("two_sources") - result = run_rscons(rsconscript: "libsuffix.rb") + result = run_rscons(args: %w[-f libsuffix.rb]) expect(result.stderr).to eq "" expect(File.exists?("two_sources.exe")).to be_truthy expect(nr(`./two_sources.exe`)).to eq "This is a C program with two sources.\n" @@ -835,7 +822,7 @@ EOF it "supports multiple values for ASSUFFIX" do test_dir("two_sources") - result = run_rscons(rsconscript: "assuffix.rb") + result = run_rscons(args: %w[-f assuffix.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling one.c}, @@ -850,7 +837,7 @@ EOF it "supports dumping an Environment's construction variables" do test_dir("simple") - result = run_rscons(rsconscript: "dump.rb") + result = run_rscons(args: %w[-f dump.rb]) expect(result.stderr).to eq "" slines = lines(result.stdout) expect(slines.include?(%{:foo => :bar})).to be_truthy @@ -881,7 +868,7 @@ EOF it "allows construction variable references which expand to arrays in sources of a build target" do test_dir("simple") - result = run_rscons(rsconscript: "cvar_array.rb") + result = run_rscons(args: %w[-f cvar_array.rb]) expect(result.stderr).to eq "" expect(File.exists?("build/e.1/simple.c.o")).to be_truthy expect(nr(`./simple.exe`)).to eq "This is a simple C program\n" @@ -889,7 +876,7 @@ EOF it "supports registering multiple build targets with the same target path" do test_dir("typical") - result = run_rscons(rsconscript: "multiple_targets_same_name.rb") + result = run_rscons(args: %w[-f multiple_targets_same_name.rb]) expect(result.stderr).to eq "" expect(File.exists?("one.o")).to be_truthy verify_lines(lines(result.stdout), [ @@ -900,7 +887,7 @@ EOF it "expands target and source paths when builders are registered in build hooks" do test_dir("typical") - result = run_rscons(rsconscript: "post_build_hook_expansion.rb") + result = run_rscons(args: %w[-f post_build_hook_expansion.rb]) expect(result.stderr).to eq "" expect(File.exists?("one.o")).to be_truthy expect(File.exists?("two.o")).to be_truthy @@ -915,15 +902,13 @@ EOF File.open("two.c", "w") do |fh| fh.puts("FOO") end - result = run_rscons(rsconscript: "cache_successful_builds_when_one_fails.rb", - rscons_args: %w[-j1]) + result = run_rscons(args: %w[-f cache_successful_builds_when_one_fails.rb -j1]) expect(result.stderr).to match /FOO/ expect(File.exists?("simple.o")).to be_truthy expect(File.exists?("two.o")).to be_falsey File.open("two.c", "w") {|fh|} - result = run_rscons(rsconscript: "cache_successful_builds_when_one_fails.rb", - rscons_args: %w[-j1]) + result = run_rscons(args: %w[-f cache_successful_builds_when_one_fails.rb -j1]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling two.c}, @@ -932,7 +917,7 @@ EOF it "allows overriding PROGSUFFIX" do test_dir("simple") - result = run_rscons(rsconscript: "progsuffix.rb") + result = run_rscons(args: %w[-f progsuffix.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, @@ -942,7 +927,7 @@ EOF it "does not use PROGSUFFIX when the Program target name expands to a value already containing an extension" do test_dir("simple") - result = run_rscons(rsconscript: "progsuffix2.rb") + result = run_rscons(args: %w[-f progsuffix2.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, @@ -952,7 +937,7 @@ EOF it "allows overriding PROGSUFFIX from extra vars passed in to the builder" do test_dir("simple") - result = run_rscons(rsconscript: "progsuffix3.rb") + result = run_rscons(args: %w[-f progsuffix3.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, @@ -962,7 +947,7 @@ EOF it "creates object files under the build root for absolute source paths" do test_dir("simple") - result = run_rscons(rsconscript: "absolute_source_path.rb") + result = run_rscons(args: %w[-f absolute_source_path.rb]) expect(result.stderr).to eq "" slines = lines(result.stdout) verify_lines(slines, [%r{build/e.1/.*/abs\.c.o$}]) @@ -995,7 +980,7 @@ EOF it "creates shared libraries using assembly" do test_dir("shared_library") - result = run_rscons(rsconscript: "shared_library_as.rb") + result = run_rscons(args: %w[-f shared_library_as.rb]) expect(result.stderr).to eq "" expect(File.exists?("file.S")).to be_truthy end @@ -1003,7 +988,7 @@ EOF it "creates shared libraries using C++" do test_dir("shared_library") - result = run_rscons(rsconscript: "shared_library_cxx.rb") + result = run_rscons(args: %w[-f shared_library_cxx.rb]) expect(result.stderr).to eq "" slines = lines(result.stdout) if RUBY_PLATFORM =~ /mingw|msys/ @@ -1012,7 +997,7 @@ EOF verify_lines(slines, [%r{Linking libmine.so}]) end - result = run_rscons(rsconscript: "shared_library_cxx.rb") + result = run_rscons(args: %w[-f shared_library_cxx.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" @@ -1023,27 +1008,27 @@ EOF it "raises an error for a circular dependency" do test_dir("simple") - result = run_rscons(rsconscript: "error_circular_dependency.rb") + result = run_rscons(args: %w[-f error_circular_dependency.rb]) expect(result.stderr).to match /Possible circular dependency for (foo|bar|baz)/ expect(result.status).to_not eq 0 end it "raises an error for a circular dependency where a build target contains itself in its source list" do test_dir("simple") - result = run_rscons(rsconscript: "error_circular_dependency2.rb") + result = run_rscons(args: %w[-f error_circular_dependency2.rb]) expect(result.stderr).to match /Possible circular dependency for foo/ expect(result.status).to_not eq 0 end it "orders builds to respect user dependencies" do test_dir("simple") - result = run_rscons(rsconscript: "user_dep_build_order.rb", rscons_args: %w[-j4]) + result = run_rscons(args: %w[-f user_dep_build_order.rb -j4]) expect(result.stderr).to eq "" end it "waits for all parallelized builds to complete if one fails" do test_dir("simple") - result = run_rscons(rsconscript: "wait_for_builds_on_failure.rb", rscons_args: %w[-j4]) + result = run_rscons(args: %w[-f wait_for_builds_on_failure.rb -j4]) expect(result.status).to_not eq 0 expect(result.stderr).to match /Failed to build foo_1/ expect(result.stderr).to match /Failed to build foo_2/ @@ -1053,7 +1038,7 @@ EOF it "clones n_threads attribute when cloning an Environment" do test_dir("simple") - result = run_rscons(rsconscript: "clone_n_threads.rb") + result = run_rscons(args: %w[-f clone_n_threads.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [/165/]) end @@ -1061,7 +1046,7 @@ EOF it "prints a builder's short description with 'command' echo mode if there is no command" do test_dir("typical") - result = run_rscons(rsconscript: "echo_command_ruby_builder.rb") + result = run_rscons(args: %w[-f echo_command_ruby_builder.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy echo_command_ruby_builder.rb => copy.rb}]) end @@ -1069,7 +1054,7 @@ EOF it "supports a string for a builder's echoed 'command' with Environment#print_builder_run_message" do test_dir("typical") - result = run_rscons(rsconscript: "echo_command_string.rb") + result = run_rscons(args: %w[-f echo_command_string.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{MyBuilder foo command}]) end @@ -1086,7 +1071,7 @@ EOF expect(result.stderr).to match %r{^Use .*/rscons(\.rb)? -F.*to view the failed command log} expect(result.status).to_not eq 0 - result = run_rscons(rscons_args: %w[-F]) + result = run_rscons(args: %w[-F]) expect(result.stderr).to eq "" expect(result.stdout).to match %r{Failed command \(1/1\):} expect(result.stdout).to match %r{^gcc -} @@ -1104,7 +1089,7 @@ EOF it "names Environment during clone" do test_dir "typical" - result = run_rscons(rsconscript: "clone_and_name.rb") + result = run_rscons(args: %w[-f clone_and_name.rb]) expect(File.exist?("build/typical/typical.exe")).to be_truthy expect(File.exist?("build/typical/src/one/one.c.o")).to be_truthy expect(Dir.exist?("build/e.1")).to be_falsey @@ -1113,7 +1098,7 @@ EOF context "colored output" do it "does not output in color with --color=off" do test_dir("simple") - result = run_rscons(rscons_args: %w[--color=off]) + result = run_rscons(args: %w[--color=off]) expect(result.stderr).to eq "" expect(result.stdout).to_not match(/\e\[/) end @@ -1121,14 +1106,14 @@ EOF it "displays output in color with --color=force" do test_dir("simple") - result = run_rscons(rscons_args: %w[--color=force]) + result = run_rscons(args: %w[--color=force]) expect(result.stderr).to eq "" expect(result.stdout).to match(/\e\[/) File.open("simple.c", "wb") do |fh| fh.write("foobar") end - result = run_rscons(rscons_args: %w[--color=force]) + result = run_rscons(args: %w[--color=force]) expect(result.stderr).to match(/\e\[/) end end @@ -1151,7 +1136,7 @@ EOF it "raises an error when an unknown source file is specified" do test_dir("cfile") - result = run_rscons(rsconscript: "error_unknown_extension.rb") + result = run_rscons(args: %w[-f error_unknown_extension.rb]) expect(result.stderr).to match /Unknown source file .foo.bar. for CFile builder/ expect(result.status).to_not eq 0 end @@ -1161,12 +1146,12 @@ EOF it "allows executing an arbitrary command" do test_dir('simple') - result = run_rscons(rsconscript: "command_builder.rb") + result = run_rscons(args: %w[-f command_builder.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{BuildIt simple.exe}]) expect(nr(`./simple.exe`)).to eq "This is a simple C program\n" - result = run_rscons(rsconscript: "command_builder.rb") + result = run_rscons(args: %w[-f command_builder.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" end @@ -1174,7 +1159,7 @@ EOF it "allows redirecting standard output to a file" do test_dir("simple") - result = run_rscons(rsconscript: "command_redirect.rb") + result = run_rscons(args: %w[-f command_redirect.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, @@ -1187,7 +1172,7 @@ EOF context "Directory builder" do it "creates the requested directory" do test_dir("simple") - result = run_rscons(rsconscript: "directory.rb") + result = run_rscons(args: %w[-f directory.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Creating directory teh_dir}]) expect(File.directory?("teh_dir")).to be_truthy @@ -1196,7 +1181,7 @@ EOF it "succeeds when the requested directory already exists" do test_dir("simple") FileUtils.mkdir("teh_dir") - result = run_rscons(rsconscript: "directory.rb") + result = run_rscons(args: %w[-f directory.rb]) expect(result.stderr).to eq "" expect(lines(result.stdout)).to_not include a_string_matching /Creating directory/ expect(File.directory?("teh_dir")).to be_truthy @@ -1205,7 +1190,7 @@ EOF it "fails when the target path is a file" do test_dir("simple") FileUtils.touch("teh_dir") - result = run_rscons(rsconscript: "directory.rb") + result = run_rscons(args: %w[-f directory.rb]) expect(result.stderr).to match %r{Error: `teh_dir' already exists and is not a directory} end end @@ -1214,11 +1199,11 @@ EOF it "copies a file to the target file name" do test_dir("typical") - result = run_rscons(rsconscript: "copy.rb") + result = run_rscons(args: %w[-f copy.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy copy.rb => inst.exe}]) - result = run_rscons(rsconscript: "copy.rb") + result = run_rscons(args: %w[-f copy.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" @@ -1226,7 +1211,7 @@ EOF expect(File.read("inst.exe", mode: "rb")).to eq(File.read("copy.rb", mode: "rb")) FileUtils.rm("inst.exe") - result = run_rscons(rsconscript: "copy.rb") + result = run_rscons(args: %w[-f copy.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy copy.rb => inst.exe}]) end @@ -1234,11 +1219,11 @@ EOF it "copies multiple files to the target directory name" do test_dir("typical") - result = run_rscons(rsconscript: "copy_multiple.rb") + result = run_rscons(args: %w[-f copy_multiple.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy copy.rb \(\+1\) => dest}]) - result = run_rscons(rsconscript: "copy_multiple.rb") + result = run_rscons(args: %w[-f copy_multiple.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" @@ -1247,7 +1232,7 @@ EOF expect(File.exists?("dest/copy_multiple.rb")).to be_truthy FileUtils.rm_rf("dest") - result = run_rscons(rsconscript: "copy_multiple.rb") + result = run_rscons(args: %w[-f copy_multiple.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy copy.rb \(\+1\) => dest}]) end @@ -1255,20 +1240,20 @@ EOF it "copies a file to the target directory name" do test_dir("typical") - result = run_rscons(rsconscript: "copy_directory.rb") + result = run_rscons(args: %w[-f copy_directory.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy copy_directory.rb => copy}]) expect(File.exists?("copy/copy_directory.rb")).to be_truthy expect(File.read("copy/copy_directory.rb", mode: "rb")).to eq(File.read("copy_directory.rb", mode: "rb")) - result = run_rscons(rsconscript: "copy_directory.rb") + result = run_rscons(args: %w[-f copy_directory.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" end it "copies a directory to the non-existent target directory name" do test_dir("typical") - result = run_rscons(rsconscript: "copy_directory.rb") + result = run_rscons(args: %w[-f copy_directory.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy src => noexist/src}]) %w[src/one/one.c src/two/two.c src/two/two.h].each do |f| @@ -1279,7 +1264,7 @@ EOF it "copies a directory to the existent target directory name" do test_dir("typical") - result = run_rscons(rsconscript: "copy_directory.rb") + result = run_rscons(args: %w[-f copy_directory.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy src => exist/src}]) %w[src/one/one.c src/two/two.c src/two/two.h].each do |f| @@ -1293,7 +1278,7 @@ EOF it "allows specifying a Symbol as a target name and reruns the builder if the sources or command have changed" do test_dir("simple") - result = run_rscons(rsconscript: "phony_target.rb") + result = run_rscons(args: %w[-f phony_target.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, @@ -1301,7 +1286,7 @@ EOF %r{Checker simple.exe}, ]) - result = run_rscons(rsconscript: "phony_target.rb") + result = run_rscons(args: %w[-f phony_target.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" @@ -1310,7 +1295,7 @@ EOF File.open("simple.exe", "w") do |fh| fh.puts "Changed simple.exe" end - result = run_rscons(rsconscript: "phony_target2.rb") + result = run_rscons(args: %w[-f phony_target2.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Checker simple.exe}, @@ -1321,7 +1306,7 @@ EOF context "Environment#clear_targets" do it "clears registered targets" do test_dir("simple") - result = run_rscons(rsconscript: "clear_targets.rb") + result = run_rscons(args: %w[-f clear_targets.rb]) expect(result.stderr).to eq "" expect(lines(result.stdout)).to_not include a_string_matching %r{Linking} end @@ -1381,7 +1366,7 @@ EOF %r{Linking simple.exe}, ]) - result = run_rscons(rsconscript: "cache_command_change.rb") + result = run_rscons(args: %w[-f cache_command_change.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Linking simple.exe}, @@ -1391,14 +1376,14 @@ EOF it "forces a build when there is a new dependency" do test_dir("simple") - result = run_rscons(rsconscript: "cache_new_dep1.rb") + result = run_rscons(args: %w[-f cache_new_dep1.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, %r{Linking simple.exe}, ]) - result = run_rscons(rsconscript: "cache_new_dep2.rb") + result = run_rscons(args: %w[-f cache_new_dep2.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Linking simple.exe}, @@ -1408,14 +1393,14 @@ EOF it "forces a build when a dependency's checksum has changed" do test_dir("simple") - result = run_rscons(rsconscript: "cache_dep_checksum_change.rb") + result = run_rscons(args: %w[-f cache_dep_checksum_change.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy simple.c => simple.copy}]) File.open("simple.c", "wb") do |fh| fh.write("hi") end - result = run_rscons(rsconscript: "cache_dep_checksum_change.rb") + result = run_rscons(args: %w[-f cache_dep_checksum_change.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{Copy simple.c => simple.copy}]) end @@ -1426,18 +1411,18 @@ EOF File.open("sources", "wb") do |fh| fh.write("one.o two.o") end - result = run_rscons(rsconscript: "cache_strict_deps.rb") + result = run_rscons(args: %w[-f cache_strict_deps.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{gcc -o program.exe one.o two.o}]) - result = run_rscons(rsconscript: "cache_strict_deps.rb") + result = run_rscons(args: %w[-f cache_strict_deps.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" File.open("sources", "wb") do |fh| fh.write("two.o one.o") end - result = run_rscons(rsconscript: "cache_strict_deps.rb") + result = run_rscons(args: %w[-f cache_strict_deps.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{gcc -o program.exe one.o two.o}]) end @@ -1447,7 +1432,7 @@ EOF File.open("foo", "wb") {|fh| fh.write("hi")} File.open("user_deps", "wb") {|fh| fh.write("")} - result = run_rscons(rsconscript: "cache_user_dep.rb") + result = run_rscons(args: %w[-f cache_user_dep.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, @@ -1455,7 +1440,7 @@ EOF ]) File.open("user_deps", "wb") {|fh| fh.write("foo")} - result = run_rscons(rsconscript: "cache_user_dep.rb") + result = run_rscons(args: %w[-f cache_user_dep.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Linking simple.exe}, @@ -1467,19 +1452,19 @@ EOF File.open("foo", "wb") {|fh| fh.write("hi")} File.open("user_deps", "wb") {|fh| fh.write("foo")} - result = run_rscons(rsconscript: "cache_user_dep.rb") + result = run_rscons(args: %w[-f cache_user_dep.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Compiling simple.c}, %r{Linking simple.exe}, ]) - result = run_rscons(rsconscript: "cache_user_dep.rb") + result = run_rscons(args: %w[-f cache_user_dep.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" File.open("foo", "wb") {|fh| fh.write("hi2")} - result = run_rscons(rsconscript: "cache_user_dep.rb") + result = run_rscons(args: %w[-f cache_user_dep.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Linking simple.exe}, @@ -1488,12 +1473,12 @@ EOF it "allows a VarSet to be passed in as the command parameter" do test_dir("simple") - result = run_rscons(rsconscript: "cache_varset.rb") + result = run_rscons(args: %w[-f cache_varset.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{TestBuilder foo}, ]) - result = run_rscons(rsconscript: "cache_varset.rb") + result = run_rscons(args: %w[-f cache_varset.rb]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" end @@ -1512,7 +1497,7 @@ EOF it "allows prepending and appending to PATH" do test_dir "simple" - result = run_rscons(rsconscript: "pathing.rb") + result = run_rscons(args: %w[-f pathing.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /flex!/ expect(result.stdout).to match /foobar!/ @@ -1521,7 +1506,7 @@ EOF it "writes the dependency file to the build root" do test_dir "simple" - result = run_rscons(rsconscript: "distclean.rb") + result = run_rscons(args: %w[-f distclean.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /Compiling simple\.c/ expect(File.exist?("simple.o")).to be_truthy @@ -1532,7 +1517,7 @@ EOF context "debugging" do it "prints a message when the target does not exist" do test_dir("simple") - result = run_rscons(rsconscript: "cache_debugging.rb") + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because it does not exist on disk/ end @@ -1540,67 +1525,67 @@ EOF it "prints a message when there is no cached build information for the target" do test_dir("simple") FileUtils.touch("foo.o") - result = run_rscons(rsconscript: "cache_debugging.rb") + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because there is no cached build information for it/ end it "prints a message when the target file has changed on disk" do test_dir("simple") - result = run_rscons(rsconscript: "cache_debugging.rb") + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" File.open("foo.o", "wb") {|fh| fh.puts "hi"} - result = run_rscons(rsconscript: "cache_debugging.rb") + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because it has been changed on disk since being built last/ end it "prints a message when the command has changed" do test_dir("simple") - result = run_rscons(rsconscript: "cache_debugging.rb") + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "cache_debugging.rb", op: %w[build command_change=yes]) + result = run_rscons(args: %w[-f cache_debugging.rb build command_change=yes]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because the command used to build it has changed/ end it "prints a message when strict_deps is in use and the set of dependencies does not match" do test_dir("simple") - result = run_rscons(rsconscript: "cache_debugging.rb", op: %w[build strict_deps1=yes]) + result = run_rscons(args: %w[-f cache_debugging.rb build strict_deps1=yes]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "cache_debugging.rb", op: %w[build strict_deps2=yes]) + result = run_rscons(args: %w[-f cache_debugging.rb build strict_deps2=yes]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because the :strict_deps option is given and the set of dependencies does not match the previous set of dependencies/ end it "prints a message when there is a new dependency" do test_dir("simple") - result = run_rscons(rsconscript: "cache_debugging.rb") + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "cache_debugging.rb", op: %w[build new_dep=yes]) + result = run_rscons(args: %w[-f cache_debugging.rb build new_dep=yes]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because there are new dependencies/ end it "prints a message when there is a new user-specified dependency" do test_dir("simple") - result = run_rscons(rsconscript: "cache_debugging.rb") + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "cache_debugging.rb", op: %w[build new_user_dep=yes]) + result = run_rscons(args: %w[-f cache_debugging.rb build new_user_dep=yes]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because the set of user-specified dependency files has changed/ end it "prints a message when a dependency file has changed" do test_dir("simple") - result = run_rscons(rsconscript: "cache_debugging.rb") + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" f = File.read("simple.c", mode: "rb") f += "\n" File.open("simple.c", "wb") do |fh| fh.write(f) end - result = run_rscons(rsconscript: "cache_debugging.rb") + result = run_rscons(args: %w[-f cache_debugging.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match /Target foo\.o needs rebuilding because dependency file simple\.c has changed/ end @@ -1610,7 +1595,7 @@ EOF context "Object builder" do it "allows overriding CCCMD construction variable" do test_dir("simple") - result = run_rscons(rsconscript: "override_cccmd.rb") + result = run_rscons(args: %w[-f override_cccmd.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{gcc -c -o simple.o -Dfoobar simple.c}, @@ -1619,7 +1604,7 @@ EOF it "allows overriding DEPFILESUFFIX construction variable" do test_dir("simple") - result = run_rscons(rsconscript: "override_depfilesuffix.rb") + result = run_rscons(args: %w[-f override_depfilesuffix.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{gcc -c -o simple.o -MMD -MF build/e.1/simple.o.deppy simple.c}, @@ -1628,7 +1613,7 @@ EOF it "raises an error when given a source file with an unknown suffix" do test_dir("simple") - result = run_rscons(rsconscript: "error_unknown_suffix.rb") + result = run_rscons(args: %w[-f error_unknown_suffix.rb]) expect(result.stderr).to match /Unknown input file type: "foo.xyz"/ end end @@ -1636,7 +1621,7 @@ EOF context "SharedObject builder" do it "raises an error when given a source file with an unknown suffix" do test_dir("shared_library") - result = run_rscons(rsconscript: "error_unknown_suffix.rb") + result = run_rscons(args: %w[-f error_unknown_suffix.rb]) expect(result.stderr).to match /Unknown input file type: "foo.xyz"/ end end @@ -1644,14 +1629,14 @@ EOF context "Library builder" do it "allows overriding ARCMD construction variable" do test_dir("library") - result = run_rscons(rsconscript: "override_arcmd.rb") + result = run_rscons(args: %w[-f override_arcmd.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [%r{ar rcf lib.a build/e.1/one.c.o build/e.1/three.c.o build/e.1/two.c.o}]) end it "allows passing object files as sources" do test_dir("library") - result = run_rscons(rsconscript: "library_from_object.rb") + result = run_rscons(args: %w[-f library_from_object.rb]) expect(result.stderr).to eq "" expect(File.exists?("two.o")).to be_truthy verify_lines(lines(result.stdout), [%r{Building static library archive lib.a}]) @@ -1662,7 +1647,7 @@ EOF it "allows explicitly specifying SHLD construction variable value" do test_dir("shared_library") - result = run_rscons(rsconscript: "shared_library_set_shld.rb") + result = run_rscons(args: %w[-f shared_library_set_shld.rb]) expect(result.stderr).to eq "" slines = lines(result.stdout) if RUBY_PLATFORM =~ /mingw|msys/ @@ -1674,7 +1659,7 @@ EOF it "allows passing object files as sources" do test_dir "shared_library" - result = run_rscons(rsconscript: "shared_library_from_object.rb") + result = run_rscons(args: %w[-f shared_library_from_object.rb]) expect(result.stderr).to eq "" expect(File.exists?("one.c.o")) end @@ -1684,7 +1669,7 @@ EOF it "generates a size file" do test_dir "simple" - result = run_rscons(rsconscript: "size.rb") + result = run_rscons(args: %w[-f size.rb]) verify_lines(lines(result.stdout), [ /Linking .*simple\.exe/, /Size .*simple\.exe .*simple\.size/, @@ -1699,7 +1684,7 @@ EOF it "waits for subcommands in threads for builders that support threaded commands" do test_dir("simple") start_time = Time.new - result = run_rscons(rsconscript: "threading.rb", rscons_args: %w[-j 4]) + result = run_rscons(args: %w[-f threading.rb -j 4]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{ThreadedTestBuilder a}, @@ -1713,20 +1698,20 @@ EOF it "allows the user to specify that a target be built after another" do test_dir("custom_builder") - result = run_rscons(rsconscript: "build_after.rb", rscons_args: %w[-j 4]) + result = run_rscons(args: %w[-f build_after.rb -j 4]) expect(result.stderr).to eq "" end it "allows the user to specify side-effect files produced by another builder with Builder#produces" do test_dir("custom_builder") - result = run_rscons(rsconscript: "produces.rb", rscons_args: %w[-j 4]) + result = run_rscons(args: %w[-f produces.rb -j 4]) expect(result.stderr).to eq "" expect(File.exists?("copy_inc.h")).to be_truthy end it "allows the user to specify side-effect files produced by another builder with Environment#produces" do test_dir("custom_builder") - result = run_rscons(rsconscript: "produces_env.rb", rscons_args: %w[-j 4]) + result = run_rscons(args: %w[-f produces_env.rb -j 4]) expect(result.stderr).to eq "" expect(File.exists?("copy_inc.h")).to be_truthy end @@ -1735,7 +1720,7 @@ EOF context "CLI" do it "shows the version number and exits with --version argument" do test_dir("simple") - result = run_rscons(rscons_args: %w[--version]) + result = run_rscons(args: %w[--version]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /version #{Rscons::VERSION}/ @@ -1743,7 +1728,7 @@ EOF it "shows CLI help and exits with --help argument" do test_dir("simple") - result = run_rscons(rscons_args: %w[--help]) + result = run_rscons(args: %w[--help]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Usage:/ @@ -1759,21 +1744,21 @@ EOF it "prints an error and exits with an error status when the given Rsconscript cannot be read" do test_dir("simple") - result = run_rscons(rsconscript: "nonexistent") + result = run_rscons(args: %w[-f nonexistent]) expect(result.stderr).to match /Cannot read nonexistent/ expect(result.status).to_not eq 0 end it "outputs an error for an unknown operation" do test_dir "simple" - result = run_rscons(op: "unknownop") + result = run_rscons(args: "unknownop") expect(result.stderr).to match /Unknown operation: unknownop/ expect(result.status).to_not eq 0 end it "displays usage and error message without a backtrace for an invalid CLI option" do test_dir "simple" - result = run_rscons(rscons_args: %w[--xyz]) + result = run_rscons(args: %w[--xyz]) expect(result.stderr).to_not match /Traceback/ expect(result.stderr).to match /invalid option.*--xyz/ expect(result.stderr).to match /Usage:/ @@ -1782,7 +1767,7 @@ EOF it "displays usage and error message without a backtrace for an invalid CLI option to a valid subcommand" do test_dir "simple" - result = run_rscons(op: %w[configure --xyz]) + result = run_rscons(args: %w[configure --xyz]) expect(result.stderr).to_not match /Traceback/ expect(result.stderr).to match /invalid option.*--xyz/ expect(result.stderr).to match /Usage:/ @@ -1793,7 +1778,7 @@ EOF context "configure operation" do it "raises a method not found error for configure methods called outside a configure block" do test_dir "configure" - result = run_rscons(rsconscript: "scope.rb") + result = run_rscons(args: %w[-f scope.rb]) expect(result.stderr).to match /NoMethodError/ expect(result.status).to_not eq 0 end @@ -1801,13 +1786,13 @@ EOF it "automatically runs the configure operation if the project is not yet configured in the given build directory" do test_dir "configure" - result = run_rscons(rsconscript: "check_c_compiler.rb") + result = run_rscons(args: %w[-f check_c_compiler.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C compiler\.\.\./ expect(Dir.exist?("build/_configure")).to be_truthy - result = run_rscons(rsconscript: "check_c_compiler.rb", rscons_args: %w[--build=bb]) + result = run_rscons(args: %w[-f check_c_compiler.rb --build=bb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C compiler\.\.\./ @@ -1820,7 +1805,7 @@ EOF context desc do it "finds the first listed C compiler" do test_dir "configure" - result = run_rscons(rsconscript: rsconscript, op: "configure") + result = run_rscons(args: %W[-f #{rsconscript} configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C compiler\.\.\. gcc/ @@ -1829,7 +1814,7 @@ EOF it "finds the second listed C compiler" do test_dir "configure" create_exe "gcc", "exit 1" - result = run_rscons(rsconscript: rsconscript, op: "configure") + result = run_rscons(args: %W[-f #{rsconscript} configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C compiler\.\.\. clang/ @@ -1839,7 +1824,7 @@ EOF test_dir "configure" create_exe "gcc", "exit 1" create_exe "clang", "exit 1" - result = run_rscons(rsconscript: rsconscript, op: "configure") + result = run_rscons(args: %W[-f #{rsconscript} configure]) expect(result.stderr).to match /Configuration failed/ expect(result.status).to_not eq 0 expect(result.stdout).to match /Checking for C compiler\.\.\. not found/ @@ -1850,7 +1835,7 @@ EOF it "successfully tests a compiler with an unknown name" do test_dir "configure" create_exe "mycompiler", %[exec gcc "$@"] - result = run_rscons(rsconscript: "check_c_compiler_custom.rb", op: "configure") + result = run_rscons(args: %w[-f check_c_compiler_custom.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C compiler\.\.\. mycompiler/ @@ -1863,7 +1848,7 @@ EOF context desc do it "finds the first listed C++ compiler" do test_dir "configure" - result = run_rscons(rsconscript: rsconscript, op: "configure") + result = run_rscons(args: %W[-f #{rsconscript} configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C\+\+ compiler\.\.\. g\+\+/ @@ -1872,7 +1857,7 @@ EOF it "finds the second listed C++ compiler" do test_dir "configure" create_exe "g++", "exit 1" - result = run_rscons(rsconscript: rsconscript, op: "configure") + result = run_rscons(args: %W[-f #{rsconscript} configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C\+\+ compiler\.\.\. clang\+\+/ @@ -1882,7 +1867,7 @@ EOF test_dir "configure" create_exe "g++", "exit 1" create_exe "clang++", "exit 1" - result = run_rscons(rsconscript: rsconscript, op: "configure") + result = run_rscons(args: %W[-f #{rsconscript} configure]) expect(result.stderr).to match /Configuration failed/ expect(result.status).to_not eq 0 expect(result.stdout).to match /Checking for C\+\+ compiler\.\.\. not found/ @@ -1893,7 +1878,7 @@ EOF it "successfully tests a compiler with an unknown name" do test_dir "configure" create_exe "mycompiler", %[exec clang++ "$@"] - result = run_rscons(rsconscript: "check_cxx_compiler_custom.rb", op: "configure") + result = run_rscons(args: %w[-f check_cxx_compiler_custom.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C\+\+ compiler\.\.\. mycompiler/ @@ -1907,7 +1892,7 @@ EOF unless RUBY_PLATFORM =~ /mingw|msys/ it "finds the first listed D compiler" do test_dir "configure" - result = run_rscons(rsconscript: rsconscript, op: "configure") + result = run_rscons(args: %W[-f #{rsconscript} configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for D compiler\.\.\. gdc/ @@ -1917,7 +1902,7 @@ EOF it "finds the second listed D compiler" do test_dir "configure" create_exe "gdc", "exit 1" - result = run_rscons(rsconscript: rsconscript, op: "configure") + result = run_rscons(args: %W[-f #{rsconscript} configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for D compiler\.\.\. ldc2/ @@ -1927,7 +1912,7 @@ EOF test_dir "configure" create_exe "gdc", "exit 1" create_exe "ldc2", "exit 1" - result = run_rscons(rsconscript: rsconscript, op: "configure") + result = run_rscons(args: %W[-f #{rsconscript} configure]) expect(result.stderr).to match /Configuration failed/ expect(result.status).to_not eq 0 expect(result.stdout).to match /Checking for D compiler\.\.\. not found/ @@ -1939,7 +1924,7 @@ EOF it "successfully tests a compiler with an unknown name that uses gdc-compatible options" do test_dir "configure" create_exe "mycompiler", %[exec gdc "$@"] - result = run_rscons(rsconscript: "check_d_compiler_custom.rb", op: "configure") + result = run_rscons(args: %w[-f check_d_compiler_custom.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for D compiler\.\.\. mycompiler/ @@ -1949,7 +1934,7 @@ EOF it "successfully tests a compiler with an unknown name that uses ldc2-compatible options" do test_dir "configure" create_exe "mycompiler", %[exec ldc2 "$@"] - result = run_rscons(rsconscript: "check_d_compiler_custom.rb", op: "configure") + result = run_rscons(args: %w[-f check_d_compiler_custom.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for D compiler\.\.\. mycompiler/ @@ -1959,7 +1944,7 @@ EOF context "check_c_header" do it "succeeds when the requested header is found" do test_dir "configure" - result = run_rscons(rsconscript: "check_c_header_success.rb", op: "configure") + result = run_rscons(args: %w[-f check_c_header_success.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C header 'string\.h'... found/ @@ -1967,7 +1952,7 @@ EOF it "fails when the requested header is not found" do test_dir "configure" - result = run_rscons(rsconscript: "check_c_header_failure.rb", op: "configure") + result = run_rscons(args: %w[-f check_c_header_failure.rb", args: "configure]) expect(result.stderr).to match /Configuration failed/ expect(result.status).to_not eq 0 expect(result.stdout).to match /Checking for C header 'not___found\.h'... not found/ @@ -1975,7 +1960,7 @@ EOF it "succeeds when the requested header is not found but :fail is set to false" do test_dir "configure" - result = run_rscons(rsconscript: "check_c_header_no_fail.rb", op: "configure") + result = run_rscons(args: %w[-f check_c_header_no_fail.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C header 'not___found\.h'... not found/ @@ -1983,11 +1968,11 @@ EOF it "sets the specified define when the header is found" do test_dir "configure" - result = run_rscons(rsconscript: "check_c_header_success_set_define.rb", op: "configure") + result = run_rscons(args: %w[-f check_c_header_success_set_define.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C header 'string\.h'... found/ - result = run_rscons(rsconscript: "check_c_header_success_set_define.rb", op: "build") + result = run_rscons(args: %w[-f check_c_header_success_set_define.rb", args: "build]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /-DHAVE_STRING_H/ @@ -1995,11 +1980,11 @@ EOF it "does not set the specified define when the header is not found" do test_dir "configure" - result = run_rscons(rsconscript: "check_c_header_no_fail_set_define.rb", op: "configure") + result = run_rscons(args: %w[-f check_c_header_no_fail_set_define.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C header 'not___found\.h'... not found/ - result = run_rscons(rsconscript: "check_c_header_no_fail_set_define.rb", op: "build") + result = run_rscons(args: %w[-f check_c_header_no_fail_set_define.rb", args: "build]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to_not match /-DHAVE_/ @@ -2012,10 +1997,10 @@ EOF File.open("usr2/frobulous.h", "wb") do |fh| fh.puts("#define FOO 42") end - result = run_rscons(rsconscript: "check_c_header_cpppath.rb", op: "configure") + result = run_rscons(args: %w[-f check_c_header_cpppath.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 - result = run_rscons(rsconscript: "check_c_header_cpppath.rb", rscons_args: %w[-v]) + result = run_rscons(args: %w[-f check_c_header_cpppath.rb -v]) expect(result.stdout).to_not match %r{-I./usr1} expect(result.stdout).to match %r{-I./usr2} end @@ -2024,7 +2009,7 @@ EOF context "check_cxx_header" do it "succeeds when the requested header is found" do test_dir "configure" - result = run_rscons(rsconscript: "check_cxx_header_success.rb", op: "configure") + result = run_rscons(args: %w[-f check_cxx_header_success.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C\+\+ header 'string\.h'... found/ @@ -2032,7 +2017,7 @@ EOF it "fails when the requested header is not found" do test_dir "configure" - result = run_rscons(rsconscript: "check_cxx_header_failure.rb", op: "configure") + result = run_rscons(args: %w[-f check_cxx_header_failure.rb", args: "configure]) expect(result.stderr).to match /Configuration failed/ expect(result.status).to_not eq 0 expect(result.stdout).to match /Checking for C\+\+ header 'not___found\.h'... not found/ @@ -2040,7 +2025,7 @@ EOF it "succeeds when the requested header is not found but :fail is set to false" do test_dir "configure" - result = run_rscons(rsconscript: "check_cxx_header_no_fail.rb", op: "configure") + result = run_rscons(args: %w[-f check_cxx_header_no_fail.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for C\+\+ header 'not___found\.h'... not found/ @@ -2053,10 +2038,10 @@ EOF File.open("usr2/frobulous.h", "wb") do |fh| fh.puts("#define FOO 42") end - result = run_rscons(rsconscript: "check_cxx_header_cpppath.rb", op: "configure") + result = run_rscons(args: %w[-f check_cxx_header_cpppath.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 - result = run_rscons(rsconscript: "check_cxx_header_cpppath.rb", rscons_args: %w[-v]) + result = run_rscons(args: %w[-f check_cxx_header_cpppath.rb -v]) expect(result.stdout).to_not match %r{-I./usr1} expect(result.stdout).to match %r{-I./usr2} end @@ -2065,7 +2050,7 @@ EOF context "check_d_import" do it "succeeds when the requested import is found" do test_dir "configure" - result = run_rscons(rsconscript: "check_d_import_success.rb", op: "configure") + result = run_rscons(args: %w[-f check_d_import_success.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for D import 'std\.stdio'... found/ @@ -2073,7 +2058,7 @@ EOF it "fails when the requested import is not found" do test_dir "configure" - result = run_rscons(rsconscript: "check_d_import_failure.rb", op: "configure") + result = run_rscons(args: %w[-f check_d_import_failure.rb", args: "configure]) expect(result.stderr).to match /Configuration failed/ expect(result.status).to_not eq 0 expect(result.stdout).to match /Checking for D import 'not\.found'... not found/ @@ -2081,7 +2066,7 @@ EOF it "succeeds when the requested import is not found but :fail is set to false" do test_dir "configure" - result = run_rscons(rsconscript: "check_d_import_no_fail.rb", op: "configure") + result = run_rscons(args: %w[-f check_d_import_no_fail.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for D import 'not\.found'... not found/ @@ -2094,10 +2079,10 @@ EOF File.open("usr2/frobulous.d", "wb") do |fh| fh.puts("int foo = 42;") end - result = run_rscons(rsconscript: "check_d_import_d_import_path.rb", op: "configure") + result = run_rscons(args: %w[-f check_d_import_d_import_path.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 - result = run_rscons(rsconscript: "check_d_import_d_import_path.rb", rscons_args: %w[-v]) + result = run_rscons(args: %w[-f check_d_import_d_import_path.rb -v]) expect(result.stdout).to_not match %r{-I./usr1} expect(result.stdout).to match %r{-I./usr2} end @@ -2106,7 +2091,7 @@ EOF context "check_lib" do it "succeeds when the requested library is found" do test_dir "configure" - result = run_rscons(rsconscript: "check_lib_success.rb", op: "configure") + result = run_rscons(args: %w[-f check_lib_success.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for library 'm'... found/ @@ -2114,7 +2099,7 @@ EOF it "fails when the requested library is not found" do test_dir "configure" - result = run_rscons(rsconscript: "check_lib_failure.rb", op: "configure") + result = run_rscons(args: %w[-f check_lib_failure.rb", args: "configure]) expect(result.stderr).to match /Configuration failed/ expect(result.status).to_not eq 0 expect(result.stdout).to match /Checking for library 'mfoofoo'... not found/ @@ -2122,7 +2107,7 @@ EOF it "succeeds when the requested library is not found but :fail is set to false" do test_dir "configure" - result = run_rscons(rsconscript: "check_lib_no_fail.rb", op: "configure") + result = run_rscons(args: %w[-f check_lib_no_fail.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for library 'mfoofoo'... not found/ @@ -2130,7 +2115,7 @@ EOF it "links against the checked library by default" do test_dir "configure" - result = run_rscons(rsconscript: "check_lib_success.rb", op: "build") + result = run_rscons(args: %w[-f check_lib_success.rb", args: "build]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for library 'm'... found/ @@ -2139,7 +2124,7 @@ EOF it "does not link against the checked library by default if :use is specified" do test_dir "configure" - result = run_rscons(rsconscript: "check_lib_use.rb", op: "build") + result = run_rscons(args: %w[-f check_lib_use.rb", args: "build]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for library 'm'... found/ @@ -2149,7 +2134,7 @@ EOF it "does not link against the checked library if :use is set to false" do test_dir "configure" - result = run_rscons(rsconscript: "check_lib_use_false.rb", op: "build") + result = run_rscons(args: %w[-f check_lib_use_false.rb", args: "build]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for library 'm'... found/ @@ -2160,13 +2145,13 @@ EOF test_dir "configure" FileUtils.mkdir_p("usr1") FileUtils.mkdir_p("usr2") - result = run_rscons(rsconscript: "check_lib_libpath1.rb") + result = run_rscons(args: %w[-f check_lib_libpath1.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 - result = run_rscons(rsconscript: "check_lib_libpath2.rb", op: "configure") + result = run_rscons(args: %w[-f check_lib_libpath2.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 - result = run_rscons(rsconscript: "check_lib_libpath2.rb") + result = run_rscons(args: %w[-f check_lib_libpath2.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match %r{-L\./usr2} @@ -2177,7 +2162,7 @@ EOF context "check_program" do it "succeeds when the requested program is found" do test_dir "configure" - result = run_rscons(rsconscript: "check_program_success.rb", op: "configure") + result = run_rscons(args: %w[-f check_program_success.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for program 'find'... .*find/ @@ -2186,7 +2171,7 @@ EOF context "with non-existent PATH entries" do it "succeeds when the requested program is found" do test_dir "configure" - result = run_rscons(rsconscript: "check_program_success.rb", op: "configure", path: "/foo/bar") + result = run_rscons(args: %w[-f check_program_success.rb", args: "configure", path: "/foo/bar]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for program 'find'... .*find/ @@ -2195,7 +2180,7 @@ EOF it "fails when the requested program is not found" do test_dir "configure" - result = run_rscons(rsconscript: "check_program_failure.rb", op: "configure") + result = run_rscons(args: %w[-f check_program_failure.rb", args: "configure]) expect(result.stderr).to match /Configuration failed/ expect(result.status).to_not eq 0 expect(result.stdout).to match /Checking for program 'program-that-is-not-found'... not found/ @@ -2203,7 +2188,7 @@ EOF it "succeeds when the requested program is not found but :fail is set to false" do test_dir "configure" - result = run_rscons(rsconscript: "check_program_no_fail.rb", op: "configure") + result = run_rscons(args: %w[-f check_program_no_fail.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for program 'program-that-is-not-found'... not found/ @@ -2215,11 +2200,11 @@ EOF it "stores flags and uses them during a build operation" do test_dir "configure" create_exe "pkg-config", "echo '-DMYPACKAGE'" - result = run_rscons(rsconscript: "check_cfg_package.rb", op: "configure") + result = run_rscons(args: %w[-f check_cfg_package.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for package 'mypackage'\.\.\. found/ - result = run_rscons(rsconscript: "check_cfg_package.rb", op: "build") + result = run_rscons(args: %w[-f check_cfg_package.rb", args: "build]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /gcc.*-o.*\.o.*-DMYPACKAGE/ @@ -2227,7 +2212,7 @@ EOF it "fails when the configure program given does not exist" do test_dir "configure" - result = run_rscons(rsconscript: "check_cfg.rb", op: "configure") + result = run_rscons(args: %w[-f check_cfg.rb", args: "configure]) expect(result.stderr).to match /Configuration failed/ expect(result.status).to_not eq 0 expect(result.stdout).to match /Checking 'my-config'\.\.\. not found/ @@ -2236,11 +2221,11 @@ EOF it "does not use the flags found by default if :use is specified" do test_dir "configure" create_exe "pkg-config", "echo '-DMYPACKAGE'" - result = run_rscons(rsconscript: "check_cfg_use.rb", op: "configure") + result = run_rscons(args: %w[-f check_cfg_use.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking for package 'mypackage'\.\.\. found/ - result = run_rscons(rsconscript: "check_cfg_use.rb", op: "build") + result = run_rscons(args: %w[-f check_cfg_use.rb", args: "build]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to_not match /gcc.*-o.*myconfigtest1.*-DMYPACKAGE/ @@ -2252,11 +2237,11 @@ EOF it "stores flags and uses them during a build operation" do test_dir "configure" create_exe "my-config", "echo '-DMYCONFIG -lm'" - result = run_rscons(rsconscript: "check_cfg.rb", op: "configure") + result = run_rscons(args: %w[-f check_cfg.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Checking 'my-config'\.\.\. found/ - result = run_rscons(rsconscript: "check_cfg.rb", op: "build") + result = run_rscons(args: %w[-f check_cfg.rb", args: "build]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /gcc.*-o.*\.o.*-DMYCONFIG/ @@ -2272,7 +2257,7 @@ EOF it "fails configuration with the correct error message" do test_dir "configure" create_exe "grep", "exit 4" - result = run_rscons(rsconscript: "custom_config_check.rb", op: "configure") + result = run_rscons(args: %w[-f custom_config_check.rb", args: "configure]) expect(result.stderr).to match /Configuration failed/ expect(result.stdout).to match /Checking 'grep' version\.\.\. error executing grep/ expect(result.status).to_not eq 0 @@ -2283,7 +2268,7 @@ EOF it "fails configuration with the correct error message" do test_dir "configure" create_exe "grep", "echo 'grep (GNU grep) 1.1'" - result = run_rscons(rsconscript: "custom_config_check.rb", op: "configure") + result = run_rscons(args: %w[-f custom_config_check.rb", args: "configure]) expect(result.stderr).to match /Configuration failed/ expect(result.stdout).to match /Checking 'grep' version\.\.\. too old!/ expect(result.status).to_not eq 0 @@ -2296,11 +2281,11 @@ EOF it "displays the correct message and does not fail configuration" do test_dir "configure" create_exe "grep", "echo 'grep (GNU grep) 2.1'" - result = run_rscons(rsconscript: "custom_config_check.rb", op: "configure") + result = run_rscons(args: %w[-f custom_config_check.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.stdout).to match /Checking 'grep' version\.\.\. we'll work with it but you should upgrade/ expect(result.status).to eq 0 - result = run_rscons(rsconscript: "custom_config_check.rb", op: "build") + result = run_rscons(args: %w[-f custom_config_check.rb", args: "build]) expect(result.stderr).to eq "" expect(result.stdout).to match /GREP_WORKAROUND/ expect(result.status).to eq 0 @@ -2312,11 +2297,11 @@ EOF it "passes configuration with the correct message" do test_dir "configure" create_exe "grep", "echo 'grep (GNU grep) 3.0'" - result = run_rscons(rsconscript: "custom_config_check.rb", op: "configure") + result = run_rscons(args: %w[-f custom_config_check.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.stdout).to match /Checking 'grep' version\.\.\. good!/ expect(result.status).to eq 0 - result = run_rscons(rsconscript: "custom_config_check.rb", op: "build") + result = run_rscons(args: %w[-f custom_config_check.rb", args: "build]) expect(result.stderr).to eq "" expect(result.stdout).to match /GREP_FULL/ expect(result.status).to eq 0 @@ -2325,7 +2310,7 @@ EOF it "allows passing standard input data to the executed command" do test_dir "configure" - result = run_rscons(rsconscript: "custom_config_check.rb", op: "configure") + result = run_rscons(args: %w[-f custom_config_check.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.stdout).to match /Checking sed -E flag\.\.\. good/ expect(result.status).to eq 0 @@ -2336,7 +2321,7 @@ EOF context "on_fail option" do it "prints on_fail messages and calls on_fail procs on failure" do test_dir "configure" - result = run_rscons(rsconscript: "on_fail.rb", op: %w[configure]) + result = run_rscons(args: %w[-f on_fail.rb configure]) expect(result.status).to_not eq 0 expect(result.stdout).to match /Install the foo123 package/ expect(result.stdout).to match /Install the foo123cxx package/ @@ -2346,7 +2331,7 @@ EOF it "does everything" do test_dir "configure" create_exe "pkg-config", "echo '-DMYPACKAGE'" - result = run_rscons(rsconscript: "everything.rb", op: %w[configure --build=bb --prefix=/my/prefix]) + result = run_rscons(args: %w[-f everything.rb configure --build=bb --prefix=/my/prefix]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /Configuring configure test\.\.\./ @@ -2366,10 +2351,10 @@ EOF it "aggregates multiple set_define's" do test_dir "configure" - result = run_rscons(rsconscript: "multiple_set_define.rb", op: "configure") + result = run_rscons(args: %w[-f multiple_set_define.rb", args: "configure]) expect(result.stderr).to eq "" expect(result.status).to eq 0 - result = run_rscons(rsconscript: "multiple_set_define.rb", op: "build") + result = run_rscons(args: %w[-f multiple_set_define.rb", args: "build]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to match /gcc.*-o.*\.o.*-DHAVE_MATH_H\s.*-DHAVE_STDIO_H/ @@ -2377,14 +2362,14 @@ EOF it "exits with an error if the project is not configured and a build is requested and autoconf is false" do test_dir "configure" - result = run_rscons(rsconscript: "autoconf_false.rb") + result = run_rscons(args: %w[-f autoconf_false.rb]) expect(result.stderr).to match /Project must be configured first, and autoconf is disabled/ expect(result.status).to_not eq 0 end it "exits with an error code and message if configuration fails during autoconf" do test_dir "configure" - result = run_rscons(rsconscript: "autoconf_fail.rb") + result = run_rscons(args: %w[-f autoconf_fail.rb]) expect(result.stdout).to match /Checking for C compiler\.\.\. not found/ expect(result.status).to_not eq 0 expect(result.stderr).to_not match /from\s/ @@ -2393,18 +2378,18 @@ EOF it "exits with an error if configuration has not been performed before attempting to create an environment" do test_dir "configure" - result = run_rscons(rsconscript: "error_env_construction_before_configure.rb") + result = run_rscons(args: %w[-f error_env_construction_before_configure.rb]) expect(result.stderr).to match /Project must be configured before creating an Environment/ expect(result.status).to_not eq 0 end it "does not rebuild after building with auto-configuration" do test_dir "configure" - result = run_rscons(rsconscript: "autoconf_rebuild.rb") + result = run_rscons(args: %w[-f autoconf_rebuild.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(File.exists?("simple.exe")).to be_truthy - result = run_rscons(rsconscript: "autoconf_rebuild.rb") + result = run_rscons(args: %w[-f autoconf_rebuild.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(result.stdout).to eq "" @@ -2414,12 +2399,12 @@ EOF context "distclean" do it "removes built files and the build directory" do test_dir "simple" - result = run_rscons(rsconscript: "distclean.rb") + result = run_rscons(args: %w[-f distclean.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(File.exists?("simple.o")).to be_truthy expect(File.exists?("build")).to be_truthy - result = run_rscons(rsconscript: "distclean.rb", op: "distclean") + result = run_rscons(args: %w[-f distclean.rb", args: "distclean]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(File.exists?("simple.o")).to be_falsey @@ -2437,28 +2422,28 @@ EOF it "echoes commands by default with -v" do test_dir('simple') - result = run_rscons(rscons_args: %w[-v]) + result = run_rscons(args: %w[-v]) expect(result.stderr).to eq "" expect(result.stdout).to match /gcc.*-o.*simple/ end it "echoes commands by default with --verbose" do test_dir('simple') - result = run_rscons(rscons_args: %w[--verbose]) + result = run_rscons(args: %w[--verbose]) expect(result.stderr).to eq "" expect(result.stdout).to match /gcc.*-o.*simple/ end it "echoes commands by default with -v after build operation" do test_dir('simple') - result = run_rscons(op: %w[build -v]) + result = run_rscons(args: %w[build -v]) expect(result.stderr).to eq "" expect(result.stdout).to match /gcc.*-o.*simple/ end it "prints operation start time" do test_dir("simple") - result = run_rscons(rscons_args: %w[-v]) + result = run_rscons(args: %w[-v]) expect(result.stderr).to eq "" expect(result.stdout).to match /Starting 'configure' at/ expect(result.stdout).to match /Starting 'build' at/ @@ -2471,13 +2456,13 @@ EOF it "allows calling Program builder in direct mode and passes all sources to the C compiler" do test_dir("direct") - result = run_rscons(rsconscript: "c_program.rb") + result = run_rscons(args: %w[-f c_program.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match %r{Compiling/Linking} expect(File.exists?("test.exe")).to be_truthy expect(`./test.exe`).to match /three/ - result = run_rscons(rsconscript: "c_program.rb") + result = run_rscons(args: %w[-f c_program.rb]) expect(result.stdout).to eq "" three_h = File.read("three.h", mode: "rb") @@ -2485,21 +2470,21 @@ EOF fh.write(three_h) fh.puts("#define FOO 42") end - result = run_rscons(rsconscript: "c_program.rb") + result = run_rscons(args: %w[-f c_program.rb]) expect(result.stdout).to match %r{Compiling/Linking} end it "allows calling SharedLibrary builder in direct mode and passes all sources to the C compiler" do test_dir("direct") - result = run_rscons(rsconscript: "c_shared_library.rb") + result = run_rscons(args: %w[-f c_shared_library.rb]) expect(result.stderr).to eq "" expect(result.stdout).to match %r{Compiling/Linking} expect(File.exists?("test.exe")).to be_truthy ld_library_path_prefix = (RUBY_PLATFORM =~ /mingw|msys/ ? "" : "LD_LIBRARY_PATH=. ") expect(`#{ld_library_path_prefix}./test.exe`).to match /three/ - result = run_rscons(rsconscript: "c_shared_library.rb") + result = run_rscons(args: %w[-f c_shared_library.rb]) expect(result.stdout).to eq "" three_h = File.read("three.h", mode: "rb") @@ -2507,7 +2492,7 @@ EOF fh.write(three_h) fh.puts("#define FOO 42") end - result = run_rscons(rsconscript: "c_shared_library.rb") + result = run_rscons(args: %w[-f c_shared_library.rb]) expect(result.stdout).to match %r{Compiling/Linking} end end @@ -2516,7 +2501,7 @@ EOF it "invokes a configure operation if the project is not yet configured" do test_dir "typical" - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stdout).to match /Configuring install_test/ end @@ -2524,9 +2509,9 @@ EOF test_dir "typical" Dir.mktmpdir do |prefix| - result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}]) + result = run_rscons(args: %W[-f install.rb configure --prefix=#{prefix}]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" expect(result.stdout).to match /Compiling/ expect(result.stdout).to match /Linking/ @@ -2537,10 +2522,10 @@ EOF test_dir "typical" Dir.mktmpdir do |prefix| - result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}]) + result = run_rscons(args: %W[-f install.rb configure --prefix=#{prefix}]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" expect(result.stdout).to match /Creating directory/ expect(result.stdout).to match /Install install.rb =>/ @@ -2555,7 +2540,7 @@ EOF expect(File.exists?("#{prefix}/mult/install.rb")).to be_truthy expect(File.exists?("#{prefix}/mult/copy.rb")).to be_truthy - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" expect(result.stdout).to eq "" end @@ -2565,15 +2550,15 @@ EOF test_dir "typical" Dir.mktmpdir do |prefix| - result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}]) + result = run_rscons(args: %W[-f install.rb configure --prefix=#{prefix}]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[build]) + result = run_rscons(args: %w[-f install.rb build]) expect(result.stderr).to eq "" expect(result.stdout).to_not match /Install/ expect(Dir.entries(prefix)).to match_array %w[. ..] - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" expect(result.stdout).to match /Install/ end @@ -2585,15 +2570,15 @@ EOF test_dir "typical" Dir.mktmpdir do |prefix| - result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}]) + result = run_rscons(args: %W[-f install.rb configure --prefix=#{prefix}]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" expect(File.exists?("#{prefix}/bin/program.exe")).to be_truthy expect(File.exists?("build/e.1/src/one/one.c.o")).to be_truthy - result = run_rscons(rsconscript: "install.rb", op: %W[uninstall]) + result = run_rscons(args: %w[-f install.rb uninstall]) expect(result.stderr).to eq "" expect(result.stdout).to_not match /Removing/ expect(File.exists?("#{prefix}/bin/program.exe")).to be_falsey @@ -2606,13 +2591,13 @@ EOF test_dir "typical" Dir.mktmpdir do |prefix| - result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}]) + result = run_rscons(args: %W[-f install.rb configure --prefix=#{prefix}]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[uninstall -v]) + result = run_rscons(args: %w[-f install.rb uninstall -v]) expect(result.stderr).to eq "" expect(result.stdout).to match %r{Removing #{prefix}/bin/program.exe} expect(File.exists?("#{prefix}/bin/program.exe")).to be_falsey @@ -2624,13 +2609,13 @@ EOF test_dir "typical" Dir.mktmpdir do |prefix| - result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}]) + result = run_rscons(args: %W[-f install.rb configure --prefix=#{prefix}]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %W[uninstall -v]) + result = run_rscons(args: %w[-f install.rb uninstall -v]) expect(result.stderr).to eq "" expect(result.stdout).to match %r{Removing #{prefix}/bin/program.exe} expect(File.exists?("#{prefix}/bin/program.exe")).to be_falsey @@ -2638,7 +2623,7 @@ EOF FileUtils.mkdir_p("#{prefix}/bin") File.open("#{prefix}/bin/program.exe", "w") {|fh| fh.write("hi")} - result = run_rscons(rsconscript: "install.rb", op: %W[uninstall -v]) + result = run_rscons(args: %w[-f install.rb uninstall -v]) expect(result.stderr).to eq "" expect(result.stdout).to_not match /Removing/ end @@ -2649,7 +2634,7 @@ EOF it "does not include install targets in build progress when not doing an install" do test_dir "typical" - result = run_rscons(rsconscript: "install.rb") + result = run_rscons(args: %w[-f install.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{\[1/3\] Compiling}, @@ -2662,10 +2647,10 @@ EOF test_dir "typical" Dir.mktmpdir do |prefix| - result = run_rscons(rsconscript: "install.rb", op: %W[configure --prefix=#{prefix}]) + result = run_rscons(args: %W[-f install.rb configure --prefix=#{prefix}]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "install.rb", op: %w[install]) + result = run_rscons(args: %w[-f install.rb install]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{\[1/9\] Compiling}, @@ -2678,7 +2663,7 @@ EOF it "includes build steps from all environments when showing build progress" do test_dir "typical" - result = run_rscons(rsconscript: "multiple_environments.rb") + result = run_rscons(args: %w[-f multiple_environments.rb]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{\[1/6\] Compiling}, @@ -2696,7 +2681,7 @@ EOF it "executes the subsidiary script from configure block" do test_dir "subsidiary" - result = run_rscons(op: %W[configure]) + result = run_rscons(args: %w[configure]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Entering directory '.*/sub'}, @@ -2715,9 +2700,9 @@ EOF it "executes the subsidiary script from build block" do test_dir "subsidiary" - result = run_rscons(op: %W[configure]) + result = run_rscons(args: %w[configure]) expect(result.stderr).to eq "" - result = run_rscons(op: %W[build]) + result = run_rscons(args: %w[build]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{sub Rsconscript2 build}, @@ -2730,7 +2715,7 @@ EOF it "executes the subsidiary script from configure block" do test_dir "subsidiary" - result = run_rscons(rsconscript: "Rsconscript_dir", op: %W[configure]) + result = run_rscons(args: %w[-f Rsconscript_dir configure]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Entering directory '.*/sub'}, @@ -2749,9 +2734,9 @@ EOF it "executes the subsidiary script from build block" do test_dir "subsidiary" - result = run_rscons(rsconscript: "Rsconscript_dir", op: %W[configure]) + result = run_rscons(args: %w[-f Rsconscript_dir configure]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "Rsconscript_dir", op: %W[build]) + result = run_rscons(args: %w[-f Rsconscript_dir build]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{sub Rsconscript2 build}, @@ -2769,7 +2754,7 @@ EOF puts "sub rscons" EOF FileUtils.chmod(0755, "sub/rscons") - result = run_rscons(op: %W[configure]) + result = run_rscons(args: %w[configure]) expect(result.stderr).to eq "" verify_lines(lines(result.stdout), [ %r{Entering directory '.*/sub'}, @@ -2789,9 +2774,9 @@ EOF it "does not print entering/leaving directory messages when the subsidiary script is in the same directory" do test_dir "subsidiary" - result = run_rscons(rsconscript: "Rsconscript_samedir", op: %W[configure]) + result = run_rscons(args: %w[-f Rsconscript_samedir configure]) expect(result.stderr).to eq "" - result = run_rscons(rsconscript: "Rsconscript_samedir", op: %W[build]) + result = run_rscons(args: %w[-f Rsconscript_samedir build]) expect(result.stderr).to eq "" expect(result.stdout).to_not match(%{(Entering|Leaving) directory}) verify_lines(lines(result.stdout), [ @@ -2803,7 +2788,7 @@ EOF it "terminates execution when a subsidiary script fails" do test_dir "subsidiary" - result = run_rscons(rsconscript: "Rsconscript_fail", op: %W[configure]) + result = run_rscons(args: %w[-f Rsconscript_fail configure]) expect(result.stderr).to_not eq "" expect(result.status).to_not eq 0 expect(result.stdout).to_not match /top configure/ @@ -2812,7 +2797,7 @@ EOF it "does not pass RSCONS_BUILD_DIR to subsidiary scripts" do test_dir "subsidiary" passenv["RSCONS_BUILD_DIR"] = "buildit" - result = run_rscons(op: %W[configure]) + result = run_rscons(args: %w[configure]) expect(result.stderr).to eq "" expect(Dir.exist?("build")).to be_falsey expect(Dir.exist?("buildit")).to be_truthy @@ -2824,7 +2809,7 @@ EOF context "sh method" do it "executes the command given" do test_dir "sh" - result = run_rscons(rsconscript: "sh.rb") + result = run_rscons(args: %w[-f sh.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 verify_lines(lines(result.stdout), [ @@ -2835,7 +2820,7 @@ EOF it "prints the command when executing verbosely" do test_dir "sh" - result = run_rscons(rsconscript: "sh.rb", rscons_args: %w[-v]) + result = run_rscons(args: %w[-f sh.rb -v]) expect(result.stderr).to eq "" expect(result.status).to eq 0 verify_lines(lines(result.stdout), [ @@ -2848,7 +2833,7 @@ EOF it "terminates execution on failure" do test_dir "sh" - result = run_rscons(rsconscript: "sh_fail.rb") + result = run_rscons(args: %w[-f sh_fail.rb]) expect(result.stderr).to match /sh_fail\.rb:2:.*foobar42/ expect(result.status).to_not eq 0 expect(result.stdout).to_not match /continued/ @@ -2856,7 +2841,7 @@ EOF it "continues execution on failure when :continue option is set" do test_dir "sh" - result = run_rscons(rsconscript: "sh_fail_continue.rb") + result = run_rscons(args: %w[-f sh_fail_continue.rb]) expect(result.stderr).to match /sh_fail_continue\.rb:2:.*foobar42/ expect(result.status).to eq 0 expect(result.stdout).to match /continued/ @@ -2866,7 +2851,7 @@ EOF context "FileUtils methods" do it "defines FileUtils methods to be available in the build script" do test_dir "typical" - result = run_rscons(rsconscript: "fileutils_methods.rb") + result = run_rscons(args: %w[-f fileutils_methods.rb]) expect(result.stderr).to eq "" expect(result.status).to eq 0 expect(Dir.exist?("foobar")).to be_truthy