diff --git a/README.md b/README.md index b1bd1c5..b96b2f1 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ playwright_integrity_map( "mac14-arm64", "ubuntu20.04-x64", ], - playright_repo_name = "playwright", + playwright_repo_name = "playwright", ), ) ``` diff --git a/docs/integrity_map.md b/docs/integrity_map.md index 45d29fe..ca3f79d 100644 --- a/docs/integrity_map.md +++ b/docs/integrity_map.md @@ -32,7 +32,7 @@ playwright_integrity_map(name, load("@rules_playwright//playwright:defs.bzl", "playwright_browser_matrix") -playwright_browser_matrix(playright_repo_name, platforms, browser_names) +playwright_browser_matrix(platforms, browser_names, playwright_repo_name, playright_repo_name) Generates a list of Bazel target labels for browser dependencies. @@ -48,9 +48,10 @@ the appropriate Bazel target labels for each combination. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| playright_repo_name | The name of the Playwright repository. | none | | platforms | A list of platform identifiers (e.g., ['mac14-arm', 'ubuntu20.04-x64]). | none | | browser_names | A list of browser names (e.g., ['chromium', 'firefox']). | none | +| playwright_repo_name | The name of the Playwright repository. | `None` | +| playright_repo_name | (DEPRECATED: use playwright_repo_name instead) The name of the Playwright repository. | `None` | **RETURNS** diff --git a/examples/rules_js/BUILD.bazel b/examples/rules_js/BUILD.bazel index 57ef8b1..14d9678 100644 --- a/examples/rules_js/BUILD.bazel +++ b/examples/rules_js/BUILD.bazel @@ -95,6 +95,6 @@ playwright_integrity_map( "mac14-arm64", "ubuntu20.04-x64", ], - playright_repo_name = "playwright", + playwright_repo_name = "playwright", ), ) diff --git a/playwright/private/integrity_map.bzl b/playwright/private/integrity_map.bzl index ec7fc6f..e81d465 100644 --- a/playwright/private/integrity_map.bzl +++ b/playwright/private/integrity_map.bzl @@ -67,7 +67,7 @@ playwright_integrity_map = rule( }, ) -def playwright_browser_matrix(playright_repo_name, platforms, browser_names): +def playwright_browser_matrix(platforms, browser_names, playwright_repo_name = None, playright_repo_name = None): """ Generates a list of Bazel target labels for browser dependencies. @@ -77,15 +77,24 @@ def playwright_browser_matrix(playright_repo_name, platforms, browser_names): "@{playright_repo_name}//browsers:{browser_name}-{platform}" Args: - playright_repo_name: The name of the Playwright repository. platforms: A list of platform identifiers (e.g., ['mac14-arm', 'ubuntu20.04-x64]). browser_names: A list of browser names (e.g., ['chromium', 'firefox']). + playwright_repo_name: The name of the Playwright repository. + playright_repo_name: (DEPRECATED: use playwright_repo_name instead) The name of the Playwright repository. Returns: A list of browser labels to be used as the browsers attribute of the integrity_map rule. """ + # TODO(mrmeku/rules_playwright#26): remove playright_repo_name + if playwright_repo_name == None and playright_repo_name == None: + fail("playwright_repo_name must be specified") + if playwright_repo_name == None: + print("WARNING: playright_repo_name is deprecated, use playwright_repo_name instead") + playwright_repo_name = playright_repo_name + playright_repo_name = None + browser_labels = [] for browser in browser_names: for platform in platforms: - browser_labels.append("@{}//browsers:{}-{}".format(playright_repo_name, browser, platform)) + browser_labels.append("@{}//browsers:{}-{}".format(playwright_repo_name, browser, platform)) return browser_labels