-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update bazel version to 3.0.0 and latest rules #45
Update bazel version to 3.0.0 and latest rules #45
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERROR: /Users/runner/runners/2.169.0/work/rules_ios/rules_ios/tests/xcodeproj/BUILD.bazel:4:1: in //rules:xcodeproj.bzl%_xcodeproj_aspect aspect on _ios_internal_unit_test_bundle rule //tests/xcodeproj:Single-Application-UnitTests.__internal__.__test_bundle:
Traceback (most recent call last):
File "/Users/runner/runners/2.169.0/work/rules_ios/rules_ios/tests/xcodeproj/BUILD.bazel", line 4
//rules:xcodeproj.bzl%_xcodeproj_aspect(...)
File "/Users/runner/runners/2.169.0/work/rules_ios/rules_ios/rules/xcodeproj.bzl", line 58, in _xcodeproj_aspect_impl
_TargetInfo(target = info, <1 more arguments>)
File "/Users/runner/runners/2.169.0/work/rules_ios/rules_ios/rules/xcodeproj.bzl", line 58, in _TargetInfo
depset([info], <1 more arguments>)
Looks like that will need to be changed to be immutable
6aa87c5
to
1fb34f8
Compare
@segiddins does it actually check if the generated xcodeproj works? I saw there is a check to see if bazel generates a different xcodeproj file, but it does not actuall test the project. I am at least adding some tests that will fail if I did not do the passing of test env correctly |
README.md
Outdated
|
||
[Click here](https://github.com/ob/rules_ios/tree/master/doc) | ||
for the documentation. | ||
Bazel version required by tThese rules is [here](https://github.com/ob/rules_ios/blob/master/.bazelversion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
|
||
## Reference documentation | ||
|
||
[Click here](https://github.com/ob/rules_ios/tree/master/doc) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -155,6 +155,12 @@ def _apple_framework_packaging_impl(ctx): | |||
|
|||
# collect modulemaps | |||
for modulemap in dep[apple_common.Objc].direct_module_maps: | |||
# rule_swift changed how non swift generates module map in this commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the comment here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about the original implementation here, as well as the change. If we assign modulemap_in to the modulemap on every iteration, aren't we just assigning modulemap_in with the last value in the array direct_module_maps
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have the same question actually! @segiddins
@@ -17,6 +17,7 @@ | |||
48A8F4B41EF706F8BEEC7ACB /* Single-Application-UnitTests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = "Single-Application-UnitTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
5FF81A9585DBB110EBD9CAC0 /* test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = test.swift; path = test.swift; sourceTree = "<group>"; }; | |||
8DBB99CE021DEB0B97F196EA /* common.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = common.pch; path = ../../rules/library/common.pch; sourceTree = "<group>"; }; | |||
BDFE1D6BB539968405F979CA /* Single_Application_UnitTests-Swift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "Single_Application_UnitTests-Swift.h"; path = "Single_Application_UnitTests-Swift.h"; sourceTree = "<group>"; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @amberdixon on this getting added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't know why this is getting added, but I'm seeing this in my PRs too. The underlying reason is that the Swift.h file is being treated as a source file (i.e. running File.is_source
on it returns true), even though the file is actually being generated by one of the rules in rules_swift. Perhaps we can leave it here and make a note to remove it later, after figuring out why it's being added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have expectation that no file change should happen to project file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, because there is a check in CI for git diff --nocheck
... so if the xcodeproj rule generates a project that is different from the one checked in already, then the CI job will fail.
I'm not sure why the -Swift.h file is showing up in the bazel target's sources as an actual source (because it's really a generated file.) Because it appears to be an actual source, the xcodeproj rule adds this file to the generated xcodeproject.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will deal with this in future: #49
@segiddins While u continue to review, I am going to test this with our app repo and inform u on what works and what does not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, other than the -Swift.h file getting added, curious what @amberdixon has to say about that
@@ -17,6 +17,7 @@ | |||
48A8F4B41EF706F8BEEC7ACB /* Single-Application-UnitTests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = "Single-Application-UnitTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
5FF81A9585DBB110EBD9CAC0 /* test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = test.swift; path = test.swift; sourceTree = "<group>"; }; | |||
8DBB99CE021DEB0B97F196EA /* common.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = common.pch; path = ../../rules/library/common.pch; sourceTree = "<group>"; }; | |||
BDFE1D6BB539968405F979CA /* Single_Application_UnitTests-Swift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "Single_Application_UnitTests-Swift.h"; path = "Single_Application_UnitTests-Swift.h"; sourceTree = "<group>"; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't know why this is getting added, but I'm seeing this in my PRs too. The underlying reason is that the Swift.h file is being treated as a source file (i.e. running File.is_source
on it returns true), even though the file is actually being generated by one of the rules in rules_swift. Perhaps we can leave it here and make a note to remove it later, after figuring out why it's being added.
@@ -4,5 +4,12 @@ class SwiftTests : XCTestCase { | |||
func testPasses() { | |||
XCTAssertTrue(true) | |||
} | |||
func testTestEnvArgsMatches() { | |||
XCTAssertEqual(ProcessInfo.processInfo.environment["test_envvar_key1"], "test_envvar_value1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine to add here, but FYI, we aren't actually running these tests in CI.
I will probably run these tests as part of CI in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am actually considering to try to add this into CI in this PR (otherwise my change has no effect)
@@ -155,6 +155,12 @@ def _apple_framework_packaging_impl(ctx): | |||
|
|||
# collect modulemaps | |||
for modulemap in dep[apple_common.Objc].direct_module_maps: | |||
# rule_swift changed how non swift generates module map in this commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about the original implementation here, as well as the change. If we assign modulemap_in to the modulemap on every iteration, aren't we just assigning modulemap_in with the last value in the array direct_module_maps
?
@amberdixon added the CI job in the workflow, can take a look? |
|
||
cd $(dirname $0) | ||
|
||
xcodebuild -project Single-Application-Project.xcodeproj -quiet -scheme Single-Application-UnitTests test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for putting these in! LGTM
waiting for Sam's PR to merge so that I don't add the |
ea7a3a5
to
ced37b6
Compare
Update rules_apple and rules_swift to latest commit on their respective repo Added a stage to run unit tests inside the sample app application
ced37b6
to
3c972d6
Compare
depset
for env var and launch arguments for tests. Instead we pass tuples to ensure correct data is passed in a safer way.