Skip to content

Commit

Permalink
Remove ObjcProvider keys and flags that are no longer used anywhere.
Browse files Browse the repository at this point in the history
RELNOTES: None.
PiperOrigin-RevId: 375175411
  • Loading branch information
allevato authored and copybara-github committed May 21, 2021
1 parent d9f70b4 commit 5a647bb
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.google.devtools.build.lib.rules.objc;

import static com.google.devtools.build.lib.packages.Type.STRING;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.MULTI_ARCH_LINKED_BINARIES;
import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.DylibDependingRule.DYLIBS_ATTR_NAME;

import com.google.common.annotations.VisibleForTesting;
Expand Down Expand Up @@ -304,7 +303,6 @@ public static AppleLinkingOutputs linkMultiArchBinary(
if (shouldLipo) {
Artifact outputArtifact =
ObjcRuleClasses.intermediateArtifacts(ruleContext).combinedArchitectureBinary();
objcProviderBuilder.add(MULTI_ARCH_LINKED_BINARIES, outputArtifact);
builder.setLegacyBinaryArtifact(outputArtifact, getBinaryType(ruleContext));
new LipoSupport(ruleContext)
.registerCombineArchitecturesAction(binariesToLipo.build(), outputArtifact, platform);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,10 @@ public SplitTransitionProviderApi getMultiArchSplitProvider() {

@Override
// This method is registered statically for Starlark, and never called directly.
public ObjcProvider newObjcProvider(
Boolean usesSwift, Dict<String, Object> kwargs, StarlarkThread thread) throws EvalException {
public ObjcProvider newObjcProvider(Dict<String, Object> kwargs, StarlarkThread thread)
throws EvalException {
ObjcProvider.StarlarkBuilder resultBuilder =
new ObjcProvider.StarlarkBuilder(thread.getSemantics());
if (usesSwift) {
resultBuilder.add(ObjcProvider.FLAG, ObjcProvider.Flag.USES_SWIFT);
}
for (Map.Entry<String, Object> entry : kwargs.entrySet()) {
ObjcProvider.Key<?> key = ObjcProvider.getStarlarkKeyForString(entry.getKey());
if (key != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

package com.google.devtools.build.lib.rules.objc;

import static com.google.devtools.build.lib.rules.objc.ObjcProvider.MULTI_ARCH_LINKED_ARCHIVES;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -169,9 +167,6 @@ public final ConfiguredTarget create(RuleContext ruleContext)
RuleConfiguredTargetBuilder targetBuilder =
ObjcRuleClasses.ruleConfiguredTarget(ruleContext, filesToBuild.build());

objcProviderBuilder.add(
MULTI_ARCH_LINKED_ARCHIVES, ruleIntermediateArtifacts.combinedArchitectureArchive());

ObjcProvider objcProvider = objcProviderBuilder.build();

if (appleConfiguration.shouldLinkingRulesPropagateObjc()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ private ObjcCommon common(
.addDeps(propagatedDeps)
.addObjcProviders(additionalDepProviders)
.setIntermediateArtifacts(intermediateArtifacts)
.setAlwayslink(false)
.setLinkedBinary(intermediateArtifacts.strippedSingleArchitectureBinary());
.setAlwayslink(false);

return commonBuilder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.IMPORTED_LIBRARY;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.J2OBJC_LIBRARY;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.LIBRARY;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.LINKED_BINARY;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.LINKOPT;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.LINKSTAMP;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.MODULE_MAP;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.SDK_DYLIB;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.SDK_FRAMEWORK;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.SOURCE;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.TOP_LEVEL_MODULE_MAP;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.UMBRELLA_HEADER;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.WEAK_SDK_FRAMEWORK;

Expand Down Expand Up @@ -116,7 +114,6 @@ static class Builder {
private boolean alwayslink;
private boolean hasModuleMap;
private Iterable<Artifact> extraImportLibraries = ImmutableList.of();
private Optional<Artifact> linkedBinary = Optional.absent();
private Iterable<CcCompilationContext> ccCompilationContexts = ImmutableList.of();
private Iterable<CcCompilationContext> directCCompilationContexts = ImmutableList.of();
private Iterable<CcLinkingContext> ccLinkingContexts = ImmutableList.of();
Expand Down Expand Up @@ -318,14 +315,6 @@ Builder addExtraImportLibraries(Iterable<Artifact> extraImportLibraries) {
return this;
}

/**
* Sets a linked binary generated by this rule to be propagated to dependers.
*/
Builder setLinkedBinary(Artifact linkedBinary) {
this.linkedBinary = Optional.of(linkedBinary);
return this;
}

ObjcCommon build() {

ObjcCompilationContext.Builder objcCompilationContextBuilder =
Expand Down Expand Up @@ -452,11 +441,8 @@ ObjcCommon build() {
}
objcProvider.add(MODULE_MAP, moduleMap.getArtifact());
objcProvider.addDirect(MODULE_MAP, moduleMap.getArtifact());
objcProvider.add(TOP_LEVEL_MODULE_MAP, moduleMap);
}

objcProvider.addAll(LINKED_BINARY, linkedBinary.asSet());

ObjcCompilationContext objcCompilationContext = objcCompilationContextBuilder.build();

return new ObjcCommon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import com.google.devtools.build.lib.packages.Info;
import com.google.devtools.build.lib.rules.cpp.CcLinkingContext;
import com.google.devtools.build.lib.rules.cpp.CcLinkingContext.Linkstamp;
import com.google.devtools.build.lib.rules.cpp.CppModuleMap;
import com.google.devtools.build.lib.rules.cpp.LibraryToLink;
import com.google.devtools.build.lib.starlarkbuildapi.apple.ObjcProviderApi;
import com.google.devtools.build.lib.vfs.PathFragment;
Expand Down Expand Up @@ -123,22 +122,6 @@ public Class<E> getType() {
public static final Key<Artifact> JRE_LIBRARY =
new Key<>(LINK_ORDER, "jre_library", Artifact.class);

/**
* Single-architecture linked binaries to be combined for the final multi-architecture binary.
*/
public static final Key<Artifact> LINKED_BINARY =
new Key<>(STABLE_ORDER, "linked_binary", Artifact.class);

/** Combined-architecture binaries to include in the final bundle. */
public static final Key<Artifact> MULTI_ARCH_LINKED_BINARIES =
new Key<>(STABLE_ORDER, "combined_arch_linked_binary", Artifact.class);
/** Combined-architecture dynamic libraries to include in the final bundle. */
public static final Key<Artifact> MULTI_ARCH_DYNAMIC_LIBRARIES =
new Key<>(STABLE_ORDER, "combined_arch_dynamic_library", Artifact.class);
/** Combined-architecture archives to include in the final bundle. */
public static final Key<Artifact> MULTI_ARCH_LINKED_ARCHIVES =
new Key<>(STABLE_ORDER, "combined_arch_linked_archive", Artifact.class);

/**
* Indicates which libraries to load with {@code -force_load}. This is a subset of the union of
* the {@link #LIBRARY} and {@link #IMPORTED_LIBRARY} sets.
Expand Down Expand Up @@ -183,15 +166,6 @@ public Class<E> getType() {
public static final Key<Artifact> MODULE_MAP =
new Key<>(STABLE_ORDER, "module_map", Artifact.class);

/**
* Information about this provider's module map, in the form of a {@link CppModuleMap}. This
* is intransitive, and can be used to get just the target's module map to pass to clang or to
* get the module maps for direct but not transitive dependencies. You should only add module maps
* for this key using {@link Builder#addWithoutPropagating}.
*/
public static final Key<CppModuleMap> TOP_LEVEL_MODULE_MAP =
new Key<>(STABLE_ORDER, "top_level_module_map", CppModuleMap.class);

/** The static library files of user-specified static frameworks. */
public static final Key<Artifact> STATIC_FRAMEWORK_FILE =
new Key<>(STABLE_ORDER, "static_framework_file", Artifact.class);
Expand All @@ -200,18 +174,6 @@ public Class<E> getType() {
public static final Key<Artifact> DYNAMIC_FRAMEWORK_FILE =
new Key<>(STABLE_ORDER, "dynamic_framework_file", Artifact.class);

/**
* Debug artifacts that should be exported by the top-level target.
*/
public static final Key<Artifact> EXPORTED_DEBUG_ARTIFACTS =
new Key<>(STABLE_ORDER, "exported_debug_artifacts", Artifact.class);

/**
* Single-architecture link map for a binary.
*/
public static final Key<Artifact> LINKMAP_FILE =
new Key<>(STABLE_ORDER, "linkmap_file", Artifact.class);

/** Linking information from cc dependencies. */
public static final Key<LibraryToLink> CC_LIBRARY =
new Key<>(LINK_ORDER, "cc_library", LibraryToLink.class);
Expand Down Expand Up @@ -251,21 +213,6 @@ public enum Flag {
* is invoked.
*/
USES_CPP,

/** Indicates that Swift dependencies are present. This affects bundling actions. */
USES_SWIFT,

/**
* Indicates that a watchOS 1 extension is present in the bundle. (There can only be one
* extension for any given watchOS version in a given bundle).
*/
HAS_WATCH1_EXTENSION,

/**
* Indicates that a watchOS 2 extension is present in the bundle. (There can only be one
* extension for any given watchOS version in a given bundle).
*/
HAS_WATCH2_EXTENSION,
}

private final StarlarkSemantics semantics;
Expand All @@ -289,21 +236,15 @@ public enum Flag {
static final ImmutableList<Key<?>> KEYS_FOR_STARLARK =
ImmutableList.<Key<?>>of(
DYNAMIC_FRAMEWORK_FILE,
EXPORTED_DEBUG_ARTIFACTS,
FORCE_LOAD_LIBRARY,
HEADER,
IMPORTED_LIBRARY,
J2OBJC_LIBRARY,
JRE_LIBRARY,
LIBRARY,
LINK_INPUTS,
LINKED_BINARY,
LINKMAP_FILE,
LINKOPT,
MODULE_MAP,
MULTI_ARCH_DYNAMIC_LIBRARIES,
MULTI_ARCH_LINKED_ARCHIVES,
MULTI_ARCH_LINKED_BINARIES,
SDK_DYLIB,
SDK_FRAMEWORK,
SOURCE,
Expand Down Expand Up @@ -343,11 +284,6 @@ NestedSet<Artifact> dynamicFrameworkFile() {
return get(DYNAMIC_FRAMEWORK_FILE);
}

@Override
public Depset /*<Artifact>*/ exportedDebugArtifacts() {
return Depset.of(Artifact.TYPE, get(EXPORTED_DEBUG_ARTIFACTS));
}

@Override
public Depset /*<Artifact>*/ forceLoadLibrary() {
return Depset.of(Artifact.TYPE, get(FORCE_LOAD_LIBRARY));
Expand Down Expand Up @@ -394,16 +330,6 @@ public Sequence<Artifact> directHeaders() {
return Depset.of(Artifact.TYPE, get(LINK_INPUTS));
}

@Override
public Depset /*<Artifact>*/ linkedBinary() {
return Depset.of(Artifact.TYPE, get(LINKED_BINARY));
}

@Override
public Depset /*<Artifact>*/ linkmapFile() {
return Depset.of(Artifact.TYPE, get(LINKMAP_FILE));
}

@Override
public Depset /*<String>*/ linkopt() {
return Depset.of(Depset.ElementType.STRING, get(LINKOPT));
Expand All @@ -419,21 +345,6 @@ public Sequence<Artifact> directModuleMaps() {
return getDirect(MODULE_MAP);
}

@Override
public Depset /*<Artifact>*/ multiArchDynamicLibraries() {
return Depset.of(Artifact.TYPE, get(MULTI_ARCH_DYNAMIC_LIBRARIES));
}

@Override
public Depset /*<Artifact>*/ multiArchLinkedArchives() {
return Depset.of(Artifact.TYPE, get(MULTI_ARCH_LINKED_ARCHIVES));
}

@Override
public Depset /*<Artifact>*/ multiArchLinkedBinaries() {
return Depset.of(Artifact.TYPE, get(MULTI_ARCH_LINKED_BINARIES));
}

@Override
public Depset /*<String>*/ sdkDylib() {
return Depset.of(Depset.ElementType.STRING, get(SDK_DYLIB));
Expand Down Expand Up @@ -495,8 +406,6 @@ public Depset weakSdkFramework() {
FLAG,
// Linkstamp is not exposed to Starlark. See commentary at its definition.
LINKSTAMP,
// CppModuleMap is not exposed to Starlark.
TOP_LEVEL_MODULE_MAP,
// Strict include is handled specially.
STRICT_INCLUDE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,23 +259,13 @@ ImmutableMap<String, String> getTargetAppleEnvironment(
@StarlarkMethod(
name = "new_objc_provider",
doc = "Creates a new ObjcProvider instance.",
parameters = {
@Param(
name = "uses_swift",
defaultValue = "False",
named = true,
positional = false,
doc = "Whether this provider should enable Swift support.")
},
parameters = {},
extraKeywords =
@Param(
name = "kwargs",
defaultValue = "{}",
doc = "Dictionary of arguments."),
@Param(name = "kwargs", defaultValue = "{}", doc = "Dictionary of arguments."),
useStarlarkThread = true)
// This method is registered statically for Starlark, and never called directly.
ObjcProviderApi<?> newObjcProvider(
Boolean usesSwift, Dict<String, Object> kwargs, StarlarkThread thread) throws EvalException;
ObjcProviderApi<?> newObjcProvider(Dict<String, Object> kwargs, StarlarkThread thread)
throws EvalException;

@StarlarkMethod(
name = "new_dynamic_framework_provider",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ public interface ObjcProviderApi<FileApiT extends FileApi> extends StarlarkValue
+ "framework.")
Depset /*<FileApiT>*/ dynamicFrameworkFileForStarlark();

@StarlarkMethod(
name = "exported_debug_artifacts",
structField = true,
doc = "Debug files that should be exported by the top-level target.")
Depset /*<FileApiT>*/ exportedDebugArtifacts();

@StarlarkMethod(
name = "force_load_library",
structField = true,
Expand Down Expand Up @@ -108,20 +102,6 @@ public interface ObjcProviderApi<FileApiT extends FileApi> extends StarlarkValue
+ " add the necessary linker flags to 'linkopt'.")
Depset /*<FileApiT>*/ linkInputs();

@StarlarkMethod(
name = "linked_binary",
structField = true,
doc =
"Single-architecture linked binaries to be combined for the final multi-architecture "
+ "binary.")
Depset /*<FileApiT>*/ linkedBinary();

@StarlarkMethod(
name = "linkmap_file",
structField = true,
doc = "Single-architecture link map for a binary.")
Depset /*<FileApiT>*/ linkmapFile();

@StarlarkMethod(name = "linkopt", structField = true, doc = "Linking options.")
Depset /*<String>*/ linkopt();

Expand All @@ -139,24 +119,6 @@ public interface ObjcProviderApi<FileApiT extends FileApi> extends StarlarkValue
+ "Used to enforce proper use of private header files and for Swift compilation.")
Sequence<FileApiT> directModuleMaps();

@StarlarkMethod(
name = "multi_arch_dynamic_libraries",
structField = true,
doc = "Combined-architecture dynamic libraries to include in the final bundle.")
Depset /*<FileApiT>*/ multiArchDynamicLibraries();

@StarlarkMethod(
name = "multi_arch_linked_archives",
structField = true,
doc = "Combined-architecture archives to include in the final bundle.")
Depset /*<FileApiT>*/ multiArchLinkedArchives();

@StarlarkMethod(
name = "multi_arch_linked_binaries",
structField = true,
doc = "Combined-architecture binaries to include in the final bundle.")
Depset /*<FileApiT>*/ multiArchLinkedBinaries();

@StarlarkMethod(
name = "sdk_dylib",
structField = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ public AppleExecutableBinaryApi newExecutableBinaryProvider(
}

@Override
public ObjcProviderApi<?> newObjcProvider(
Boolean usesSwift, Dict<String, Object> kwargs, StarlarkThread thread) {
public ObjcProviderApi<?> newObjcProvider(Dict<String, Object> kwargs, StarlarkThread thread) {
return new FakeObjcProvider();
}

Expand Down
Loading

0 comments on commit 5a647bb

Please sign in to comment.