Skip to content

Commit f1de4ae

Browse files
gregestrencopybara-github
authored andcommitted
Remove unused Java references.
Part of a Bazel dead code cleanup. PiperOrigin-RevId: 532258399 Change-Id: I22d8f74b0be90ae01771c559f7f3ef086ab7e5cb
1 parent 540ab18 commit f1de4ae

File tree

2 files changed

+9
-94
lines changed

2 files changed

+9
-94
lines changed

src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import com.google.devtools.build.lib.util.CPU;
1818
import com.google.devtools.build.lib.util.OS;
19-
import com.google.devtools.build.lib.util.Pair;
2019
import com.google.devtools.common.options.Converter;
2120
import com.google.devtools.common.options.OptionsParsingException;
2221

@@ -83,51 +82,6 @@ public String convert(String input) throws OptionsParsingException {
8382
return input;
8483
}
8584

86-
/**
87-
* Reverses the conversion performed by {@link Converter#convert} to return the matching OS, CPU
88-
* pair.
89-
*/
90-
public static Pair<CPU, OS> reverse(String input) {
91-
if (input == null || input.length() == 0 || "unknown".equals(input)) {
92-
// Use the auto-detected values.
93-
return Pair.of(CPU.getCurrent(), OS.getCurrent());
94-
}
95-
96-
// Handle the easy cases.
97-
if (input.startsWith("darwin")) {
98-
return Pair.of(CPU.getCurrent(), OS.DARWIN);
99-
} else if (input.startsWith("freebsd")) {
100-
return Pair.of(CPU.getCurrent(), OS.FREEBSD);
101-
} else if (input.startsWith("openbsd")) {
102-
return Pair.of(CPU.getCurrent(), OS.OPENBSD);
103-
} else if (input.startsWith("x64_windows")) {
104-
return Pair.of(CPU.getCurrent(), OS.WINDOWS);
105-
}
106-
107-
// Handle the Linux cases.
108-
switch (input) {
109-
case "piii":
110-
return Pair.of(CPU.X86_32, OS.LINUX);
111-
case "k8":
112-
return Pair.of(CPU.X86_64, OS.LINUX);
113-
case "ppc":
114-
return Pair.of(CPU.PPC, OS.LINUX);
115-
case "arm":
116-
return Pair.of(CPU.ARM, OS.LINUX);
117-
case "s390x":
118-
return Pair.of(CPU.S390X, OS.LINUX);
119-
case "mips64":
120-
return Pair.of(CPU.MIPS64, OS.LINUX);
121-
case "riscv64":
122-
return Pair.of(CPU.RISCV64, OS.LINUX);
123-
default:
124-
// fall through
125-
}
126-
127-
// Use the auto-detected values.
128-
return Pair.of(CPU.getCurrent(), OS.getCurrent());
129-
}
130-
13185
@Override
13286
public String getTypeDescription() {
13387
return "a string";

src/main/java/com/google/devtools/build/lib/packages/PackageSpecification.java

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,6 @@ public abstract class PackageSpecification {
7575
// TODO(b/77598306): Remove the parameter after switching all callers to pass true.
7676
protected abstract String asString(boolean includeDoubleSlash);
7777

78-
/**
79-
* Returns a string representation of this package spec without the repository, and which is
80-
* round-trippable through {@link #fromString}.
81-
*
82-
* <p>For instance, {@code @somerepo//pkg/subpkg/...} turns into {@code "//pkg/subpkg/..."}.
83-
*
84-
* <p>Omitting the repository means that the returned strings are ambiguous in the absence of
85-
* additional context. But, for instance, if interpreted with respect to a {@code package_group}'s
86-
* {@code packages} attribute, the strings always have the same repository as the package group.
87-
*/
88-
// TODO(brandjon): This method's main benefit is that it's round-trippable. But we can already
89-
// achieve the same thing with asString(), if the caller parses out the repo to pass to
90-
// fromString() as a separate arg. It'd be nice to eliminate this method in favor of asString()
91-
// and make a version of fromString() that can parse repo names in the label. We'd just have to
92-
// mimic the Label parsing of repo (we can't reuse Label parsing directly since it won't like the
93-
// `/...` syntax). Repo remapping shouldn't come up, since the names we get from stringification
94-
// ought to already be canonical/absolute.
95-
protected abstract String asStringWithoutRepository();
96-
9778
@Override
9879
public String toString() {
9980
return asString(/*includeDoubleSlash=*/ false);
@@ -300,12 +281,6 @@ protected String asString(boolean includeDoubleSlash) {
300281
return PackageGroupContents.stringForSinglePackage(singlePackageName, includeDoubleSlash);
301282
}
302283

303-
@Override
304-
protected String asStringWithoutRepository() {
305-
return PackageGroupContents.stringForSinglePackageWithDoubleSlashAndWithoutRepository(
306-
singlePackageName);
307-
}
308-
309284
@Override
310285
public boolean equals(Object o) {
311286
if (this == o) {
@@ -342,12 +317,6 @@ protected String asString(boolean includeDoubleSlash) {
342317
return PackageGroupContents.stringForAllPackagesBeneath(prefix, includeDoubleSlash);
343318
}
344319

345-
@Override
346-
protected String asStringWithoutRepository() {
347-
return PackageGroupContents.stringForAllPackagesBeneathWithDoubleSlashAndWithoutRepository(
348-
prefix);
349-
}
350-
351320
@Override
352321
public boolean equals(Object o) {
353322
if (this == o) {
@@ -384,11 +353,6 @@ protected String asString(boolean includeDoubleSlash) {
384353
return "-" + delegate.asString(includeDoubleSlash);
385354
}
386355

387-
@Override
388-
protected String asStringWithoutRepository() {
389-
return "-" + delegate.asStringWithoutRepository();
390-
}
391-
392356
@Override
393357
public boolean equals(Object obj) {
394358
if (this == obj) {
@@ -419,11 +383,6 @@ protected String asString(boolean includeDoubleSlash) {
419383
return PackageGroupContents.stringForAllPackages(includeDoubleSlash);
420384
}
421385

422-
@Override
423-
protected String asStringWithoutRepository() {
424-
return "public";
425-
}
426-
427386
@Override
428387
public boolean equals(Object o) {
429388
return o instanceof AllPackages;
@@ -450,11 +409,6 @@ protected String asString(boolean includeDoubleSlash) {
450409
return "private";
451410
}
452411

453-
@Override
454-
protected String asStringWithoutRepository() {
455-
return "private";
456-
}
457-
458412
@Override
459413
public boolean equals(Object o) {
460414
return o instanceof NoPackages;
@@ -692,8 +646,15 @@ private static String stringForAllPackagesBeneath(
692646
}
693647

694648
/**
695-
* Does the equivalent of mapping {@link PackageSpecification#asStringWithoutRepository} to the
696-
* component package specs.
649+
* /** Returns a string representation of this package spec without the repository, and which is
650+
* round-trippable through {@link #fromString}.
651+
*
652+
* <p>For instance, {@code @somerepo//pkg/subpkg/...} turns into {@code "//pkg/subpkg/..."}.
653+
*
654+
* <p>Omitting the repository means that the returned strings are ambiguous in the absence of
655+
* additional context. But, for instance, if interpreted with respect to a {@code
656+
* package_group}'s {@code packages} attribute, the strings always have the same repository as
657+
* the package group.
697658
*
698659
* <p>Note that this is ambiguous w.r.t. specs that reference other repositories.
699660
*

0 commit comments

Comments
 (0)