@@ -7,63 +7,69 @@ require "pathname"
7
7
PROC_CRD_DOC_DIR = Pathname . new "#{ $root} /backends/proc_crd"
8
8
PROC_CRD_GEN_DIR = $root / "gen" / "proc_crd"
9
9
10
- Dir . glob ( "#{ $root} /arch/proc_cert_model/*.yaml" ) do |f |
11
- model_name = File . basename ( f , ".yaml" )
12
- model_obj = YAML . load_file ( f , permitted_classes : [ Date ] )
13
- class_name = File . basename ( model_obj [ 'class' ] [ '$ref' ] . split ( "#" ) [ 0 ] , ".yaml" )
14
- raise "Ill-formed processor certificate model file #{ f } : missing 'class' field" if model_obj [ 'class' ] . nil?
15
-
16
- file "#{ PROC_CRD_GEN_DIR } /adoc/#{ model_name } -CRD.adoc" => [
17
- __FILE__ ,
18
- "#{ $root} /arch/proc_cert_class/#{ class_name } .yaml" ,
19
- "#{ $root} /arch/proc_cert_model/#{ model_name } .yaml" ,
20
- "#{ $root} /lib/arch_obj_models/certificate.rb" ,
21
- "#{ $root} /lib/arch_obj_models/portfolio.rb" ,
22
- "#{ $root} /lib/portfolio_design.rb" ,
23
- "#{ $root} /backends/portfolio/templates/ext_appendix.adoc.erb" ,
24
- "#{ $root} /backends/portfolio/templates/inst_appendix.adoc.erb" ,
25
- "#{ $root} /backends/portfolio/templates/csr_appendix.adoc.erb" ,
26
- "#{ $root} /backends/portfolio/templates/beginning.adoc.erb" ,
27
- "#{ $root} /backends/proc_cert/templates/typographic.adoc.erb" ,
28
- "#{ $root} /backends/proc_cert/templates/rev_history.adoc.erb" ,
29
- "#{ $root} /backends/proc_cert/templates/related_specs.adoc.erb" ,
30
- "#{ $root} /backends/proc_cert/templates/priv_modes.adoc.erb" ,
31
- "#{ $root} /backends/proc_cert/templates/rev_history.adoc.erb" ,
32
- "#{ PROC_CRD_DOC_DIR } /templates/proc_crd.adoc.erb"
33
- ] do |t |
34
- proc_cert_create_adoc ( "#{ PROC_CRD_DOC_DIR } /templates/proc_crd.adoc.erb" , t . name , model_name )
35
- end
10
+ rule %r{#{ PROC_CRD_GEN_DIR } /adoc/[^/]+-CRD.adoc} => [
11
+ __FILE__ ,
12
+ "#{ $root} /lib/arch_obj_models/certificate.rb" ,
13
+ "#{ $root} /lib/arch_obj_models/portfolio.rb" ,
14
+ "#{ $root} /lib/portfolio_design.rb" ,
15
+ "#{ $root} /backends/portfolio/templates/ext_appendix.adoc.erb" ,
16
+ "#{ $root} /backends/portfolio/templates/inst_appendix.adoc.erb" ,
17
+ "#{ $root} /backends/portfolio/templates/csr_appendix.adoc.erb" ,
18
+ "#{ $root} /backends/portfolio/templates/beginning.adoc.erb" ,
19
+ "#{ $root} /backends/proc_cert/templates/typographic.adoc.erb" ,
20
+ "#{ $root} /backends/proc_cert/templates/rev_history.adoc.erb" ,
21
+ "#{ $root} /backends/proc_cert/templates/related_specs.adoc.erb" ,
22
+ "#{ $root} /backends/proc_cert/templates/priv_modes.adoc.erb" ,
23
+ "#{ $root} /backends/proc_cert/templates/rev_history.adoc.erb" ,
24
+ "#{ PROC_CRD_DOC_DIR } /templates/proc_crd.adoc.erb"
25
+ ] do |t |
26
+ model_name = File . basename ( t . name , ".adoc" ) [ 0 ...-4 ]
27
+ proc_cert_create_adoc ( "#{ PROC_CRD_DOC_DIR } /templates/proc_crd.adoc.erb" , t . name , model_name , ENV [ "CONFIG" ] )
28
+ end
36
29
37
- file "#{ PROC_CRD_GEN_DIR } /pdf/#{ model_name } -CRD.pdf" => [
30
+ rule %r{#{ PROC_CRD_GEN_DIR } /pdf/[^/]+-CRD.pdf} => proc { |tname |
31
+ model_name = File . basename ( tname , ".pdf" ) [ 0 ...-4 ]
32
+ [
38
33
__FILE__ ,
39
34
"#{ PROC_CRD_GEN_DIR } /adoc/#{ model_name } -CRD.adoc"
40
- ] do |t |
41
- pf_adoc2pdf ( "#{ PROC_CRD_GEN_DIR } /adoc/#{ model_name } -CRD.adoc" , t . name )
42
- end
35
+ ]
36
+ } do |t |
37
+ model_name = File . basename ( t . name , ".pdf" ) [ 0 ...-4 ]
38
+ pf_adoc2pdf ( "#{ PROC_CRD_GEN_DIR } /adoc/#{ model_name } -CRD.adoc" , t . name )
39
+ end
43
40
44
- file "#{ PROC_CRD_GEN_DIR } /html/#{ model_name } -CRD.html" => [
41
+ rule %r{#{ PROC_CRD_GEN_DIR } /html/[^/]+-CRD.html"} => proc { |tname |
42
+ model_name = File . basename ( tname , ".html" ) [ 0 ...-4 ]
43
+ [
45
44
__FILE__ ,
46
45
"#{ PROC_CRD_GEN_DIR } /adoc/#{ model_name } -CRD.adoc"
47
- ] do |t |
48
- pf_adoc2html ( "#{ PROC_CRD_GEN_DIR } /adoc/#{ model_name } -CRD.adoc" , t . name )
49
- end
46
+ ]
47
+ } do |t |
48
+ model_name = File . basename ( t . name , ".html" ) [ 0 ...-4 ]
49
+ pf_adoc2html ( "#{ PROC_CRD_GEN_DIR } /adoc/#{ model_name } -CRD.adoc" , t . name )
50
50
end
51
51
52
52
namespace :gen do
53
53
desc <<~DESC
54
54
Generate Processor CRD (Certification Requirements Document) as a PDF.
55
55
56
56
Required options:
57
- model_name - The name of the certification model under arch/proc_cert_model
57
+ CONFIG - Configuration to use for base architecture
58
+ MODE - The name of the certification model under arch/proc_cert_model
58
59
DESC
59
- task :proc_crd_pdf , [ :model_name ] do |_t , args |
60
- model_name = args [ :model_name ]
60
+ task :proc_crd_pdf do
61
+ raise "Missing required argument 'CONFIG'" unless ENV . key? ( "CONFIG" )
62
+ raise "Missing required argument 'MODEL'" unless ENV . key? ( "MODEL" )
63
+
64
+ model_name = ENV [ "MODEL" ]
61
65
if model_name . nil?
62
66
warn "Missing required option: 'model_name'"
63
67
exit 1
64
68
end
65
69
66
- unless File . exist? ( "#{ $root} /arch/proc_cert_model/#{ model_name } .yaml" )
70
+ cfg_arch = cfg_arch_for ( ENV [ "CONFIG" ] )
71
+
72
+ unless cfg_arch . proc_cert_models . any? { |model | model . name == model_name }
67
73
warn "No certification model named '#{ model_name } ' found in arch/proc_cert_model"
68
74
exit 1
69
75
end
@@ -75,19 +81,26 @@ namespace :gen do
75
81
Generate Processor CRD (Certification Requirements Document) as an HTML file.
76
82
77
83
Required options:
78
- model_name - The name of the certification model under arch/proc_cert_model
84
+ CONFIG - Configuration to use for base architecture
85
+ MODE - The name of the certification model under arch/proc_cert_model
79
86
DESC
80
- task :proc_crd_html , [ :model_name ] do |_t , args |
81
- if args [ :model_name ] . nil?
87
+ task :proc_crd_html do
88
+ raise "Missing required argument 'CONFIG'" unless ENV . key? ( "CONFIG" )
89
+ raise "Missing required argument 'MODEL'" unless ENV . key? ( "MODEL" )
90
+
91
+ model_name = ENV [ "MODEL" ]
92
+ if model_name . nil?
82
93
warn "Missing required option: 'model_name'"
83
94
exit 1
84
95
end
85
96
86
- unless File . exist? ( "#{ $root} /arch/proc_cert_model/#{ args [ :model_name ] } .yaml" )
87
- warn "No certification model named '#{ args [ :model_name ] } ' found in arch/proc_cert_model"
97
+ cfg_arch = cfg_arch_for ( ENV [ "CONFIG" ] )
98
+
99
+ unless cfg_arch . proc_cert_models . any? { |model | model . name == model_name }
100
+ warn "No certification model named '#{ model_name } ' found in arch/proc_cert_model"
88
101
exit 1
89
102
end
90
103
91
- Rake ::Task [ "#{ PROC_CRD_GEN_DIR } /html/#{ args [ : model_name] } -CRD.html" ] . invoke
104
+ Rake ::Task [ "#{ PROC_CRD_GEN_DIR } /html/#{ model_name } -CRD.html" ] . invoke
92
105
end
93
106
end
0 commit comments