|
96 | 96 |
|
97 | 97 | # compile the schematron |
98 | 98 | metaschema_toolchain="${OSCALDIR}/build/metaschema/toolchains/xslt-M4" |
99 | | -schematron="${metaschema_toolchain}/validate/metaschema-composition-check.sch" |
100 | | -compiled_schematron="${metaschema_toolchain}/validate/metaschema-composition-check-compiled.xsl" |
| 99 | +composition_check_schematron="${metaschema_toolchain}/validate/metaschema-composition-check.sch" |
| 100 | +documentation_check_schematron="${OSCALDIR}/src/utils/schematron/oscal-documentation.sch" |
| 101 | +compiled_composition_check_schematron="${metaschema_toolchain}/validate/metaschema-composition-check-compiled.xsl" |
| 102 | +compiled_documentation_check_schematron="${SCRATCH_DIR}/oscal-documentation.xsl" |
101 | 103 | metaschema_xsd="${OSCALDIR}/build/metaschema/schema/xml/metaschema.xsd" |
102 | 104 |
|
103 | | -build_schematron "$schematron" "$compiled_schematron" |
| 105 | +build_schematron "$composition_check_schematron" "$compiled_composition_check_schematron" |
104 | 106 | cmd_exitcode=$? |
105 | 107 | if [ $cmd_exitcode -ne 0 ]; then |
106 | | - echo -e "${P_ERROR}Compilation of Schematron '${P_END}${schematron}${P_ERROR}' failed.${P_END}" |
| 108 | + echo -e "${P_ERROR}Compilation of Schematron '${P_END}${composition_check_schematron}${P_ERROR}' failed.${P_END}" |
| 109 | + exit 1 |
| 110 | +fi |
| 111 | + |
| 112 | +build_schematron "$documentation_check_schematron" "$compiled_documentation_check_schematron" |
| 113 | +cmd_exitcode=$? |
| 114 | +if [ $cmd_exitcode -ne 0 ]; then |
| 115 | + echo -e "${P_ERROR}Compilation of Schematron '${P_END}${documentation_check_schematron}${P_ERROR}' failed.${P_END}" |
107 | 116 | exit 1 |
108 | 117 | fi |
109 | 118 |
|
@@ -137,26 +146,39 @@ while IFS="|" read path gen_schema gen_converter gen_docs || [[ -n "$path" ]]; d |
137 | 146 | echo -e "${P_ERROR}XML Schema validation failed for metaschema '${P_END}${metaschema_relative}${P_ERROR}'.${P_END}" |
138 | 147 | echo -e "${P_ERROR}${result}${P_END}" |
139 | 148 | exitcode=1 |
| 149 | + fi |
| 150 | + |
| 151 | + svrl_result="$SCRATCH_DIR/svrl/composition_check_${metaschema/$OSCALDIR\/src\//}.svrl" |
| 152 | + svrl_result_dir=${svrl_result%/*} |
| 153 | + mkdir -p "$svrl_result_dir" |
| 154 | + result=$(validate_with_schematron "$compiled_composition_check_schematron" "$metaschema" "$svrl_result") |
| 155 | + cmd_exitcode=$? |
| 156 | + if [ $cmd_exitcode -ne 0 ]; then |
| 157 | + echo -e "${P_ERROR}Schematron composition validation failed for metaschema '${P_END}${metaschema_relative}${P_ERROR}'.${P_END}" |
| 158 | + echo -e "${P_ERROR}${result}${P_END}" |
| 159 | + exitcode=1 |
140 | 160 | else |
141 | | - svrl_result="$SCRATCH_DIR/svrl/${metaschema/$OSCALDIR\/src\//}.svrl" |
142 | | - svrl_result_dir=${svrl_result%/*} |
143 | | - mkdir -p "$svrl_result_dir" |
144 | | - result=$(validate_with_schematron "$compiled_schematron" "$metaschema" "$svrl_result") |
145 | | - cmd_exitcode=$? |
146 | | - if [ $cmd_exitcode -ne 0 ]; then |
147 | | - echo -e "${P_ERROR}Schematron validation failed for metaschema '${P_END}${metaschema_relative}${P_ERROR}'.${P_END}" |
148 | | - echo -e "${P_ERROR}${result}${P_END}" |
149 | | - exitcode=1 |
150 | | - else |
151 | | - echo -e "${P_OK}XML Schema and Schematron validation passed for '${P_END}${metaschema_relative}${P_OK}'.${P_END}" |
152 | | - fi |
| 161 | + echo -e "${P_OK}Schematron composition validation passed for '${P_END}${metaschema_relative}${P_OK}'.${P_END}" |
| 162 | + fi |
| 163 | + |
| 164 | + svrl_result="$SCRATCH_DIR/svrl/documentation_check_${metaschema/$OSCALDIR\/src\//}.svrl" |
| 165 | + svrl_result_dir=${svrl_result%/*} |
| 166 | + mkdir -p "$svrl_result_dir" |
| 167 | + result=$(validate_with_schematron "$compiled_documentation_check_schematron" "$metaschema" "$svrl_result") |
| 168 | + cmd_exitcode=$? |
| 169 | + if [ $cmd_exitcode -ne 0 ]; then |
| 170 | + echo -e "${P_ERROR}Schematron documentation validation failed for metaschema '${P_END}${metaschema_relative}${P_ERROR}'.${P_END}" |
| 171 | + echo -e "${P_ERROR}${result}${P_END}" |
| 172 | + exitcode=1 |
| 173 | + else |
| 174 | + echo -e "${P_OK}All XML Schema and Schematron validation passed for '${P_END}${metaschema_relative}${P_OK}'.${P_END}" |
153 | 175 | fi |
154 | 176 | done |
155 | 177 | done < $OSCALDIR/build/ci-cd/config/metaschema |
156 | 178 | shopt -u nullglob |
157 | 179 | shopt -u globstar |
158 | 180 |
|
159 | 181 | # cleanup compiled schematron |
160 | | -rm -f "$compiled_schematron" |
| 182 | +rm -f "$compiled_composition_check_schematron" |
161 | 183 |
|
162 | 184 | exit $exitcode |
0 commit comments