Compare commits

...
8 Commits
Author SHA1 Message Date
josh b970490de2 v1.19.0 2020-04-16 16:36:44 -04:00
josh 87f1b92e7a update CHANGELOG for v1.19.0 2020-04-16 16:36:16 -04:00
josh a65247db0c fix yard warning 2020-04-16 16:21:06 -04:00
josh b6f0e61052 ruby 2.7 compatibility - #117 2020-04-16 16:12:30 -04:00
josh 93c5561190 stick with simplecov 0.15.x for now 2020-04-16 16:06:18 -04:00
josh 355a8383d0 Revert "update simplecov"
This reverts commit 01ca86de8b.
2020-04-16 16:04:18 -04:00
josh 64a7e56ee1 update bundle 2020-04-16 16:02:44 -04:00
John Lindgren 24ed649982 Check that user dependencies exist before running builders.
IMHO it's more intuitive if env.depends("my-target", "invalid-dep")
causes the build to fail when "invalid-dep" does not exist, rather
than having no effect (i.e. the build still succeeds with no warning).

This will make it more obvious, earlier, if you made a mistake in
an env.depends() call.  Otherwise the mistake could sit latent for
a while until you happen to notice that a build used a out-of-date
copy of some file rather than rebuilding it.

I've only added the check for user dependencies, not for direct
sources.  Listing a source file that doesn't exist will probably
cause the builder to fail anyway, so I don't think the preliminary
check is needed in that case.
2020-03-03 17:32:52 -05:00
10 changed files with 100 additions and 37 deletions

No files matched your search

+10
View File
@@ -1,5 +1,15 @@
## ChangeLog
### v1.19.0
#### New Features
- #117 - ruby 2.7 compatibility
#### Fixes
- #115 - Check that user dependencies exist before running builders.
### v1.18.0
#### Performance Improvements
+14 -14
View File
@@ -1,36 +1,36 @@
PATH
remote: .
specs:
rscons (1.18.0)
rscons (1.19.0)
json (>= 1.8, < 3.0)
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.3)
docile (1.3.2)
json (2.2.0)
rake (13.0.0)
rdoc (6.2.0)
docile (1.1.5)
json (2.3.0)
rake (13.0.1)
rdoc (6.2.1)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.0)
rspec-support (~> 3.9.0)
rspec-expectations (3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)
simplecov (0.17.1)
docile (~> 1.1)
rspec-support (3.9.2)
simplecov (0.15.1)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
yard (0.9.20)
yard (0.9.24)
PLATFORMS
ruby
@@ -41,8 +41,8 @@ DEPENDENCIES
rdoc
rscons!
rspec
simplecov
simplecov (~> 0.15.0)
yard
BUNDLED WITH
1.17.3
2.1.4
+1
View File
@@ -0,0 +1 @@
# This file is referenced by cache_debugging.rb
+1
View File
@@ -5,6 +5,7 @@ require_relative "rscons/cache"
require_relative "rscons/environment"
require_relative "rscons/job_set"
require_relative "rscons/threaded_command"
require_relative "rscons/util"
require_relative "rscons/varset"
require_relative "rscons/version"
+10 -10
View File
@@ -282,6 +282,16 @@ module Rscons
@cache["directories"].keys
end
# Return a file's checksum, or the previously calculated checksum for
# the same file.
#
# @param file [String] The file name.
#
# @return [String] The file's checksum.
def lookup_checksum(file)
@lookup_checksums[file] || calculate_checksum(file)
end
private
# Return a String key based on the target name to use in the on-disk cache.
@@ -312,16 +322,6 @@ module Rscons
@lookup_checksums = {}
end
# Return a file's checksum, or the previously calculated checksum for
# the same file.
#
# @param file [String] The file name.
#
# @return [String] The file's checksum.
def lookup_checksum(file)
@lookup_checksums[file] || calculate_checksum(file)
end
# Calculate and return a file's checksum.
#
# @param file [String] The file name.
+22 -5
View File
@@ -1,7 +1,6 @@
require "fileutils"
require "set"
require "shellwords"
require "thwait"
module Rscons
# The Environment class is the main programmatic interface to Rscons. It
@@ -341,6 +340,7 @@ module Rscons
cache.clear_checksum_cache!
if job
validate_user_deps(job[:target], @user_deps[job[:target]], cache)
result = run_builder(job[:builder],
job[:target],
job[:sources],
@@ -1011,10 +1011,7 @@ module Rscons
!thread.alive?
end
else
if threads.empty?
raise "No threads to wait for"
end
ThreadsWait.new(*threads).next_wait
Util.wait_for_thread(*threads)
end
end
@@ -1107,5 +1104,25 @@ module Rscons
end
deps
end
# Ensures that user dependencies exist with valid checksums in the
# cache. Raises an exception if any dependency is invalid.
#
# @param target [String]
# Target to be built
# @param user_deps [Array<String>, nil]
# User dependencies of the target
# @param cache [Cache]
# Rscons cache instance
#
# @return [void]
def validate_user_deps(target, user_deps, cache)
return if user_deps.nil?
user_deps.each do |dep|
if cache.lookup_checksum(dep) == ""
raise "User dependency #{dep} of target #{target} is invalid"
end
end
end
end
end
+34
View File
@@ -0,0 +1,34 @@
module Rscons
# A collection of stand-alone utility methods.
module Util
class << self
# Wait for any of a number of threads to complete.
#
# @param threads [Array<Thread>]
# Threads to wait for.
#
# @return [Thread]
# The Thread that completed.
def wait_for_thread(*threads)
if threads.empty?
raise "No threads to wait for"
end
queue = Queue.new
threads.each do |thread|
# Create a wait thread for each thread we're waiting for.
Thread.new do
begin
thread.join
ensure
queue.push(thread)
end
end
end
# Wait for any thread to complete.
queue.pop
end
end
end
end
+1 -1
View File
@@ -1,4 +1,4 @@
module Rscons
# gem version
VERSION = "1.18.0"
VERSION = "1.19.0"
end
+1 -1
View File
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "rspec"
gem.add_development_dependency "rake"
gem.add_development_dependency "simplecov"
gem.add_development_dependency "simplecov", "~> 0.15.0"
gem.add_development_dependency "yard"
gem.add_development_dependency "rdoc"
end
+6 -6
View File
@@ -97,7 +97,7 @@ ENV["TERM"] = nil
EOF
end
stdout, stderr, status = nil, nil, nil
Bundler.with_clean_env do
Bundler.with_unbundled_env do
stdout, stderr, status = Open3.capture3(*command)
end
# Remove output lines generated as a result of the test environment
@@ -417,14 +417,14 @@ EOF
expect(result.stderr).to eq ""
expect(lines(result.stdout)).to eq(["LD simple.exe"])
File.unlink("program.ld")
result = run_test(rsconsfile: "user_dependencies.rb")
expect(result.stderr).to eq ""
expect(lines(result.stdout)).to eq ["LD simple.exe"]
result = run_test(rsconsfile: "user_dependencies.rb")
expect(result.stderr).to eq ""
expect(result.stdout).to eq ""
File.unlink("program.ld")
result = run_test(rsconsfile: "user_dependencies.rb")
expect(result.stderr).to match /User dependency program\.ld of target simple\.exe is invalid/
expect(result.status).to_not eq 0
end
unless ENV["omit_gdc_tests"]