rscons 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +9 -0
- data/lib/rscons/environment.rb +27 -16
- data/lib/rscons/version.rb +1 -1
- data/spec/build_tests_spec.rb +26 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTA0YjY5YjRkMGY4Y2QxOGFjNzhlOTJjMmRjMzA5MjZiZjI2MTUzOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmJjM2ZmZjRkMGUwMTdjNjE3ZmFmNTI5NTVlYjFhNTg0YzNhMmNmNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2M3YjM1ZGI4ODEyNjI4M2E5YzhkNTU5NTI2MDFiMjE2MDY0ODRhNDI2YzM1
|
10
|
+
MTg1YmFlMTRkNWYyMjdjMzBiZTU2M2QzY2NjMDA2NzZlMDEwYmVhMGIxZjYy
|
11
|
+
NWY2YzAxNDQxMmFiZWNhNzk0MjZkODA4ZWEzMzMyZGNhMjFkMWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmEwNDAzZTc1ZDgyMjEzODJhOGQ4Njk2ZDlkY2ZkZDc2ZGU1ZDk0ZGU3MDgw
|
14
|
+
NjdmZjNkMmZmNmQzZjI5NmFlN2NmMDg0ZWU1ZjczYzQyNjZmYWMzN2ZhMTcz
|
15
|
+
NWRlYjcxZDc3NWY5ODYyYmFjMmFmMGMwNTE2MDNmNmNiNjMxYTA=
|
data/README.md
CHANGED
@@ -329,6 +329,15 @@ http://rubydoc.info/github/holtrop/rscons/frames.
|
|
329
329
|
|
330
330
|
## Release Notes
|
331
331
|
|
332
|
+
### v1.4.2
|
333
|
+
|
334
|
+
- add Environment#expand_path
|
335
|
+
- expand construction variable references in builder targets and sources before invoking builder
|
336
|
+
|
337
|
+
### v1.4.1
|
338
|
+
|
339
|
+
- fix invoking a builder with no sources while a build root defined
|
340
|
+
|
332
341
|
### v1.4.0
|
333
342
|
|
334
343
|
- add CFile builder
|
data/lib/rscons/environment.rb
CHANGED
@@ -172,7 +172,7 @@ module Rscons
|
|
172
172
|
# called after the block returns.
|
173
173
|
def process
|
174
174
|
unless @targets.empty?
|
175
|
-
|
175
|
+
expand_paths!
|
176
176
|
cache = Cache.instance
|
177
177
|
cache.clear_checksum_cache!
|
178
178
|
targets_processed = {}
|
@@ -337,24 +337,35 @@ module Rscons
|
|
337
337
|
builder.run(target, sources, cache, self, vars)
|
338
338
|
end
|
339
339
|
|
340
|
-
|
340
|
+
# Expand a path to be relative to the Environment's build root.
|
341
|
+
#
|
342
|
+
# Paths beginning with "^/" are expanded by replacing "^" with the
|
343
|
+
# Environment's build root.
|
344
|
+
#
|
345
|
+
# @param path [String] The path to expand.
|
346
|
+
#
|
347
|
+
# @return [String] The expanded path.
|
348
|
+
def expand_path(path)
|
349
|
+
path.sub(%r{^\^(?=[\\/])}, @build_root)
|
350
|
+
end
|
341
351
|
|
342
|
-
|
343
|
-
# Environment's build root, if present
|
344
|
-
def clean_target_paths!
|
345
|
-
if @build_root
|
346
|
-
expand = lambda do |path|
|
347
|
-
path.sub(%r{^\^(?=[\\/])}, @build_root)
|
348
|
-
end
|
352
|
+
private
|
349
353
|
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
354
|
+
# Expand target and source paths before invoking builders.
|
355
|
+
#
|
356
|
+
# This method expand construction variable references in the target and
|
357
|
+
# source file names before passing them to the builder. It also expands
|
358
|
+
# "^/" prefixes to the Environment's build root if a build root is defined.
|
359
|
+
def expand_paths!
|
360
|
+
@targets = @targets.reduce({}) do |result, (target, target_params)|
|
361
|
+
sources = target_params[:sources].map do |source|
|
362
|
+
source = expand_path(source) if @build_root
|
363
|
+
expand_varref(source)
|
356
364
|
end
|
357
|
-
|
365
|
+
target = expand_path(target) if @build_root
|
366
|
+
target = expand_varref(target)
|
367
|
+
result[target] = target_params.merge(sources: sources)
|
368
|
+
result
|
358
369
|
end
|
359
370
|
end
|
360
371
|
|
data/lib/rscons/version.rb
CHANGED
data/spec/build_tests_spec.rb
CHANGED
@@ -498,4 +498,30 @@ EOF
|
|
498
498
|
env.TestBuilder("file")
|
499
499
|
end
|
500
500
|
end
|
501
|
+
|
502
|
+
it "expands construction variables in builder target and sources before invoking the builder" do
|
503
|
+
test_dir('custom_builder')
|
504
|
+
class MySource < Rscons::Builder
|
505
|
+
def run(target, sources, cache, env, vars)
|
506
|
+
File.open(target, 'w') do |fh|
|
507
|
+
fh.puts <<EOF
|
508
|
+
#define THE_VALUE 678
|
509
|
+
EOF
|
510
|
+
end
|
511
|
+
target
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
Rscons::Environment.new do |env|
|
516
|
+
env["hdr"] = "inc.h"
|
517
|
+
env["src"] = "program.c"
|
518
|
+
env.add_builder(MySource.new)
|
519
|
+
env.MySource('${hdr}')
|
520
|
+
env.Program('program', "${src}")
|
521
|
+
end
|
522
|
+
|
523
|
+
lines.should == ['CC program.o', 'LD program']
|
524
|
+
File.exists?('inc.h').should be_true
|
525
|
+
`./program`.should == "The value is 678\n"
|
526
|
+
end
|
501
527
|
end
|
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.
|
4
|
+
version: 1.4.2
|
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-
|
11
|
+
date: 2014-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|