MCPcopy Index your code
hub / github.com/google/adk-python / builder_build

Method builder_build

src/google/adk/cli/dev_server.py:361–404  ·  view source on GitHub ↗
(
        app_name: str, files: list[UploadFile], tmp: Optional[bool] = False
    )

Source from the content-addressed store, hash-verified

359 "/dev/apps/{app_name}/builder/save", response_model_exclude_none=True
360 )
361 async def builder_build(
362 app_name: str, files: list[UploadFile], tmp: Optional[bool] = False
363 ) -> bool:
364 try:
365 uploads: list[tuple[str, bytes]] = []
366 for file in files:
367 rel_path = _parse_upload_filename(app_name, file.filename)
368 content = await file.read()
369 uploads.append((rel_path, content))
370
371 for rel_path, content in uploads:
372 _check_yaml_for_blocked_keys(content, f"{app_name}/{rel_path}")
373
374 if tmp:
375 app_root = _get_app_root(app_name)
376 tmp_agent_root = _get_tmp_agent_root(app_root, app_name)
377 tmp_agent_root.mkdir(parents=True, exist_ok=True)
378
379 for rel_path, content in uploads:
380 destination_path = _resolve_under_dir(tmp_agent_root, rel_path)
381 destination_path.parent.mkdir(parents=True, exist_ok=True)
382 destination_path.write_bytes(content)
383
384 return True
385
386 app_root = _get_app_root(app_name)
387 app_root.mkdir(parents=True, exist_ok=True)
388
389 tmp_agent_root = _get_tmp_agent_root(app_root, app_name)
390 if tmp_agent_root.is_dir():
391 copy_dir_contents(tmp_agent_root, app_root)
392
393 for rel_path, content in uploads:
394 destination_path = _resolve_under_dir(app_root, rel_path)
395 destination_path.parent.mkdir(parents=True, exist_ok=True)
396 destination_path.write_bytes(content)
397
398 return cleanup_tmp(app_name)
399 except ValueError as exc:
400 logger.exception("Error in builder_build: %s", exc)
401 raise HTTPException(status_code=400, detail=str(exc))
402 except OSError as exc:
403 logger.exception("Error in builder_build: %s", exc)
404 return False
405
406 @app.post(
407 "/dev/apps/{app_name}/builder/cancel", response_model_exclude_none=True

Callers

nothing calls this directly

Calls 9

_parse_upload_filenameFunction · 0.85
_get_app_rootFunction · 0.85
_get_tmp_agent_rootFunction · 0.85
_resolve_under_dirFunction · 0.85
copy_dir_contentsFunction · 0.85
cleanup_tmpFunction · 0.85
readMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected