MCPcopy Create free account
hub / github.com/Impact-I/reFlutter / patch_source

Function patch_source

reflutter/utils.py:426–620  ·  view source on GitHub ↗
(libapp_hash: str, ver: int, patch_dump: bool)

Source from the content-addressed store, hash-verified

424
425
426def patch_source(libapp_hash: str, ver: int, patch_dump: bool):
427 try:
428 os.makedirs(os.path.join(os.environ["HOME"], "Documents"))
429 except Exception:
430 pass
431 try:
432 os.makedirs("Documents")
433 except Exception:
434 pass
435 replace_file_text(
436 "DEPS",
437 "'src/third_party/dart/third_party/pkg/stagehand':\n Var('dart_git') + '/stagehand.git@e64ac90cac508981011299c4ceb819149e71f1bd',",
438 "",
439 )
440 replace_file_text(
441 "DEPS",
442 "'src/third_party/dart/third_party/pkg/stagehand':\n Var('dart_git') + '/stagehand.git' + '@' + Var('dart_stagehand_tag'),",
443 "",
444 )
445 replace_file_text(
446 "DEPS",
447 "'src/third_party/dart/third_party/pkg/tflite_native':\n Var('dart_git') + '/tflite_native.git' + '@' + Var('dart_tflite_native_rev'),",
448 "",
449 )
450 replace_file_text(
451 "src/third_party/dart/DEPS",
452 'Var("dart_root") + "/third_party/pkg/tflite_native":\n Var("dart_git") + "tflite_native.git" + "@" + Var("tflite_native_rev"),',
453 "",
454 )
455 replace_file_text(
456 "DEPS",
457 'Var("dart_root") + "/third_party/pkg/tflite_native":\n Var("dart_git") + "tflite_native.git" + "@" + Var("tflite_native_rev"),',
458 "",
459 )
460
461 if ver >= 24 and patch_dump:
462 replace_file_text(
463 "src/third_party/dart/runtime/vm/clustered_snapshot.cc",
464 "monomorphic_entry_point + unchecked_offset",
465 "previous_text_offset_",
466 )
467 if ver < 24 and patch_dump:
468 replace_file_text(
469 "src/third_party/dart/runtime/vm/clustered_snapshot.cc",
470 "monomorphic_entry_point + unchecked_offset",
471 "bare_offset",
472 )
473 if ver < 39 and patch_dump:
474 replace_file_text(
475 "src/third_party/dart/runtime/vm/app_snapshot.cc",
476 "monomorphic_entry_point + unchecked_offset",
477 "previous_text_offset_",
478 )
479 if ver > 38 and patch_dump:
480 replace_file_text(
481 "src/third_party/dart/runtime/vm/app_snapshot.cc",
482 """code->untag()->monomorphic_unchecked_entry_point_ =
483 monomorphic_entry_point + unchecked_offset;""",

Callers

nothing calls this directly

Calls 1

replace_file_textFunction · 0.85

Tested by

no test coverage detected