Skip to content

Commit

Permalink
Rename Label.local_target_label to Label.same_package_label
Browse files Browse the repository at this point in the history
"local" is an incredibly overloaded term.

Follow-up for #16210

RELNOTES: Label.local_target_label is renamed to Label.same_package_label.
PiperOrigin-RevId: 591940544
Change-Id: Ic050234471dc7c729a014794de57590a145b1e34
  • Loading branch information
Wyverald committed Jan 22, 2024
1 parent 291cb02 commit 6769e35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ public String getRepoName() throws EvalException {
* @throws LabelSyntaxException if {@code targetName} is not a valid target name
*/
@StarlarkMethod(
name = "local_target_label",
name = "same_package_label",
doc = "Creates a label in the same package as this label with the given target name.",
parameters = {@Param(name = "target_name", doc = "The target name of the new label.")})
public Label getLocalTargetLabel(String targetName) throws LabelSyntaxException {
public Label getSamePackageLabel(String targetName) throws LabelSyntaxException {
return create(packageIdentifier, targetName);
}

Expand All @@ -485,7 +485,7 @@ public Label getLocalTargetLabel(String targetName) throws LabelSyntaxException
doc =
"<strong>Deprecated.</strong> This method behaves surprisingly when used with an argument"
+ " containing an apparent repo name. Prefer <a"
+ " href=\"#local_target_label\"><code>Label.local_target_label()</code></a>, <a"
+ " href=\"#local_target_label\"><code>Label.same_package_label()</code></a>, <a"
+ " href=\"../toplevel/native#package_relative_label\"><code>native.package_relative_label()</code></a>,"
+ " or <a href=\"#Label\"><code>Label()</code></a> instead.<p>Resolves a label that"
+ " is either absolute (starts with <code>//</code>) or relative to the current"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public static void addMockK8Platform(MockToolsConfig mockToolsConfig, Label cros
"toolchain(",
" name = 'toolchain_cc-compiler-k8',",
" toolchain_type = '" + TestConstants.TOOLS_REPOSITORY + "//tools/cpp:toolchain_type',",
" toolchain = '" + crosstoolLabel.getLocalTargetLabel("cc-compiler-k8-compiler") + "',",
" toolchain = '" + crosstoolLabel.getSamePackageLabel("cc-compiler-k8-compiler") + "',",
" target_compatible_with = [':mock_value'],",
")");
}
Expand All @@ -220,7 +220,7 @@ public static void addMockPPCPlatform(MockToolsConfig mockToolsConfig, Label cro
"toolchain(",
" name = 'toolchain_cc-compiler-ppc',",
" toolchain_type = '" + TestConstants.TOOLS_REPOSITORY + "//tools/cpp:toolchain_type',",
" toolchain = '" + crosstoolLabel.getLocalTargetLabel("cc-compiler-ppc-compiler") + "',",
" toolchain = '" + crosstoolLabel.getSamePackageLabel("cc-compiler-ppc-compiler") + "',",
" target_compatible_with = [':mock_value'],",
")");
}
Expand Down

0 comments on commit 6769e35

Please sign in to comment.