diff --git a/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl b/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl index 400d42f2..e996d324 100644 --- a/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl +++ b/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl @@ -703,8 +703,10 @@ def _collect_module_maps(target, rule_attr): return depset(transitive = depsets) return depset() -def _collect_objc_defines(objc_provider, rule_attr): +def _collect_objc_defines(objc_provider, cc_provider, rule_attr): """Returns a depset of C-compiler defines.""" + if cc_provider and not objc_provider: + return cc_provider.compilation_context.defines depsets = [objc_provider.define] if objc_provider else [] for dep in _collect_dependencies(rule_attr, "deps"): if CcInfo in dep: @@ -885,16 +887,25 @@ def _tulsi_sources_aspect(target, ctx): all_attributes.update(transitive_attributes) objc_provider = _get_opt_provider(target, ObjcInfo) + cc_provider = _get_opt_provider(target, CcInfo) objc_defines = [] - target_includes = [] + includes_depsets = [] if objc_provider: + includes_depsets = [objc_provider.include, objc_provider.iquote, objc_provider.include_system] + elif cc_provider: + cc_ctx = cc_provider.compilation_context + includes_depsets = [cc_ctx.includes, cc_ctx.quote_includes, cc_ctx.system_includes] + + if includes_depsets: target_includes = [ _convert_outpath_to_symlink_path(x) - for x in depset(transitive = [objc_provider.include, objc_provider.iquote, objc_provider.include_system]).to_list() + for x in depset(transitive = includes_depsets).to_list() ] + else: + target_includes = [] - objc_defines = _collect_objc_defines(objc_provider, rule_attr).to_list() + objc_defines = _collect_objc_defines(objc_provider, cc_provider, rule_attr).to_list() platform_type, os_deployment_target = _get_deployment_info(target, ctx) non_arc_srcs = _collect_files(rule, "attr.non_arc_srcs") diff --git a/src/TulsiGeneratorIntegrationTests/Resources/GoldenProjects/SimpleCCProject.xcodeproj/project.pbxproj b/src/TulsiGeneratorIntegrationTests/Resources/GoldenProjects/SimpleCCProject.xcodeproj/project.pbxproj index 982f0805..a619d8d0 100644 --- a/src/TulsiGeneratorIntegrationTests/Resources/GoldenProjects/SimpleCCProject.xcodeproj/project.pbxproj +++ b/src/TulsiGeneratorIntegrationTests/Resources/GoldenProjects/SimpleCCProject.xcodeproj/project.pbxproj @@ -371,6 +371,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; + HEADER_SEARCH_PATHS = "$(inherited) $(TULSI_WR)/. $(TULSI_WR)/bazel-tulsi-includes/x/x/ $(TULSI_WR)/external/bazel_tools $(TULSI_WR)/bazel-tulsi-includes/x/x/external/bazel_tools $(TULSI_BWRS)/. $(TULSI_BWRS)/bazel-tulsi-includes/x/x/ $(TULSI_BWRS)/external/bazel_tools $(TULSI_BWRS)/bazel-tulsi-includes/x/x/external/bazel_tools "; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DLIBRARY_DEFINES_DEFINE=1"; PRODUCT_NAME = _idx_ccBinary_C9583FBE_ios_min8.0; @@ -383,7 +384,9 @@ isa = XCBuildConfiguration; buildSettings = { GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; + HEADER_SEARCH_PATHS = "$(inherited) $(TULSI_WR)/. $(TULSI_WR)/bazel-tulsi-includes/x/x/ $(TULSI_BWRS)/. $(TULSI_BWRS)/bazel-tulsi-includes/x/x/ "; IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_CFLAGS = "-DLIBRARY_DEFINES_DEFINE=1"; PRODUCT_NAME = _idx_ccLibrary_CCA8EDE9_ios_min8.0; SDKROOT = iphoneos; USER_HEADER_SEARCH_PATHS = "$(TULSI_WR)"; @@ -446,6 +449,7 @@ isa = XCBuildConfiguration; buildSettings = { GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1"; + HEADER_SEARCH_PATHS = "$(inherited) $(TULSI_WR)/. $(TULSI_WR)/bazel-tulsi-includes/x/x/ $(TULSI_WR)/external/bazel_tools $(TULSI_WR)/bazel-tulsi-includes/x/x/external/bazel_tools $(TULSI_BWRS)/. $(TULSI_BWRS)/bazel-tulsi-includes/x/x/ $(TULSI_BWRS)/external/bazel_tools $(TULSI_BWRS)/bazel-tulsi-includes/x/x/external/bazel_tools "; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DLIBRARY_DEFINES_DEFINE=1"; PRODUCT_NAME = _idx_ccBinary_C9583FBE_ios_min8.0; @@ -458,7 +462,9 @@ isa = XCBuildConfiguration; buildSettings = { GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1"; + HEADER_SEARCH_PATHS = "$(inherited) $(TULSI_WR)/. $(TULSI_WR)/bazel-tulsi-includes/x/x/ $(TULSI_BWRS)/. $(TULSI_BWRS)/bazel-tulsi-includes/x/x/ "; IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_CFLAGS = "-DLIBRARY_DEFINES_DEFINE=1"; PRODUCT_NAME = _idx_ccLibrary_CCA8EDE9_ios_min8.0; SDKROOT = iphoneos; USER_HEADER_SEARCH_PATHS = "$(TULSI_WR)";