rscons 1.12.0 → 1.13.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: b20b9e60cf3744f02e69d2abfcc87453225b2085
4
- data.tar.gz: d491f89527d60984f9ded839f065a58b3d29b9fc
3
+ metadata.gz: 9bbed2cb9726801827e437d1ab661b47bb6da8b8
4
+ data.tar.gz: 49b1e6a941a5dcab901d33af55996279b0f7b2ce
5
5
  SHA512:
6
- metadata.gz: 58a410427a682e312203153d088aee392c74a68ddf50061896898327f43077fbf046310c25109bf3a6f5c192d03e79529e26175f32c8f1e23579d159c7633e71
7
- data.tar.gz: 6520c5177851e0b238398ba2321a26383b00ba9ba8b7b2468de54d5212730745ffbacfa1624cf1a0c878604caaeb5789f595c08ea73432512137ed43686de0ea
6
+ metadata.gz: 9f92bb8c57a8be8ccb18e9f50d5bd81488b7a4bf30cf5df663e577db61fb507f2dd239de54c881111c5fd17f3d4ca7acde3505f780b64fa5bce6dcf5585502d6
7
+ data.tar.gz: 84a151047302b7e0f67e6b1c0842597516cb4012061aab4005bbaa966eba0041753d5275c9b2cb6c22f057a6bcd9b8e391f3d07c8b38cc10987b89e00f3ec532
data/lib/rscons/ansi.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  module Rscons
2
+ # Module to contain logic to write ANSI color escape codes.
2
3
  module Ansi
3
4
  class << self
4
5
 
@@ -231,7 +231,7 @@ module Rscons
231
231
  # @param env [Environment] The Environment executing the builder.
232
232
  # @param cache [Cache] The Cache object.
233
233
  # @param options [Hash] Options.
234
- # @options options [String] :stdout
234
+ # @option options [String] :stdout
235
235
  # File name to redirect standard output to.
236
236
  #
237
237
  # @return [String,ThreadedCommand]
@@ -45,8 +45,9 @@ module Rscons
45
45
  def initialize(options = {})
46
46
  @threaded_commands = Set.new
47
47
  @registered_build_dependencies = {}
48
+ @side_effects = {}
48
49
  @varset = VarSet.new
49
- @job_set = JobSet.new(@registered_build_dependencies)
50
+ @job_set = JobSet.new(@registered_build_dependencies, @side_effects)
50
51
  @user_deps = {}
51
52
  @builders = {}
52
53
  @build_dirs = []
@@ -502,6 +503,26 @@ module Rscons
502
503
  end
503
504
  end
504
505
 
506
+ # Manually record the given side effect file(s) as being produced when the
507
+ # named target is produced.
508
+ #
509
+ # @since 1.13.0
510
+ #
511
+ # @param target [String]
512
+ # Target of a build operation.
513
+ # @param side_effects [Array<String>]
514
+ # File(s) produced when the target file is produced.
515
+ #
516
+ # @return [void]
517
+ def produces(target, *side_effects)
518
+ target = expand_path(expand_varref(target))
519
+ side_effects = Array(side_effects).map do |side_effect|
520
+ expand_path(expand_varref(side_effect))
521
+ end.flatten
522
+ @side_effects[target] ||= []
523
+ @side_effects[target] += side_effects
524
+ end
525
+
505
526
  # Return the list of user dependencies for a given target.
506
527
  #
507
528
  # @param target [String] Target file name.
@@ -9,9 +9,14 @@ module Rscons
9
9
  # @param build_dependencies [Hash]
10
10
  # Hash mapping targets to a set of build dependencies. A job will not be
11
11
  # returned as ready to run if any of its dependencies are still building.
12
- def initialize(build_dependencies)
12
+ # @param side_effects [Hash]
13
+ # Hash mapping targets to a set of side-effect files. A job will not be
14
+ # returned as ready to run if any of its dependencies is a side-effect
15
+ # of another target that has not yet been built.
16
+ def initialize(build_dependencies, side_effects)
13
17
  @jobs = {}
14
18
  @build_dependencies = build_dependencies
19
+ @side_effects = side_effects
15
20
  end
16
21
 
17
22
  # Add a job to the JobSet.
@@ -47,18 +52,16 @@ module Rscons
47
52
  # @return [nil, Hash]
48
53
  # The next job to run.
49
54
  def get_next_job_to_run(targets_still_building)
55
+ targets_not_built_yet = targets_still_building + @jobs.keys
56
+ side_effects = targets_not_built_yet.map do |target|
57
+ @side_effects[target] || []
58
+ end.flatten
59
+ targets_not_built_yet += side_effects
60
+
50
61
  @jobs.keys.each do |target|
51
62
  skip = false
52
63
  (@jobs[target][0][:sources] + (@build_dependencies[target] || []).to_a).each do |src|
53
- if @jobs.include?(src)
54
- # Skip this target because it depends on another target not yet
55
- # built.
56
- skip = true
57
- break
58
- end
59
- if targets_still_building.include?(src)
60
- # Skip this target because it depends on another target that is
61
- # currently being built.
64
+ if targets_not_built_yet.include?(src)
62
65
  skip = true
63
66
  break
64
67
  end
@@ -1,4 +1,4 @@
1
1
  module Rscons
2
2
  # gem version
3
- VERSION = "1.12.0"
3
+ VERSION = "1.13.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.12.0
4
+ version: 1.13.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-07-11 00:00:00.000000000 Z
11
+ date: 2017-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json