Skip to content

Commit

Permalink
Flip --incompatible_disable_objc_library_transition
Browse files Browse the repository at this point in the history
  • Loading branch information
keith committed Sep 6, 2023
1 parent 32ece76 commit b3fed5c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ public final class BuildLanguageOptions extends OptionsBase {

@Option(
name = "incompatible_disable_objc_library_transition",
defaultValue = "false",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
Expand Down Expand Up @@ -913,7 +913,7 @@ public StarlarkSemantics toStarlarkSemantics() {
public static final String INCOMPATIBLE_OBJC_PROVIDER_REMOVE_LINKING_INFO =
"-incompatible_objc_provider_remove_linking_info";
public static final String INCOMPATIBLE_DISABLE_OBJC_LIBRARY_TRANSITION =
"-incompatible_disable_objc_library_transition";
"+incompatible_disable_objc_library_transition";
public static final String INCOMPATIBLE_FAIL_ON_UNKNOWN_ATTRIBUTES =
"-incompatible_fail_on_unknown_attributes";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ protected Artifact j2objcArchive(String j2objcLibraryTarget, String javaTargetNa

@Test
public void testJ2ObjcInformationExportedFromObjcLibrary() throws Exception {
setBuildLanguageOptions("--incompatible_disable_objc_library_transition=false");
scratch.file("app/lib.m");
scratch.file(
"app/BUILD",
Expand Down Expand Up @@ -720,6 +721,7 @@ public void testJ2ObjcInformationExportedFromObjcLibrary() throws Exception {

@Test
public void testJ2ObjcInfoExportedInObjcLibraryFromRuntimeDeps() throws Exception {
setBuildLanguageOptions("--incompatible_disable_objc_library_transition=false");
scratch.file("app/lib.m");
scratch.file(
"app/BUILD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ public void testAllowVariousNonBlacklistedTypesInHeaders() throws Exception {

@Test
public void testAppleSdkVersionEnv() throws Exception {
useConfiguration("--apple_platform_type=ios");
useConfiguration("--apple_platform_type=ios", "--cpu=ios_x86_64");
createLibraryTargetWriter("//objc:lib")
.setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
.setAndCreateFiles("hdrs", "c.h")
Expand All @@ -1028,7 +1028,9 @@ public void testAppleSdkVersionEnv() throws Exception {

@Test
public void testNonDefaultAppleSdkVersionEnv() throws Exception {
useConfiguration("--apple_platform_type=ios", "--ios_sdk_version=8.1");
useConfiguration(
"--apple_platform_type=ios", "--ios_sdk_version=8.1",
"--cpu=ios_x86_64");

createLibraryTargetWriter("//objc:lib")
.setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
Expand Down Expand Up @@ -1109,7 +1111,7 @@ public void testSdkIncludesUsedInCompileAction() throws Exception {

@Test
public void testCompilationActionsWithPch() throws Exception {
useConfiguration("--apple_platform_type=ios");
useConfiguration("--apple_platform_type=ios", "--cpu=ios_x86_64");
scratch.file("objc/foo.pch");
createLibraryTargetWriter("//objc:lib")
.setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
Expand Down Expand Up @@ -1411,7 +1413,7 @@ public void testUsesDotdPruning() throws Exception {

@Test
public void testAppleSdkDefaultPlatformEnv() throws Exception {
useConfiguration("--apple_platform_type=ios");
useConfiguration("--apple_platform_type=ios", "--cpu=ios_x86_64");
createLibraryTargetWriter("//objc:lib")
.setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
.setAndCreateFiles("hdrs", "c.h")
Expand Down Expand Up @@ -1567,6 +1569,7 @@ public void testFilesToCompileOutputGroup() throws Exception {
public void testDefaultEnabledFeatureIsUsed() throws Exception {
// Although using --cpu=ios_x86_64, it transitions to darwin_x86_64, so the actual
// cc_toolchain in use will be the darwin_x86_64 one.
setBuildLanguageOptions("--incompatible_disable_objc_library_transition=false");
MockObjcSupport.setupCcToolchainConfig(
mockToolsConfig, MockObjcSupport.darwinX86_64().withFeatures("default_feature"));
useConfiguration("--cpu=ios_x86_64");
Expand Down Expand Up @@ -2075,7 +2078,7 @@ public void testPassesDependenciesStaticLibrariesInCcInfo() throws Exception {
.flatMap(List::stream)
.map(LibraryToLink::getStaticLibrary)
.collect(toImmutableList())))
.contains("/ x/libbaz.a");
.containsExactly("bin x/libbar.a", "bin x/libfoo.a", "bin x/libbaz.a");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -933,18 +933,22 @@ protected void checkClangCoptsForCompilationMode(
switch (codeCoverageMode) {
case NONE:
useConfiguration(
"--apple_platform_type=ios", "--compilation_mode=" + compilationModeFlag(mode));
"--cpu=ios_x86_64",
"--apple_platform_type=ios",
"--compilation_mode=" + compilationModeFlag(mode));
break;
case GCOV:
allExpectedCoptsBuilder.addAll(CompilationSupport.CLANG_GCOV_COVERAGE_FLAGS);
useConfiguration(
"--cpu=ios_x86_64",
"--apple_platform_type=ios",
"--collect_code_coverage",
"--compilation_mode=" + compilationModeFlag(mode));
break;
case LLVMCOV:
allExpectedCoptsBuilder.addAll(CompilationSupport.CLANG_LLVM_COVERAGE_FLAGS);
useConfiguration(
"--cpu=ios_x86_64",
"--apple_platform_type=ios",
"--collect_code_coverage",
"--experimental_use_llvm_covmap",
Expand All @@ -967,7 +971,8 @@ protected void checkClangCoptsForDebugModeWithoutGlib(RuleType ruleType) throws
.addAll(ObjcConfiguration.DBG_COPTS);

useConfiguration(
"--apple_platform_type=ios", "--compilation_mode=dbg", "--objc_debug_with_GLIBCXX=false");
"--apple_platform_type=ios", "--compilation_mode=dbg", "--objc_debug_with_GLIBCXX=false",
"--cpu=ios_x86_64");
scratch.file("x/a.m");
ruleType.scratchTarget(scratch, "srcs", "['a.m']");

Expand Down

0 comments on commit b3fed5c

Please sign in to comment.