Skip to content

Commit

Permalink
Delete stale package_config.json in gclient sync hook
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer committed Dec 13, 2024
1 parent f0ff4f2 commit a64ccaf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/pub_get_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ def find_unlisted_packages():
return unlisted


def deleteConfigFiles():
# Find all package_config.json that are not under version control.
gitCmd = ['git', 'ls-files', '-o', '**/.dart_tool/package_config.json']
filesToDelete = subprocess.check_output(
gitCmd, cwd=ENGINE_DIR, stderr=subprocess.STDOUT, text=True
).splitlines()
for file in filesToDelete:
os.remove(os.path.join(ENGINE_DIR, file))


def main():
# Intentionally use the Dart SDK prebuilt instead of the Flutter prebuilt
# (i.e. prebuilts/{platform}/dart-sdk/bin/dart) because the script has to run
Expand All @@ -135,6 +145,10 @@ def main():
SRC_ROOT, 'flutter', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin'
)

# Delete all package_config.json files. These may be stale.
# Required ones will be regenerated fresh below.
deleteConfigFiles()

# Ensure all relevant packages are listed in ALL_PACKAGES.
unlisted = find_unlisted_packages()
if len(unlisted) > 0:
Expand Down

0 comments on commit a64ccaf

Please sign in to comment.