Delete system framework paths from blaze
This has been moved to crosstool.
RELNOTES: None.
PiperOrigin-RevId: 253647421
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
index ff5c600..bb807f6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java
@@ -87,9 +87,6 @@
import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException;
import com.google.devtools.build.lib.rules.apple.AppleCommandLineOptions.AppleBitcodeMode;
import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
-import com.google.devtools.build.lib.rules.apple.ApplePlatform;
-import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType;
-import com.google.devtools.build.lib.rules.apple.AppleToolchain;
import com.google.devtools.build.lib.rules.apple.XcodeConfig;
import com.google.devtools.build.lib.rules.apple.XcodeConfigProvider;
import com.google.devtools.build.lib.rules.cpp.CcCommon;
@@ -673,28 +670,11 @@
.build();
}
- /** Add framework search paths common to both headers and libraries. */
- private static void addCommonFrameworkSearchPaths(
- ImmutableList.Builder<String> paths,
- RuleContext ruleContext,
- BuildConfiguration buildConfiguration) {
-
- ApplePlatform platform =
- buildConfiguration.getFragment(AppleConfiguration.class).getSingleArchPlatform();
- paths.add(
- AppleToolchain.sdkFrameworkDir(platform, XcodeConfig.getXcodeConfigProvider(ruleContext)));
- // As of sdk8.1, XCTest is in a base Framework dir.
- if (platform.getType() != PlatformType.WATCHOS) { // WatchOS does not have this directory.
- paths.add(AppleToolchain.platformDeveloperFrameworkDir(platform));
- }
- }
-
/** Returns a list of framework search paths for clang actions for pre-cleanup mode. */
static ImmutableList<String> preCleanupFrameworkSearchPaths(
ObjcProvider provider, RuleContext ruleContext, BuildConfiguration buildConfiguration) {
- ImmutableList.Builder<String> frameworkNames = new ImmutableList.Builder<String>();
- addCommonFrameworkSearchPaths(frameworkNames, ruleContext, buildConfiguration);
+ ImmutableList.Builder<String> frameworkNames = new ImmutableList.Builder<>();
return frameworkNames
// Add custom (non-SDK) framework search paths. For each framework foo/bar.framework,
// include "foo" as a search path.
@@ -723,7 +703,6 @@
return preCleanupFrameworkSearchPaths(provider, ruleContext, buildConfiguration);
}
ImmutableList.Builder<String> searchPaths = new ImmutableList.Builder<String>();
- addCommonFrameworkSearchPaths(searchPaths, ruleContext, buildConfiguration);
return searchPaths
// Add header search paths corresponding to custom (non-SDK) frameworks. For each framework
// foo/bar.framework, include "foo" as a search path.
@@ -744,7 +723,6 @@
return preCleanupFrameworkSearchPaths(provider, ruleContext, buildConfiguration);
}
ImmutableList.Builder<String> searchPaths = new ImmutableList.Builder<String>();
- addCommonFrameworkSearchPaths(searchPaths, ruleContext, buildConfiguration);
return searchPaths
// Add library search paths corresponding to custom (non-SDK) frameworks. For each framework
// foo/bar.framework, include "foo" as a search path.
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java
index 9ba2a36..3086405 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java
@@ -36,9 +36,6 @@
import com.google.devtools.build.lib.packages.SkylarkProvider;
import com.google.devtools.build.lib.packages.StructImpl;
import com.google.devtools.build.lib.rules.apple.AppleConfiguration.ConfigurationDistinguisher;
-import com.google.devtools.build.lib.rules.apple.ApplePlatform;
-import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType;
-import com.google.devtools.build.lib.rules.apple.AppleToolchain;
import com.google.devtools.build.lib.rules.objc.AppleBinary.BinaryType;
import com.google.devtools.build.lib.rules.objc.CompilationSupport.ExtraLinkArgs;
import com.google.devtools.build.lib.syntax.SkylarkDict;
@@ -1519,33 +1516,6 @@
}
@Test
- public void testMacosFrameworkDirectories() throws Exception {
- scratch.file(
- "test/BUILD",
- "apple_binary(",
- " name = 'test',",
- " deps = [':lib'],",
- " platform_type = 'macos',",
- ")",
- "objc_library(",
- " name = 'lib',",
- " srcs = ['a.m'],",
- ")");
-
- CommandAction linkAction = linkAction("//test:test");
- ImmutableList<String> expectedCommandLineFragments =
- ImmutableList.<String>builder()
- .add(AppleToolchain.sdkDir() + AppleToolchain.SYSTEM_FRAMEWORK_PATH)
- .add(frameworkDir(ApplePlatform.forTarget(PlatformType.MACOS, "x86_64")))
- .build();
-
- String linkArgs = Joiner.on(" ").join(linkAction.getArguments());
- for (String expectedCommandLineFragment : expectedCommandLineFragments) {
- assertThat(linkArgs).contains(expectedCommandLineFragment);
- }
- }
-
- @Test
public void testDrops32BitArchitecture() throws Exception {
verifyDrops32BitArchitecture(getRuleType());
}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcLibraryTest.java
index 16912f3..555a2d4 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcLibraryTest.java
@@ -40,7 +40,6 @@
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.packages.NativeAspectClass;
-import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType;
import com.google.devtools.build.lib.rules.apple.AppleToolchain;
import com.google.devtools.build.lib.rules.apple.DottedVersion;
@@ -1212,8 +1211,6 @@
String genfilesFragment =
getConfiguration(j2objcLibraryTarget).getGenfilesFragment().toString();
String binFragment = getConfiguration(j2objcLibraryTarget).getBinFragment().toString();
- AppleConfiguration appleConfiguration =
- getConfiguration(j2objcLibraryTarget).getFragment(AppleConfiguration.class);
String commandLine = Joiner.on(" ").join(compileAction.getArguments());
ImmutableList<String> expectedArgs =
@@ -1228,12 +1225,6 @@
.add("-arch", "i386")
.add("-isysroot")
.add(AppleToolchain.sdkDir())
- .add("-F")
- .add(AppleToolchain.sdkDir() + "/Developer/Library/Frameworks")
- .add("-F")
- .add(
- AppleToolchain.platformDeveloperFrameworkDir(
- appleConfiguration.getSingleArchPlatform()))
.add("-O0")
.add("-DDEBUG=1")
.add("-iquote")
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
index 717f0e7..18b018b 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
@@ -47,7 +47,6 @@
import com.google.devtools.build.lib.analysis.util.ScratchAttributeWriter;
import com.google.devtools.build.lib.packages.NoSuchTargetException;
import com.google.devtools.build.lib.packages.util.MockObjcSupport;
-import com.google.devtools.build.lib.rules.apple.ApplePlatform;
import com.google.devtools.build.lib.rules.apple.AppleToolchain;
import com.google.devtools.build.lib.rules.cpp.CppCompileAction;
import com.google.devtools.build.lib.rules.cpp.CppModuleMap;
@@ -58,7 +57,6 @@
import com.google.devtools.build.lib.testutil.TestConstants;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.common.options.OptionsParsingException;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.junit.Ignore;
@@ -434,12 +432,6 @@
assertThat(compileActionA.getArguments())
.containsAtLeast("-isysroot", AppleToolchain.sdkDir())
.inOrder();
- assertThat(Collections.frequency(compileActionA.getArguments(),
- "-F" + AppleToolchain.sdkDir() + "/Developer/Library/Frameworks")).isEqualTo(1);
- assertThat(
- Collections.frequency(
- compileActionA.getArguments(), "-F" + frameworkDir(ApplePlatform.IOS_SIMULATOR)))
- .isEqualTo(1);
assertThat(compileActionA.getArguments())
.containsAtLeastElementsIn(AppleToolchain.DEFAULT_WARNINGS.values());
assertThat(compileActionA.getArguments())
@@ -484,12 +476,6 @@
assertThat(compileActionA.getArguments())
.containsAtLeast("-isysroot", AppleToolchain.sdkDir())
.inOrder();
- assertThat(Collections.frequency(compileActionA.getArguments(),
- "-F" + AppleToolchain.sdkDir() + "/Developer/Library/Frameworks")).isEqualTo(1);
- assertThat(
- Collections.frequency(
- compileActionA.getArguments(), "-F" + frameworkDir(ApplePlatform.IOS_DEVICE)))
- .isEqualTo(1);
assertThat(compileActionA.getArguments())
.containsAtLeastElementsIn(AppleToolchain.DEFAULT_WARNINGS.values());
assertThat(compileActionA.getArguments())
@@ -1308,29 +1294,9 @@
checkSdkIncludesUsedInCompileAction(RULE_TYPE);
}
- // Test with ios device SDK version 9.0. Framework path differs from previous versions.
- @Test
- public void testCompilationActions_deviceSdk9() throws Exception {
- useConfiguration("--cpu=ios_armv7", "--ios_minimum_os=1.0", "--ios_sdk_version=9.0");
-
- createLibraryTargetWriter("//objc:lib")
- .setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
- .setAndCreateFiles("hdrs", "c.h")
- .write();
-
- CommandAction compileAction = compileAction("//objc:lib", "a.o");
-
- // We remove spaces, since the crosstool rules do not use spaces in command line args.
-
- String compileArgs = Joiner.on("").join(compileAction.getArguments()).replace(" ", "");
- assertThat(compileArgs)
- .contains("-F" + AppleToolchain.sdkDir() + AppleToolchain.SYSTEM_FRAMEWORK_PATH);
- }
-
@Test
public void testCompilationActionsWithPch() throws Exception {
useConfiguration("--apple_platform_type=ios");
- ApplePlatform platform = ApplePlatform.IOS_SIMULATOR;
scratch.file("objc/foo.pch");
createLibraryTargetWriter("//objc:lib")
.setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
@@ -1352,8 +1318,6 @@
.add("-mios-simulator-version-min=" + DEFAULT_IOS_SDK_VERSION)
.add("-arch x86_64")
.add("-isysroot", AppleToolchain.sdkDir())
- .add("-F" + AppleToolchain.sdkDir() + "/Developer/Library/Frameworks")
- .add("-F" + frameworkDir(platform))
.addAll(FASTBUILD_COPTS)
.addAll(
iquoteArgs(
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryTest.java
index 0842ac7..e48a8f4 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryTest.java
@@ -31,7 +31,6 @@
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.packages.util.MockObjcSupport;
import com.google.devtools.build.lib.packages.util.MockProtoSupport;
-import com.google.devtools.build.lib.rules.apple.ApplePlatform;
import com.google.devtools.build.lib.rules.apple.AppleToolchain;
import com.google.devtools.build.lib.rules.cpp.CppModuleMapAction;
import com.google.devtools.build.lib.testutil.TestConstants;
@@ -464,7 +463,6 @@
@Test
public void testCompilationAction() throws Exception {
useConfiguration("--apple_platform_type=ios", "--cpu=ios_i386");
- ApplePlatform platform = ApplePlatform.IOS_SIMULATOR;
// Because protos are linked/compiled within the apple_binary context, we need to traverse the
// action graph to find the linked protos (.a) and compiled protos (.o).
@@ -506,8 +504,6 @@
.add("-mios-simulator-version-min=" + DEFAULT_IOS_SDK_VERSION)
.add("-arch", "i386")
.add("-isysroot", AppleToolchain.sdkDir())
- .add("-F", AppleToolchain.sdkDir() + AppleToolchain.DEVELOPER_FRAMEWORK_PATH)
- .add("-F", frameworkDir(platform))
.addAll(FASTBUILD_COPTS)
.addAll(
ObjcLibraryTest.iquoteArgs(
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
index 133c6ae..11202af 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
@@ -52,7 +52,6 @@
import com.google.devtools.build.lib.packages.util.MockProtoSupport;
import com.google.devtools.build.lib.rules.apple.AppleCommandLineOptions;
import com.google.devtools.build.lib.rules.apple.AppleConfiguration.ConfigurationDistinguisher;
-import com.google.devtools.build.lib.rules.apple.ApplePlatform;
import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType;
import com.google.devtools.build.lib.rules.apple.AppleToolchain;
import com.google.devtools.build.lib.rules.apple.DottedVersion;
@@ -217,11 +216,6 @@
MockProtoSupport.setup(mockToolsConfig);
}
- protected static String frameworkDir(ApplePlatform platform) {
- return AppleToolchain.platformDir(
- platform.getNameInPlist()) + AppleToolchain.DEVELOPER_FRAMEWORK_PATH;
- }
-
/**
* Creates an {@code objc_library} target writer for the label indicated by the given String.
*/
@@ -364,8 +358,6 @@
.add("-mios-simulator-version-min=" + DEFAULT_IOS_SDK_VERSION)
.add("-arch " + arch)
.add("-isysroot " + AppleToolchain.sdkDir())
- .add(AppleToolchain.sdkDir() + AppleToolchain.DEVELOPER_FRAMEWORK_PATH)
- .add(frameworkDir(ApplePlatform.forTarget(PlatformType.IOS, arch)))
.addAll(frameworkPathFragmentParents.build())
.add("-Xlinker -objc_abi_version -Xlinker 2")
.add("-fobjc-link-runtime")