MobileNativeFoundation / rules_xcodeproj

Bazel rules for generating Xcode projects.
MIT License
528 stars 85 forks source link

Feature Request: Add Bazel integration tests #115

Closed cgrindel closed 2 years ago

cgrindel commented 2 years ago

What

Implement Bazel integration tests that confirm that the functionality in this project works with select versions of Bazel.

How

I will put together one or more PRs with the above functionality. I will reference this issue.

cgrindel commented 2 years ago

Unfortunately, we are running into bazelbuild/bazel#4327. A PR has been submitted with a fix (bazelbuild/bazel#14676), but it is still awaiting review.

$ bazel test //test/integration:ios_app_test_bazel_5_0_0
INFO: Analyzed target //test/integration:ios_app_test_bazel_5_0_0 (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
ERROR: /Users/chuckgrindel/code/buildbuddy-io/rules_xcodeproj/cg/gh115_add_bazel_int_test/test/integration/BUILD:13:24: Creating runfiles tree bazel-out/darwin-fastbuild/bin/test/integration/ios_app_test_bazel_5_0_0.runfiles failed: build-runfiles failed: error executing command
  (cd /private/var/tmp/_bazel_chuckgrindel/853db947d73af477cfc9f189a9d79b20/execroot/com_github_buildbuddy_io_rules_xcodeproj && \
  exec env - \
    PATH=/Users/chuckgrindel/Library/Caches/bazelisk/downloads/bazelbuild/bazel-5.0.0-darwin-x86_64/bin:/Users/chuckgrindel/code/cgrindel/dev-machine/osx/bin:/Users/chuckgrindel/code/cgrindel/dev-machine/home/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/chuckgrindel/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/salt/bin:/usr/local/sbin:/usr/local/munki:/Library/Apple/usr/bin:/Users/chuckgrindel/go/bin:/Users/chuckgrindel/robinhood/phabricator/arcanist/bin/ \
  /var/tmp/_bazel_chuckgrindel/install/0c7899cb691a00c6ca493ede5765e1af/build-runfiles bazel-out/darwin-fastbuild/bin/test/integration/ios_app_test_bazel_5_0_0.runfiles_manifest bazel-out/darwin-fastbuild/bin/test/integration/ios_app_test_bazel_5_0_0.runfiles): Process exited with status 1: Process exited with status 1
/var/tmp/_bazel_chuckgrindel/install/0c7899cb691a00c6ca493ede5765e1af/build-runfiles (args bazel-out/darwin-fastbuild/bin/test/integration/ios_app_test_bazel_5_0_0.runfiles_manifest bazel-out/darwin-fastbuild/bin/test/integration/ios_app_test_bazel_5_0_0.runfiles): link or target filename contains space on line 38: 'com_github_buildbuddy_io_rules_xcodeproj/test/integration/ios_app/Example/Preview Content/Preview Assets.xcassets/Contents.json /Users/chuckgrindel/code/buildbuddy-io/rules_xcodeproj/cg/gh115_add_bazel_int_test/test/integration/ios_app/Example/Preview Content/Preview Assets.xcassets/Contents.json'

Target //test/integration:ios_app_test_bazel_5_0_0 failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.272s, Critical Path: 0.01s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
//test/integration:ios_app_test_bazel_5_0_0                     FAILED TO BUILD

FAILED: Build did NOT complete successfully

I will poke around to see if there is a workaround. However, I am not very hopeful.

cgrindel commented 2 years ago

@brentleyjones How important is it to support paths with spaces? It causes Bazel many headaches as referenced by bazelbuild/bazel#4327. Do you think that we could recommend a project layout that does not include spaces? It looks like the primary issue is with Preview Content and Preview Assets.xcassets. I am not sure if these are magical names for Xcode. However, if we can avoid them, that would be awesome.

BTW, I can move forward with the integration test by renaming the paths. Here is the WIP.

brentleyjones commented 2 years ago

One goal of the project is if it builds with bazel, then we should be able to support it. I think we can remove spaces for our own examples/tests though to get around runfile issues.

cgrindel commented 2 years ago

Great. I will plan to rename the directories for the integration test. I will not change the directories for the example.