Compare commits
No commits in common. "master" and "v3.0.0" have entirely different histories.
15
CHANGELOG.md
15
CHANGELOG.md
@ -1,18 +1,3 @@
|
||||
## v3.0.2
|
||||
|
||||
### Fixes
|
||||
|
||||
- #159 - Compiler check configure methods should respect :use flag
|
||||
- #160 - Configure parameters should not be stored as unscoped construction variables
|
||||
|
||||
## v3.0.1
|
||||
|
||||
### Fixes
|
||||
|
||||
- #156 - Avoid running configure operation twice
|
||||
- #157 - Load configure task arguments before early configure operations
|
||||
- #158 - Do not configure for clean tasks when not yet configured
|
||||
|
||||
## v3.0.0
|
||||
|
||||
- #136 - Move rsconscache into build directory
|
||||
|
@ -35,7 +35,7 @@ task :dspec, [:example_string] => :build_dist do |task, args|
|
||||
FileUtils.mkdir_p("test")
|
||||
FileUtils.cp("dist/rscons", "test/rscons.rb")
|
||||
ENV["dist_specs"] = "1"
|
||||
Rake::Task["spec"].execute(args)
|
||||
Rake::Task["spec"].execute(args.example_string)
|
||||
ENV.delete("dist_specs")
|
||||
FileUtils.rm_f(Dir.glob(".rscons-*"))
|
||||
end
|
||||
|
@ -1,12 +0,0 @@
|
||||
configure do
|
||||
check_c_compiler "clang", use: "clang"
|
||||
check_c_compiler
|
||||
end
|
||||
|
||||
env "t1" do |env|
|
||||
env.Program("test_gcc.exe", "simple.c")
|
||||
end
|
||||
|
||||
env "t2", use: "clang" do |env|
|
||||
env.Program("test_clang.exe", "simple.c")
|
||||
end
|
@ -1,12 +0,0 @@
|
||||
configure do
|
||||
check_cxx_compiler "clang++", use: "clang"
|
||||
check_cxx_compiler
|
||||
end
|
||||
|
||||
env "t1" do |env|
|
||||
env.Program("test_gcc.exe", "simple.cc")
|
||||
end
|
||||
|
||||
env "t2", use: "clang" do |env|
|
||||
env.Program("test_clang.exe", "simple.cc")
|
||||
end
|
@ -1,12 +0,0 @@
|
||||
configure do
|
||||
check_d_compiler "ldc2", use: "ldc2"
|
||||
check_d_compiler
|
||||
end
|
||||
|
||||
env "t1" do |env|
|
||||
env.Program("test_gcc.exe", "simple.d")
|
||||
end
|
||||
|
||||
env "t2", use: "ldc2" do |env|
|
||||
env.Program("test_ldc2.exe", "simple.d")
|
||||
end
|
@ -1,6 +0,0 @@
|
||||
configure do
|
||||
check_c_compiler
|
||||
end
|
||||
env do |env|
|
||||
puts "Prefix is #{Task["configure"]["prefix"]}"
|
||||
end
|
@ -1,6 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout << "Hi" << std::endl;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import std.stdio;
|
||||
|
||||
int main()
|
||||
{
|
||||
writeln("Hello");
|
||||
return 0;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
env do |env|
|
||||
env.Program('simple.exe', Dir['*.c'])
|
||||
end
|
||||
|
||||
clean do
|
||||
puts "custom clean action"
|
||||
end
|
@ -446,9 +446,6 @@ end
|
||||
See ${#Configuring the Project} for more details on how to make use of the
|
||||
configuration functionality that Rscons provides.
|
||||
|
||||
Configure blocks must be defined in the Rsconscript file before any
|
||||
environments are created.
|
||||
|
||||
####> Default Task
|
||||
|
||||
The `default` task is special in that Rscons will execute it if no other task
|
||||
|
@ -73,7 +73,6 @@ module Rscons
|
||||
# Process exit code (0 on success).
|
||||
def run(rsconscript, tasks_and_params, show_tasks, all_tasks, enabled_variants)
|
||||
Cache.instance["failed_commands"] = []
|
||||
@tasks_and_params = tasks_and_params
|
||||
@enabled_variants = enabled_variants
|
||||
if enabled_variants == "" && !tasks_and_params.include?("configure")
|
||||
if cache_enabled_variants = Cache.instance["configuration_data"]["enabled_variants"]
|
||||
@ -81,15 +80,13 @@ module Rscons
|
||||
end
|
||||
end
|
||||
@script = Script.new
|
||||
if should_load_script
|
||||
@script.load(rsconscript)
|
||||
enable_variants
|
||||
end
|
||||
@script.load(rsconscript)
|
||||
enable_variants
|
||||
if show_tasks
|
||||
show_script_tasks(all_tasks)
|
||||
return 0
|
||||
end
|
||||
apply_task_params(false)
|
||||
apply_task_params(tasks_and_params)
|
||||
@task_execution_phase = true
|
||||
if tasks_and_params.empty?
|
||||
check_process_environments
|
||||
@ -172,8 +169,8 @@ module Rscons
|
||||
def distclean
|
||||
cache = Cache.instance
|
||||
clean
|
||||
cache.clear
|
||||
FileUtils.rm_rf(@build_dir)
|
||||
cache.clear
|
||||
end
|
||||
|
||||
# Check if the project needs to be configured.
|
||||
@ -182,7 +179,6 @@ module Rscons
|
||||
#
|
||||
# @return [void]
|
||||
def check_configure
|
||||
apply_task_params(true)
|
||||
enable_variants
|
||||
unless Cache.instance["configuration_data"]["configured"]
|
||||
if @script.autoconf
|
||||
@ -211,18 +207,15 @@ module Rscons
|
||||
#
|
||||
# @return [void]
|
||||
def configure
|
||||
unless @_configured
|
||||
@_configured = true
|
||||
co = ConfigureOp.new(@script)
|
||||
begin
|
||||
@script.configure(co)
|
||||
rescue RsconsError => e
|
||||
co.close(false)
|
||||
raise e
|
||||
end
|
||||
Cache.instance["configuration_data"]["enabled_variants"] = @enabled_variants
|
||||
co.close(true)
|
||||
co = ConfigureOp.new(@script)
|
||||
begin
|
||||
@script.configure(co)
|
||||
rescue RsconsError => e
|
||||
co.close(false)
|
||||
raise e
|
||||
end
|
||||
Cache.instance["configuration_data"]["enabled_variants"] = @enabled_variants
|
||||
co.close(true)
|
||||
end
|
||||
|
||||
# Remove installed files.
|
||||
@ -382,27 +375,18 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
def apply_task_params(only_configure)
|
||||
@tasks_and_params.each do |task_name, task_params|
|
||||
unless only_configure && task_name != "configure"
|
||||
task_params.each do |param_name, param_value|
|
||||
if param = Task[task_name].params[param_name]
|
||||
Task[task_name].set_param_value(param_name, param_value)
|
||||
else
|
||||
raise RsconsError.new("Unknown parameter #{param_name.inspect} for task #{task_name}")
|
||||
end
|
||||
def apply_task_params(tasks_and_params)
|
||||
tasks_and_params.each do |task_name, task_params|
|
||||
task_params.each do |param_name, param_value|
|
||||
if param = Task[task_name].params[param_name]
|
||||
Task[task_name].set_param_value(param_name, param_value)
|
||||
else
|
||||
raise RsconsError.new("Unknown parameter #{param_name.inspect} for task #{task_name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def should_load_script
|
||||
return true if @tasks_and_params.empty?
|
||||
return true if Cache.instance["configuration_data"]["configured"]
|
||||
return false if (@tasks_and_params.keys - %w[distclean clean uninstall]).empty?
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -101,7 +101,6 @@ module Rscons
|
||||
#
|
||||
# @return [void]
|
||||
def write
|
||||
return unless Dir.exist?(File.dirname(cache_file))
|
||||
@cache["version"] = VERSION
|
||||
File.open(cache_file, "w") do |fh|
|
||||
fh.puts(JSON.dump(@cache))
|
||||
|
@ -23,11 +23,14 @@ module Rscons
|
||||
$stdout.puts "Configuring project..."
|
||||
end
|
||||
end
|
||||
vars = {}
|
||||
Task["configure"].params.each do |name, param|
|
||||
unless Rscons.application.silent_configure
|
||||
Ansi.write($stdout, "Setting #{name}... ", :green, param.value, :reset, "\n")
|
||||
end
|
||||
vars[name] = param.value
|
||||
end
|
||||
store_merge(vars)
|
||||
end
|
||||
|
||||
# Close the log file handle.
|
||||
@ -62,7 +65,7 @@ module Rscons
|
||||
ccc = %w[gcc clang]
|
||||
end
|
||||
cc = ccc.find do |cc|
|
||||
test_c_compiler(cc, options)
|
||||
test_c_compiler(cc)
|
||||
end
|
||||
complete(cc ? 0 : 1, options.merge(success_message: cc))
|
||||
end
|
||||
@ -84,7 +87,7 @@ module Rscons
|
||||
ccc = %w[g++ clang++]
|
||||
end
|
||||
cc = ccc.find do |cc|
|
||||
test_cxx_compiler(cc, options)
|
||||
test_cxx_compiler(cc)
|
||||
end
|
||||
complete(cc ? 0 : 1, options.merge(success_message: cc))
|
||||
end
|
||||
@ -106,7 +109,7 @@ module Rscons
|
||||
cdc = %w[gdc ldc2]
|
||||
end
|
||||
dc = cdc.find do |dc|
|
||||
test_d_compiler(dc, options)
|
||||
test_d_compiler(dc)
|
||||
end
|
||||
complete(dc ? 0 : 1, options.merge(success_message: dc))
|
||||
end
|
||||
@ -412,7 +415,7 @@ module Rscons
|
||||
#
|
||||
# @return [Boolean]
|
||||
# Whether the C compiler tested successfully.
|
||||
def test_c_compiler(cc, options)
|
||||
def test_c_compiler(cc)
|
||||
File.open("#{@work_dir}/cfgtest.c", "wb") do |fh|
|
||||
fh.puts <<-EOF
|
||||
int fun(int val) {
|
||||
@ -424,7 +427,7 @@ module Rscons
|
||||
merge = {"CC" => cc}
|
||||
_, _, status = log_and_test_command(command)
|
||||
if status == 0
|
||||
store_merge(merge, options)
|
||||
store_merge(merge)
|
||||
true
|
||||
end
|
||||
end
|
||||
@ -436,7 +439,7 @@ module Rscons
|
||||
#
|
||||
# @return [Boolean]
|
||||
# Whether the C++ compiler tested successfully.
|
||||
def test_cxx_compiler(cc, options)
|
||||
def test_cxx_compiler(cc)
|
||||
File.open("#{@work_dir}/cfgtest.cxx", "wb") do |fh|
|
||||
fh.puts <<-EOF
|
||||
template<typename T>
|
||||
@ -449,7 +452,7 @@ module Rscons
|
||||
merge = {"CXX" => cc}
|
||||
_, _, status = log_and_test_command(command)
|
||||
if status == 0
|
||||
store_merge(merge, options)
|
||||
store_merge(merge)
|
||||
true
|
||||
end
|
||||
end
|
||||
@ -461,7 +464,7 @@ module Rscons
|
||||
#
|
||||
# @return [Boolean]
|
||||
# Whether the D compiler tested successfully.
|
||||
def test_d_compiler(dc, options)
|
||||
def test_d_compiler(dc)
|
||||
File.open("#{@work_dir}/cfgtest.d", "wb") do |fh|
|
||||
fh.puts <<-EOF
|
||||
import core.math;
|
||||
@ -490,7 +493,7 @@ module Rscons
|
||||
end
|
||||
_, _, status = log_and_test_command(command)
|
||||
if status == 0
|
||||
store_merge(merge, options)
|
||||
store_merge(merge)
|
||||
true
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Rscons
|
||||
# Project version.
|
||||
VERSION = "3.0.2"
|
||||
VERSION = "3.0.0"
|
||||
end
|
||||
|
@ -60,13 +60,7 @@ combined_file.each do |line|
|
||||
end
|
||||
end
|
||||
|
||||
license = File.read("LICENSE.txt").gsub(/^(.*?)$/) do |line|
|
||||
if line.size > 0
|
||||
"# #{line}"
|
||||
else
|
||||
"#"
|
||||
end
|
||||
end
|
||||
license = File.read("LICENSE.txt").gsub(/^/, "# ")
|
||||
|
||||
require "zlib"
|
||||
require "base64"
|
||||
|
@ -372,17 +372,6 @@ EOF
|
||||
expect(File.exists?('simple.c')).to be_truthy
|
||||
end
|
||||
|
||||
it "executes custom clean action blocks" do
|
||||
test_dir("simple")
|
||||
result = run_rscons(args: %w[-f clean.rb])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(File.exists?("build/e.1/simple.c.o")).to be_truthy
|
||||
result = run_rscons(args: %w[-f clean.rb clean])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.stdout).to match %r{custom clean action}
|
||||
expect(File.exists?("build/e.1/simple.c.o")).to be_falsey
|
||||
end
|
||||
|
||||
it "does not process environments" do
|
||||
test_dir("simple")
|
||||
result = run_rscons(args: %w[clean])
|
||||
@ -1836,51 +1825,6 @@ EOF
|
||||
expect(result.status).to_not eq 0
|
||||
end
|
||||
|
||||
it "only runs the configure operation once" do
|
||||
test_dir "configure"
|
||||
|
||||
result = run_rscons(args: %w[-f configure_with_top_level_env.rb configure])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to_not match %r{Configuring project.*Configuring project}m
|
||||
end
|
||||
|
||||
it "loads configure parameters before invoking configure" do
|
||||
test_dir "configure"
|
||||
|
||||
result = run_rscons(args: %w[-f configure_with_top_level_env.rb configure --prefix=/yodabob])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to match "Prefix is /yodabob"
|
||||
end
|
||||
|
||||
it "does not configure for distclean operation" do
|
||||
test_dir "configure"
|
||||
|
||||
result = run_rscons(args: %w[-f configure_with_top_level_env.rb distclean])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to_not match %r{Configuring project}
|
||||
end
|
||||
|
||||
it "does not configure for clean operation" do
|
||||
test_dir "configure"
|
||||
|
||||
result = run_rscons(args: %w[-f configure_with_top_level_env.rb clean])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to_not match %r{Configuring project}
|
||||
end
|
||||
|
||||
it "does not configure for uninstall operation" do
|
||||
test_dir "configure"
|
||||
|
||||
result = run_rscons(args: %w[-f configure_with_top_level_env.rb uninstall])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to_not match %r{Configuring project}
|
||||
end
|
||||
|
||||
it "automatically runs the configure task if the project is not yet configured in the given build directory" do
|
||||
test_dir "configure"
|
||||
|
||||
@ -1940,17 +1884,6 @@ EOF
|
||||
end
|
||||
end
|
||||
|
||||
it "respects use flag" do
|
||||
test_dir "configure"
|
||||
result = run_rscons(args: %w[-f check_c_compiler_use.rb -v])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to match %r{\bgcc .*/t1/}
|
||||
expect(result.stdout).to_not match %r{\bclang .*/t1/}
|
||||
expect(result.stdout).to match %r{\bclang .*/t2/}
|
||||
expect(result.stdout).to_not match %r{\bgcc .*/t2/}
|
||||
end
|
||||
|
||||
it "successfully tests a compiler with an unknown name" do
|
||||
test_dir "configure"
|
||||
create_exe "mycompiler", %[exec gcc "$@"]
|
||||
@ -1994,17 +1927,6 @@ EOF
|
||||
end
|
||||
end
|
||||
|
||||
it "respects use flag" do
|
||||
test_dir "configure"
|
||||
result = run_rscons(args: %w[-f check_cxx_compiler_use.rb -v])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to match %r{\bg\+\+ .*/t1/}
|
||||
expect(result.stdout).to_not match %r{\bclang\+\+ .*/t1/}
|
||||
expect(result.stdout).to match %r{\bclang\+\+ .*/t2/}
|
||||
expect(result.stdout).to_not match %r{\bg\+\+ .*/t2/}
|
||||
end
|
||||
|
||||
it "successfully tests a compiler with an unknown name" do
|
||||
test_dir "configure"
|
||||
create_exe "mycompiler", %[exec clang++ "$@"]
|
||||
@ -2050,17 +1972,6 @@ EOF
|
||||
end
|
||||
end
|
||||
|
||||
it "respects use flag" do
|
||||
test_dir "configure"
|
||||
result = run_rscons(args: %w[-f check_d_compiler_use.rb -v])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to match %r{\bgdc .*/t1/}
|
||||
expect(result.stdout).to_not match %r{\bldc2 .*/t1/}
|
||||
expect(result.stdout).to match %r{\bldc2 .*/t2/}
|
||||
expect(result.stdout).to_not match %r{\bgdc .*/t2/}
|
||||
end
|
||||
|
||||
unless RUBY_PLATFORM =~ /mingw|msys/
|
||||
it "successfully tests a compiler with an unknown name that uses gdc-compatible options" do
|
||||
test_dir "configure"
|
||||
|
Loading…
x
Reference in New Issue
Block a user