remove a few deprecated methods - #84

This commit is contained in:
josh committed 2019-01-04 13:55:00 -05:00
1 parent 31ef45258f
commit 12f1909d35
8 files changed
+16 -202

No files matched your search

-30
View File
@@ -1,30 +0,0 @@
class MyObject < Rscons::Builder
def produces?(target, source, env)
target.end_with?(".o") and source.end_with?(".xyz")
end
def run(target, sources, cache, env, vars)
cflags = env.expand_varref("${CFLAGS}", vars)
vars = vars.merge(
"CFLAGS" => cflags + %w[-x c],
"CSUFFIX" => ".xyz")
env.run_builder(env.builders["Object"], target, sources, cache, vars)
end
end
build do
Environment.new do |env|
env.add_builder(MyObject.new)
File.open("test.xyz", "w") do |fh|
fh.puts <<EOF
#include <stdio.h>
int main(int argc, char * argv[])
{
printf("XYZ!\\n");
return 0;
}
EOF
env.Program("test", "test.xyz")
end
end
end
-24
View File
@@ -1,24 +0,0 @@
class MyProgram < Rscons::Builder
def run(options)
target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
objects = env.build_sources(sources, [".o"], cache, vars)
command = %W[gcc -o #{target}] + objects
return false unless env.execute("#{name} #{target}", command)
target
end
end
build do
Environment.new do |env|
env.add_builder(MyProgram.new)
env.Object("simple.o", "simple.c")
File.open("two.c", "wb") do |fh|
fh.puts <<-EOF
void two(void)
{
}
EOF
end
env.MyProgram("simple.exe", ["simple.o", "two.c"])
end
end
+8 -5
View File
@@ -16,12 +16,15 @@ class DebugBuilder < Rscons::Builder
sources = ["extra"] + sources
strict_deps = true
end
unless cache.up_to_date?(target, command, sources, env, debug: true, strict_deps: strict_deps)
desc = "#{name} #{target}"
return false unless env.execute(desc, command)
cache.register_build(target, command, sources, env)
if cache.up_to_date?(target, command, sources, env, debug: true, strict_deps: strict_deps)
target
else
ThreadedCommand.new(command, short_description: "#{name} #{target}")
end
target
end
def finalize(options)
standard_finalize(options)
end
end
-19
View File
@@ -1,19 +0,0 @@
build do
class MyCommand < Rscons::Builder
def run(target, sources, cache, env, vars)
vars = vars.merge({
"_TARGET" => target,
"_SOURCES" => sources,
})
command = env.build_command("${CMD}", vars)
cmd_desc = vars["CMD_DESC"] || "MyCommand"
standard_build("#{cmd_desc} #{target}", target, command, sources, env, cache)
end
end
Environment.new do |env|
env.add_builder(MyCommand.new)
command = %w[gcc -c -o ${_TARGET} ${_SOURCES}]
env.MyCommand("simple.o", "simple.c", "CMD" => command)
end
end
+8 -4
View File
@@ -2,11 +2,15 @@ class StrictBuilder < Rscons::Builder
def run(options)
target, sources, cache, env = options.values_at(:target, :sources, :cache, :env)
command = %W[gcc -o #{target}] + sources.sort
unless cache.up_to_date?(target, command, sources, env, strict_deps: true)
return false unless env.execute("StrictBuilder #{target}", command)
cache.register_build(target, command, sources, env)
if cache.up_to_date?(target, command, sources, env, strict_deps: true)
target
else
ThreadedCommand.new(command, short_description: "#{name} #{target}")
end
target
end
def finalize(options)
standard_finalize(options)
end
end