|
7 | 7 | CLAUDE_API_KEY = os.getenv("CLAUDE_API_KEY") |
8 | 8 | DEFAULT_BUILD_FOLDER = "build" |
9 | 9 | DEFAULT_CONFORMANCE_TESTS_FOLDER = "conformance_tests" |
| 10 | +DEFAULT_BUILD_DEST = "dist" |
| 11 | +DEFAULT_CONFORMANCE_TESTS_DEST = "dist_conformance_tests" |
10 | 12 |
|
11 | 13 | UNIT_TESTS_SCRIPT_NAME = "unittests_script" |
12 | 14 | CONFORMANCE_TESTS_SCRIPT_NAME = "conformance_tests_script" |
@@ -90,7 +92,7 @@ def update_args_with_config(args, parser): |
90 | 92 | arg_action = action_types.get(key) |
91 | 93 | if arg_action and isinstance(arg_action, argparse._StoreAction): |
92 | 94 | # For regular arguments, only skip if explicitly provided |
93 | | - if getattr(args, key) is not None: |
| 95 | + if getattr(args, key) is not None and (arg_action.default is None or value == arg_action.default): |
94 | 96 | continue |
95 | 97 | elif arg_action and isinstance(arg_action, argparse._StoreTrueAction): |
96 | 98 | # For boolean flags, skip if True (explicitly set) |
@@ -178,12 +180,44 @@ def parse_arguments(): |
178 | 180 | "2) this custom template directory (if provided), " |
179 | 181 | "3) built-in standard_template_library directory", |
180 | 182 | ) |
| 183 | + parser.add_argument( |
| 184 | + "--copy-build", |
| 185 | + action="store_true", |
| 186 | + default=False, |
| 187 | + help="If set, copy the build folder to --build-dest after every successful functional requirement rendering.", |
| 188 | + ) |
| 189 | + parser.add_argument( |
| 190 | + "--build-dest", |
| 191 | + type=non_empty_string, |
| 192 | + default=DEFAULT_BUILD_DEST, |
| 193 | + help="Target folder to copy build output to (used only if --copy-build is set).", |
| 194 | + ) |
| 195 | + parser.add_argument( |
| 196 | + "--copy-conformance-tests", |
| 197 | + action="store_true", |
| 198 | + default=False, |
| 199 | + help="If set, copy the conformance tests folder to --conformance-tests-dest after every successful functional requirement rendering. Requires --conformance-tests-script.", |
| 200 | + ) |
| 201 | + parser.add_argument( |
| 202 | + "--conformance-tests-dest", |
| 203 | + type=non_empty_string, |
| 204 | + default=DEFAULT_CONFORMANCE_TESTS_DEST, |
| 205 | + help="Target folder to copy conformance tests output to (used only if --copy-conformance-tests is set).", |
| 206 | + ) |
181 | 207 |
|
182 | 208 | args = parser.parse_args() |
183 | 209 | args = update_args_with_config(args, parser) |
184 | 210 |
|
| 211 | + if args.build_folder == args.build_dest: |
| 212 | + parser.error("--build-folder and --build-dest cannot be the same") |
| 213 | + if args.conformance_tests_folder == args.conformance_tests_dest: |
| 214 | + parser.error("--conformance-tests-folder and --conformance-tests-dest cannot be the same") |
| 215 | + |
185 | 216 | args.render_conformance_tests = args.conformance_tests_script is not None |
186 | 217 |
|
| 218 | + if not args.render_conformance_tests and args.copy_conformance_tests: |
| 219 | + parser.error("--copy-conformance-tests requires --conformance-tests-script to be set") |
| 220 | + |
187 | 221 | script_arg_names = [UNIT_TESTS_SCRIPT_NAME, CONFORMANCE_TESTS_SCRIPT_NAME] |
188 | 222 | for script_name in script_arg_names: |
189 | 223 | args = process_test_script_path(script_name, args) |
|
0 commit comments