build-tool 0.5.7 → 0.6.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/.gitignore +1 -0
  2. data/.rvmrc +1 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +5 -0
  5. data/Gemfile.lock +56 -0
  6. data/History.txt +64 -0
  7. data/README.txt +0 -7
  8. data/Rakefile +8 -56
  9. data/bin/build-tool +4 -1
  10. data/build-tool.gemspec +62 -0
  11. data/db/migrations/20110703074000_add_command_logs.rb +17 -0
  12. data/db/migrations/20110703075000_add_module_logs.rb +20 -0
  13. data/db/migrations/20110815170000_add_features.rb +17 -0
  14. data/db/migrations/20120103204700_add_modules.rb +17 -0
  15. data/db/migrations/20120106181200_add_settings.rb +18 -0
  16. data/lib/build-tool.rb +3 -4
  17. data/lib/build-tool/application.rb +127 -37
  18. data/lib/build-tool/build-system/autoconf.rb +2 -8
  19. data/lib/build-tool/build-system/base.rb +12 -4
  20. data/lib/build-tool/build-system/cmake.rb +2 -0
  21. data/lib/build-tool/build-system/custom.rb +2 -0
  22. data/lib/build-tool/build-system/kdel10n.rb +2 -0
  23. data/lib/build-tool/build-system/make.rb +2 -0
  24. data/lib/build-tool/build-system/none.rb +2 -0
  25. data/lib/build-tool/build-system/qmake.rb +2 -0
  26. data/lib/build-tool/build-system/qt.rb +4 -0
  27. data/lib/build-tool/cfg/lexer.rex +40 -8
  28. data/lib/build-tool/cfg/lexer_base.rb +3 -1
  29. data/lib/build-tool/cfg/node.rb +17 -1
  30. data/lib/build-tool/cfg/parser.y +92 -10
  31. data/lib/build-tool/cfg/visitor.rb +202 -78
  32. data/lib/build-tool/command_actions.rb +26 -10
  33. data/lib/build-tool/commands.rb +289 -197
  34. data/lib/build-tool/commands/build.rb +13 -9
  35. data/lib/build-tool/commands/configuration.rb +25 -0
  36. data/lib/build-tool/commands/configuration/edit.rb +42 -0
  37. data/lib/build-tool/commands/configuration/list.rb +48 -0
  38. data/lib/build-tool/commands/configure.rb +9 -5
  39. data/lib/build-tool/commands/ctags.rb +8 -3
  40. data/lib/build-tool/commands/environments.rb +2 -4
  41. data/lib/build-tool/commands/environments/list.rb +13 -10
  42. data/lib/build-tool/commands/environments/set.rb +5 -1
  43. data/lib/build-tool/commands/features.rb +24 -0
  44. data/lib/build-tool/commands/features/disable.rb +70 -0
  45. data/lib/build-tool/commands/features/enable.rb +66 -0
  46. data/lib/build-tool/commands/features/list.rb +92 -0
  47. data/lib/build-tool/commands/fetch.rb +9 -3
  48. data/lib/build-tool/commands/files.rb +9 -5
  49. data/lib/build-tool/commands/gc.rb +48 -15
  50. data/lib/build-tool/commands/history.rb +21 -16
  51. data/lib/build-tool/commands/info.rb +16 -13
  52. data/lib/build-tool/commands/install.rb +8 -4
  53. data/lib/build-tool/commands/modules.rb +2 -4
  54. data/lib/build-tool/commands/modules/cleanup.rb +52 -0
  55. data/lib/build-tool/commands/modules/disable.rb +95 -0
  56. data/lib/build-tool/commands/modules/enable.rb +52 -0
  57. data/lib/build-tool/commands/modules/info.rb +44 -35
  58. data/lib/build-tool/commands/modules/list.rb +67 -15
  59. data/lib/build-tool/commands/modules/shell.rb +8 -2
  60. data/lib/build-tool/commands/rebase.rb +15 -7
  61. data/lib/build-tool/commands/recipes.rb +2 -4
  62. data/lib/build-tool/commands/recipes/add.rb +16 -2
  63. data/lib/build-tool/commands/recipes/edit.rb +72 -0
  64. data/lib/build-tool/commands/recipes/incoming.rb +11 -7
  65. data/lib/build-tool/commands/recipes/info.rb +12 -8
  66. data/lib/build-tool/commands/recipes/install.rb +37 -42
  67. data/lib/build-tool/commands/recipes/list.rb +6 -2
  68. data/lib/build-tool/configuration.rb +88 -3
  69. data/lib/build-tool/environment.rb +2 -0
  70. data/lib/build-tool/errors.rb +5 -0
  71. data/lib/build-tool/history.rb +3 -181
  72. data/lib/build-tool/model/command_log.rb +93 -0
  73. data/lib/build-tool/model/feature.rb +80 -0
  74. data/lib/build-tool/{module.rb → model/module.rb} +110 -29
  75. data/lib/build-tool/model/module_log.rb +64 -0
  76. data/lib/build-tool/model/setting.rb +84 -0
  77. data/lib/build-tool/recipe.rb +40 -18
  78. data/lib/build-tool/repository.rb +39 -33
  79. data/lib/build-tool/server.rb +27 -3
  80. data/lib/build-tool/singleton.rb +2 -0
  81. data/lib/build-tool/sshkey.rb +2 -0
  82. data/lib/build-tool/state_helper.rb +64 -0
  83. data/lib/build-tool/vcs/archive.rb +3 -1
  84. data/lib/build-tool/vcs/base.rb +13 -0
  85. data/lib/build-tool/vcs/git-svn.rb +36 -14
  86. data/lib/build-tool/vcs/git.rb +180 -44
  87. data/lib/build-tool/vcs/mercurial.rb +25 -13
  88. data/lib/build-tool/vcs/svn.rb +20 -15
  89. data/lib/build-tool/version.rb +30 -0
  90. data/lib/mj/error.rb +2 -0
  91. data/lib/mj/logging.rb +2 -0
  92. data/lib/mj/mixins/inherited_attributes.rb +73 -0
  93. data/lib/mj/tools/editor.rb +34 -0
  94. data/lib/mj/tools/ssh.rb +2 -0
  95. data/lib/mj/tools/subprocess.rb +2 -1
  96. data/lib/mj/vcs/git.rb +14 -2
  97. data/lib/mj/visitor.rb +22 -0
  98. data/tasks/db.rake +36 -0
  99. data/tasks/racc.rake +14 -0
  100. data/tasks/rdoc.rake +8 -0
  101. data/tasks/rexical.rake +14 -0
  102. data/tasks/test.rake +21 -0
  103. data/test/integration/history_test.rb +88 -0
  104. data/test/integration/parser_configuration.rb +36 -0
  105. data/test/integration/parser_environment_parser.rb +156 -0
  106. data/test/integration/parser_feature_test.rb +75 -0
  107. data/test/integration/parser_git-svn_test.rb +92 -0
  108. data/test/integration/parser_git_test.rb +97 -0
  109. data/test/integration/parser_mercurial_test.rb +77 -0
  110. data/test/integration/parser_module_test.rb +103 -0
  111. data/test/integration/parser_svn_test.rb +92 -0
  112. data/test/integration/parser_test.rb +73 -0
  113. data/test/test_helper.rb +61 -0
  114. data/test/unit/configuration_test.rb +36 -0
  115. data/test/unit/git_configuration_test.rb +163 -0
  116. data/test/unit/git_svn_configuration_test.rb +240 -0
  117. data/test/unit/mercurial_configuration_test.rb +64 -0
  118. data/test/unit/model/command_log_test.rb +103 -0
  119. data/test/unit/model/feature_test.rb +29 -0
  120. data/test/unit/model/module_log_test.rb +70 -0
  121. data/test/unit/model/module_test.rb +32 -0
  122. data/test/unit/repository_test.rb +110 -0
  123. data/test/unit/server_test.rb +66 -0
  124. data/test/unit/svn_configuration_test.rb +90 -0
  125. metadata +134 -93
  126. data/Manifest.txt +0 -80
  127. data/db/migrations/001_command_histories.rb +0 -20
  128. data/db/migrations/002_module_events.rb +0 -24
  129. data/db/migrations/003_command_histories_add_logfile.rb +0 -19
  130. data/lib/build-tool/GUI.rb +0 -360
  131. data/lib/build-tool/commands/help.rb +0 -22
  132. data/lib/build-tool/commands/lsfeatures.rb +0 -76
  133. data/lib/build-tool/feature.rb +0 -47
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+ require 'mj/tools/subprocess'
1
3
  require 'build-tool/build-system/make'
2
4
 
3
5
  module BuildTool; module BuildSystem
@@ -91,14 +93,6 @@ def configure
91
93
  rc
92
94
  end
93
95
 
94
- def install( fast )
95
- make( "install" )
96
- end
97
-
98
- def install_fast_supported?
99
- true
100
- end
101
-
102
96
  def make( target = nil )
103
97
  Make.make( "#{target ? target : "" }", build_directory, self.module.environment.values )
104
98
  end
@@ -1,4 +1,7 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'build-tool/errors'
4
+ require 'mj/logging'
2
5
 
3
6
  module BuildTool; module BuildSystem
4
7
 
@@ -250,7 +253,11 @@ def recipe
250
253
  end
251
254
 
252
255
  def remove_build_directory
253
- self.class.execute "rm -rf #{build_directory}"
256
+ FileUtils.rm_rf( build_directory, :noop => $noop )
257
+ end
258
+
259
+ def remove_source_directory
260
+ FileUtils.rm_rf( source_directory, :noop => $noop )
254
261
  end
255
262
 
256
263
  end # class Base
@@ -270,14 +277,15 @@ def write( event )
270
277
  @pbar = nil
271
278
  @oldlogger.append( event )
272
279
  rescue Exception => e
273
- puts e
280
+ logger.error( e )
281
+ logger.verbose( e.backtrace.join( "\n" ) )
274
282
  end
275
283
  else
276
284
  begin
277
285
  grep_progress( message )
278
286
  rescue Exception => e
279
- puts e
280
- puts e.backtrace
287
+ logger.error( e )
288
+ logger.verbose( e.backtrace.join( "\n" ) )
281
289
  end
282
290
  end
283
291
  self
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'mj/tools/subprocess'
2
4
  require 'build-tool/build-system/base'
3
5
  require 'build-tool/build-system/make'
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'mj/tools/subprocess'
2
4
  require 'build-tool/build-system/base'
3
5
 
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'mj/tools/subprocess'
2
4
  require 'build-tool/build-system/base'
3
5
 
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'mj/tools/subprocess'
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'mj/tools/subprocess'
2
4
  require 'build-tool/build-system/base'
3
5
 
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'mj/tools/subprocess'
2
4
  require 'build-tool/build-system/base'
3
5
  require 'build-tool/build-system/make'
@@ -1,3 +1,7 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'mj/tools/subprocess.rb'
4
+
1
5
  require 'build-tool/build-system/make'
2
6
 
3
7
  module BuildTool; module BuildSystem
@@ -40,8 +40,9 @@ macro
40
40
  COMMENT \#[^\r\n]*
41
41
  INHERITANCE <
42
42
 
43
- STRING "([^\"\r\n]*)"
44
- STRINGERROR "([^\"\r\n]*)$
43
+ STRING "([^\"\r\n]*)"
44
+ STRINGERROR "([^\"\r\n]*)$"
45
+ MULTILINE_STRING """
45
46
 
46
47
  TOKEN [a-zA-Z][A-Za-z_0-9-]*
47
48
 
@@ -160,12 +161,15 @@ rule
160
161
  #
161
162
  ### GIT_SVN
162
163
  #
164
+ :GIT_SVN track\b { [:TRACK, text]; }
165
+ :GIT_SVN {INHERITANCE} { [:INHERITANCE, text] }
166
+ :GIT_SVN option\b { [:OPTION, text]; }
167
+ :GIT_SVN global\b { [:GLOBAL, text]; }
163
168
  :GIT_SVN external\b { [:EXTERNAL, text]; }
169
+ :GIT_SVN remote-path\b { [:REMOTE_PATH, text]; }
164
170
  :GIT_SVN use\b { @states.push @state; @state = :USE; [:USE, text]; }
165
- :GIT_SVN track\b { [:TRACK, text]; }
166
171
  :GIT_SVN ssh-key\b { @states.push @state; @state = :SSH_KEY; [:SSH_KEY, text]; }
167
172
  :GIT_SVN repository\b { @states.push @state; @state = :REPOSITORY; [:REPOSITORY, text]; }
168
- :GIT_SVN remote-path\b { [:REMOTE_PATH, text]; }
169
173
  :GIT_SVN remote\b { @states.push @state; @state = :GIT_REMOTE; [:REMOTE, text]; }
170
174
  :GIT_SVN end\b { @state = @states.pop; [ :END, text ]; }
171
175
  # COMMON
@@ -180,12 +184,15 @@ rule
180
184
  #
181
185
  ### GIT
182
186
  #
183
- :GIT url\b { [:URL, text]; }
184
187
  :GIT track\b { [:TRACK, text]; }
188
+ :GIT {INHERITANCE} { [:INHERITANCE, text] }
189
+ :GIT option\b { [:OPTION, text]; }
190
+ :GIT global\b { [:GLOBAL, text]; }
191
+ :GIT url\b { [:URL, text]; }
185
192
  :GIT push\b { [:PUSH, text]; }
186
- :GIT ssh-key\b { @states.push @state; @state = :SSH_KEY; [:SSH_KEY, text]; }
187
- :GIT remote\b { @states.push @state; @state = :GIT_REMOTE; [:REMOTE, text]; }
188
- :GIT end\b { @state = @states.pop; [ :END, text ]; }
193
+ :GIT ssh-key\b { @states.push @state; @state = :SSH_KEY; [:SSH_KEY, text]; }
194
+ :GIT remote\b { @states.push @state; @state = :GIT_REMOTE; [:REMOTE, text]; }
195
+ :GIT end\b { @state = @states.pop; [ :END, text ]; }
189
196
  # COMMON
190
197
  :GIT {STRING} { [:STRING, @ss[1]]; }
191
198
  :GIT {TOKEN} { [:TOKEN, text]; }
@@ -211,6 +218,24 @@ rule
211
218
  :GIT_REMOTE {STRINGERROR} { [:GARBAGE, text]; }
212
219
  :GIT_REMOTE . { [:GARBAGE, text]; }
213
220
 
221
+ #
222
+ ### MERCURIAL
223
+ #
224
+ :MERCURIAL track\b { [:TRACK, text]; }
225
+ :MERCURIAL {INHERITANCE} { [:INHERITANCE, text] }
226
+ :MERCURIAL url\b { [:URL, text]; }
227
+ :MERCURIAL push\b { [:PUSH, text]; }
228
+ :MERCURIAL ssh-key\b { @states.push @state; @state = :SSH_KEY; [:SSH_KEY, text]; }
229
+ :MERCURIAL end\b { @state = @states.pop; [ :END, text ]; }
230
+ # COMMON
231
+ :MERCURIAL {STRING} { [:STRING, @ss[1]]; }
232
+ :MERCURIAL {TOKEN} { [:TOKEN, text]; }
233
+ :MERCURIAL {COMMENT} { [:COMMENT, text]; }
234
+ :MERCURIAL {BLANK} { [:IGNORE, text]; }
235
+ :MERCURIAL {LF} { [:IGNORE, text]; }
236
+ :MERCURIAL {STRINGERROR} { [:GARBAGE, text]; }
237
+ :MERCURIAL . { [:GARBAGE, text]; }
238
+
214
239
  #
215
240
  ### MODULE
216
241
  #
@@ -231,6 +256,7 @@ rule
231
256
 
232
257
  :MODULE end\b { @state = @states.pop; [:END, text]; }
233
258
  # COMMON
259
+ :MODULE {MULTILINE_STRING} { @states.push @state; @state = :MULTILINE_STRING; [:MULTILINE_STRING, text]; }
234
260
  :MODULE {STRING} { [:STRING, @ss[1]]; }
235
261
  :MODULE {TOKEN} { [:TOKEN, text]; }
236
262
  :MODULE {COMMENT} { [:COMMENT, text]; }
@@ -239,6 +265,10 @@ rule
239
265
  :MODULE {STRINGERROR} { [:GARBAGE, text]; }
240
266
  :MODULE . { [:GARBAGE, text]; }
241
267
 
268
+ :MULTILINE_STRING {MULTILINE_STRING} { @state = @states.pop; [:MULTILINE_STRING, text]; }
269
+ :MULTILINE_STRING [^\"]+ { [:TEXT, text]; }
270
+ :MULTILINE_STRING . { [:TEXT, text]; }
271
+
242
272
  #
243
273
  ### REPOSITORY
244
274
  #
@@ -293,6 +323,7 @@ rule
293
323
  ### SVN
294
324
  #
295
325
  :SVN only\b { [:ONLY, text]; }
326
+ :SVN {INHERITANCE} { [:INHERITANCE, text] }
296
327
  :SVN end\b { @state = @states.pop; [ :END, text ]; }
297
328
  :SVN repository\b { @states.push @state; @state = :REPOSITORY; [:REPOSITORY, text]; }
298
329
  :SVN use\b { @states.push @state; @state = :USE; [:USE, text]; }
@@ -331,6 +362,7 @@ rule
331
362
  :VCS git\b { @state = :GIT; [:GIT, text]; }
332
363
  :VCS svn\b { @state = :SVN; [:SVN, text]; }
333
364
  :VCS archive\b { @state = :ARCHIVE; [:ARCHIVE, text]; }
365
+ :VCS mercurial { @state = :MERCURIAL; [:MERCURIAL, text]; }
334
366
  # COMMON
335
367
  :VCS {STRING} { [:STRING, @ss[1]]; }
336
368
  :VCS {TOKEN} { [:TOKEN, text]; }
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'racc/parser'
2
4
 
3
5
  module BuildTool; module Cfg;
@@ -37,7 +39,7 @@ def pre_match
37
39
  def next_token
38
40
  begin
39
41
  token = rex_next_token
40
- # puts "#{state.inspect}##{token.inspect} #{lineno}"
42
+ # logger.debug2( "#{state.inspect}##{token.inspect} #{lineno}" )
41
43
  case token[0]
42
44
  when :IGNORE; redo
43
45
  when :COMMENT; redo
@@ -1,3 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
1
3
  require 'mj/visitor'
2
4
 
3
5
  module BuildTool; module Cfg;
@@ -8,14 +10,22 @@ module BuildTool; module Cfg;
8
10
  class Node < MJ::Visitable
9
11
 
10
12
  attr_accessor :values
13
+ attr_accessor :args
14
+ attr_accessor :options
11
15
 
12
16
  def value
13
17
  values
14
18
  #raise StandardError, "1 Value expected.#{values.length} values found!."
15
19
  end
16
20
 
17
- def initialize(values = nil)
21
+ def initialize(values = nil, *args )
18
22
  @values = values
23
+ @args = *args
24
+ if !@args.empty? && @args[-1].kind_of?( Hash )
25
+ @options = @args.pop
26
+ else
27
+ @options = {}
28
+ end
19
29
  end
20
30
 
21
31
  end # class Node
@@ -43,6 +53,8 @@ def initialize(values = nil)
43
53
  GitSvnDeclaration
44
54
 
45
55
  GitDeclaration
56
+ GitOption
57
+ GitOptionsDeclaration
46
58
  GitRemotePath
47
59
  GitRemoteUrl
48
60
  GitRemoteDeclaration
@@ -56,6 +68,10 @@ def initialize(values = nil)
56
68
 
57
69
  LogDirectory
58
70
 
71
+ MercurialDeclaration
72
+ MercurialTrack
73
+ MercurialUrl
74
+
59
75
  ModuleBuildPrefix
60
76
  ModuleDeclaration
61
77
  ModuleInstallPrefix
@@ -15,6 +15,7 @@ class BuildTool::Cfg::Parser < BuildTool::Cfg::Lexer
15
15
  token FILE
16
16
  token GIT
17
17
  token GIT_SVN
18
+ token GLOBAL
18
19
  token HOST
19
20
  token INCLUDE
20
21
  token INHERITANCE
@@ -23,6 +24,8 @@ class BuildTool::Cfg::Parser < BuildTool::Cfg::Lexer
23
24
  token LOCAL_PATH
24
25
  token LOG_DIRECTORY
25
26
  token LONG
27
+ token MERCURIAL
28
+ token MULTILINE_STRING
26
29
  token MODULE
27
30
  token ONLY
28
31
  token OPTION
@@ -41,6 +44,7 @@ class BuildTool::Cfg::Parser < BuildTool::Cfg::Lexer
41
44
  token STRING
42
45
  token SVN
43
46
  token TEMPLATE
47
+ token TEXT
44
48
  token TOKEN
45
49
  token TRACK
46
50
  token URL
@@ -78,8 +82,14 @@ rule
78
82
 
79
83
  top_level_statement
80
84
  : LOG_DIRECTORY STRING { result = LogDirectoryNode.new( val[1] ); }
81
- | DISABLE FEATURE identifier { result = DisableFeatureNode.new( val[2] ); }
82
- | ENABLE FEATURE identifier { result = EnableFeatureNode.new( val[2] ); }
85
+ | DISABLE FEATURE identifier {
86
+ result = DisableFeatureNode.new( val[2], :global => @global );
87
+ deprecated( "Enabling/Disabling feature %s from override file!" % ( val[2] ) ) if not @global;
88
+ }
89
+ | ENABLE FEATURE identifier {
90
+ result = EnableFeatureNode.new( val[2], :global => @global );
91
+ deprecated( "Enabling/Disabling feature %s from override file!" % ( val[2] ) ) if not @global;
92
+ }
83
93
  | statement { result = val[0]; }
84
94
  ;
85
95
 
@@ -96,8 +106,15 @@ rule
96
106
  | ssh_key_declaration { result = val[0]; }
97
107
  | include_directive { result = val[0]; }
98
108
  | feature_declaration { result = val[0]; }
99
- | DISABLE MODULE identifier { result = DisableModuleNode.new( val[2] ); }
100
- | ENABLE MODULE identifier { result = EnableModuleNode.new( val[2] ); }
109
+ | vcs_options_declaration { result = val[0]; }
110
+ | DISABLE MODULE identifier {
111
+ result = DisableModuleNode.new( val[2], :global => @global );
112
+ deprecated( "Enabling/Disabling module %s from override file!" % ( val[2] ) ) if not @global;
113
+ }
114
+ | ENABLE MODULE identifier {
115
+ result = EnableModuleNode.new( val[2], :global => @global );
116
+ deprecated( "Enabling/Disabling module %s from override file!" % ( val[2] ) ) if not @global;
117
+ }
101
118
  ;
102
119
 
103
120
  vcs_declaration
@@ -105,10 +122,15 @@ rule
105
122
  | svn_declaration { result = val[0]; }
106
123
  | git_svn_declaration { result = val[0]; }
107
124
  | archive_declaration { result = val[0]; }
125
+ | mercurial_declaration { result = val[0]; }
126
+ ;
127
+
128
+ vcs_options_declaration
129
+ : git_options_declaration { result = val[0]; }
108
130
  ;
109
131
 
110
132
  #
111
- ### GIT-SVN CONFIGURATION
133
+ ### CONFIGURATION
112
134
  #
113
135
  archive_declaration
114
136
  : VCS ARCHIVE archive_statements END { result = ArchiveDeclarationNode.new( val[2] ); }
@@ -183,11 +205,32 @@ rule
183
205
  | SHORT DESCRIPTION STRING { result = ShortDescriptionNode.new( val[2] ); }
184
206
  ;
185
207
 
208
+ #
209
+ ### GIT OPTION DECLARATION
210
+ #
211
+ git_options_declaration
212
+ : VCS GIT git_global_option_statements END { result = GitOptionsDeclarationNode.new( val[2] ); }
213
+
214
+ git_global_option_statements
215
+ : /* EMPTY */
216
+ | git_global_option_statement git_global_option_statements { result = val.flatten; }
217
+ ;
218
+
219
+ git_global_option_statement
220
+ : GLOBAL OPTION identifier STRING { result = GitOptionNode.new( val[2..-1], :GLOBAL ); }
221
+ | git_option_statement
222
+ ;
223
+
224
+ git_option_statement
225
+ : OPTION identifier STRING { result = GitOptionNode.new( val[1..-1], :LOCAL ); }
226
+ ;
227
+
186
228
  #
187
229
  ### GIT CONFIGURATION
188
230
  #
189
231
  git_declaration
190
232
  : VCS GIT git_statements END { result = GitDeclarationNode.new( val[2] ); }
233
+ | VCS GIT inheritance git_statements END { result = GitDeclarationNode.new( val[3] ); result.options[:inheritance] = true; }
191
234
  ;
192
235
 
193
236
  git_remote_statements
@@ -211,6 +254,7 @@ rule
211
254
  : REMOTE STRING git_remote_statements END { result = GitRemoteDeclarationNode.new( val[1..-1]); }
212
255
  | TRACK STRING { result = GitTrackNode.new( val[1] ); }
213
256
  | git_remote_statement { result = val[0]; }
257
+ | git_option_statement { result = val[0]; }
214
258
  ;
215
259
 
216
260
  #
@@ -218,6 +262,7 @@ rule
218
262
  #
219
263
  git_svn_declaration
220
264
  : VCS GIT_SVN git_svn_statements END { result = GitSvnDeclarationNode.new( val[2] ); }
265
+ | VCS GIT_SVN inheritance git_svn_statements END { result = GitSvnDeclarationNode.new( val[3] ); result.options[:inheritance] = true; }
221
266
  ;
222
267
 
223
268
  git_svn_statements
@@ -240,6 +285,24 @@ rule
240
285
  : INCLUDE STRING { result = IncludeNode.new( val[1] ) };
241
286
  ;
242
287
 
288
+ #
289
+ ### MERCURIAL CONFIGURATION
290
+ #
291
+ mercurial_declaration
292
+ : VCS MERCURIAL mercurial_statements END { result = MercurialDeclarationNode.new( val[2] ); }
293
+ | VCS MERCURIAL inheritance mercurial_statements END { result = MercurialDeclarationNode.new( val[3] ); result.options[:inheritance] = true; }
294
+ ;
295
+
296
+ mercurial_statements
297
+ : /* empty */
298
+ | mercurial_statement mercurial_statements { result = val.flatten; }
299
+ ;
300
+
301
+ mercurial_statement
302
+ : TRACK STRING { result = MercurialTrackNode.new( val[1] ); }
303
+ | URL STRING { result = MercurialUrlNode.new( val[1..-1] ); }
304
+ ;
305
+
243
306
  #
244
307
  ### MODULE DECLARATION
245
308
  #
@@ -331,6 +394,7 @@ rule
331
394
  #
332
395
  svn_declaration
333
396
  : VCS SVN svn_statements END { result = SvnDeclarationNode.new( val[2] ); }
397
+ | VCS SVN inheritance svn_statements END { result = SvnDeclarationNode.new( val[3] ); result.options[:inheritance] = true; }
334
398
  ;
335
399
 
336
400
  svn_statements
@@ -348,11 +412,17 @@ rule
348
412
  #
349
413
  ### HELPER
350
414
  #
351
- multiline_string
415
+ multiline_text
352
416
  : /* empty */
353
- | multiline_string STRING { result = val[0] ? val[0] + "\n" + val[1] : val[1]; }
417
+ | multiline_text TEXT { result = val[0] ? val[0] + "\n" + val[1] : val[1]; }
418
+ ;
419
+
420
+ multiline_string
421
+ : STRING { result = val[0]; }
422
+ | MULTILINE_STRING multiline_text MULTILINE_STRING { result = val[1]; }
354
423
  ;
355
424
 
425
+
356
426
  end # class BuildTool::Cfg::GitParser
357
427
 
358
428
  ---- header ----
@@ -362,6 +432,8 @@ end # class BuildTool::Cfg::GitParser
362
432
  require 'build-tool/cfg/lexer'
363
433
  require 'build-tool/cfg/node'
364
434
  require 'build-tool/cfg/visitor'
435
+ require 'build-tool/configuration'
436
+ require 'build-tool/errors'
365
437
 
366
438
 
367
439
  ---- inner ----
@@ -370,18 +442,28 @@ require 'build-tool/cfg/visitor'
370
442
  #
371
443
  attr_accessor :configuration
372
444
 
373
- def initialize( configuration = Configuration.new)
445
+ def initialize( configuration, global = true)
374
446
  super()
447
+ @global = global
375
448
  @configuration = configuration
376
449
  end
377
450
 
378
451
  def parse_string( string, file = "<string>" )
379
- tree = super
380
- visitor = Cfg::ConfigurationFileVisitor.new( configuration )
452
+ begin
453
+ tree = super
454
+ visitor = Cfg::ConfigurationFileVisitor.new( configuration )
455
+ rescue Racc::ParseError => e
456
+ debug( e.backtrace.join( "\n" ) )
457
+ raise BuildTool::ParseError( e.message )
458
+ end
381
459
  conf = tree.accept( visitor )
382
460
  return configuration
383
461
  end
384
462
 
463
+ def deprecated( message )
464
+ logger.warn "[%s:%d]:deprecation warning:%s" % [ filename, lineno, message ]
465
+ end
466
+
385
467
  ---- footer ----
386
468
  #
387
469
  ### FOOTER