ninja-gen 0.1.3.0 → 0.1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ninja.rb +7 -6
- data/lib/ninja/file.rb +14 -2
- data/lib/ninja/response_file.rb +13 -0
- data/lib/ninja/rule.rb +10 -3
- data/lib/ninja/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 627c18801e65b03fef493fb1989cef2c9f918b64
|
4
|
+
data.tar.gz: 9e86bc2dc4cf11ed1417b01cb2fada3eb811bea2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 235cb05524107b5292eb688191f0ea2db88487cebeba5e8aebfa141e23e9fb8d4f637618ce919792ae4f94cbee143fb9b74328eb84cb0cd3f684c48bd5c5f51b
|
7
|
+
data.tar.gz: aaa20a4d06618b2e1599e53f6dfda832f1541cc7ad090a0fb2f3ccfd09d3a254afa934046f8a17fdce3e09ad163eac46e8412e9a3f64fbac8b7ca33c4ed390fb
|
data/lib/ninja.rb
CHANGED
@@ -11,10 +11,11 @@
|
|
11
11
|
# ===----------------------------------------------------------------------=== #
|
12
12
|
|
13
13
|
module Ninja
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
require_relative 'ninja/version'
|
15
|
+
require_relative 'ninja/delegator'
|
16
|
+
require_relative 'ninja/variable'
|
17
|
+
require_relative 'ninja/response_file'
|
18
|
+
require_relative 'ninja/rule'
|
19
|
+
require_relative 'ninja/build'
|
20
|
+
require_relative 'ninja/file'
|
20
21
|
end
|
data/lib/ninja/file.rb
CHANGED
@@ -14,9 +14,16 @@ module Ninja
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def rule(name, command, opts={})
|
17
|
+
additional = {}
|
18
|
+
|
19
|
+
if opts[:response_file]
|
20
|
+
additional[:response_file] = Ninja::ResponseFile.new("$out.rsp", opts[:response_file])
|
21
|
+
end
|
22
|
+
|
17
23
|
@rules.push(Ninja::Rule.new(:name => name,
|
18
24
|
:command => command,
|
19
|
-
:dependencies => opts[:dependencies]
|
25
|
+
:dependencies => opts[:dependencies],
|
26
|
+
**additional))
|
20
27
|
end
|
21
28
|
|
22
29
|
def build(rule, outputs_to_inputs={})
|
@@ -65,7 +72,12 @@ module Ninja
|
|
65
72
|
f.write " depfile = #{rule.dependencies}\n"
|
66
73
|
end
|
67
74
|
end
|
68
|
-
f.write " command = #{rule.command}\n
|
75
|
+
f.write " command = #{rule.command}\n"
|
76
|
+
if rule.response_file
|
77
|
+
f.write " rspfile = #{rule.response_file.name}\n"
|
78
|
+
f.write " rspfile_content = #{rule.response_file.contents}\n"
|
79
|
+
end
|
80
|
+
f.write "\n"
|
69
81
|
end
|
70
82
|
|
71
83
|
@builds.each do |build|
|
data/lib/ninja/rule.rb
CHANGED
@@ -2,7 +2,8 @@ module Ninja
|
|
2
2
|
class Rule
|
3
3
|
attr_reader :name,
|
4
4
|
:command,
|
5
|
-
:dependencies
|
5
|
+
:dependencies,
|
6
|
+
:response_file
|
6
7
|
|
7
8
|
def initialize(desc={})
|
8
9
|
Description.validate!(desc)
|
@@ -10,6 +11,7 @@ module Ninja
|
|
10
11
|
@name = desc[:name]
|
11
12
|
@command = desc[:command]
|
12
13
|
@dependencies = desc[:dependencies]
|
14
|
+
@response_file = desc[:response_file]
|
13
15
|
end
|
14
16
|
|
15
17
|
module Description #:nodoc:
|
@@ -19,8 +21,9 @@ module Ninja
|
|
19
21
|
raise "Expected name to be a string composed of [a-Z,0-9,-,_] characters." unless /\A([-\w]+?)+\z/.match(desc[:name])
|
20
22
|
|
21
23
|
raise "Command not specified." unless desc.include?(:command)
|
22
|
-
|
23
|
-
raise "
|
24
|
+
# TODO(mtwilliams): Check response file.
|
25
|
+
# raise "Input not used by the command." unless desc[:command].include? '$in'
|
26
|
+
# raise "Output not used by the command." unless desc[:command].include? '$out'
|
24
27
|
|
25
28
|
if desc[:dependencies]
|
26
29
|
if desc[:dependencies].is_a?(String)
|
@@ -30,6 +33,10 @@ module Ninja
|
|
30
33
|
raise "Expected dependencies to be name or auto-detection method."
|
31
34
|
end
|
32
35
|
end
|
36
|
+
|
37
|
+
if desc[:response_file]
|
38
|
+
raise "Expected a `Ninja::Responsefile`." unless desc[:response_file].is_a?(ResponseFile)
|
39
|
+
end
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|
data/lib/ninja/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ninja-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/ninja/build.rb
|
69
69
|
- lib/ninja/delegator.rb
|
70
70
|
- lib/ninja/file.rb
|
71
|
+
- lib/ninja/response_file.rb
|
71
72
|
- lib/ninja/rule.rb
|
72
73
|
- lib/ninja/variable.rb
|
73
74
|
- lib/ninja/version.rb
|
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
93
|
version: '0'
|
93
94
|
requirements: []
|
94
95
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.6.8
|
96
97
|
signing_key:
|
97
98
|
specification_version: 4
|
98
99
|
summary: Generate Ninja build files.
|