rules_spm icon indicating copy to clipboard operation
rules_spm copied to clipboard

Add support for setting defines of declared swift_library

Open gferon opened this issue 3 years ago • 8 comments

While trying to use Auth0.swift I realized it failed to compile because WEB_AUTH_PLATFORM wasn't defined.

This patch adds support to adding the output of manifest.settings.kind["define"] to the defines of the generated swift_library (I use spm_repositories in bazel mode).

EDIT: ~~I haven't added support to the spm_swift_library counterpart, and I could give it a try if you'd like me to.~~ this is obviously not necessary because spm handles this properly.

gferon avatar Sep 14 '22 10:09 gferon

Thanks for the contribution! What do you think would be a good test for this functionality?

cgrindel avatar Sep 14 '22 13:09 cgrindel

Good point. I guess I could expand the JSON from https://github.com/cgrindel/rules_spm/blob/main/test/json_test_data.bzl or introduce another one and check that the final target compiles with the right defines?

gferon avatar Sep 14 '22 13:09 gferon

Is it possible to add Auth0.swift to the interesting_deps example where it uses a define?

cgrindel avatar Sep 14 '22 13:09 cgrindel

Is it possible to add Auth0.swift to the interesting_deps example where it uses a define?

I just did this, it should be good enough as a test (the extra example wouldn't build without the extra defines).

gferon avatar Sep 14 '22 14:09 gferon

To fix the failing CI tests, run bazel run //:update_all, then commit and push any changes that have been made.

cgrindel avatar Sep 16 '22 14:09 cgrindel

@cgrindel it should be fine now!

gferon avatar Sep 19 '22 16:09 gferon

@gferon I just used GitHub to update your PR with the AsyncMain fix. I hope that this will address the failing CI job.

cgrindel avatar Sep 20 '22 15:09 cgrindel

@cgrindel I'm not exactly sure which steps I need to take to get CI to pass, could you point me in the right direction? Thanks!

gferon avatar Oct 31 '22 12:10 gferon