diff options
author | plf <plf@google.com> | 2018-06-25 07:07:25 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-25 07:08:44 -0700 |
commit | 40e3c7cfddecea4c21e5ff418d598fd75afadfbb (patch) | |
tree | 00dce3457c56bee0b33175ea7ce1eacb463ed12a /src/main/java/com/google/devtools | |
parent | eed98a66405ff70c69d435a9419c3dc4ae7c184a (diff) |
C++: Remove CcLinkParamsStore parameter from CcLinkingInfo.
I will remove the CcLinkParamsStore class in a separate CL. For now, make sure
the API doesn't expose this class.
The only Skylark use was in cc_import which is migrated in this CL.
RELNOTES:none
PiperOrigin-RevId: 201948058
Diffstat (limited to 'src/main/java/com/google/devtools')
3 files changed, 34 insertions, 37 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java index cd3026e514..ae2992c4ba 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java @@ -19,12 +19,10 @@ import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.VisibleForSerialization; -import com.google.devtools.build.lib.skylarkbuildapi.cpp.CcLinkParamsStoreApi; /** An implementation class for the AbstractCcLinkParamsStore. */ @AutoCodec -public final class CcLinkParamsStore extends AbstractCcLinkParamsStore - implements CcLinkParamsStoreApi { +public final class CcLinkParamsStore extends AbstractCcLinkParamsStore { public static final ObjectCodec<com.google.devtools.build.lib.rules.cpp.CcLinkParamsStore> CODEC = new CcLinkParamsStore_AutoCodec(); public static final Function<TransitiveInfoCollection, AbstractCcLinkParamsStore> TO_LINK_PARAMS = diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingInfo.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingInfo.java index cb9021ef8a..91df5b6aac 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingInfo.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingInfo.java @@ -40,14 +40,24 @@ public final class CcLinkingInfo extends NativeInfo implements CcLinkingInfoApi FunctionSignature.of( /* numMandatoryPositionals= */ 0, /* numOptionalPositionals= */ 0, + // TODO(plf): Make CcLinkParams parameters mandatory once existing rules have been + // migrated. /* numMandatoryNamedOnly= */ 0, /* starArg= */ false, /* kwArg= */ false, - "cc_link_params_store", + "static_shared_params", + "static_no_shared_params", + "no_static_shared_params", + "no_static_no_shared_params", "cc_runfiles"), - /* defaultValues= */ ImmutableList.of(Runtime.NONE, Runtime.NONE), + /* defaultValues= */ ImmutableList.of( + Runtime.NONE, Runtime.NONE, Runtime.NONE, Runtime.NONE, Runtime.NONE), /* types= */ ImmutableList.of( - SkylarkType.of(CcLinkParamsStore.class), SkylarkType.of(CcRunfiles.class))); + SkylarkType.of(CcLinkParams.class), + SkylarkType.of(CcLinkParams.class), + SkylarkType.of(CcLinkParams.class), + SkylarkType.of(CcLinkParams.class), + SkylarkType.of(CcRunfiles.class))); @Nullable private static Object nullIfNone(Object object) { @@ -67,10 +77,28 @@ public final class CcLinkingInfo extends NativeInfo implements CcLinkingInfoApi Object[] args, Environment env, Location loc) throws EvalException { CcCommon.checkLocationWhitelisted(loc); int i = 0; - CcLinkParamsStore ccLinkParamsStore = (CcLinkParamsStore) nullIfNone(args[i++]); + CcLinkParams staticSharedParams = (CcLinkParams) nullIfNone(args[i++]); + CcLinkParams staticNoSharedParams = (CcLinkParams) nullIfNone(args[i++]); + CcLinkParams noStaticSharedParams = (CcLinkParams) nullIfNone(args[i++]); + CcLinkParams noStaticNoSharedParams = (CcLinkParams) nullIfNone(args[i++]); CcRunfiles ccRunfiles = (CcRunfiles) nullIfNone(args[i++]); CcLinkingInfo.Builder ccLinkingInfoBuilder = CcLinkingInfo.Builder.create(); - ccLinkingInfoBuilder.setCcLinkParamsStore(ccLinkParamsStore); + if (staticSharedParams != null) { + if (staticNoSharedParams == null + || noStaticSharedParams == null + || noStaticNoSharedParams == null) { + throw new EvalException( + loc, + "Every CcLinkParams parameter must be passed to CcLinkingInfo " + + "if one of them is passed."); + } + ccLinkingInfoBuilder.setCcLinkParamsStore( + new CcLinkParamsStore( + staticSharedParams, + staticNoSharedParams, + noStaticSharedParams, + noStaticNoSharedParams)); + } // TODO(plf): The CcDynamicLibrariesForRuntime provider can be removed perhaps. Do not // add to the API until we know for sure. The CcRunfiles provider is already in the API // at the time of this comment (cl/200184914). Perhaps it can be removed but Skylark rules diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcLinkParamsStoreApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcLinkParamsStoreApi.java deleted file mode 100644 index 94e0bb65ff..0000000000 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcLinkParamsStoreApi.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 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.skylarkbuildapi.cpp; - -import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; -import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory; - -/** Skylark interface for CcLinkParamsStore. */ -@SkylarkModule( - name = "CcLinkParamsStore", - documented = false, - doc = - "Store for all possible combinations of CcLinkParams that may be passed to the linker " - + "depending on whether we have static linking mode and whether we are building a " - + "dynamic library", - category = SkylarkModuleCategory.BUILTIN) -public interface CcLinkParamsStoreApi {} |