Cleaning up more test failures

This commit is contained in:
Josh Holtrop 2022-01-26 19:30:47 -05:00
parent d255c7f46e
commit 9d14cc7eb0
5 changed files with 32 additions and 17 deletions

View File

@ -1,9 +1,13 @@
project_name "install_test"
default do
Environment.new do |env|
env["CPPPATH"] += glob("src/**")
task "build" do
env.Program("^/program.exe", glob("src/**/*.c"))
end
task "install", deps: "build" do
env.InstallDirectory("${prefix}/bin")
env.Install("${prefix}/bin", "^/program.exe")
env.InstallDirectory("${prefix}/share")
@ -12,3 +16,5 @@ default do
env.Install("${prefix}/src", "src")
end
end
default(deps: "build")

View File

@ -17,12 +17,17 @@ module Rscons
# The number of threads to use when scheduling subprocesses.
attr_accessor :n_threads
# @return [Script]
# Build script.
attr_reader :script
# @return [Boolean]
# Whether to run verbosely.
attr_accessor :verbose
# Create Application instance.
def initialize
@script = Script.new
@build_dir = ENV["RSCONS_BUILD_DIR"] || "build"
ENV.delete("RSCONS_BUILD_DIR")
@n_threads = Util.determine_n_threads
@ -35,8 +40,6 @@ module Rscons
#
# @api private
#
# @param script [Script]
# The script.
# @param tasks [Array<String>]
# List of task(s) to execute.
# @param options [Hash]
@ -44,8 +47,7 @@ module Rscons
#
# @return [Integer]
# Process exit code (0 on success).
def run(script, tasks, options = {})
@script = script
def run(tasks, options = {})
Cache.instance["failed_commands"] = []
begin
tasks.each do |task|
@ -123,6 +125,19 @@ module Rscons
cache.clear
end
# Check if the project needs to be configured.
#
# @api private
#
# @return [void]
def check_configure
unless Cache.instance["configuration_data"]["configured"]
if @script.autoconf
configure
end
end
end
# Configure the project.
#
# @api private

View File

@ -8,11 +8,6 @@ module Rscons
# Default files to look for to execute if none specified.
DEFAULT_RSCONSCRIPTS = %w[Rsconscript Rsconscript.rb]
# Create an instance of the rscons command-line interpreter.
def initialize
@script = Script.new
end
# Run the Rscons CLI.
#
# @param argv [Array]
@ -125,7 +120,7 @@ module Rscons
# Load the build script.
if rsconscript
@script.load(rsconscript)
Rscons.application.script.load(rsconscript)
end
# Do help after loading the build script (if found) so that any
@ -155,7 +150,7 @@ module Rscons
# Finally, with the script fully loaded and command-line parsed, run
# the application to execute all required tasks.
Rscons.application.run(@script, tasks)
Rscons.application.run(tasks)
end
def usage

View File

@ -76,6 +76,7 @@ module Rscons
# If a block is given, the Environment object is yielded to the block and
# when the block returns, the {#process} method is automatically called.
def initialize(options = {})
Rscons.application.check_configure
unless Cache.instance["configuration_data"]["configured"]
raise "Project must be configured before creating an Environment"
end

View File

@ -137,9 +137,7 @@ module Rscons
def execute
@executed = true
if @autoconf
unless Cache.instance["configuration_data"]["configured"]
Task["configure"].check_execute
end
Rscons.application.check_configure
end
@deps.each do |dep|
Task[dep].check_execute