rscons 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +4 -0
- data/lib/rscons/builders/library.rb +1 -1
- data/lib/rscons/builders/object.rb +1 -1
- data/lib/rscons/builders/program.rb +1 -1
- data/lib/rscons/environment.rb +43 -13
- data/lib/rscons/version.rb +1 -1
- data/spec/build_tests_spec.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWUxZmFhZjYxM2JhN2QzNTE0OWVkODEwMGQxMGFlZjQ4OTRkMmExMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWQzNjAxMzBmZDI3ZDVjMzlkMTBiZGQ0YjU1YjllZTcyY2NlOTkxOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDI2MGJiMjY1ZGM3YmQ2NjlhNGI5MThhNGM5MWU0MWEyZDI1MmI1NjY4MDAz
|
10
|
+
NjViZmYwZTcxNzBlZWM0NmNjODk3MjhjNWQyZWJiZmUxNzc1ZjZmNWUxYjk5
|
11
|
+
MDUyNWI1ZWFlYzVmMWZkYmY3YmJmYjlhZGI4MTk3MjU0MmFiYzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjQzN2I1MjU5ZjEwNTM3MjliZGUzNzA1ODczYTk5NWNjN2ViMThlOTg0ZjM3
|
14
|
+
MjczNmEyZWY4MDQ4M2M1YjUxZDFkM2JhNTI5MDA1NzY3MmE4MDU0ZDQ5Mzlm
|
15
|
+
MDkxZjMzMThlODFlNjI0NTBjMjhhOGE2NjliOTc5NmIzOTZjYmQ=
|
data/README.md
CHANGED
@@ -243,6 +243,10 @@ http://rubydoc.info/github/holtrop/rscons/frames.
|
|
243
243
|
|
244
244
|
## Release Notes
|
245
245
|
|
246
|
+
### v1.2.0
|
247
|
+
- add :clone option to Environment#clone to control exactly which Environment attributes are cloned
|
248
|
+
- allow nil to be passed in to Environment#build_root=
|
249
|
+
|
246
250
|
### v1.1.0
|
247
251
|
|
248
252
|
- Change Cache#up_to_date?() and #register_build() to accept a single target
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Rscons
|
2
2
|
module Builders
|
3
|
-
# A default
|
3
|
+
# A default Rscons builder that knows how to link object files into an
|
4
4
|
# executable program.
|
5
5
|
class Rscons::Builders::Program < Rscons::Builder
|
6
6
|
def default_variables(env)
|
data/lib/rscons/environment.rb
CHANGED
@@ -2,7 +2,7 @@ require 'set'
|
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
4
|
module Rscons
|
5
|
-
# The Environment class is the main programmatic interface to
|
5
|
+
# The Environment class is the main programmatic interface to Rscons. It
|
6
6
|
# contains a collection of construction variables, options, builders, and
|
7
7
|
# rules for building targets.
|
8
8
|
class Environment
|
@@ -15,7 +15,8 @@ module Rscons
|
|
15
15
|
# String or +nil+
|
16
16
|
attr_reader :build_root
|
17
17
|
def build_root=(build_root)
|
18
|
-
@build_root = build_root
|
18
|
+
@build_root = build_root
|
19
|
+
@build_root.gsub!('\\', '/') if @build_root
|
19
20
|
end
|
20
21
|
|
21
22
|
# Create an Environment object.
|
@@ -50,24 +51,53 @@ module Rscons
|
|
50
51
|
end
|
51
52
|
|
52
53
|
# Make a copy of the Environment object.
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# hooks, build directories, or the build root.
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
54
|
+
#
|
55
|
+
# By default, a cloned environment will contain a copy of all environment
|
56
|
+
# options, construction variables, and builders, but not a copy of the
|
57
|
+
# targets, build hooks, build directories, or the build root.
|
58
|
+
#
|
59
|
+
# Exactly which items are cloned are controllable via the optional :clone
|
60
|
+
# parameter, which can be :none, :all, or a set or array of any of the
|
61
|
+
# following:
|
62
|
+
# - :variables to clone construction variables (on by default)
|
63
|
+
# - :builders to clone the builders (on by default)
|
64
|
+
# - :build_root to clone the build root (off by default)
|
65
|
+
# - :build_dirs to clone the build directories (off by default)
|
66
|
+
# - :build_hooks to clone the build hooks (off by default)
|
67
|
+
#
|
68
|
+
# If a block is given, the Environment object is yielded to the block and
|
69
|
+
# when the block returns, the {#process} method is automatically called.
|
70
|
+
#
|
71
|
+
# Any options that #initialize receives can also be specified here.
|
72
|
+
#
|
73
|
+
# @return a new {Environment} object.
|
60
74
|
def clone(options = {})
|
75
|
+
clone = options[:clone] || Set[:variables, :builders]
|
76
|
+
clone = Set[:variables, :builders, :build_root, :build_dirs, :build_hooks] if clone == :all
|
77
|
+
clone = Set[] if clone == :none
|
78
|
+
clone = Set.new(clone) if clone.is_a?(Array)
|
79
|
+
clone.delete(:builders) if options[:exclude_builders]
|
61
80
|
env = self.class.new(
|
62
81
|
echo: options[:echo] || @echo,
|
63
82
|
build_root: options[:build_root],
|
64
83
|
exclude_builders: true)
|
65
|
-
|
84
|
+
if clone.include?(:builders)
|
66
85
|
@builders.each do |builder_name, builder|
|
67
86
|
env.add_builder(builder)
|
68
87
|
end
|
69
88
|
end
|
70
|
-
env.append(@varset.clone)
|
89
|
+
env.append(@varset.clone) if clone.include?(:variables)
|
90
|
+
env.build_root = @build_root if clone.include?(:build_root)
|
91
|
+
if clone.include?(:build_dirs)
|
92
|
+
@build_dirs.each do |src_dir, obj_dir|
|
93
|
+
env.build_dir(src_dir, obj_dir)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
if clone.include?(:build_hooks)
|
97
|
+
@build_hooks.each do |build_hook_block|
|
98
|
+
env.add_build_hook(&build_hook_block)
|
99
|
+
end
|
100
|
+
end
|
71
101
|
|
72
102
|
if block_given?
|
73
103
|
yield env
|
@@ -246,7 +276,7 @@ module Rscons
|
|
246
276
|
|
247
277
|
# Build a list of source files into files containing one of the suffixes
|
248
278
|
# given by suffixes.
|
249
|
-
# This method is used internally by
|
279
|
+
# This method is used internally by Rscons builders.
|
250
280
|
# @param sources [Array] List of source files to build.
|
251
281
|
# @param suffixes [Array] List of suffixes to try to convert source files into.
|
252
282
|
# @param cache [Cache] The Cache.
|
@@ -294,7 +324,7 @@ module Rscons
|
|
294
324
|
end
|
295
325
|
|
296
326
|
# Parse dependencies for a given target from a Makefile.
|
297
|
-
# This method is used internally by
|
327
|
+
# This method is used internally by Rscons builders.
|
298
328
|
# @param mf_fname [String] File name of the Makefile to read.
|
299
329
|
# @param target [String] Name of the target to gather dependencies for.
|
300
330
|
def self.parse_makefile_deps(mf_fname, target)
|
data/lib/rscons/version.rb
CHANGED
data/spec/build_tests_spec.rb
CHANGED
@@ -298,6 +298,29 @@ EOF
|
|
298
298
|
]
|
299
299
|
end
|
300
300
|
|
301
|
+
it 'allows cloning all attributes of an Environment object' do
|
302
|
+
test_dir('clone_env')
|
303
|
+
|
304
|
+
env1 = Rscons::Environment.new(echo: :command) do |env|
|
305
|
+
env.build_dir('src', 'build')
|
306
|
+
env['CFLAGS'] = '-O2'
|
307
|
+
env.add_build_hook do |build_op|
|
308
|
+
build_op[:vars]['CPPFLAGS'] = '-DSTRING="Hello"'
|
309
|
+
end
|
310
|
+
env.Program('program', Dir['src/*.c'])
|
311
|
+
end
|
312
|
+
|
313
|
+
env2 = env1.clone(clone: :all) do |env|
|
314
|
+
env.Program('program2', Dir['src/*.c'])
|
315
|
+
end
|
316
|
+
|
317
|
+
lines.should == [
|
318
|
+
%q{gcc -c -o build/program.o -MMD -MF build/program.mf -DSTRING="Hello" -O2 src/program.c},
|
319
|
+
%q{gcc -o program build/program.o},
|
320
|
+
%q{gcc -o program2 build/program.o},
|
321
|
+
]
|
322
|
+
end
|
323
|
+
|
301
324
|
it 'builds a C++ program with one source file' do
|
302
325
|
test_dir('simple_cc')
|
303
326
|
Rscons::Environment.new do |env|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rscons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Holtrop
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|