bake-toolkit 1.8.0.1 → 2.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/bin/bake +14 -53
  3. data/bin/bakery +50 -43
  4. data/bin/createVSProjects +3 -3
  5. data/doc/cmd/install.html +1 -5
  6. data/doc/cmd/usecmd.html +29 -5
  7. data/doc/dyk/lint.html +21 -4
  8. data/doc/dyk/tipps.html +0 -6
  9. data/doc/eclipse/import.html +3 -1
  10. data/doc/eclipse/import/Import.png +0 -0
  11. data/doc/eclipse/use.html +8 -5
  12. data/doc/further/change.html +134 -1
  13. data/doc/further/issues.html +1 -0
  14. data/doc/further/wish.html +24 -21
  15. data/doc/index.html +1 -1
  16. data/doc/syntax/subst.html +8 -1
  17. data/doc/syntax/syntax.html +42 -14
  18. data/lib/bake/cache.rb +51 -59
  19. data/lib/bake/config/loader.rb +289 -0
  20. data/lib/bake/libElement.rb +134 -0
  21. data/lib/bake/mergeConfig.rb +1 -1
  22. data/lib/bake/model/language.rb +1 -1
  23. data/lib/bake/model/loader.rb +88 -0
  24. data/lib/bake/model/metamodel.rb +24 -16
  25. data/lib/bake/model/metamodel_ext.rb +9 -4
  26. data/lib/bake/options/options.rb +222 -0
  27. data/lib/bake/options/showConfigNames.rb +44 -0
  28. data/lib/bake/options/showDoc.rb +19 -0
  29. data/lib/bake/options/showLicense.rb +9 -0
  30. data/lib/bake/options/showToolchains.rb +39 -0
  31. data/lib/bake/options/usage.rb +54 -0
  32. data/lib/bake/process_output.rb +10 -0
  33. data/lib/bake/subst.rb +105 -40
  34. data/lib/bake/toolchain/clang.rb +44 -0
  35. data/lib/bake/toolchain/colorizing_formatter.rb +125 -0
  36. data/lib/bake/toolchain/diab.rb +53 -0
  37. data/lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb +40 -0
  38. data/lib/bake/toolchain/errorparser/diab_linker_error_parser.rb +41 -0
  39. data/lib/bake/toolchain/errorparser/error_parser.rb +71 -0
  40. data/lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb +35 -0
  41. data/lib/bake/toolchain/errorparser/gcc_linker_error_parser.rb +35 -0
  42. data/lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb +32 -0
  43. data/lib/bake/toolchain/errorparser/greenhills_linker_error_parser.rb +44 -0
  44. data/lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb +40 -0
  45. data/lib/bake/toolchain/errorparser/keil_linker_error_parser.rb +30 -0
  46. data/lib/bake/toolchain/errorparser/lint_error_parser.rb +34 -0
  47. data/lib/bake/toolchain/errorparser/process_output.rb +3 -0
  48. data/lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb +30 -0
  49. data/lib/bake/toolchain/errorparser/ti_linker_error_parser.rb +30 -0
  50. data/lib/bake/toolchain/gcc.rb +49 -0
  51. data/lib/bake/toolchain/gcc_param.rb +7 -0
  52. data/lib/bake/toolchain/greenhills.rb +52 -0
  53. data/lib/bake/toolchain/keil.rb +55 -0
  54. data/lib/bake/toolchain/lint.rb +20 -0
  55. data/lib/bake/toolchain/provider.rb +136 -0
  56. data/lib/bake/toolchain/ti.rb +47 -0
  57. data/lib/bake/util.rb +27 -15
  58. data/lib/bakery/buildPattern.rb +1 -1
  59. data/lib/bakery/model/language.rb +1 -1
  60. data/lib/bakery/model/loader.rb +56 -0
  61. data/lib/bakery/model/metamodel.rb +1 -1
  62. data/lib/bakery/options/options.rb +87 -0
  63. data/lib/bakery/toBake.rb +10 -6
  64. data/lib/blocks/block.rb +225 -0
  65. data/lib/blocks/blockBase.rb +155 -0
  66. data/lib/blocks/commandLine.rb +25 -0
  67. data/lib/blocks/compile.rb +382 -0
  68. data/lib/blocks/docu.rb +28 -0
  69. data/lib/blocks/executable.rb +143 -0
  70. data/lib/blocks/has_execute_command.rb +31 -0
  71. data/lib/blocks/library.rb +78 -0
  72. data/lib/blocks/lint.rb +53 -0
  73. data/lib/blocks/makefile.rb +87 -0
  74. data/lib/blocks/showIncludes.rb +114 -0
  75. data/lib/common/abortException.rb +4 -0
  76. data/lib/common/cleanup.rb +9 -0
  77. data/lib/common/exit_helper.rb +28 -0
  78. data/lib/common/ext/file.rb +88 -0
  79. data/lib/common/ext/stdout.rb +45 -0
  80. data/lib/common/ide_interface.rb +194 -0
  81. data/lib/common/options/option.rb +13 -0
  82. data/lib/common/options/parser.rb +59 -0
  83. data/lib/common/process.rb +64 -0
  84. data/lib/common/utils.rb +52 -0
  85. data/lib/{bake → common}/version.rb +3 -10
  86. data/lib/multithread/job.rb +44 -0
  87. data/lib/tocxx.rb +201 -932
  88. data/lib/vs/options.rb +3 -2
  89. data/license.txt +47 -22
  90. metadata +90 -30
  91. data/bin/bake-doc +0 -12
  92. data/lib/alias/loader.rb +0 -56
  93. data/lib/alias/model/language.rb +0 -22
  94. data/lib/alias/model/metamodel.rb +0 -29
  95. data/lib/bake/loader.rb +0 -92
  96. data/lib/bake/options.rb +0 -421
  97. data/lib/bakery/loader.rb +0 -57
  98. data/lib/bakery/options.rb +0 -105
  99. data/lib/option/parser.rb +0 -73
data/lib/vs/options.rb CHANGED
@@ -1,6 +1,7 @@
1
- require "option/parser"
1
+ require "common/options/parser"
2
+ require "common/options/option"
2
3
 
3
- module Cxxproject
4
+ module Bake
4
5
 
5
6
  class VsOptions < Parser
6
7
  attr_accessor :version, :roots, :rewriteSolution
data/license.txt CHANGED
@@ -1,4 +1,6 @@
1
- Copyright (c) 2012 E.S.R.Labs GmbH
1
+ bake License:
2
+
3
+ Copyright (c) 2012-2015 E.S.R.Labs AG
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
6
  this software and associated documentation files (the "Software"), to deal in
@@ -18,30 +20,27 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
20
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
21
  IN THE SOFTWARE.
20
22
 
23
+ _______________________________________________________________________________
21
24
 
22
- -------------------------------------------------------------------------------
23
-
24
-
25
- This Product is based on lake that was created by Lear Corporation and that
26
- are governed by their lake license, which are contained hereinafter.
27
-
28
- This license applies only to (portions of) the source code file(s) in which
29
- the license is contained or in which it is explicitly referenced, and to
30
- compiled or otherwise processed forms of such source code. The licenses does not
31
- apply to This Product as a whole, even when it uses terms such as "product",
32
- "program", or any other equivalent terms/phrases. This Product as a whole is
33
- governed by the lake License (see above). Some parts of the lake source code have
34
- been modified by the authors of This Product. Unless otherwise stated, such
35
- modifications and additions are governed by the lake (see above). Note:
36
- Unless otherwise stated, graphics and files that are not part of the source
37
- code are governed by the lake License.
25
+ Third-Party Licenses:
38
26
 
27
+ This Product contains components that were created by third parties and that
28
+ are governed by third-party licenses, which are contained hereinafter
29
+ (separated by lines consisting of underscores). Each of the third-party
30
+ licenses applies only to (portions of) the source code file(s) in which the
31
+ third-party license is contained or in which it is explicitly referenced,
32
+ and to compiled or otherwise processed forms of such source code. None of the
33
+ third-party licenses applies to This Product as a whole, even when it uses
34
+ terms such as "product", "program", or any other equivalent terms/phrases.
35
+ This Product as a whole is governed by the bake License (see above). Some of
36
+ the third-party components have been modified by the authors of This Product.
37
+ Unless otherwise stated, such modifications and additions are governed by the
38
+ bake License (see above). Note: Unless otherwise stated, graphics and files
39
+ that are not part of the source code are governed by the bake License.
39
40
 
40
- -------------------------------------------------------------------------------
41
-
42
-
43
- lake license:
41
+ _______________________________________________________________________________
44
42
 
43
+ lake License:
45
44
 
46
45
  Copyright (c) 2011 LEAR Corporation
47
46
 
@@ -61,4 +60,30 @@ FITNESS FOR A ARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
61
60
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
62
61
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
63
62
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
64
- IN THE SOFTWARE.
63
+ IN THE SOFTWARE.
64
+
65
+ _______________________________________________________________________________
66
+
67
+ cxxproject License:
68
+
69
+ Copyright (c) 2010, All rights reserved.
70
+
71
+ Redistribution and use in source and binary forms, with or without
72
+ modification, are permitted provided that the following conditions are met:
73
+ * Redistributions of source code must retain the above copyright
74
+ notice, this list of conditions and the following disclaimer.
75
+ * Redistributions in binary form must reproduce the above copyright
76
+ notice, this list of conditions and the following disclaimer in the
77
+ documentation and/or other materials provided with the distribution.
78
+
79
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
80
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
81
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
82
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
83
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
84
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
85
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
86
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
87
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
88
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
89
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
metadata CHANGED
@@ -1,88 +1,149 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0.1
4
+ version: 2.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Schaal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-07 00:00:00.000000000 Z
11
+ date: 2015-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: cxxproject
14
+ name: rtext
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.76
19
+ version: 0.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.76
26
+ version: 0.2.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: rtext
28
+ name: rgen
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.0
33
+ version: 0.6.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.0
40
+ version: 0.6.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: rgen
42
+ name: highline
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.6.0
47
+ version: 1.6.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.6.0
55
- description: |2
56
- This build tool is used to compile projects fast and easy.
54
+ version: 1.6.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: colored
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: See documentation for more details
57
70
  email: alexander.schaal@esrlabs.com
58
71
  executables:
59
72
  - bake
60
73
  - bakery
61
74
  - createVSProjects
62
- - bake-doc
63
75
  extensions: []
64
76
  extra_rdoc_files: []
65
77
  files:
66
- - lib/alias/loader.rb
67
- - lib/alias/model/language.rb
68
- - lib/alias/model/metamodel.rb
69
78
  - lib/bake/cache.rb
70
- - lib/bake/loader.rb
79
+ - lib/bake/config/loader.rb
80
+ - lib/bake/libElement.rb
71
81
  - lib/bake/mergeConfig.rb
72
82
  - lib/bake/model/language.rb
83
+ - lib/bake/model/loader.rb
73
84
  - lib/bake/model/metamodel.rb
74
85
  - lib/bake/model/metamodel_ext.rb
75
- - lib/bake/options.rb
86
+ - lib/bake/options/options.rb
87
+ - lib/bake/options/showConfigNames.rb
88
+ - lib/bake/options/showDoc.rb
89
+ - lib/bake/options/showLicense.rb
90
+ - lib/bake/options/showToolchains.rb
91
+ - lib/bake/options/usage.rb
92
+ - lib/bake/process_output.rb
76
93
  - lib/bake/subst.rb
94
+ - lib/bake/toolchain/clang.rb
95
+ - lib/bake/toolchain/colorizing_formatter.rb
96
+ - lib/bake/toolchain/diab.rb
97
+ - lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb
98
+ - lib/bake/toolchain/errorparser/diab_linker_error_parser.rb
99
+ - lib/bake/toolchain/errorparser/error_parser.rb
100
+ - lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb
101
+ - lib/bake/toolchain/errorparser/gcc_linker_error_parser.rb
102
+ - lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb
103
+ - lib/bake/toolchain/errorparser/greenhills_linker_error_parser.rb
104
+ - lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb
105
+ - lib/bake/toolchain/errorparser/keil_linker_error_parser.rb
106
+ - lib/bake/toolchain/errorparser/lint_error_parser.rb
107
+ - lib/bake/toolchain/errorparser/process_output.rb
108
+ - lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb
109
+ - lib/bake/toolchain/errorparser/ti_linker_error_parser.rb
110
+ - lib/bake/toolchain/gcc.rb
111
+ - lib/bake/toolchain/gcc_param.rb
112
+ - lib/bake/toolchain/greenhills.rb
113
+ - lib/bake/toolchain/keil.rb
114
+ - lib/bake/toolchain/lint.rb
115
+ - lib/bake/toolchain/provider.rb
116
+ - lib/bake/toolchain/ti.rb
77
117
  - lib/bake/util.rb
78
- - lib/bake/version.rb
79
118
  - lib/bakery/buildPattern.rb
80
- - lib/bakery/loader.rb
81
119
  - lib/bakery/model/language.rb
120
+ - lib/bakery/model/loader.rb
82
121
  - lib/bakery/model/metamodel.rb
83
- - lib/bakery/options.rb
122
+ - lib/bakery/options/options.rb
84
123
  - lib/bakery/toBake.rb
85
- - lib/option/parser.rb
124
+ - lib/blocks/block.rb
125
+ - lib/blocks/blockBase.rb
126
+ - lib/blocks/commandLine.rb
127
+ - lib/blocks/compile.rb
128
+ - lib/blocks/docu.rb
129
+ - lib/blocks/executable.rb
130
+ - lib/blocks/has_execute_command.rb
131
+ - lib/blocks/library.rb
132
+ - lib/blocks/lint.rb
133
+ - lib/blocks/makefile.rb
134
+ - lib/blocks/showIncludes.rb
135
+ - lib/common/abortException.rb
136
+ - lib/common/cleanup.rb
137
+ - lib/common/exit_helper.rb
138
+ - lib/common/ext/file.rb
139
+ - lib/common/ext/stdout.rb
140
+ - lib/common/ide_interface.rb
141
+ - lib/common/options/option.rb
142
+ - lib/common/options/parser.rb
143
+ - lib/common/process.rb
144
+ - lib/common/utils.rb
145
+ - lib/common/version.rb
146
+ - lib/multithread/job.rb
86
147
  - lib/tocxx.rb
87
148
  - lib/vs/options.rb
88
149
  - Rakefile.rb
@@ -156,8 +217,7 @@ files:
156
217
  - bin/bake
157
218
  - bin/bakery
158
219
  - bin/createVSProjects
159
- - bin/bake-doc
160
- homepage: http://www.esrlabs.com
220
+ homepage:
161
221
  licenses:
162
222
  - MIT
163
223
  metadata: {}
@@ -171,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
231
  requirements:
172
232
  - - '>='
173
233
  - !ruby/object:Gem::Version
174
- version: '0'
234
+ version: '1.9'
175
235
  required_rubygems_version: !ruby/object:Gem::Requirement
176
236
  requirements:
177
237
  - - '>='
@@ -179,8 +239,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
239
  version: '0'
180
240
  requirements: []
181
241
  rubyforge_project:
182
- rubygems_version: 2.0.14
242
+ rubygems_version: 2.0.15
183
243
  signing_key:
184
244
  specification_version: 4
185
- summary: Frontend for cxxproject.
245
+ summary: Build tool to compile C/C++ projects fast and easy.
186
246
  test_files: []
data/bin/bake-doc DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- link = File.expand_path(File.dirname(__FILE__)+"/../doc/index.html")
4
- if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
5
- system "start #{link}"
6
- elsif RUBY_PLATFORM =~ /darwin/
7
- system "open #{link}"
8
- elsif RUBY_PLATFORM =~ /linux|bsd/
9
- system "xdg-open #{link}"
10
- else
11
- puts "Please open #{link} manually in your browser."
12
- end
data/lib/alias/loader.rb DELETED
@@ -1,56 +0,0 @@
1
- require 'alias/model/metamodel'
2
- require 'alias/model/language'
3
-
4
- require 'rgen/environment'
5
- require 'rgen/fragment/fragmented_model'
6
-
7
- require 'rtext/default_loader'
8
-
9
- require 'cxxproject/utils/exit_helper'
10
- require 'cxxproject/utils/printer'
11
-
12
- module Cxxproject
13
-
14
- class AliasLoader
15
-
16
- attr_reader :model
17
-
18
- def initialize(options)
19
- @env = RGen::Environment.new
20
- @options = options
21
- @model = RGen::Fragment::FragmentedModel.new(:env => @env)
22
- end
23
-
24
- def load(filename)
25
-
26
- sumErrors = 0
27
-
28
- if not File.exists?filename
29
- Printer.printError "Error: #{filename} does not exist"
30
- ExitHelper.exit(1)
31
- end
32
-
33
- loader = RText::DefaultLoader.new(
34
- Cxxproject::AliasLanguage,
35
- @model,
36
- :file_provider => proc { [filename] },
37
- :cache => @DumpFileCache)
38
- loader.load()
39
-
40
- f = @model.fragments[0]
41
-
42
- f.data[:problems].each do |p|
43
- Printer.printError "Error: "+p.file+"("+p.line.to_s+"): "+p.message
44
- end
45
-
46
- if f.data[:problems].length > 0
47
- ExitHelper.exit(1)
48
- end
49
-
50
- return @env
51
-
52
- end
53
-
54
-
55
- end
56
- end
@@ -1,22 +0,0 @@
1
- require 'bake/model/metamodel'
2
- require 'rtext/language'
3
-
4
- module Cxxproject
5
-
6
- AliasLanguage =
7
- RText::Language.new(AliasModel.ecore,
8
- :feature_provider => proc {|c|
9
- RGen::Serializer::OppositeReferenceFilter.call(c.eAllStructuralFeatures).reject {|f|
10
- f.eAnnotations.any? {|a|
11
- a.details.any? {|d| d.key == 'internal' && d.value == 'true'}
12
- }
13
- }
14
- },
15
- :unlabled_arguments => proc {|c|
16
- ["hdd_name", "logical_name"]
17
- },
18
- :line_number_attribute => "line_number",
19
- :file_name_attribute => "file_name"
20
- )
21
-
22
- end
@@ -1,29 +0,0 @@
1
- require 'rgen/metamodel_builder'
2
- require 'rgen/metamodel_builder/data_types'
3
-
4
- module Cxxproject
5
-
6
- module AliasModel
7
- extend RGen::MetamodelBuilder::ModuleExtension
8
-
9
- class ModelElement < RGen::MetamodelBuilder::MMBase
10
- abstract
11
- has_attr 'line_number', Integer do
12
- annotation :details => {'internal' => 'true'}
13
- end
14
- has_attr 'file_name', String do
15
- annotation :details => {'internal' => 'true'}
16
- end
17
- end
18
-
19
- class Alias < ModelElement
20
- has_attr 'hdd_name', String, :defaultValueLiteral => ""
21
- has_attr 'logical_name', String, :defaultValueLiteral => ""
22
- end
23
- class Aliases < ModelElement
24
- contains_many 'alias', Alias, 'aliases'
25
- end
26
-
27
- end
28
-
29
- end
data/lib/bake/loader.rb DELETED
@@ -1,92 +0,0 @@
1
- require 'bake/model/metamodel'
2
- require 'bake/model/language'
3
- require 'bake/version'
4
-
5
- require 'rgen/environment'
6
- require 'rgen/fragment/dump_file_cache'
7
- require 'rgen/fragment/fragmented_model'
8
- require 'rgen/util/file_cache_map'
9
-
10
- require 'rtext/default_loader'
11
-
12
- require 'cxxproject/utils/exit_helper'
13
- require 'cxxproject/utils/printer'
14
- require 'bake/options'
15
-
16
- module Cxxproject
17
-
18
- class Loader
19
-
20
- attr_reader :model
21
-
22
- def initialize(options)
23
- @env = RGen::Environment.new
24
- @options = options
25
-
26
- fcm = RGen::Util::FileCacheMap.new(".bake", ".cache")
27
- fcm.version_info = Version.bake
28
- @DumpFileCache = RGen::Fragment::DumpFileCache.new(fcm)
29
- if @options.nocache
30
- def @DumpFileCache.load(fragment)
31
- :invalid
32
- end
33
- end
34
-
35
- @model = RGen::Fragment::FragmentedModel.new(:env => @env)
36
- @mainProjectName = File::basename(@options.main_dir)
37
- end
38
-
39
- def load(filename)
40
-
41
- sumErrors = 0
42
-
43
- if not File.exists?filename
44
- Printer.printError "Error: #{filename} does not exist"
45
- ExitHelper.exit(1)
46
- end
47
-
48
- loader = RText::DefaultLoader.new(
49
- Cxxproject::Language,
50
- @model,
51
- :file_provider => proc { [filename] },
52
- :cache => @DumpFileCache)
53
- loader.load(:before_load => proc {|fragment, kind|
54
- case kind
55
- when :load_update_cache
56
- if @options.verbose
57
- puts "Loading and caching #{fragment.location}"
58
- else
59
- puts "Loading #{fragment.location}"
60
- end
61
- when :load_cached
62
- if @options.verbose
63
- puts "Loading cached #{fragment.location}"
64
- else
65
- puts "Loading #{fragment.location}"
66
- end
67
- when :load
68
- puts "Loading #{fragment.location}"
69
- else
70
- Printer.printError "Error: Could not load #{fragment.location}"
71
- ExitHelper.exit(1)
72
- end
73
- })
74
-
75
- f = @model.fragments[0]
76
- @model.remove_fragment(f)
77
-
78
- f.data[:problems].each do |p|
79
- Printer.printError "Error: "+p.file+"("+p.line.to_s+"): "+p.message
80
- end
81
-
82
- if f.data[:problems].length > 0
83
- ExitHelper.exit(1)
84
- end
85
-
86
- return f
87
-
88
- end
89
-
90
-
91
- end
92
- end