move default builder classes into Rscons::Builders namespace module

This commit is contained in:
josh committed 2013-12-31 13:31:17 -05:00
1 parent cdb3352b4e
commit 5362f761e6
7 files changed
+18 -9

No files matched your search

+3 -3
View File
@@ -14,9 +14,9 @@ require "rscons/builders/program"
# Namespace module for rscons classes
module Rscons
DEFAULT_BUILDERS = [
Library,
Object,
Program,
:Library,
:Object,
:Program,
]
class BuildError < RuntimeError; end
+3
View File
@@ -1,6 +1,9 @@
require "fileutils"
module Rscons
# Namespace module in which to store builders for convenient grouping
module Builders; end
# Class to hold an object that knows how to build a certain type of file.
class Builder
# Return the name of the builder.
+3 -3
View File
@@ -1,8 +1,7 @@
require 'fileutils'
module Rscons
module Builders
# A default RScons builder that produces a static library archive.
class Library < Builder
class Rscons::Builders::Library < Rscons::Builder
def default_variables(env)
{
'AR' => 'ar',
@@ -25,4 +24,5 @@ module Rscons
end
end
end
end
end
+2
View File
@@ -1,4 +1,5 @@
module Rscons
module Builders
# A default RScons builder which knows how to produce an object file from
# various types of source files.
class Object < Builder
@@ -76,4 +77,5 @@ module Rscons
target
end
end
end
end
+3 -1
View File
@@ -1,7 +1,8 @@
module Rscons
module Builders
# A default RScons builder that knows how to link object files into an
# executable program.
class Program < Builder
class Rscons::Builders::Program < Rscons::Builder
def default_variables(env)
{
'LD' => nil,
@@ -36,4 +37,5 @@ module Rscons
standard_build("LD #{target}", target, command, objects, env, cache)
end
end
end
end
+3 -1
View File
@@ -34,7 +34,9 @@ module Rscons
@build_dirs = []
@build_hooks = []
unless options[:exclude_builders]
DEFAULT_BUILDERS.each do |builder_class|
DEFAULT_BUILDERS.each do |builder_class_name|
builder_class = Builders.const_get(builder_class_name)
builder_class or raise "Could not find builder class #{builder_class_name}"
add_builder(builder_class.new)
end
end
+1 -1
View File
@@ -48,7 +48,7 @@ module Rscons
it "adds the builder to the list of builders" do
env = Environment.new(exclude_builders: true)
env.builders.keys.should == []
env.add_builder(Rscons::Object.new)
env.add_builder(Rscons::Builders::Object.new)
env.builders.keys.should == ["Object"]
end
end