Skip to content

Commit

Permalink
Adding a helper script for Bzlmod migration. (#74)
Browse files Browse the repository at this point in the history
* Adding a helper script for Bzlmod migration.

The script does the following things:
  - 1. Run the build without Bzlmod enabled to generate resolved external
    dependencies with --experimental_repository_resolved_file
  - 2. Run the build with Bzlmod enabled and identify recongnized error message
  - 3. Use the resolved external deps info to give migration suggestions.
  - 4. Repeat 2 and 3 until all external deps are available via Bzlmod (or WORKSPACE.bzlmod).

To start the migration, clone the Bazel central registry repo and run the following command from your project root:
```
<path to a local BCR repo>/tools/migrate_to_bzlmod.py <build flags> <build targets>
```

* More fixes

* Rename function

* Address comments
  • Loading branch information
meteorcloudy committed Mar 15, 2022
1 parent ae9df9b commit 92bb87f
Show file tree
Hide file tree
Showing 3 changed files with 547 additions and 23 deletions.
10 changes: 7 additions & 3 deletions tools/add_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@
import sys
import time

from colorama import Fore, Style
from registry import Module
from registry import RegistryClient
from registry import log


YELLOW = "\x1b[33m"
RESET = "\x1b[0m"


def yes_or_no(question, default):
if default:
question += " [Y/n]: "
Expand All @@ -67,7 +70,7 @@ def yes_or_no(question, default):


def ask_input(msg):
return input(f"{Fore.YELLOW}ACTION: {Style.RESET_ALL}{msg}")
return input(f"{YELLOW}ACTION: {RESET}{msg}")


def from_user_input():
Expand Down Expand Up @@ -123,7 +126,8 @@ def from_user_input():
module.add_build_target(target)

if yes_or_no("Do you have a test module in your source archive?", True):
module.test_module_path = ask_input("Please enter the test module path in your source archive: ")
module.test_module_path = ask_input(
"Please enter the test module path in your source archive: ")
first = True
while not (module.test_module_build_targets or module.test_module_test_targets):
if not first:
Expand Down
Loading

0 comments on commit 92bb87f

Please sign in to comment.