rscons 1.17.0 → 1.18.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 +4 -4
- data/lib/rscons/cache.rb +5 -11
- data/lib/rscons/environment.rb +23 -5
- data/lib/rscons/varset.rb +64 -29
- data/lib/rscons/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72aa6f2561702f7e37fa19cb19e7db7bf68b88e54767107b98f22b4e2afc452e
|
4
|
+
data.tar.gz: e2a52a29f3f98ed8135611de9014b126d1c3ef8bc5dc406999789a20f647c972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2d618e135d05c30020c34512b932e952fdb38fc824f424e355923c0cd5f588a8a4d4ce92b377a53929c5df500223cebd1b149242bb576cccd975b4e4b7b7271
|
7
|
+
data.tar.gz: 31ce3d2252e998bee8ca980116c8d6f2c14ad865bc5254a6588fbefcadc9ba44e9c99e16d73d76879f27a154a5b214e772f63c8c6ae7be0d78333d7e21a0e555
|
data/lib/rscons/cache.rb
CHANGED
@@ -85,17 +85,14 @@ module Rscons
|
|
85
85
|
@lookup_checksums = {}
|
86
86
|
end
|
87
87
|
|
88
|
-
# Write the cache to disk
|
88
|
+
# Write the cache to disk.
|
89
89
|
#
|
90
90
|
# @return [void]
|
91
91
|
def write
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
fh.puts(JSON.dump(@cache))
|
96
|
-
end
|
92
|
+
@cache["version"] = VERSION
|
93
|
+
File.open(CACHE_FILE, "w") do |fh|
|
94
|
+
fh.puts(JSON.dump(@cache))
|
97
95
|
end
|
98
|
-
@dirty = false
|
99
96
|
end
|
100
97
|
|
101
98
|
# Check if target(s) are up to date.
|
@@ -249,7 +246,6 @@ module Rscons
|
|
249
246
|
}
|
250
247
|
end,
|
251
248
|
}
|
252
|
-
@dirty = true
|
253
249
|
end
|
254
250
|
end
|
255
251
|
|
@@ -272,9 +268,8 @@ module Rscons
|
|
272
268
|
next if parts[i] == ""
|
273
269
|
subpath = File.join(*parts[0, i + 1])
|
274
270
|
unless File.exists?(subpath)
|
275
|
-
FileUtils.
|
271
|
+
FileUtils.mkdir_p(subpath)
|
276
272
|
@cache["directories"][subpath] = true
|
277
|
-
@dirty = true
|
278
273
|
end
|
279
274
|
end
|
280
275
|
end
|
@@ -315,7 +310,6 @@ module Rscons
|
|
315
310
|
@cache["targets"] ||= {}
|
316
311
|
@cache["directories"] ||= {}
|
317
312
|
@lookup_checksums = {}
|
318
|
-
@dirty = false
|
319
313
|
end
|
320
314
|
|
321
315
|
# Return a file's checksum, or the previously calculated checksum for
|
data/lib/rscons/environment.rb
CHANGED
@@ -280,6 +280,24 @@ module Rscons
|
|
280
280
|
@varset.send(:[], *args)
|
281
281
|
end
|
282
282
|
|
283
|
+
# Access the value of a construction variable.
|
284
|
+
#
|
285
|
+
# @since 1.18.0
|
286
|
+
#
|
287
|
+
# This method is similar to #[] but does not make a copy-on-access copy of
|
288
|
+
# the variable accessed. This means that the returned value is NOT safe to
|
289
|
+
# be modified by the caller. Thus the caller must guarantee that it does
|
290
|
+
# not modify the returned value.
|
291
|
+
#
|
292
|
+
# @param key [String, Symbol]
|
293
|
+
# The construction variable name.
|
294
|
+
#
|
295
|
+
# @return [Object]
|
296
|
+
# The construction variable's value.
|
297
|
+
def get_var(key)
|
298
|
+
@varset.get_var(key)
|
299
|
+
end
|
300
|
+
|
283
301
|
# Set a construction variable's value.
|
284
302
|
#
|
285
303
|
# @see VarSet#[]=
|
@@ -782,7 +800,7 @@ module Rscons
|
|
782
800
|
append["LDFLAGS", ["-arch", val]]
|
783
801
|
end
|
784
802
|
skip = true
|
785
|
-
elsif word =~ /^#{
|
803
|
+
elsif word =~ /^#{get_var("CPPDEFPREFIX")}(.*)$/
|
786
804
|
handle["CPPDEFINES", $1]
|
787
805
|
elsif word == "-include"
|
788
806
|
if val = words[i + 1]
|
@@ -795,11 +813,11 @@ module Rscons
|
|
795
813
|
append["LDFLAGS", ["-isysroot", val]]
|
796
814
|
end
|
797
815
|
skip = true
|
798
|
-
elsif word =~ /^#{
|
816
|
+
elsif word =~ /^#{get_var("INCPREFIX")}(.*)$/
|
799
817
|
handle["CPPPATH", $1]
|
800
|
-
elsif word =~ /^#{
|
818
|
+
elsif word =~ /^#{get_var("LIBLINKPREFIX")}(.*)$/
|
801
819
|
handle["LIBS", $1]
|
802
|
-
elsif word =~ /^#{
|
820
|
+
elsif word =~ /^#{get_var("LIBDIRPREFIX")}(.*)$/
|
803
821
|
handle["LIBPATH", $1]
|
804
822
|
elsif word == "-mno-cygwin"
|
805
823
|
append["CCFLAGS", [word]]
|
@@ -848,7 +866,7 @@ module Rscons
|
|
848
866
|
# @return [void]
|
849
867
|
def merge_flags(flags)
|
850
868
|
flags.each_pair do |key, val|
|
851
|
-
if self
|
869
|
+
if self.get_var(key).is_a?(Array) and val.is_a?(Array)
|
852
870
|
self[key] += val
|
853
871
|
else
|
854
872
|
self[key] = val
|
data/lib/rscons/varset.rb
CHANGED
@@ -11,11 +11,13 @@ module Rscons
|
|
11
11
|
append(vars)
|
12
12
|
end
|
13
13
|
|
14
|
-
# Access the value of variable.
|
14
|
+
# Access the value of a variable.
|
15
15
|
#
|
16
|
-
# @param key [String, Symbol]
|
16
|
+
# @param key [String, Symbol]
|
17
|
+
# The variable name.
|
17
18
|
#
|
18
|
-
# @return [Object]
|
19
|
+
# @return [Object]
|
20
|
+
# The variable's value.
|
19
21
|
def [](key)
|
20
22
|
if @my_vars.include?(key)
|
21
23
|
@my_vars[key]
|
@@ -30,11 +32,38 @@ module Rscons
|
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
35
|
+
# Access the value of a variable.
|
36
|
+
#
|
37
|
+
# This method is similar to #[] but does not make a copy-on-access copy of
|
38
|
+
# the variable accessed. This means that the returned value is NOT safe to
|
39
|
+
# be modified by the caller. Thus the caller must guarantee that it does
|
40
|
+
# not modify the returned value.
|
41
|
+
#
|
42
|
+
# @param key [String, Symbol]
|
43
|
+
# The variable name.
|
44
|
+
#
|
45
|
+
# @return [Object]
|
46
|
+
# The variable's value.
|
47
|
+
def get_var(key)
|
48
|
+
if @my_vars.include?(key)
|
49
|
+
@my_vars[key]
|
50
|
+
else
|
51
|
+
@coa_vars.each do |coa_vars|
|
52
|
+
if coa_vars.include?(key)
|
53
|
+
return coa_vars[key]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
nil
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
33
60
|
# Assign a value to a variable.
|
34
61
|
#
|
35
|
-
# @param key [String, Symbol]
|
62
|
+
# @param key [String, Symbol]
|
63
|
+
# The variable name.
|
36
64
|
#
|
37
|
-
# @param val [Object]
|
65
|
+
# @param val [Object]
|
66
|
+
# The value to set.
|
38
67
|
def []=(key, val)
|
39
68
|
@my_vars[key] = val
|
40
69
|
end
|
@@ -94,36 +123,42 @@ module Rscons
|
|
94
123
|
# @return [nil, String, Array, Symbol, TrueClass, FalseClass]
|
95
124
|
# Expanded value with "$!{var}" variable references replaced.
|
96
125
|
def expand_varref(varref, lambda_args)
|
97
|
-
|
126
|
+
case varref
|
127
|
+
when String
|
98
128
|
if varref =~ /^(.*)\$\{([^}]+)\}(.*)$/
|
99
129
|
prefix, varname, suffix = $1, $2, $3
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
130
|
+
prefix = expand_varref(prefix, lambda_args) unless prefix.empty?
|
131
|
+
varval = expand_varref(get_var(varname), lambda_args)
|
132
|
+
# suffix needs no expansion since the regex matches the last occurence
|
133
|
+
case varval
|
134
|
+
when Array
|
135
|
+
if prefix.is_a?(Array)
|
136
|
+
varval.map {|vv| prefix.map {|p| "#{p}#{vv}#{suffix}"}}.flatten
|
137
|
+
else
|
138
|
+
varval.map {|vv| "#{prefix}#{vv}#{suffix}"}
|
139
|
+
end
|
140
|
+
when String, Symbol, true, false, nil
|
141
|
+
if prefix.is_a?(Array)
|
142
|
+
prefix.map {|p| "#{p}#{varval}#{suffix}"}
|
143
|
+
else
|
144
|
+
"#{prefix}#{varval}#{suffix}"
|
145
|
+
end
|
105
146
|
else
|
106
|
-
raise "
|
147
|
+
raise "Unknown construction variable type: #{varval.class} (from #{varname.inspect} => #{get_var(varname).inspect})"
|
107
148
|
end
|
108
149
|
else
|
109
150
|
varref
|
110
151
|
end
|
111
|
-
|
152
|
+
when Array
|
112
153
|
varref.map do |ent|
|
113
154
|
expand_varref(ent, lambda_args)
|
114
155
|
end.flatten
|
115
|
-
|
116
|
-
expand_varref(varref[*lambda_args], lambda_args)
|
117
|
-
elsif varref.nil?
|
118
|
-
nil
|
119
|
-
elsif varref.is_a?(Symbol)
|
120
|
-
varref
|
121
|
-
elsif varref.is_a?(TrueClass)
|
122
|
-
varref
|
123
|
-
elsif varref.is_a?(FalseClass)
|
156
|
+
when Symbol, true, false, nil
|
124
157
|
varref
|
158
|
+
when Proc
|
159
|
+
expand_varref(varref[*lambda_args], lambda_args)
|
125
160
|
else
|
126
|
-
raise "Unknown
|
161
|
+
raise "Unknown construction variable type: #{varref.class} (#{varref.inspect})"
|
127
162
|
end
|
128
163
|
end
|
129
164
|
|
@@ -188,16 +223,16 @@ module Rscons
|
|
188
223
|
#
|
189
224
|
# @return [Object] Deep copied value.
|
190
225
|
def deep_dup(obj)
|
191
|
-
|
192
|
-
|
226
|
+
case obj
|
227
|
+
when String
|
228
|
+
obj.dup
|
229
|
+
when Array
|
230
|
+
obj.map { |v| deep_dup(v) }
|
231
|
+
when Hash
|
193
232
|
obj.reduce({}) do |result, (k, v)|
|
194
233
|
result[k] = deep_dup(v)
|
195
234
|
result
|
196
235
|
end
|
197
|
-
elsif obj_class == Array
|
198
|
-
obj.map { |v| deep_dup(v) }
|
199
|
-
elsif obj_class == String
|
200
|
-
obj.dup
|
201
236
|
else
|
202
237
|
obj
|
203
238
|
end
|
data/lib/rscons/version.rb
CHANGED
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
|
+
version: 1.18.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:
|
11
|
+
date: 2019-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -153,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
|
-
|
157
|
-
rubygems_version: 2.7.7
|
156
|
+
rubygems_version: 3.0.3
|
158
157
|
signing_key:
|
159
158
|
specification_version: 4
|
160
159
|
summary: Software construction library inspired by SCons and implemented in Ruby
|