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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba95bc9eff377b4dc0bba2506fadb29b5ff3cd1e
4
- data.tar.gz: ff27cc3a73ad564143b9f20bf164bb975e268f7e
3
+ metadata.gz: 627c18801e65b03fef493fb1989cef2c9f918b64
4
+ data.tar.gz: 9e86bc2dc4cf11ed1417b01cb2fada3eb811bea2
5
5
  SHA512:
6
- metadata.gz: bd426a121b8b5a811c727f7d1969104d43c0939fbd3d54f62741c64fa5f46b84f0613d493d5b6190c4868713c0115ede110ff47020b4adbc2e099ce9a5561e9f
7
- data.tar.gz: 35f9ef819cffed3b5f1e843f4d265759b647a555cb7b53b2c7a7a8570087154b4dda053a937440e7e23fa143379bc764c8e2eb407e1a2b3716bbca36eaba3580
6
+ metadata.gz: 235cb05524107b5292eb688191f0ea2db88487cebeba5e8aebfa141e23e9fb8d4f637618ce919792ae4f94cbee143fb9b74328eb84cb0cd3f684c48bd5c5f51b
7
+ data.tar.gz: aaa20a4d06618b2e1599e53f6dfda832f1541cc7ad090a0fb2f3ccfd09d3a254afa934046f8a17fdce3e09ad163eac46e8412e9a3f64fbac8b7ca33c4ed390fb
@@ -11,10 +11,11 @@
11
11
  # ===----------------------------------------------------------------------=== #
12
12
 
13
13
  module Ninja
14
- require 'ninja/version'
15
- require 'ninja/delegator'
16
- require 'ninja/variable'
17
- require 'ninja/rule'
18
- require 'ninja/build'
19
- require 'ninja/file'
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
@@ -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\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|
@@ -0,0 +1,13 @@
1
+ module Ninja
2
+ class ResponseFile
3
+ attr_reader :name,
4
+ :contents
5
+
6
+ def initialize(name, contents)
7
+ raise "Name not specified." unless name
8
+
9
+ @name = name
10
+ @contents = contents
11
+ end
12
+ end
13
+ end
@@ -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
- raise "Input not used by the command." unless desc[:command].include? '$in'
23
- raise "Output not used by the command." unless desc[:command].include? '$out'
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
@@ -1,6 +1,6 @@
1
1
  module Ninja
2
2
  module VERSION #:nodoc:
3
- MAJOR, MINOR, PATCH, PRE = [0, 1, 3, 0]
3
+ MAJOR, MINOR, PATCH, PRE = [0, 1, 4, 0]
4
4
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
5
5
  end
6
6
 
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.3.0
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: 2016-03-09 00:00:00.000000000 Z
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.4.5
96
+ rubygems_version: 2.6.8
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: Generate Ninja build files.