tulsi icon indicating copy to clipboard operation
tulsi copied to clipboard

Error: 'SwiftInfo' value has no field or method 'direct_modules'

Open manosh7n opened this issue 4 years ago • 6 comments

bazel: 3.7.2 xcode: 12.4

I tried to build ios app from mediapipe framework.

in this https://github.com/bazelbuild/rules_swift/issues/565 , I was prompted to write an issue here, if updating tulsi does not solve the problem

WORKSPACE file:

http_archive(
    name = "build_bazel_rules_swift",
    sha256 = "d0e5f888b2ccce42c92e6d4686b5507b4230462627f965f9d39862e11ae9fb35",
    url = "https://github.com/bazelbuild/rules_swift/releases/download/0.18.0/rules_swift.0.18.0.tar.gz",
)

load(
    "@build_bazel_rules_swift//swift:repositories.bzl",
    "swift_rules_dependencies",
)

swift_rules_dependencies()

Also tried with versions 17.1 and 16.0

My BUILD file:

objc_library(
    name = "HandTrackingGpuAppLibrary",
    #  ... some code
    # deps = [
    #    ":SwiftBridge",             If you uncomment this lines i will get an error
    # ]
)

load("@build_bazel_rules_swift//swift:swift.bzl",
     "swift_library")

swift_library(
    name= "SwiftBridge",
    srcs = ["ModelHandler.swift"],
)

Error message:

/Users/dmitry/projects/mediapipe/mediapipe/examples/ios/handtrackinggpu/BUILD:84:14: In @tulsi//:tulsi/tulsi_aspects.bzl%tulsi_outputs_aspect aspect on swift_library rule //mediapipe/examples/ios/handtrackinggpu:SwiftBridge:

Traceback (most recent call last):
	File "/private/var/tmp/_bazel_dmitry/e9c11b00192eccedcb4a5c3de492fe7b/external/tulsi/tulsi/tulsi_aspects.bzl", line 1159, column 24, in _tulsi_outputs_aspect

		if _is_swift_target(target):

	File "/private/var/tmp/_bazel_dmitry/e9c11b00192eccedcb4a5c3de492fe7b/external/tulsi/tulsi/tulsi_aspects.bzl", line 632, column 36, in _is_swift_target
		for module in target[SwiftInfo].direct_modules:

Error: 'SwiftInfo' value has no field or method 'direct_modules'

Available attributes: direct_defines, direct_swiftdocs, direct_swiftmodules, module_name, swift_version, transitive_defines, transitive_generated_headers, transitive_modulemaps, transitive_swiftdocs, transitive_swiftinterfaces, transitive_swiftmodules

Analysis of aspect '@tulsi//:tulsi/tulsi_aspects.bzl%tulsi_outputs_aspect of //mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp' failed; build aborted: Analysis of target '//mediapipe/examples/ios/handtrackinggpu:SwiftBridge' failed

manosh7n avatar Feb 10 '21 16:02 manosh7n

so what commit of tulsi is this with now?

keith avatar Feb 10 '21 17:02 keith

ah actually can you try HEAD from rules_swift with this

keith avatar Feb 10 '21 17:02 keith

we probably need to create a new release for compatibility

keith avatar Feb 10 '21 17:02 keith

so what commit of tulsi is this with now?

I used latest commit

manosh7n avatar Feb 10 '21 17:02 manosh7n

We've just updated Tulsi with the new Apple rules releases. Can you try again with the latest commit? (You will need Bazel 4.0.0 to build it now.)

thii avatar Mar 13 '21 01:03 thii

I'm struggling with the same issue, on Bazel 4.2 with Xcode 12.5. I'm not the most adept at this toolchain, but i'm using the latest commit of Tulsi, and have updated my workspace to be pulling the latest apple rules and swift rules

minifigmaster125 avatar Aug 26 '21 20:08 minifigmaster125

Thanks for submitting this issue but this tool is being deprecated. Please checkout rules_xcodeproj for a more complete and maintained Xcode integration.

keith avatar Feb 15 '23 17:02 keith