Support for cc_test

PiperOrigin-RevId: 229805804
diff --git a/src/Tulsi/ConfigEditorBuildTargetSelectorViewController.swift b/src/Tulsi/ConfigEditorBuildTargetSelectorViewController.swift
index e5e1bcd..3540e26 100644
--- a/src/Tulsi/ConfigEditorBuildTargetSelectorViewController.swift
+++ b/src/Tulsi/ConfigEditorBuildTargetSelectorViewController.swift
@@ -30,6 +30,7 @@
       "apple_ui_test",
       "cc_binary",
       "cc_library",
+      "cc_test",
       "objc_library",
       "ios_application",
       "ios_framework",
diff --git a/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl b/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl
index c030f0a..dcdb7e2 100644
--- a/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl
+++ b/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl
@@ -1011,9 +1011,10 @@
         infoplist = bundle_info.infoplist
 
         bundle_name = bundle_info.bundle_name
-    elif target_kind == "macos_command_line_application":
-        # Special support for macos_command_line_application which does not have an
-        # AppleBundleInfo provider.
+    elif (target_kind == "macos_command_line_application" or
+          target_kind == "cc_binary" or target_kind == "cc_test"):
+        # Special support for macos_command_line_application and cc_* targets
+        # which do not have an AppleBundleInfo provider.
 
         # Both the dSYM binary and executable binary don't have an extension, so
         # pick the first extension-less file not in a DWARF folder.
diff --git a/src/TulsiGenerator/RuleEntry.swift b/src/TulsiGenerator/RuleEntry.swift
index 22fed60..ea41db8 100644
--- a/src/TulsiGenerator/RuleEntry.swift
+++ b/src/TulsiGenerator/RuleEntry.swift
@@ -135,6 +135,7 @@
   static let BuildTypeToTargetType = [
       "cc_binary": PBXTarget.ProductType.Application,
       "cc_library": PBXTarget.ProductType.StaticLibrary,
+      "cc_test": PBXTarget.ProductType.Tool,
       // macos_command_line_application is not a bundled type in our rules as it does not contain
       // any resources, so we must explicitly list it here.
       "macos_command_line_application": PBXTarget.ProductType.Tool,
@@ -314,6 +315,9 @@
   /// Returns the value to be used as the Xcode SDKROOT for the build target generated for this
   /// RuleEntry.
   private(set) lazy var XcodeSDKRoot: String? = { [unowned self] in
+    guard type != "cc_binary" && type != "cc_test" else {
+      return PlatformType.macos.deviceSDK
+    }
     if let platformType = self.deploymentTarget?.platform {
       return platformType.deviceSDK
     }
diff --git a/src/TulsiGeneratorIntegrationTests/QueryTests.swift b/src/TulsiGeneratorIntegrationTests/QueryTests.swift
index 998236e..609f756 100644
--- a/src/TulsiGeneratorIntegrationTests/QueryTests.swift
+++ b/src/TulsiGeneratorIntegrationTests/QueryTests.swift
@@ -74,6 +74,11 @@
       .hasType("cc_binary")
       .hasNoLinkedTargetLabels()
       .hasNoDependencies()
+
+    checker.assertThat("//tulsi_test:ccTest")
+      .hasType("cc_test")
+      .hasNoLinkedTargetLabels()
+      .hasNoDependencies()
   }
 
 
diff --git a/src/TulsiGeneratorIntegrationTests/Resources/GoldenProjects/SimpleCCProject.xcodeproj/project.pbxproj b/src/TulsiGeneratorIntegrationTests/Resources/GoldenProjects/SimpleCCProject.xcodeproj/project.pbxproj
index 935d589..e875ee4 100644
--- a/src/TulsiGeneratorIntegrationTests/Resources/GoldenProjects/SimpleCCProject.xcodeproj/project.pbxproj
+++ b/src/TulsiGeneratorIntegrationTests/Resources/GoldenProjects/SimpleCCProject.xcodeproj/project.pbxproj
@@ -259,7 +259,7 @@
 				OTHER_LDFLAGS = "-help";
 				OTHER_SWIFT_FLAGS = "-help";
 				PYTHONIOENCODING = utf8;
-				SDKROOT = iphoneos;
+				SDKROOT = macosx;
 				SWIFT_INSTALL_OBJC_HEADER = NO;
 				SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(PRODUCT_NAME).h";
 				TULSI_BWRS = "${TULSI_WR}/tulsi-workspace";
@@ -285,7 +285,7 @@
 				OTHER_LDFLAGS = "-help";
 				OTHER_SWIFT_FLAGS = "-help";
 				PRODUCT_NAME = ccBinary;
-				SDKROOT = iphoneos;
+				SDKROOT = macosx;
 				SWIFT_INSTALL_OBJC_HEADER = NO;
 				SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(PRODUCT_NAME).h";
 				TULSI_BUILD_PATH = tulsi_e2e_ccsimple;
@@ -320,7 +320,7 @@
 				HEADER_SEARCH_PATHS = "$(TULSI_BWRS) $(TULSI_WR)/bazel-bin $(TULSI_WR)/bazel-genfiles $(TULSI_BWRS)/_tulsi-includes/x/x";
 				ONLY_ACTIVE_ARCH = YES;
 				PYTHONIOENCODING = utf8;
-				SDKROOT = iphoneos;
+				SDKROOT = macosx;
 				TULSI_BWRS = "${TULSI_WR}/tulsi-workspace";
 				TULSI_PROJECT = SimpleCCProject;
 				TULSI_VERSION = 9.99.999.9999;
@@ -350,7 +350,7 @@
 				INFOPLIST_FILE = "${PROJECT_FILE_PATH}/.tulsi/Resources/StubInfoPlist.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				PRODUCT_NAME = ccBinary;
-				SDKROOT = iphoneos;
+				SDKROOT = macosx;
 				TULSI_BUILD_PATH = tulsi_e2e_ccsimple;
 				TULSI_XCODE_VERSION = 10.1.0;
 			};
@@ -383,7 +383,7 @@
 				HEADER_SEARCH_PATHS = "$(TULSI_BWRS) $(TULSI_WR)/bazel-bin $(TULSI_WR)/bazel-genfiles $(TULSI_BWRS)/_tulsi-includes/x/x";
 				ONLY_ACTIVE_ARCH = YES;
 				PYTHONIOENCODING = utf8;
-				SDKROOT = iphoneos;
+				SDKROOT = macosx;
 				TULSI_BWRS = "${TULSI_WR}/tulsi-workspace";
 				TULSI_PROJECT = SimpleCCProject;
 				TULSI_VERSION = 9.99.999.9999;
@@ -413,7 +413,7 @@
 				INFOPLIST_FILE = "${PROJECT_FILE_PATH}/.tulsi/Resources/StubInfoPlist.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				PRODUCT_NAME = ccBinary;
-				SDKROOT = iphoneos;
+				SDKROOT = macosx;
 				TULSI_BUILD_PATH = tulsi_e2e_ccsimple;
 				TULSI_XCODE_VERSION = 10.1.0;
 			};
@@ -449,7 +449,7 @@
 				OTHER_LDFLAGS = "-help";
 				OTHER_SWIFT_FLAGS = "-help";
 				PYTHONIOENCODING = utf8;
-				SDKROOT = iphoneos;
+				SDKROOT = macosx;
 				SWIFT_INSTALL_OBJC_HEADER = NO;
 				SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(PRODUCT_NAME).h";
 				TULSI_BWRS = "${TULSI_WR}/tulsi-workspace";
@@ -475,7 +475,7 @@
 				OTHER_LDFLAGS = "-help";
 				OTHER_SWIFT_FLAGS = "-help";
 				PRODUCT_NAME = ccBinary;
-				SDKROOT = iphoneos;
+				SDKROOT = macosx;
 				SWIFT_INSTALL_OBJC_HEADER = NO;
 				SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(PRODUCT_NAME).h";
 				TULSI_BUILD_PATH = tulsi_e2e_ccsimple;
diff --git a/src/TulsiGeneratorIntegrationTests/Resources/Simple.BUILD b/src/TulsiGeneratorIntegrationTests/Resources/Simple.BUILD
index 933f3e5..ba0d3c6 100644
--- a/src/TulsiGeneratorIntegrationTests/Resources/Simple.BUILD
+++ b/src/TulsiGeneratorIntegrationTests/Resources/Simple.BUILD
@@ -82,6 +82,16 @@
     ],
 )
 
+cc_test(
+    name = "ccTest",
+    srcs = [
+        "Test/primaryTest.cc",
+    ],
+    deps = [
+        ":ccLibrary",
+    ],
+)
+
 objc_library(
     name = "Library",
     srcs = [