File tree Expand file tree Collapse file tree 4 files changed +49
-29
lines changed
Expand file tree Collapse file tree 4 files changed +49
-29
lines changed Original file line number Diff line number Diff line change @@ -100,3 +100,25 @@ jobs:
100100
101101 - name : Test stdlib builds
102102 run : pcb build stdlib
103+
104+ - name : Checkout kicad-test-fixtures
105+ uses : actions/checkout@v5
106+ with :
107+ repository : diodeinc/kicad-test-fixtures
108+ token : ${{ secrets.DIODE_ROBOT_TOKEN }}
109+ path : kicad-test-fixtures
110+
111+ - name : Test pcb import (E2E)
112+ run : |
113+ pcb new --workspace test-import --repo github.com/test/test-import
114+ find kicad-test-fixtures -name '*.kicad_pro' | while IFS= read -r pro; do
115+ echo "=== Importing $pro ==="
116+ pcb import "$pro" ./test-import
117+ done
118+ for board_dir in ./test-import/boards/*/; do
119+ board=$(basename "$board_dir")
120+ echo "=== Build $board ==="
121+ pcb build "./test-import/boards/$board/$board.zen"
122+ echo "=== Layout $board ==="
123+ pcb layout "./test-import/boards/$board/$board.zen" --no-open
124+ done
Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ pub(super) fn execute(args: ImportArgs) -> Result<()> {
55 let ctx = ImportContext :: new ( args) ?;
66
77 let discovered = Discovered :: run ( ctx) ?;
8- prepare_output ( & discovered. ctx . paths , & discovered. selection ) ?;
8+ prepare_output (
9+ & discovered. ctx . paths ,
10+ & discovered. selection ,
11+ & discovered. ctx . args ,
12+ ) ?;
913 let validated = Validated :: run ( discovered) ?;
1014 let extracted = Extracted :: run ( validated) ?;
1115 let hierarchized = Hierarchized :: run ( extracted) ;
@@ -60,18 +64,29 @@ impl Discovered {
6064 }
6165}
6266
63- fn prepare_output ( paths : & ImportPaths , selection : & ImportSelection ) -> Result < ( ) > {
67+ fn prepare_output (
68+ paths : & ImportPaths ,
69+ selection : & ImportSelection ,
70+ args : & ImportArgs ,
71+ ) -> Result < ( ) > {
6472 let board_dir = paths
6573 . workspace_root
6674 . join ( "boards" )
6775 . join ( & selection. board_name ) ;
6876 if board_dir. exists ( ) {
69- std:: fs:: remove_dir_all ( & board_dir) . with_context ( || {
70- format ! (
71- "Failed to remove existing board dir {}" ,
77+ if args. force {
78+ std:: fs:: remove_dir_all ( & board_dir) . with_context ( || {
79+ format ! (
80+ "Failed to remove existing board dir {}" ,
81+ board_dir. display( )
82+ )
83+ } ) ?;
84+ } else {
85+ anyhow:: bail!(
86+ "Board directory already exists: {}. Use --force to overwrite." ,
7287 board_dir. display( )
73- )
74- } ) ? ;
88+ ) ;
89+ }
7590 }
7691
7792 let board_scaffold = crate :: new:: scaffold_board ( & paths. workspace_root , & selection. board_name ) ?;
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ pub struct ImportArgs {
104104 #[ arg( value_name = "OUTPUT_DIR" , value_hint = clap:: ValueHint :: AnyPath ) ]
105105 pub output_dir : PathBuf ,
106106
107- /// Skip interactive confirmations (continue even if ERC/DRC errors are present)
107+ /// Overwrite existing board directory if it already exists
108108 #[ arg( long = "force" ) ]
109109 pub force : bool ,
110110}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use pcb_zen_core::Diagnostics;
99pub ( super ) fn validate (
1010 paths : & ImportPaths ,
1111 selection : & ImportSelection ,
12- args : & ImportArgs ,
12+ _args : & ImportArgs ,
1313) -> Result < ImportValidationRun > {
1414 let kicad_pro_abs = paths. kicad_project_root . join ( & selection. selected . kicad_pro ) ;
1515 let kicad_sch_abs = paths. kicad_project_root . join ( & selection. selected . kicad_sch ) ;
@@ -87,26 +87,9 @@ pub(super) fn validate(
8787
8888 let error_count = diagnostics_for_render. error_count ( ) ;
8989 if error_count > 0 {
90- if args. force {
91- eprintln ! (
92- "Warning: KiCad ERC/DRC reported {error_count} errors; continuing due to --force."
93- ) ;
94- } else if !crate :: tty:: is_interactive ( ) || std:: env:: var ( "CI" ) . is_ok ( ) {
95- anyhow:: bail!(
96- "KiCad ERC/DRC reported {error_count} errors. Fix them, or re-run in an interactive terminal to confirm continuing."
97- ) ;
98- } else {
99- let continue_anyway = inquire:: Confirm :: new ( & format ! (
100- "KiCad ERC/DRC reported {error_count} errors. Continue anyway?"
101- ) )
102- . with_default ( false )
103- . prompt ( )
104- . context ( "Failed to read confirmation" ) ?;
105-
106- if !continue_anyway {
107- anyhow:: bail!( "Aborted due to KiCad ERC/DRC errors" ) ;
108- }
109- }
90+ eprintln ! (
91+ "Warning: KiCad ERC/DRC reported {error_count} errors; these do not block import."
92+ ) ;
11093 }
11194
11295 Ok ( ImportValidationRun {
You can’t perform that action at this time.
0 commit comments