rscons 1.10.0 → 1.11.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ceb5baf09b2d108fcb231a024434805e133d3fa
4
- data.tar.gz: c38980efedd1fca10de580afa672a8fe5ad444cd
3
+ metadata.gz: e1071a4e53bdabc660529e3ed77a04fd63478055
4
+ data.tar.gz: 772db7e7f90b80976d30f1523a296b2df2bec98b
5
5
  SHA512:
6
- metadata.gz: f58839f1655e17599d94cc7e694cda950c61ed224520fa9a1b38e3c9d5171b9b978571f5554f8c73854557a9c714f3de98b274204a073ac91f07da734a73c60c
7
- data.tar.gz: 858a9dbdb7d95ec61e24eac775a22532c55a2482bf1df57420bd18b31b034893c52210f1e436d1f5ca16940f2da9df99c9e455872c8dedc6dbb6fb6a0ff69cde
6
+ metadata.gz: 07ab3b0b3ad7f31684c0dd6d930e3228403aeba2083c20657ed5fc3b60521962156bdd31d787c5bdc2e2427fe120526bc4398d2f1535584b887eaa1efdd4d6b2
7
+ data.tar.gz: 5ee4e79134a58409a2855fc6e6da3b44e29e33f0d85a5a4827ed192ec1367d768cbce44641bae9cb452fed3f3207ec77cd82f1d6ed89cf122d67cbe6f11ca02e
@@ -24,11 +24,11 @@ module Rscons
24
24
  'SHCCFLAGS' => ['${CCFLAGS}'] + pic_flags,
25
25
 
26
26
  'SHCC' => '${CC}',
27
- 'SHCFLAGS' => [],
27
+ 'SHCFLAGS' => ['${CFLAGS}'],
28
28
  'SHCCCMD' => ['${SHCC}', '-c', '-o', '${_TARGET}', '${CCDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${SHCFLAGS}', '${SHCCFLAGS}', '${_SOURCES}'],
29
29
 
30
30
  'SHCXX' => '${CXX}',
31
- 'SHCXXFLAGS' => [],
31
+ 'SHCXXFLAGS' => ['${CXXFLAGS}'],
32
32
  'SHCXXCMD' => ['${SHCXX}', '-c', '-o', '${_TARGET}', '${CXXDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${SHCXXFLAGS}', '${SHCCFLAGS}', '${_SOURCES}'],
33
33
 
34
34
  'SHDC' => 'gdc',
@@ -17,6 +17,11 @@ module Rscons
17
17
  # @return [String] The build root.
18
18
  attr_reader :build_root
19
19
 
20
+ # @return [Integer]
21
+ # The number of threads to use for this Environment. If nil (the
22
+ # default), the global Rscons.n_threads default value will be used.
23
+ attr_writer :n_threads
24
+
20
25
  # Set the build root.
21
26
  #
22
27
  # @param build_root [String] The build root.
@@ -73,9 +78,9 @@ module Rscons
73
78
  # following:
74
79
  # - :variables to clone construction variables (on by default)
75
80
  # - :builders to clone the builders (on by default)
76
- # - :build_root to clone the build root (off by default)
77
- # - :build_dirs to clone the build directories (off by default)
78
- # - :build_hooks to clone the build hooks (off by default)
81
+ # - :build_root to clone the build root (on by default)
82
+ # - :build_dirs to clone the build directories (on by default)
83
+ # - :build_hooks to clone the build hooks (on by default)
79
84
  #
80
85
  # If a block is given, the Environment object is yielded to the block and
81
86
  # when the block returns, the {#process} method is automatically called.
@@ -84,7 +89,7 @@ module Rscons
84
89
  #
85
90
  # @return [Environment] The newly created {Environment} object.
86
91
  def clone(options = {})
87
- clone = options[:clone] || Set[:variables, :builders]
92
+ clone = options[:clone] || :all
88
93
  clone = Set[:variables, :builders, :build_root, :build_dirs, :build_hooks] if clone == :all
89
94
  clone = Set[] if clone == :none
90
95
  clone = Set.new(clone) if clone.is_a?(Array)
@@ -101,7 +106,7 @@ module Rscons
101
106
  env.append(@varset) if clone.include?(:variables)
102
107
  env.build_root = @build_root if clone.include?(:build_root)
103
108
  if clone.include?(:build_dirs)
104
- @build_dirs.each do |src_dir, obj_dir|
109
+ @build_dirs.reverse.each do |src_dir, obj_dir|
105
110
  env.build_dir(src_dir, obj_dir)
106
111
  end
107
112
  end
@@ -222,7 +227,7 @@ module Rscons
222
227
  if src_dir.is_a?(String)
223
228
  src_dir = src_dir.gsub("\\", "/").sub(%r{/*$}, "")
224
229
  end
225
- @build_dirs << [src_dir, obj_dir]
230
+ @build_dirs.unshift([src_dir, obj_dir])
226
231
  end
227
232
 
228
233
  # Return the file name to be built from +source_fname+ with suffix
@@ -330,7 +335,8 @@ module Rscons
330
335
  end
331
336
 
332
337
  # If needed, do a blocking wait.
333
- if (completed_tcs.empty? and job.nil?) or @threaded_commands.size >= Rscons.n_threads
338
+ if (@threaded_commands.size > 0) and
339
+ ((completed_tcs.empty? and job.nil?) or (@threaded_commands.size >= n_threads))
334
340
  completed_tcs << wait_for_threaded_commands
335
341
  end
336
342
 
@@ -476,8 +482,10 @@ module Rscons
476
482
  targets = Array(targets)
477
483
  prerequisites = Array(prerequisites)
478
484
  targets.each do |target|
485
+ target = expand_path(expand_varref(target))
479
486
  @registered_build_dependencies[target] ||= Set.new
480
487
  prerequisites.each do |prerequisite|
488
+ prerequisite = expand_path(expand_varref(prerequisite))
481
489
  @registered_build_dependencies[target] << prerequisite
482
490
  end
483
491
  end
@@ -825,6 +833,15 @@ module Rscons
825
833
  end
826
834
  end
827
835
 
836
+ # Get the number of threads to use for parallelized builds in this
837
+ # Environment.
838
+ #
839
+ # @return [Integer]
840
+ # Number of threads to use for parallelized builds in this Environment.
841
+ def n_threads
842
+ @n_threads || Rscons.n_threads
843
+ end
844
+
828
845
  private
829
846
 
830
847
  # Add a build target.
@@ -47,12 +47,18 @@ module Rscons
47
47
  # @return [nil, Hash]
48
48
  # The next job to run.
49
49
  def get_next_job_to_run(targets_still_building)
50
+ targets_skipped = Set.new
50
51
  @jobs.keys.each do |target|
51
52
  skip = false
52
53
  (@jobs[target][0][:sources] + (@build_dependencies[target] || []).to_a).each do |src|
53
54
  if @jobs.include?(src)
55
+ if targets_skipped.include?(src) or (src == target)
56
+ # We have encountered a circular dependency.
57
+ raise "Circular build dependency for #{src}"
58
+ end
54
59
  # Skip this target because it depends on another target later in
55
60
  # the job set.
61
+ targets_skipped << target
56
62
  skip = true
57
63
  break
58
64
  end
@@ -1,4 +1,4 @@
1
1
  module Rscons
2
2
  # gem version
3
- VERSION = "1.10.0"
3
+ VERSION = "1.11.0"
4
4
  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.10.0
4
+ version: 1.11.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: 2017-06-10 00:00:00.000000000 Z
11
+ date: 2017-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json