bake 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +23 -1
- data/CONCEPTS +2 -2
- data/TUTORIAL +14 -8
- data/lib/bake.rb +18 -6
- data/lib/bake/configuration.rb +16 -44
- data/lib/bake/context.rb +41 -9
- data/lib/bake/extensions.rb +3 -0
- data/lib/bake/extensions/class.rb +11 -0
- data/lib/bake/extensions/object.rb +22 -0
- data/lib/bake/{string_utils.rb → extensions/string.rb} +0 -1
- data/lib/bake/file_target.rb +8 -3
- data/lib/bake/plugin.rb +13 -36
- data/lib/bake/plugins/cpp.rb +111 -45
- data/lib/bake/plugins/cpp/darwin.rb +3 -4
- data/lib/bake/plugins/cpp/gcc.rb +5 -0
- data/lib/bake/plugins/cpp/gcc_toolset_base.rb +11 -28
- data/lib/bake/plugins/cpp/msvc.rb +10 -16
- data/lib/bake/plugins/cpp/qt.rb +29 -26
- data/lib/bake/plugins/cpp/toolset_base.rb +28 -70
- data/lib/bake/plugins/runner.rb +40 -0
- data/lib/bake/plugins/system.rb +6 -22
- data/lib/bake/project.rb +60 -19
- data/lib/bake/project_loader.rb +13 -4
- data/lib/bake/system_utils.rb +42 -0
- data/lib/bake/target.rb +100 -23
- data/lib/bake/toolset.rb +8 -1
- data/lib/bake_version.rb +1 -1
- data/test/test_bake.rb +2 -0
- data/test/test_configuration.rb +58 -0
- metadata +11 -8
- data/test/bake_test.rb +0 -5
- data/test/configuration_test.rb +0 -102
- data/test/context_test.rb +0 -94
- data/test/scheme_test.rb +0 -121
- data/test/target_test.rb +0 -93
data/test/scheme_test.rb
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
$: << File.dirname(__FILE__) + '/../lib'
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'bake/toolset'
|
5
|
-
require 'bake/target'
|
6
|
-
require 'bake/scheme'
|
7
|
-
|
8
|
-
module GoodScheme
|
9
|
-
class Tool1 < Bake::Toolset
|
10
|
-
end
|
11
|
-
|
12
|
-
class Tool2 < Bake::Toolset
|
13
|
-
end
|
14
|
-
|
15
|
-
class Target1 < Bake::Target
|
16
|
-
ACCESSORS = :target1
|
17
|
-
|
18
|
-
def some_target1_meth
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class Target2 < Bake::Target
|
23
|
-
ACCESSORS = [ :target2_first, :target2_second ]
|
24
|
-
end
|
25
|
-
|
26
|
-
class Target3 < Bake::Target
|
27
|
-
attr_reader :some_value
|
28
|
-
|
29
|
-
def initialize(parent, value)
|
30
|
-
super(parent)
|
31
|
-
@some_value = value
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
module SomeModule
|
37
|
-
module NestedScheme
|
38
|
-
class Tool < Bake::Toolset
|
39
|
-
end
|
40
|
-
|
41
|
-
class Target < Bake::Target
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
module NoTargetsScheme
|
47
|
-
class TestToolset < Bake::Toolset
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
module NoToolsetsScheme
|
52
|
-
class TestTarget < Bake::Toolset
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class SchemeTest < Test::Unit::TestCase
|
57
|
-
def setup
|
58
|
-
@good_scheme = Bake::Scheme.new(GoodScheme)
|
59
|
-
@nested_scheme = Bake::Scheme.new(SomeModule::NestedScheme)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_init
|
63
|
-
assert_equal('good_scheme', @good_scheme.name)
|
64
|
-
assert_equal(2, @good_scheme.toolsets.size)
|
65
|
-
assert_equal(3, @good_scheme.targets.size)
|
66
|
-
assert_nil(@good_scheme.toolset)
|
67
|
-
|
68
|
-
assert_equal('some_module/nested_scheme', @nested_scheme.name)
|
69
|
-
assert_equal(1, @nested_scheme.toolsets.size)
|
70
|
-
assert_equal(1, @nested_scheme.toolsets.size)
|
71
|
-
assert_nil(@nested_scheme.toolset)
|
72
|
-
|
73
|
-
assert_raise(RuntimeError) { Bake::Scheme.new(NoTargetsScheme) }
|
74
|
-
assert_raise(RuntimeError) { Bake::Scheme.new(NoToolsetsScheme) }
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_toolset
|
78
|
-
assert_raise(RuntimeError) { @good_scheme.toolset = :tool3 }
|
79
|
-
assert_raise(RuntimeError) do
|
80
|
-
@good_scheme.toolset = SomeModule::NestedScheme::Tool.new
|
81
|
-
end
|
82
|
-
assert_nil(@good_scheme.toolset)
|
83
|
-
|
84
|
-
@good_scheme.toolset = :tool1
|
85
|
-
assert_instance_of(GoodScheme::Tool1, @good_scheme.toolset)
|
86
|
-
@good_scheme.toolset = GoodScheme::Tool2.new
|
87
|
-
assert_instance_of(GoodScheme::Tool2, @good_scheme.toolset)
|
88
|
-
|
89
|
-
@nested_scheme.toolset = :tool
|
90
|
-
assert_instance_of(SomeModule::NestedScheme::Tool,
|
91
|
-
@nested_scheme.toolset)
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_constructors
|
95
|
-
assert(@good_scheme.has_constructor?(:target1))
|
96
|
-
assert(@good_scheme.has_constructor?(:target2_first))
|
97
|
-
assert(@good_scheme.has_constructor?(:target2_second))
|
98
|
-
assert(!@good_scheme.has_constructor?(:random))
|
99
|
-
assert(!@nested_scheme.has_constructor?(:anything))
|
100
|
-
|
101
|
-
assert_raise(RuntimeError) { @good_scheme.construct(:invalid) }
|
102
|
-
assert_raise(RuntimeError) do
|
103
|
-
@good_scheme.construct(SomeModule::NestedScheme::Tool)
|
104
|
-
end
|
105
|
-
|
106
|
-
root = @good_scheme.construct(:target1, nil)
|
107
|
-
assert_instance_of(GoodScheme::Target1, root)
|
108
|
-
branch1 = @good_scheme.construct(:target2_first, root)
|
109
|
-
assert_instance_of(GoodScheme::Target2, branch1)
|
110
|
-
branch1a = @nested_scheme.construct(
|
111
|
-
SomeModule::NestedScheme::Target, branch1)
|
112
|
-
assert_instance_of(SomeModule::NestedScheme::Target, branch1a)
|
113
|
-
assert_same(branch1, branch1a.parent)
|
114
|
-
assert_same(root, branch1.parent)
|
115
|
-
|
116
|
-
branch1b = @good_scheme.construct(GoodScheme::Target3, branch1, 'yeap')
|
117
|
-
assert_instance_of(GoodScheme::Target3, branch1b)
|
118
|
-
assert_equal('yeap', branch1b.some_value)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
data/test/target_test.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
$: << File.dirname(__FILE__) + '/../lib'
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'bake/target'
|
5
|
-
|
6
|
-
class SimpleProjectLoader
|
7
|
-
def load_project(path, from_proj)
|
8
|
-
path = path.split('/')
|
9
|
-
proj = from_proj
|
10
|
-
path.each do |subdir|
|
11
|
-
next if subdir == '.'
|
12
|
-
proj = proj.child(subdir)
|
13
|
-
raise "invalid child #{subdir}" if !proj
|
14
|
-
end
|
15
|
-
return proj
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class TargetTest < Test::Unit::TestCase
|
20
|
-
def setup
|
21
|
-
@loader = SimpleProjectLoader.new
|
22
|
-
|
23
|
-
@target = Bake::Target.new(nil)
|
24
|
-
@parent = Bake::Project.new(nil)
|
25
|
-
@parent.name 'parent'
|
26
|
-
@parent.loader = @loader
|
27
|
-
@child1 = Bake::Target.new(@parent)
|
28
|
-
@child1.name 'child1'
|
29
|
-
@child2 = Bake::Target.new(@parent)
|
30
|
-
@child2.name 'child2'
|
31
|
-
@child2a = Bake::Project.new(@child2)
|
32
|
-
@child2a.name 'child2a'
|
33
|
-
@child2a.loader = @loader
|
34
|
-
@child2b = Bake::Target.new(@child2)
|
35
|
-
@child2b.name 'child2b'
|
36
|
-
@child2c = Bake::Target.new(@child2)
|
37
|
-
@child2c.name 'child2c'
|
38
|
-
@child2ai = Bake::Target.new(@child2a)
|
39
|
-
@child2aii = Bake::Target.new(@child2a)
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_initialize
|
43
|
-
assert_nil(@target.parent)
|
44
|
-
assert_equal(0, @target.children.size)
|
45
|
-
|
46
|
-
assert_nil(@parent.parent)
|
47
|
-
assert_equal(2, @parent.children.size)
|
48
|
-
assert_same(@child1.parent, @child2.parent)
|
49
|
-
assert_equal(0, @child1.children.size)
|
50
|
-
assert_equal(3, @child2.children.size)
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_name
|
54
|
-
assert_nil(@target.name)
|
55
|
-
assert_equal('oh no', @target.name('oh no'))
|
56
|
-
assert_equal('oh no', @target.name)
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_child
|
60
|
-
assert_same(@child1, @parent.child('child1'))
|
61
|
-
assert_same(@child2c, @child2.child('child2c'))
|
62
|
-
assert_nil(@child1.child('anything'))
|
63
|
-
assert_nil(@parent.child('child2a'))
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_project
|
67
|
-
assert_same(@parent, @child1.project)
|
68
|
-
assert_same(@parent, @child2.project)
|
69
|
-
assert_same(@parent, @child2a.project)
|
70
|
-
assert_same(@parent, @child2b.project)
|
71
|
-
assert_nil(@parent.project)
|
72
|
-
assert_same(@child2a, @child2ai.project)
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_dep
|
76
|
-
assert(@child2aii.deps.empty?)
|
77
|
-
assert_raise(RuntimeError) { @child2aii.dep('child1') }
|
78
|
-
@parent.map('child1' => '.')
|
79
|
-
@child2aii.dep('child1')
|
80
|
-
assert_equal(1, @child2aii.deps.size)
|
81
|
-
assert_same(@child1, @child2aii.deps[0])
|
82
|
-
|
83
|
-
@child1.dep('child2')
|
84
|
-
assert_equal(1, @child1.deps.size)
|
85
|
-
assert_same(@child2, @child1.deps[0])
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_map
|
89
|
-
@parent.map('child1' => '.')
|
90
|
-
assert_same(@child1, @parent.mapping('child1'))
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|