xchammer icon indicating copy to clipboard operation
xchammer copied to clipboard

Can't get generated xcode project to compile

Open WilliamIzzo83 opened this issue 4 years ago • 3 comments

To test xchammer I tried the workflow on the Tailor sample code. I did the following:

cd sample/Tailor
xchammer generate XCHammer.yaml

And the output was the following

ERROR: /Users/William/Documents/work/clients/perceptolab/research/xchammer/sample/Tailor/BUILD:8:1: in ios_application rule //:ios-app:
Traceback (most recent call last):
	File "/Users/William/Documents/work/clients/perceptolab/research/xchammer/sample/Tailor/BUILD", line 8
		ios_application(name = 'ios-app')
	File "/private/var/tmp/_bazel_William/bc9f6e1936ebc1d1d725c6dd8e3ade19/external/build_bazel_rules_apple/apple/internal/ios_rules.bzl", line 160, in _ios_application_impl
		run_support.register_simulator_executable(<2 more arguments>)
	File "/private/var/tmp/_bazel_William/bc9f6e1936ebc1d1d725c6dd8e3ade19/external/build_bazel_rules_apple/apple/internal/run_support.bzl", line 28, in run_support.register_simulator_executable
		ctx.actions.expand_template(<4 more arguments>)
	File "/private/var/tmp/_bazel_William/bc9f6e1936ebc1d1d725c6dd8e3ade19/external/build_bazel_rules_apple/apple/internal/run_support.bzl", line 36, in ctx.actions.expand_template
		shell.quote(<1 more arguments>)
	File "/private/var/tmp/_bazel_William/bc9f6e1936ebc1d1d725c6dd8e3ade19/external/bazel_skylib/lib/shell.bzl", line 49, in shell.quote
		s.replace("'", "'\\''")
type 'NoneType' has no method replace()```

To mitigate this I changed the rules_apple.git repository tag to 0.19.0. At this point the project is generated but it won't compile. 
XCode output is the following:

:0: error: module map file 'tulsi-workspace/bazel-tulsi-includes/x/x/tailor.modulemaps/module.modulemap' not found :0: error: module map file 'tulsi-workspace/bazel-tulsi-includes/x/x/tailor.modulemaps/module.modulemap' not found :0: error: missing required module 'SwiftShims'


I'm using bazel 2.0.0

Thank you!

WilliamIzzo83 avatar Feb 07 '20 16:02 WilliamIzzo83

Doesn't work as well with the same error (master branch):

'NoneType' value has no field or method 'replace'
ERROR: Analysis of aspect '@tulsi//:tulsi/tulsi_aspects.bzl%tulsi_sources_aspect of //:ios-app' failed; build aborted: Analysis of target '//:ios-app' failed
INFO: Elapsed time: 3.994s
INFO: 0 processes.
INFO: Build Event Protocol files produced successfully.
Tulsi: BazelInfoExtractionFailed

XCHammer: ** Completed read_aspects in 13.8220s
XCHammer: ** Completed generate in 13.8240s
swiftException(XCHammerSources.Generator.GenerateError.some(TulsiGenerator.BazelWorkspaceInfoExtractorError.aspectExtractorFailed("Bazel aspects could not be built.")))
The operation couldn’t be completed. (Commandant.CommandantError<XCHammerSources.CommandError> error 1.)

@WilliamIzzo83 did you fix it?

bigbangvn avatar Jun 02 '20 03:06 bigbangvn

Hi @bigbangvn

unfortunately I was not able to make it work. From what I gather the problem show itself with newer bazel versions. For me this was kinda of a showstopper because I had hard contraints about it. I tried to update the rules involved, but in the end I had to give up.

WilliamIzzo83 avatar Jun 02 '20 09:06 WilliamIzzo83

In case this helps out anyone in the future, I ran into the same issue, for me, it was an issue with how xcode_project was being generated.

Specifically, i set:

        generate_xcode_schemes = False,

Doing this got things working for me.

rafe-g avatar Feb 03 '22 22:02 rafe-g