From 97cd2957e55a33f8dc38f8cf38d6841c6112285e Mon Sep 17 00:00:00 2001 From: cmita Date: Thu, 21 Apr 2022 03:09:31 -0700 Subject: [PATCH] Remove cpu-arch logic from Java code. PiperOrigin-RevId: 443325184 --- .../devtools/build/lib/rules/cpp/FakeCPU.java | 67 ------------------- .../lib/rules/cpp/GoogleLegacyStubs.java | 5 -- .../cpp/GoWrapCcHelperApi.java | 10 --- 3 files changed, 82 deletions(-) delete mode 100644 src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCPU.java diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCPU.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCPU.java deleted file mode 100644 index edfa7a460f8797..00000000000000 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCPU.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2018 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.build.lib.rules.cpp; - -/** - * DO NOT USE in Bazel. - * - *

A temporary, and very regrettable Google-only hack that allows us to support targeting other - * platforms in certain cases. - */ -public class FakeCPU { - - private FakeCPU() { - // Private constructor to prohibit creating objects. - } - - /** - * These are fake CPU values used to indicate that amd64 OSX / Windows should be - * the targeted architecture and platform. This is a hack to support compiling - * Go targeting OSX and Windows, until we have proper support for this kind of thing. - * It is largely unsupported. - */ - public static final String DARWIN_FAKE_CPU = "x86_64-darwin"; - public static final String WINDOWS_FAKE_CPU_64 = "x86_64-windows"; - public static final String WINDOWS_FAKE_CPU_32 = "x86_32-windows"; - - public static boolean isFakeCPU(String cpu) { - return DARWIN_FAKE_CPU.equals(cpu) || WINDOWS_FAKE_CPU_32.equals(cpu) - || WINDOWS_FAKE_CPU_64.equals(cpu); - } - - /** - * Returns the real CPU for a (possible) fake CPU. If isFakeCPU(fakeCPU) - * returns true, - * this method will return the actual target CPU that should be used. - * Otherwise, it - * will simply return fakeCPU. - */ - public static String getRealCPU(String fakeCPU) { - if (isFakeCPU(fakeCPU)) { - // We have a special fake CPU for 32 bit Windows binaries. - if (WINDOWS_FAKE_CPU_32.equals(fakeCPU)) { - return "piii"; - } - // If targeting darwin or windows 64, pretend to be k8 so that we don't need to - // mess with crosstool configurations. A big fat warning was printed by the - // ConfigurationFactory warning people that they shouldn't expect anything - // other than go_{binary,library} to work, so the spurious - // k8 results we will return for other languages are fine. - return "k8"; - } else { - return fakeCPU; - } - } -} diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/GoogleLegacyStubs.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/GoogleLegacyStubs.java index a9f1086ecdcf1b..b297ccb5a2f0c8 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/GoogleLegacyStubs.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/GoogleLegacyStubs.java @@ -190,11 +190,6 @@ public RunfilesApi starlarkGetGoRunfiles( return null; } - @Override - public int getArchIntSize(GoConfigurationApi goConfig) { - return 0; - } - @Override public GoContextInfoApi starlarkCollectTransitiveGoContextGopkg( StarlarkRuleContextApi starlarkRuleContext, diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/GoWrapCcHelperApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/GoWrapCcHelperApi.java index 53e7058e9c9def..e500a55eba941f 100644 --- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/GoWrapCcHelperApi.java +++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/GoWrapCcHelperApi.java @@ -78,16 +78,6 @@ public interface GoWrapCcHelperApi< public RunfilesApi starlarkGetGoRunfiles(StarlarkRuleContextT starlarkRuleContext) throws EvalException, InterruptedException; - @StarlarkMethod( - name = "get_arch_int_size", - doc = "", - documented = false, - parameters = { - @Param(name = "go", positional = false, named = true), - }) - // TODO(b/113797843): Not written in Starlark because of GoCompilationHelper. - public int getArchIntSize(GoConfigurationT goConfig); - @StarlarkMethod( name = "collect_transitive_go_context_gopkg", doc = "",