origen 0.44.0 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/application.rb +2 -2
- data/config/boot.rb +0 -7
- data/config/commands.rb +3 -74
- data/config/rubocop/easy_disabled.yml +4 -0
- data/config/rubocop/easy_enabled.yml +0 -4
- data/config/rubocop/strict_disabled.yml +4 -0
- data/config/rubocop/strict_enabled.yml +0 -4
- data/config/version.rb +1 -2
- data/lib/origen/application/deployer.rb +3 -1
- data/lib/origen/application/release.rb +2 -2
- data/lib/origen/application/runner.rb +9 -2
- data/lib/origen/application.rb +91 -2
- data/lib/origen/boot/app.rb +0 -4
- data/lib/origen/boot.rb +2 -1
- data/lib/origen/code_generators/actions.rb +244 -34
- data/lib/origen/code_generators/base.rb +9 -2
- data/lib/origen/code_generators/block.rb +203 -0
- data/lib/origen/code_generators/block_common.rb +100 -0
- data/lib/origen/code_generators/dut.rb +62 -0
- data/lib/origen/code_generators/feature.rb +50 -0
- data/lib/origen/code_generators/klass.rb +41 -0
- data/lib/origen/code_generators/model.rb +60 -0
- data/lib/origen/code_generators/module.rb +92 -0
- data/lib/origen/code_generators.rb +30 -10
- data/lib/origen/commands/lint.rb +6 -1
- data/lib/origen/commands/new.rb +1 -1
- data/lib/origen/commands/new_resource.rb +41 -0
- data/lib/origen/commands/web.rb +11 -6
- data/lib/origen/commands.rb +18 -0
- data/lib/{option_parser → origen/core_ext/option_parser}/optparse.rb +0 -0
- data/lib/origen/dependencies.rb +0 -0
- data/lib/origen/file_handler.rb +8 -4
- data/lib/origen/generator/pattern_finder.rb +3 -3
- data/lib/origen/loader.rb +377 -0
- data/lib/origen/model.rb +22 -1
- data/lib/origen/model_initializer.rb +5 -1
- data/lib/origen/parameters/set.rb +2 -1
- data/lib/origen/parameters.rb +95 -3
- data/lib/origen/sub_blocks.rb +21 -7
- data/lib/origen/top_level.rb +11 -0
- data/lib/origen.rb +3 -1
- data/origen_app_generators/Gemfile +6 -2
- data/origen_app_generators/Gemfile.lock +83 -72
- data/origen_app_generators/bin/boot.rb +4 -2
- data/origen_app_generators/config/commands.rb +3 -3
- data/origen_app_generators/config/shared_commands.rb +11 -6
- data/origen_app_generators/lbin/bundle +105 -0
- data/origen_app_generators/lbin/byebug +29 -0
- data/origen_app_generators/lbin/coderay +29 -0
- data/origen_app_generators/lbin/htmldiff +29 -0
- data/origen_app_generators/lbin/httparty +29 -0
- data/origen_app_generators/lbin/httpclient +29 -0
- data/origen_app_generators/lbin/kramdown +29 -0
- data/origen_app_generators/lbin/ldiff +29 -0
- data/origen_app_generators/lbin/nanoc +29 -0
- data/origen_app_generators/lbin/nokogiri +29 -0
- data/origen_app_generators/lbin/origen +62 -0
- data/origen_app_generators/lbin/pry +29 -0
- data/origen_app_generators/lbin/rackup +29 -0
- data/origen_app_generators/lbin/rake +29 -0
- data/origen_app_generators/lbin/rspec +29 -0
- data/origen_app_generators/lbin/rubocop +29 -0
- data/origen_app_generators/lbin/ruby-parse +29 -0
- data/origen_app_generators/lbin/ruby-rewrite +29 -0
- data/origen_app_generators/lbin/thor +29 -0
- data/origen_app_generators/lbin/tilt +29 -0
- data/origen_app_generators/lbin/yard +29 -0
- data/origen_app_generators/lbin/yardoc +29 -0
- data/origen_app_generators/lbin/yri +29 -0
- data/origen_app_generators/lib/origen_app_generators/application.rb +12 -12
- data/origen_app_generators/lib/origen_app_generators/base.rb +34 -8
- data/origen_app_generators/lib/origen_app_generators/new.rb +17 -9
- data/origen_app_generators/lib/{tasks/new_app_tests.rake → origen_app_generators/new_app_tests.rb} +1 -5
- data/origen_app_generators/lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb +6 -8
- data/origen_app_generators/lib/origen_app_generators/plugin.rb +4 -7
- data/origen_app_generators/lib/origen_app_generators/test_engineering/common.rb +29 -0
- data/origen_app_generators/lib/origen_app_generators/test_engineering/stand_alone_application.rb +9 -181
- data/origen_app_generators/lib/origen_app_generators/test_engineering/test_block.rb +4 -105
- data/origen_app_generators/lib/origen_app_generators.rb +6 -4
- data/origen_app_generators/origen_app_generators.gemspec +7 -7
- data/origen_app_generators/templates/app_generators/application/Gemfile +14 -3
- data/origen_app_generators/templates/app_generators/application/{lib → app/blocks}/top_level.rb +1 -1
- data/origen_app_generators/templates/app_generators/application/app/lib/module.rb +6 -0
- data/origen_app_generators/templates/app_generators/application/{templates → app/templates}/web/index.md.erb +0 -0
- data/origen_app_generators/templates/app_generators/application/{templates → app/templates}/web/layouts/_basic.html.erb +0 -0
- data/origen_app_generators/templates/app_generators/application/{templates → app/templates}/web/partials/_navbar.html.erb +0 -0
- data/origen_app_generators/templates/app_generators/application/{templates → app/templates}/web/release_notes.md.erb +0 -0
- data/origen_app_generators/templates/app_generators/application/config/application.rb +51 -55
- data/origen_app_generators/templates/app_generators/application/{spec → test/spec}/spec_helper.rb +0 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/{lib → app/lib}/application.rb +0 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/{lib → app/lib}/base.rb +0 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/{lib → app/lib}/module.rb +0 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/{lib → app/lib}/plugin.rb +0 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/config/load_generators.rb +1 -1
- data/origen_app_generators/templates/app_generators/plugin/Gemfile +5 -2
- data/origen_app_generators/templates/app_generators/plugin/{templates → app/templates}/web/index.md.erb +0 -0
- data/origen_app_generators/templates/app_generators/plugin/{templates → app/templates}/web/partials/_navbar_external.html.erb +0 -0
- data/origen_app_generators/templates/app_generators/plugin/{templates → app/templates}/web/partials/_navbar_internal.html.erb +0 -0
- data/origen_app_generators/templates/app_generators/plugin/gemspec.rb +4 -3
- data/origen_app_generators/templates/app_generators/test_engineering/{stand_alone_application/environment → environment}/j750.rb +0 -0
- data/origen_app_generators/templates/app_generators/test_engineering/{stand_alone_application/environment → environment}/uflex.rb +0 -0
- data/origen_app_generators/templates/app_generators/test_engineering/{stand_alone_application/environment → environment}/v93k.rb +0 -0
- data/origen_site_config.yml +0 -7
- data/templates/code_generators/attributes.rb +20 -0
- data/templates/code_generators/class.rb +9 -0
- data/templates/code_generators/controller.rb +87 -0
- data/templates/code_generators/model.rb +21 -0
- data/templates/code_generators/module.rb +4 -0
- data/templates/code_generators/parameters.rb +19 -0
- data/templates/code_generators/pins.rb +28 -0
- data/templates/code_generators/registers.rb +20 -0
- data/templates/code_generators/sub_blocks.rb +24 -0
- data/templates/code_generators/timesets.rb +24 -0
- data/templates/code_generators/version.rb +0 -1
- metadata +66 -77
- data/lib/c99/ate_interface.rb +0 -77
- data/lib/c99/nvm.rb +0 -110
- data/lib/c99/target/mock2.rb +0 -1
- data/lib/c99/target/subdir/mock3.rb +0 -1
- data/lib/origen/code_generators/bundler.rb +0 -17
- data/lib/origen/code_generators/gem_setup.rb +0 -49
- data/lib/origen/code_generators/rake.rb +0 -13
- data/lib/origen/code_generators/rspec.rb +0 -12
- data/lib/origen/commands/add.rb +0 -12
- data/lib/tasks/private/build.rake +0 -8
- data/origen_app_generators/bin/fix_my_workspace +0 -100
- data/origen_app_generators/lib/origen_app_generators/sub_block_parser.rb +0 -81
- data/origen_app_generators/lib/tasks/app_generators.rake +0 -6
- data/origen_app_generators/spec/sub_block_spec.rb +0 -36
- data/origen_app_generators/templates/app_generators/application/lib/app.rake +0 -6
- data/origen_app_generators/templates/app_generators/application/lib/module.rb +0 -22
- data/origen_app_generators/templates/app_generators/plugin/lib/README +0 -4
- data/origen_app_generators/templates/app_generators/plugin/lib_dev/README +0 -5
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/Gemfile +0 -23
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/jlink.rb +0 -1
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/ip_block.rb +0 -23
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/ip_block_controller.rb +0 -5
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/top_level.rb +0 -33
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/top_level_controller.rb +0 -21
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/pattern/example.rb +0 -4
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/target/top_level.rb +0 -4
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/j750.rb +0 -2
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/ultraflex.rb +0 -2
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/v93k.rb +0 -2
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/controller.rb +0 -12
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/interface.rb +0 -21
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/model.rb +0 -18
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib_dev/dut.rb +0 -27
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib_dev/dut_controller.rb +0 -26
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/pattern/example.rb +0 -5
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/program/prb1.rb +0 -11
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/target/default.rb +0 -2
- data/templates/code_generators/gemfile_app.rb +0 -4
- data/templates/code_generators/gemfile_plugin.rb +0 -6
- data/templates/code_generators/gemspec.rb +0 -33
- data/templates/code_generators/rakefile.rb +0 -10
- data/templates/code_generators/spec_helper.rb +0 -49
data/origen_app_generators/lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb
CHANGED
@@ -77,23 +77,21 @@ module OrigenAppGenerators
|
|
77
77
|
list = super # Always pick up the parent list
|
78
78
|
# Example of how to remove a file from the parent list
|
79
79
|
# list.delete(:web_doc_layout)
|
80
|
-
list.delete(:lib_readme)
|
81
|
-
list.delete(:lib_readme_dev)
|
82
80
|
list.delete(:templates_shared)
|
83
81
|
# Example of how to add a file, in this case the file will be compiled and copied to
|
84
82
|
# the same location in the new app
|
85
83
|
# list[:config_shared_commands] = { source: 'config/shared_commands.rb' }
|
86
84
|
list[:config_load_generators] = { source: 'config/load_generators.rb' }
|
87
|
-
list[:lib_base] = { source: 'lib/base.rb', dest: "lib/#{@name}/base.rb" }
|
88
|
-
list[:lib_plugin] = { source: 'lib/plugin.rb', dest: "lib/#{@name}/plugin.rb" }
|
89
|
-
list[:lib_application] = { source: 'lib/application.rb', dest: "lib/#{@name}/application.rb" }
|
85
|
+
list[:lib_base] = { source: 'app/lib/base.rb', dest: "app/lib/#{@name}/base.rb" }
|
86
|
+
list[:lib_plugin] = { source: 'app/lib/plugin.rb', dest: "app/lib/#{@name}/plugin.rb" }
|
87
|
+
list[:lib_application] = { source: 'app/lib/application.rb', dest: "app/lib/#{@name}/application.rb" }
|
90
88
|
# Alternatively specifying a different destination, typically you would do this when
|
91
89
|
# the final location is dynamic
|
92
90
|
# list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
93
91
|
# Example of how to create a directory
|
94
|
-
list[:templates_app] = { dest: 'templates/app_generators/application', type: :directory }
|
95
|
-
list[:templates_plugin] = { dest: 'templates/app_generators/plugin', type: :directory }
|
96
|
-
list[:templates_base] = { dest: 'templates/app_generators/base', type: :directory }
|
92
|
+
list[:templates_app] = { dest: 'app/templates/app_generators/application', type: :directory }
|
93
|
+
list[:templates_plugin] = { dest: 'app/templates/app_generators/plugin', type: :directory }
|
94
|
+
list[:templates_base] = { dest: 'app/templates/app_generators/base', type: :directory }
|
97
95
|
# By default, directories created in this way will contain a .keep file, to inhibit this:
|
98
96
|
# list[:pattern_dir] = { dest: "pattern", type: :directory, nokeep: true }
|
99
97
|
# Example of how to create a symlink
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module OrigenAppGenerators
|
2
2
|
# The base generator class that should be used by all plugin generators
|
3
3
|
class Plugin < Application
|
4
|
-
def
|
5
|
-
get_name_and_namespace
|
4
|
+
def get_additional_user_input
|
6
5
|
get_summary
|
7
6
|
get_audience unless @audience
|
8
7
|
end
|
@@ -19,15 +18,13 @@ module OrigenAppGenerators
|
|
19
18
|
list.delete(:web_installation)
|
20
19
|
list.delete(:web_introduction)
|
21
20
|
list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
22
|
-
list[:templates_shared] = { dest: 'templates/shared', type: :directory }
|
21
|
+
list[:templates_shared] = { dest: 'app/templates/shared', type: :directory }
|
23
22
|
if @audience == :external
|
24
23
|
list[:travis] = { source: '.travis.yml' }
|
25
|
-
list[:web_navbar] = { source: 'templates/web/partials/_navbar_external.html.erb', dest: 'templates/web/partials/_navbar.html.erb' }
|
24
|
+
list[:web_navbar] = { source: 'app/templates/web/partials/_navbar_external.html.erb', dest: 'app/templates/web/partials/_navbar.html.erb' }
|
26
25
|
else
|
27
|
-
list[:web_navbar] = { source: 'templates/web/partials/_navbar_internal.html.erb', dest: 'templates/web/partials/_navbar.html.erb' }
|
26
|
+
list[:web_navbar] = { source: 'app/templates/web/partials/_navbar_internal.html.erb', dest: 'app/templates/web/partials/_navbar.html.erb' }
|
28
27
|
end
|
29
|
-
list[:lib_readme] = { source: 'lib/README', dest: "lib/#{@name}/README" }
|
30
|
-
list[:lib_readme_dev] = { source: 'lib_dev/README', dest: "lib/#{@name}_dev/README" }
|
31
28
|
list
|
32
29
|
end
|
33
30
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module OrigenAppGenerators
|
2
|
+
module TestEngineering
|
3
|
+
module Common
|
4
|
+
def common_filelist(list)
|
5
|
+
# Example of how to remove a file from the parent list
|
6
|
+
# list.delete(:target_debug)
|
7
|
+
# Example of how to add a file, in this case the file will be compiled and copied to
|
8
|
+
# the same location in the new app
|
9
|
+
list[:environment_v93k] = { source: 'environment/v93k.rb' }
|
10
|
+
list[:environment_j750] = { source: 'environment/j750.rb' }
|
11
|
+
list[:environment_uflex] = { source: 'environment/uflex.rb' }
|
12
|
+
# Alternatively specifying a different destination, typically you would do this when
|
13
|
+
# the final location is dynamic
|
14
|
+
# list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
15
|
+
# Example of how to create a directory
|
16
|
+
# list[:pattern_dir] = { dest: 'pattern', type: :directory }
|
17
|
+
# Example of how to create a symlink
|
18
|
+
list[:environment_default] = { source: 'uflex.rb', # Relative to the file being linked to
|
19
|
+
dest: 'environment/default.rb', # Relative to destination_root
|
20
|
+
type: :symlink }
|
21
|
+
# Test engineering source directories
|
22
|
+
list[:patterns_dir] = { dest: 'app/patterns', type: :directory }
|
23
|
+
list[:flows_dir] = { dest: 'app/flows', type: :directory }
|
24
|
+
# Remember to return the final list
|
25
|
+
list
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/origen_app_generators/lib/origen_app_generators/test_engineering/stand_alone_application.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module OrigenAppGenerators
|
2
2
|
module TestEngineering
|
3
|
-
require 'origen_app_generators/sub_block_parser'
|
4
3
|
# Generates a generic application shell
|
5
4
|
class StandAloneApplication < Application
|
5
|
+
include Common
|
6
|
+
|
6
7
|
desc 'A stand alone test engineering application'
|
7
8
|
|
8
9
|
# Any methods that are not protected will get invoked in the order that they are
|
@@ -13,13 +14,12 @@ module OrigenAppGenerators
|
|
13
14
|
# The methods to get the common user input that applies to all applications will
|
14
15
|
# get called at the start automatically, you have a chance here to ask any additional
|
15
16
|
# questions that are specific to the type of application being generated
|
16
|
-
get_top_level_names
|
17
|
-
get_sub_block_names
|
18
17
|
end
|
19
18
|
|
20
19
|
def generate_files
|
21
|
-
|
22
|
-
|
20
|
+
@development_dependencies = [
|
21
|
+
['origen_testers']
|
22
|
+
]
|
23
23
|
build_filelist
|
24
24
|
end
|
25
25
|
|
@@ -37,122 +37,8 @@ module OrigenAppGenerators
|
|
37
37
|
|
38
38
|
protected
|
39
39
|
|
40
|
-
def sub_block_parser
|
41
|
-
@sub_block_parser ||= SubBlockParser.new
|
42
|
-
end
|
43
|
-
|
44
|
-
def get_top_level_names
|
45
|
-
puts
|
46
|
-
puts 'NAME YOUR TOP-LEVEL DEVICE(S)'
|
47
|
-
puts
|
48
|
-
puts 'What do you want to call the top-level class that represents your device?'
|
49
|
-
puts 'By default it will be called TopLevel, but if you want this application to support multiple devices you should'
|
50
|
-
puts 'give them unique names.'
|
51
|
-
puts 'Separate multiple names with a comma: Falcon, Eagle, Vulture'
|
52
|
-
puts
|
53
|
-
|
54
|
-
valid = false
|
55
|
-
until valid
|
56
|
-
@top_level_names = get_text(single: true, default: 'TopLevel').strip.split(',').map do |name|
|
57
|
-
name.strip.gsub(/\s+/, '_').camelize
|
58
|
-
end
|
59
|
-
unless @top_level_names.empty?
|
60
|
-
# Should we check anything here?
|
61
|
-
valid = true
|
62
|
-
end
|
63
|
-
end
|
64
|
-
@top_level_names
|
65
|
-
end
|
66
|
-
|
67
|
-
def get_sub_block_names
|
68
|
-
puts
|
69
|
-
puts 'DEFINE YOUR SUB-BLOCKS'
|
70
|
-
puts
|
71
|
-
puts 'What sub-blocks does this device contain?'
|
72
|
-
puts 'You can leave this blank, but entering some details of the sub-blocks you will want to involve in your tests'
|
73
|
-
puts 'will save you some manual setup of the associated models and controllers.'
|
74
|
-
puts 'You can specify layers of hierarchy and multiple instantiations, here are some examples:'
|
75
|
-
puts
|
76
|
-
puts ' A RAM, OSC, PLL and 2 ATDs at the top-level: ram, osc, pll, atd(2)'
|
77
|
-
puts ' With 3 COMMS blocks with embedded components: ram, osc, pll, atd(2), comms[ram(2), osc](3)'
|
78
|
-
if @top_level_names.size > 1
|
79
|
-
puts
|
80
|
-
puts 'If you want different modules for each of your top-level devices you can do:'
|
81
|
-
puts
|
82
|
-
puts " #{@top_level_names[0]}[ram, atd(2)], #{@top_level_names[1]}[ram(2), atd(4)]"
|
83
|
-
end
|
84
|
-
puts
|
85
|
-
|
86
|
-
valid = false
|
87
|
-
until valid
|
88
|
-
input = get_text(single: true).strip
|
89
|
-
if input.empty?
|
90
|
-
@sub_blocks_lookup = {}
|
91
|
-
valid = true
|
92
|
-
else
|
93
|
-
begin
|
94
|
-
@sub_blocks_lookup = sub_block_parser.parse(input)
|
95
|
-
valid = true
|
96
|
-
rescue
|
97
|
-
valid = false
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
@sub_blocks_lookup
|
102
|
-
end
|
103
|
-
|
104
|
-
# Returns a hash that looks like:
|
105
|
-
#
|
106
|
-
# {"Falcon"=>{"RAM"=>{}, "ATD"=>{:instances=>2}}, "Eagle"=>{"RAM"=>{:instances=>2}, "ATD"=>{:instances=>4}}}
|
107
|
-
def top_level_sub_blocks
|
108
|
-
blocks = {}
|
109
|
-
# Make sure that each top-level object has a sub blocks assignment
|
110
|
-
if @top_level_names.any? { |n| @sub_blocks_lookup[n] }
|
111
|
-
@top_level_names.each do |name|
|
112
|
-
if @sub_blocks_lookup[name]
|
113
|
-
blocks[name] = @sub_blocks_lookup[name][:children] || {}
|
114
|
-
else
|
115
|
-
blocks[name] = {}
|
116
|
-
end
|
117
|
-
end
|
118
|
-
# Duplicate the given sub blocks to all top-level objects if none have been specified
|
119
|
-
else
|
120
|
-
@top_level_names.each do |name|
|
121
|
-
blocks[name] = @sub_blocks_lookup
|
122
|
-
end
|
123
|
-
end
|
124
|
-
blocks
|
125
|
-
end
|
126
|
-
|
127
|
-
# Returns a hash with all sub-blocks at the top-level, e.g.:
|
128
|
-
#
|
129
|
-
# {"RAM"=>{}, "ATD"=>{}, "Comms"=>{"RAM"=>{:instances=>2}, "Osc"=>{}}, "Osc"=>{}}
|
130
|
-
def sub_blocks
|
131
|
-
blocks = {}
|
132
|
-
top_level_sub_blocks.each do |top, attrs|
|
133
|
-
extract_sub_blocks(attrs) do |name, attrs|
|
134
|
-
if blocks[name]
|
135
|
-
if blocks[name] != (attrs[:children] || {})
|
136
|
-
Origen.log.warning "The app builder does not currently support different sub-block definitions for block #{name}"
|
137
|
-
Origen.log.warning 'Only the first defintion has been built'
|
138
|
-
end
|
139
|
-
else
|
140
|
-
blocks[name] = attrs[:children] || {}
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
blocks
|
145
|
-
end
|
146
|
-
|
147
|
-
def extract_sub_blocks(blocks, &block)
|
148
|
-
blocks.each do |name, attrs|
|
149
|
-
yield name, attrs
|
150
|
-
extract_sub_blocks(attrs[:children], &block) if attrs[:children]
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
40
|
# Defines the filelist for the generator, the default list is inherited from the
|
155
|
-
# parent class (
|
41
|
+
# parent class (Plugin).
|
156
42
|
# The filelist can contain references to generate files, directories or symlinks in the
|
157
43
|
# new application.
|
158
44
|
#
|
@@ -160,74 +46,16 @@ module OrigenAppGenerators
|
|
160
46
|
# from the parent generator, this means that your generator will automatically stay up
|
161
47
|
# to date with the latest conventions
|
162
48
|
#
|
163
|
-
# The master templates live in templates/app_generators/
|
49
|
+
# The master templates live in templates/app_generators/plugin, but
|
164
50
|
# DO NOT MODIFY THESE FILES DIRECTLY.
|
165
51
|
# Either add or remove things post-generation in the modify_files method or copy the
|
166
|
-
# master file to the equivalent sub-directory of templates/app_generators/test_engineering/
|
52
|
+
# master file to the equivalent sub-directory of templates/app_generators/test_engineering/mpg_test_block
|
167
53
|
# which will override the version in the master directory.
|
168
54
|
#
|
169
55
|
# Additional files can be added or removed from the filelist as shown below.
|
170
56
|
def filelist
|
171
57
|
@filelist ||= begin
|
172
|
-
list = super # Always pick up the parent list
|
173
|
-
# Example of how to remove a file from the parent list
|
174
|
-
list.delete(:lib_top_level)
|
175
|
-
list.delete(:target_debug)
|
176
|
-
list.delete(:target_production)
|
177
|
-
list.delete(:target_default)
|
178
|
-
# Example of how to add a file, in this case the file will be compiled and copied to
|
179
|
-
# the same location in the new app
|
180
|
-
@top_level_names.each_with_index do |name, i|
|
181
|
-
list["top_level_model_#{i}"] = { source: 'lib/top_level.rb',
|
182
|
-
dest: "lib/#{@name}/#{name.underscore}.rb",
|
183
|
-
options: { name: name, sub_blocks: top_level_sub_blocks[name] }
|
184
|
-
}
|
185
|
-
|
186
|
-
list["top_level_controller_#{i}"] = { source: 'lib/top_level_controller.rb',
|
187
|
-
dest: "lib/#{@name}/#{name.underscore}_controller.rb",
|
188
|
-
options: { name: name }
|
189
|
-
}
|
190
|
-
|
191
|
-
list["target_#{name}"] = { source: 'target/top_level.rb',
|
192
|
-
dest: "target/#{name.underscore}.rb",
|
193
|
-
options: { name: name }
|
194
|
-
}
|
195
|
-
if i == 0
|
196
|
-
list[:target_default] = { source: "#{name.underscore}.rb", # Relative to the file being linked to
|
197
|
-
dest: 'target/default.rb', # Relative to destination_root
|
198
|
-
type: :symlink }
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
sub_blocks.each do |name, blocks|
|
203
|
-
list["ip_block_#{name}"] = { source: 'lib/ip_block.rb',
|
204
|
-
dest: "lib/#{@name}/#{name.underscore}.rb",
|
205
|
-
options: { name: name, sub_blocks: blocks }
|
206
|
-
}
|
207
|
-
|
208
|
-
list["ip_block_controller_#{name}"] = { source: 'lib/ip_block_controller.rb',
|
209
|
-
dest: "lib/#{@name}/#{name.underscore}_controller.rb" }
|
210
|
-
end
|
211
|
-
|
212
|
-
list[:environment_j750] = { source: 'environment/j750.rb' }
|
213
|
-
list[:environment_uflex] = { source: 'environment/uflex.rb' }
|
214
|
-
list[:environment_v93k] = { source: 'environment/v93k.rb' }
|
215
|
-
list[:environment_jlink] = { source: 'environment/jlink.rb' }
|
216
|
-
# Alternatively specifying a different destination, typically you would do this when
|
217
|
-
# the final location is dynamic
|
218
|
-
# list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
219
|
-
# Example of how to create a directory
|
220
|
-
# list[:pattern_dir] = { dest: "pattern", type: :directory }
|
221
|
-
# Example of how to create a symlink
|
222
|
-
list[:environment_default] = { source: 'j750.rb', # Relative to the file being linked to
|
223
|
-
dest: 'environment/default.rb', # Relative to destination_root
|
224
|
-
type: :symlink }
|
225
|
-
# Test engineering source directories
|
226
|
-
list[:program_dir] = { dest: 'program', type: :directory }
|
227
|
-
list[:pattern_dir] = { dest: 'pattern', type: :directory }
|
228
|
-
# Example source files
|
229
|
-
list[:pattern_example] = { source: 'pattern/example.rb' }
|
230
|
-
# Remember to return the final list
|
58
|
+
list = common_filelist(super) # Always pick up the parent list
|
231
59
|
list
|
232
60
|
end
|
233
61
|
end
|
@@ -2,6 +2,8 @@ module OrigenAppGenerators
|
|
2
2
|
module TestEngineering
|
3
3
|
# Generates a generic plugin shell
|
4
4
|
class TestBlock < Plugin
|
5
|
+
include Common
|
6
|
+
|
5
7
|
desc 'An IP test module intended to plugin into a top-level (SoC) application'
|
6
8
|
|
7
9
|
def initialize(*args)
|
@@ -13,8 +15,6 @@ module OrigenAppGenerators
|
|
13
15
|
# The methods to get the common user input that applies to all applications will
|
14
16
|
# get called at the start automatically, you have a chance here to ask any additional
|
15
17
|
# questions that are specific to the type of application being generated
|
16
|
-
get_ip_names
|
17
|
-
get_sub_block_name
|
18
18
|
end
|
19
19
|
|
20
20
|
def generate_files
|
@@ -25,72 +25,15 @@ module OrigenAppGenerators
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def final_modifications
|
28
|
-
prepend_to_file "lib/#{@name}.rb", "require 'origen_testers'\n"
|
29
|
-
# Add require line
|
30
|
-
doc_helpers = /gem 'origen_doc_helpers'/
|
31
|
-
inject_into_file 'Gemfile', "\ngem 'origen_jtag'\ngem 'origen_arm_debug'\n",
|
32
|
-
after: doc_helpers
|
28
|
+
prepend_to_file "app/lib/#{@name}.rb", "require 'origen_testers'\n"
|
33
29
|
end
|
34
30
|
|
35
31
|
def conclude
|
36
32
|
puts "New test module created at: #{destination_root}"
|
37
|
-
puts
|
38
|
-
puts 'Generate an example pattern by running "origen g example"'
|
39
33
|
end
|
40
34
|
|
41
35
|
protected
|
42
36
|
|
43
|
-
def get_ip_names
|
44
|
-
puts
|
45
|
-
puts 'NAME THE IP BLOCKS THAT THIS MODULE WILL SUPPORT'
|
46
|
-
puts
|
47
|
-
puts "You don't need to name them all up front, but you must declare at least one."
|
48
|
-
puts 'We recommend that you use the official name(s) for the IP(s) as used by your design team.'
|
49
|
-
puts 'Separate multiple names with a comma: FLASH_C40_512K, FLASH_C40_2M'
|
50
|
-
puts
|
51
|
-
|
52
|
-
valid = false
|
53
|
-
until valid
|
54
|
-
@ip_names = get_text(single: true).strip.split(',').map do |name|
|
55
|
-
n = name.strip.symbolize.to_s.upcase
|
56
|
-
unless n.empty?
|
57
|
-
n
|
58
|
-
end
|
59
|
-
end.compact
|
60
|
-
unless @ip_names.empty?
|
61
|
-
# Should we check anything here?
|
62
|
-
valid = true
|
63
|
-
end
|
64
|
-
end
|
65
|
-
@ip_names
|
66
|
-
end
|
67
|
-
|
68
|
-
def get_sub_block_name
|
69
|
-
puts
|
70
|
-
puts "WHAT SHOULD BE THE PATH TO #{@ip_names.first} WHEN IT IS INSTANTIATED IN AN SOC?"
|
71
|
-
puts
|
72
|
-
puts 'Your IP(s) will be instantiated by a top-level (SoC) model, at which point it should be given a generic nickname'
|
73
|
-
puts 'that will provide an easy way to access it.'
|
74
|
-
puts 'For example, if you had an IP model for an NVM block, the IP name might be "FLASH_C40_512K_128K", but when it is'
|
75
|
-
puts 'instantiated it would be given the name "flash", allowing it be easily accessed as "dut.flash".'
|
76
|
-
puts
|
77
|
-
|
78
|
-
valid = false
|
79
|
-
until valid
|
80
|
-
@sub_block_name = get_text(single: true).strip.split(',').map do |name|
|
81
|
-
n = name.strip.symbolize.to_s.downcase
|
82
|
-
unless n.empty?
|
83
|
-
n
|
84
|
-
end
|
85
|
-
end.compact
|
86
|
-
unless @sub_block_name.empty?
|
87
|
-
# Should we check anything here?
|
88
|
-
valid = true
|
89
|
-
end
|
90
|
-
end
|
91
|
-
@sub_block_name = @sub_block_name.first
|
92
|
-
end
|
93
|
-
|
94
37
|
# Defines the filelist for the generator, the default list is inherited from the
|
95
38
|
# parent class (Plugin).
|
96
39
|
# The filelist can contain references to generate files, directories or symlinks in the
|
@@ -109,51 +52,7 @@ module OrigenAppGenerators
|
|
109
52
|
# Additional files can be added or removed from the filelist as shown below.
|
110
53
|
def filelist
|
111
54
|
@filelist ||= begin
|
112
|
-
list = super # Always pick up the parent list
|
113
|
-
# Example of how to remove a file from the parent list
|
114
|
-
list.delete(:target_debug)
|
115
|
-
list.delete(:target_production)
|
116
|
-
# Example of how to add a file, in this case the file will be compiled and copied to
|
117
|
-
# the same location in the new app
|
118
|
-
list[:target_default] = { source: 'target/default.rb' }
|
119
|
-
list[:environment_v93k] = { source: 'environment/v93k.rb' }
|
120
|
-
list[:environment_j750] = { source: 'environment/j750.rb' }
|
121
|
-
list[:environment_ultraflex] = { source: 'environment/ultraflex.rb' }
|
122
|
-
list[:program_prb1] = { source: 'program/prb1.rb' }
|
123
|
-
list[:lib_interface] = { source: 'lib/interface.rb', dest: "lib/#{@name}/interface.rb" }
|
124
|
-
# Alternatively specifying a different destination, typically you would do this when
|
125
|
-
# the final location is dynamic
|
126
|
-
# list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
127
|
-
# Example of how to create a directory
|
128
|
-
list[:pattern_dir] = { dest: 'pattern', type: :directory }
|
129
|
-
# Example of how to create a symlink
|
130
|
-
list[:environment_default] = { source: 'ultraflex.rb', # Relative to the file being linked to
|
131
|
-
dest: 'environment/default.rb', # Relative to destination_root
|
132
|
-
type: :symlink }
|
133
|
-
list[:dev_dut] = { source: 'lib_dev/dut.rb',
|
134
|
-
dest: "lib/#{@name}_dev/dut.rb",
|
135
|
-
options: { class_name: @ip_names.first, sub_block_name: @sub_block_name }
|
136
|
-
}
|
137
|
-
list[:dev_dutc] = { source: 'lib_dev/dut_controller.rb',
|
138
|
-
dest: "lib/#{@name}_dev/dut_controller.rb"
|
139
|
-
}
|
140
|
-
|
141
|
-
@ip_names.each_with_index do |name, i|
|
142
|
-
list["ip_#{i}"] = { source: 'lib/model.rb',
|
143
|
-
dest: "lib/#{@name}/#{name.underscore}.rb",
|
144
|
-
options: { name: name }
|
145
|
-
}
|
146
|
-
|
147
|
-
list["ip_controller_#{i}"] = { source: 'lib/controller.rb',
|
148
|
-
dest: "lib/#{@name}/#{name.underscore}_controller.rb",
|
149
|
-
options: { name: name }
|
150
|
-
}
|
151
|
-
end
|
152
|
-
|
153
|
-
list[:pattern_example] = { source: 'pattern/example.rb',
|
154
|
-
options: { sub_block_name: @sub_block_name }
|
155
|
-
}
|
156
|
-
# Remember to return the final list
|
55
|
+
list = common_filelist(super) # Always pick up the parent list
|
157
56
|
list
|
158
57
|
end
|
159
58
|
end
|
@@ -7,6 +7,7 @@ require 'origen_app_generators/plugin'
|
|
7
7
|
require 'origen_app_generators/empty_application'
|
8
8
|
require 'origen_app_generators/empty_plugin'
|
9
9
|
require 'origen_app_generators/new'
|
10
|
+
require 'origen_app_generators/test_engineering/common'
|
10
11
|
require 'origen_app_generators/test_engineering/test_block'
|
11
12
|
require 'origen_app_generators/test_engineering/stand_alone_application'
|
12
13
|
require 'origen_app_generators/origen_infrastructure/app_generator_plugin'
|
@@ -16,15 +17,16 @@ module OrigenAppGenerators
|
|
16
17
|
|
17
18
|
TEST_INPUTS = [
|
18
19
|
# 0 - Empty app
|
19
|
-
['0', '0', :default
|
20
|
+
['0', '0', :default],
|
20
21
|
# 1 - Empty plugin
|
21
22
|
['0', '1', :default, :default, 'A test block', 'yes', :default],
|
22
23
|
# 2 - Stand alone test engineering app
|
23
|
-
['2', '0',
|
24
|
+
['2', '0', [:default]],
|
24
25
|
# 3 - Test module
|
25
|
-
['2', '1',
|
26
|
+
# ['2', '1', 'Test module for all flash IPs', [:default, 'origen g example']],
|
27
|
+
['2', '1', 'Test module for all flash IPs', :default],
|
26
28
|
# 4 - An app generators plugin
|
27
|
-
['1', '0',
|
29
|
+
['1', '0', 'My application generators', :default]
|
28
30
|
] # END_OF_TEST_INPUTS Don't remove this comment, it is used by the app_gen:new command!
|
29
31
|
|
30
32
|
# As you add new generators to this app they will be entered here, this enables the
|
@@ -8,26 +8,26 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.8.11".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Stephen McGinty".freeze]
|
11
|
-
s.date = "2019-05-
|
11
|
+
s.date = "2019-05-27"
|
12
12
|
s.email = ["stephen.f.mcginty@gmail.com".freeze]
|
13
|
-
s.files = ["bin/boot.rb".freeze, "
|
13
|
+
s.files = ["bin/boot.rb".freeze, "config/application.rb".freeze, "config/boot.rb".freeze, "config/commands.rb".freeze, "config/shared_commands.rb".freeze, "config/version.rb".freeze, "lib/origen_app_generators.rb".freeze, "lib/origen_app_generators/application.rb".freeze, "lib/origen_app_generators/base.rb".freeze, "lib/origen_app_generators/empty_application.rb".freeze, "lib/origen_app_generators/empty_plugin.rb".freeze, "lib/origen_app_generators/new.rb".freeze, "lib/origen_app_generators/new_app_tests.rb".freeze, "lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb".freeze, "lib/origen_app_generators/plugin.rb".freeze, "lib/origen_app_generators/test_engineering/common.rb".freeze, "lib/origen_app_generators/test_engineering/stand_alone_application.rb".freeze, "lib/origen_app_generators/test_engineering/test_block.rb".freeze, "templates/app_generators".freeze, "templates/app_generators/application".freeze, "templates/app_generators/application/.gitignore".freeze, "templates/app_generators/application/.irbrc".freeze, "templates/app_generators/application/.rspec".freeze, "templates/app_generators/application/.travis.yml".freeze, "templates/app_generators/application/Gemfile".freeze, "templates/app_generators/application/Rakefile".freeze, "templates/app_generators/application/app".freeze, "templates/app_generators/application/app/blocks".freeze, "templates/app_generators/application/app/blocks/top_level.rb".freeze, "templates/app_generators/application/app/lib".freeze, "templates/app_generators/application/app/lib/module.rb".freeze, "templates/app_generators/application/app/templates".freeze, "templates/app_generators/application/app/templates/web".freeze, "templates/app_generators/application/app/templates/web/index.md.erb".freeze, "templates/app_generators/application/app/templates/web/layouts".freeze, "templates/app_generators/application/app/templates/web/layouts/_basic.html.erb".freeze, "templates/app_generators/application/app/templates/web/partials".freeze, "templates/app_generators/application/app/templates/web/partials/_navbar.html.erb".freeze, "templates/app_generators/application/app/templates/web/release_notes.md.erb".freeze, "templates/app_generators/application/config".freeze, "templates/app_generators/application/config/application.rb".freeze, "templates/app_generators/application/config/boot.rb".freeze, "templates/app_generators/application/config/commands.rb".freeze, "templates/app_generators/application/config/maillist_dev.txt".freeze, "templates/app_generators/application/config/maillist_prod.txt".freeze, "templates/app_generators/application/config/version.rb".freeze, "templates/app_generators/application/doc".freeze, "templates/app_generators/application/doc/history".freeze, "templates/app_generators/application/dot_keep".freeze, "templates/app_generators/application/origen_core_session".freeze, "templates/app_generators/application/target".freeze, "templates/app_generators/application/target/debug.rb".freeze, "templates/app_generators/application/target/default.rb".freeze, "templates/app_generators/application/target/production.rb".freeze, "templates/app_generators/application/test".freeze, "templates/app_generators/application/test/spec".freeze, "templates/app_generators/application/test/spec/spec_helper.rb".freeze, "templates/app_generators/new".freeze, "templates/app_generators/new/generator.rb".freeze, "templates/app_generators/new/info.md.erb".freeze, "templates/app_generators/origen_infrastructure".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/application.rb".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/base.rb".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/module.rb".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/plugin.rb".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/config".freeze, "templates/app_generators/origen_infrastructure/app_generator_plugin/config/load_generators.rb".freeze, "templates/app_generators/plugin".freeze, "templates/app_generators/plugin/Gemfile".freeze, "templates/app_generators/plugin/Rakefile".freeze, "templates/app_generators/plugin/app".freeze, "templates/app_generators/plugin/app/templates".freeze, "templates/app_generators/plugin/app/templates/web".freeze, "templates/app_generators/plugin/app/templates/web/index.md.erb".freeze, "templates/app_generators/plugin/app/templates/web/partials".freeze, "templates/app_generators/plugin/app/templates/web/partials/_navbar_external.html.erb".freeze, "templates/app_generators/plugin/app/templates/web/partials/_navbar_internal.html.erb".freeze, "templates/app_generators/plugin/config".freeze, "templates/app_generators/plugin/config/boot.rb".freeze, "templates/app_generators/plugin/gemspec.rb".freeze, "templates/app_generators/test_engineering".freeze, "templates/app_generators/test_engineering/environment".freeze, "templates/app_generators/test_engineering/environment/j750.rb".freeze, "templates/app_generators/test_engineering/environment/uflex.rb".freeze, "templates/app_generators/test_engineering/environment/v93k.rb".freeze, "templates/app_generators/test_engineering/stand_alone_application".freeze, "templates/app_generators/test_engineering/stand_alone_application/.keep".freeze, "templates/app_generators/test_engineering/test_block".freeze, "templates/app_generators/test_engineering/test_block/.keep".freeze]
|
14
14
|
s.homepage = "http://origen-sdk.org/origen_app_generators".freeze
|
15
15
|
s.licenses = ["MIT".freeze]
|
16
16
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.3".freeze)
|
17
|
-
s.rubygems_version = "2.7.
|
17
|
+
s.rubygems_version = "2.7.7".freeze
|
18
18
|
s.summary = "Origen application generators".freeze
|
19
19
|
|
20
|
-
s.installed_by_version = "2.7.
|
20
|
+
s.installed_by_version = "2.7.7" if s.respond_to? :installed_by_version
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
s.specification_version = 4
|
24
24
|
|
25
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
-
s.add_runtime_dependency(%q<origen>.freeze, [">= 0.
|
26
|
+
s.add_runtime_dependency(%q<origen>.freeze, [">= 0.40.2"])
|
27
27
|
else
|
28
|
-
s.add_dependency(%q<origen>.freeze, [">= 0.
|
28
|
+
s.add_dependency(%q<origen>.freeze, [">= 0.40.2"])
|
29
29
|
end
|
30
30
|
else
|
31
|
-
s.add_dependency(%q<origen>.freeze, [">= 0.
|
31
|
+
s.add_dependency(%q<origen>.freeze, [">= 0.40.2"])
|
32
32
|
end
|
33
33
|
end
|
@@ -6,13 +6,24 @@ source '<%= server %>'
|
|
6
6
|
source 'https://rubygems.org'
|
7
7
|
<% end -%>
|
8
8
|
|
9
|
-
gem 'origen', '>= <%= @latest_origen_version %>'
|
9
|
+
#gem 'origen', '>= <%= @latest_origen_version %>'
|
10
|
+
gem 'origen', git: 'https://github.com/Origen-SDK/origen.git', branch: 'app_dir'
|
10
11
|
|
11
12
|
gem 'origen_doc_helpers'
|
13
|
+
<% if @development_dependencies -%>
|
14
|
+
<% @development_dependencies.each do |dep| -%>
|
15
|
+
gem <%= dep.map{ |d| "\"#{d}\"" }.join(', ') %>
|
16
|
+
<% end -%>
|
17
|
+
<% end -%>
|
12
18
|
|
13
|
-
gem 'byebug'
|
19
|
+
gem 'byebug', '~>8' # You can remove this version constraint if you don't care about your app
|
20
|
+
# supporting earlier versions of Ruby 2
|
21
|
+
<% if RUBY_VERSION < "2.3.0" -%>
|
14
22
|
|
15
|
-
|
23
|
+
# Lock this version of nokogiri to enable compatibility with Ruby 2.2, if you don't need
|
24
|
+
# that then you can remove this line
|
25
|
+
gem 'nokogiri', '1.8.5'
|
26
|
+
<% end -%>
|
16
27
|
|
17
28
|
# Uncomment these if you want to use a visual debugger (e.g. Visual Studio Code) to debug your app
|
18
29
|
#gem 'ruby-debug-ide'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|