this repo has no description

Add build.py script for incremental compilation

Adds a build-only script that syncs src/ into an existing Vitis
workspace and rebuilds the app without recreating the platform/BSP.
Faster than re-running checkout.py for iterative src/ edits.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

oscillatory.net 5ab86abc ddcc3f57

verified
+61
+61
sw/scripts/build.py
··· 1 + """ 2 + Usage: vitis -s <path-to-scripts-repo>/build.py 3 + Builds an existing Vitis workspace without recreating the platform. 4 + Syncs source files from src/ into the workspace, then compiles. 5 + 6 + Requires a workspace already created by checkout.py. 7 + Much faster than checkout.py for iterative src/ edits since it skips 8 + platform/BSP rebuild. 9 + """ 10 + from vitis import create_client, dispose 11 + from os import path, sep, walk 12 + 13 + 14 + def find_app_name(src_path): 15 + """Walk src/ to find the application directory (contains a src/ subdir).""" 16 + for dirpath, dirnames, _ in walk(src_path): 17 + for dirname in dirnames: 18 + if dirname == "src": 19 + return path.basename(dirpath) 20 + return None 21 + 22 + 23 + def main(): 24 + script_path = path.dirname(path.abspath(__file__)) 25 + sw_root = script_path[:script_path.rfind(sep)] 26 + ws_path = path.join(sw_root, "ws") 27 + src_path = path.join(sw_root, "src") 28 + 29 + if not path.isdir(ws_path): 30 + raise RuntimeError( 31 + f"Workspace not found at {ws_path}. Run checkout.py first." 32 + ) 33 + 34 + app_name = find_app_name(src_path) 35 + if app_name is None: 36 + raise RuntimeError(f"Could not find application directory under {src_path}") 37 + 38 + print(f"\nBuilding app: {app_name}") 39 + print(f"Workspace: {ws_path}") 40 + print(f"Source: {path.join(src_path, app_name, 'src')}\n") 41 + 42 + client = create_client() 43 + client.set_workspace(ws_path) 44 + 45 + app = client.get_component(app_name) 46 + 47 + print("Syncing source files from src/ into workspace...") 48 + app.import_files( 49 + from_loc=path.join(src_path, app_name, "src"), 50 + dest_dir_in_cmp="src" 51 + ) 52 + 53 + print("Building...\n") 54 + app.build() 55 + 56 + dispose() 57 + print("\nBuild complete.") 58 + 59 + 60 + if __name__ == "__main__": 61 + main()