rscons 1.18.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72aa6f2561702f7e37fa19cb19e7db7bf68b88e54767107b98f22b4e2afc452e
4
- data.tar.gz: e2a52a29f3f98ed8135611de9014b126d1c3ef8bc5dc406999789a20f647c972
3
+ metadata.gz: 8c7771e92dd77c04d253785e7c9a8d41afdf507d0e7d8a2e7276b9d3fa34b3c4
4
+ data.tar.gz: 7134613cd37d9b3d4c57e619f42658acbace9ce8cb2ad8d031597d5d00e3334e
5
5
  SHA512:
6
- metadata.gz: b2d618e135d05c30020c34512b932e952fdb38fc824f424e355923c0cd5f588a8a4d4ce92b377a53929c5df500223cebd1b149242bb576cccd975b4e4b7b7271
7
- data.tar.gz: 31ce3d2252e998bee8ca980116c8d6f2c14ad865bc5254a6588fbefcadc9ba44e9c99e16d73d76879f27a154a5b214e772f63c8c6ae7be0d78333d7e21a0e555
6
+ metadata.gz: 34b8ede6f30e98ffa18bc66c1efe2d374adafc7395487fa86f994f170fd86628813f7a4df66db594e0691ea91288345519ad3670d19c4b112b9681cc6c33e144
7
+ data.tar.gz: 4550902549425f79320a5c780d94a7e562a67b16894a9b42d223f91f2fafa50a9ee997d7254b092fd94931849f3c9b816358db96b765cce0700c469ae15592f6
@@ -5,6 +5,7 @@ require_relative "rscons/cache"
5
5
  require_relative "rscons/environment"
6
6
  require_relative "rscons/job_set"
7
7
  require_relative "rscons/threaded_command"
8
+ require_relative "rscons/util"
8
9
  require_relative "rscons/varset"
9
10
  require_relative "rscons/version"
10
11
 
@@ -282,6 +282,16 @@ module Rscons
282
282
  @cache["directories"].keys
283
283
  end
284
284
 
285
+ # Return a file's checksum, or the previously calculated checksum for
286
+ # the same file.
287
+ #
288
+ # @param file [String] The file name.
289
+ #
290
+ # @return [String] The file's checksum.
291
+ def lookup_checksum(file)
292
+ @lookup_checksums[file] || calculate_checksum(file)
293
+ end
294
+
285
295
  private
286
296
 
287
297
  # Return a String key based on the target name to use in the on-disk cache.
@@ -312,16 +322,6 @@ module Rscons
312
322
  @lookup_checksums = {}
313
323
  end
314
324
 
315
- # Return a file's checksum, or the previously calculated checksum for
316
- # the same file.
317
- #
318
- # @param file [String] The file name.
319
- #
320
- # @return [String] The file's checksum.
321
- def lookup_checksum(file)
322
- @lookup_checksums[file] || calculate_checksum(file)
323
- end
324
-
325
325
  # Calculate and return a file's checksum.
326
326
  #
327
327
  # @param file [String] The file name.
@@ -1,7 +1,6 @@
1
1
  require "fileutils"
2
2
  require "set"
3
3
  require "shellwords"
4
- require "thwait"
5
4
 
6
5
  module Rscons
7
6
  # The Environment class is the main programmatic interface to Rscons. It
@@ -341,6 +340,7 @@ module Rscons
341
340
  cache.clear_checksum_cache!
342
341
 
343
342
  if job
343
+ validate_user_deps(job[:target], @user_deps[job[:target]], cache)
344
344
  result = run_builder(job[:builder],
345
345
  job[:target],
346
346
  job[:sources],
@@ -1011,10 +1011,7 @@ module Rscons
1011
1011
  !thread.alive?
1012
1012
  end
1013
1013
  else
1014
- if threads.empty?
1015
- raise "No threads to wait for"
1016
- end
1017
- ThreadsWait.new(*threads).next_wait
1014
+ Util.wait_for_thread(*threads)
1018
1015
  end
1019
1016
  end
1020
1017
 
@@ -1107,5 +1104,25 @@ module Rscons
1107
1104
  end
1108
1105
  deps
1109
1106
  end
1107
+
1108
+ # Ensures that user dependencies exist with valid checksums in the
1109
+ # cache. Raises an exception if any dependency is invalid.
1110
+ #
1111
+ # @param target [String]
1112
+ # Target to be built
1113
+ # @param user_deps [Array<String>, nil]
1114
+ # User dependencies of the target
1115
+ # @param cache [Cache]
1116
+ # Rscons cache instance
1117
+ #
1118
+ # @return [void]
1119
+ def validate_user_deps(target, user_deps, cache)
1120
+ return if user_deps.nil?
1121
+ user_deps.each do |dep|
1122
+ if cache.lookup_checksum(dep) == ""
1123
+ raise "User dependency #{dep} of target #{target} is invalid"
1124
+ end
1125
+ end
1126
+ end
1110
1127
  end
1111
1128
  end
@@ -0,0 +1,34 @@
1
+ module Rscons
2
+ # A collection of stand-alone utility methods.
3
+ module Util
4
+ class << self
5
+
6
+ # Wait for any of a number of threads to complete.
7
+ #
8
+ # @param threads [Array<Thread>]
9
+ # Threads to wait for.
10
+ #
11
+ # @return [Thread]
12
+ # The Thread that completed.
13
+ def wait_for_thread(*threads)
14
+ if threads.empty?
15
+ raise "No threads to wait for"
16
+ end
17
+ queue = Queue.new
18
+ threads.each do |thread|
19
+ # Create a wait thread for each thread we're waiting for.
20
+ Thread.new do
21
+ begin
22
+ thread.join
23
+ ensure
24
+ queue.push(thread)
25
+ end
26
+ end
27
+ end
28
+ # Wait for any thread to complete.
29
+ queue.pop
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -1,4 +1,4 @@
1
1
  module Rscons
2
2
  # gem version
3
- VERSION = "1.18.0"
3
+ VERSION = "1.19.0"
4
4
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
 
23
23
  gem.add_development_dependency "rspec"
24
24
  gem.add_development_dependency "rake"
25
- gem.add_development_dependency "simplecov"
25
+ gem.add_development_dependency "simplecov", "~> 0.15.0"
26
26
  gem.add_development_dependency "yard"
27
27
  gem.add_development_dependency "rdoc"
28
28
  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.18.0
4
+ version: 1.19.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: 2019-10-10 00:00:00.000000000 Z
11
+ date: 2020-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -62,16 +62,16 @@ dependencies:
62
62
  name: simplecov
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: 0.15.0
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0'
74
+ version: 0.15.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: yard
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -131,6 +131,7 @@ files:
131
131
  - lib/rscons/environment.rb
132
132
  - lib/rscons/job_set.rb
133
133
  - lib/rscons/threaded_command.rb
134
+ - lib/rscons/util.rb
134
135
  - lib/rscons/varset.rb
135
136
  - lib/rscons/version.rb
136
137
  - rscons.gemspec
@@ -153,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  - !ruby/object:Gem::Version
154
155
  version: '0'
155
156
  requirements: []
156
- rubygems_version: 3.0.3
157
+ rubygems_version: 3.1.2
157
158
  signing_key:
158
159
  specification_version: 4
159
160
  summary: Software construction library inspired by SCons and implemented in Ruby