-
Notifications
You must be signed in to change notification settings - Fork 229
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
Adds swift FML code generation #4780
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4780 +/- ##
=======================================
Coverage 81.49% 81.49%
=======================================
Files 49 49
Lines 5653 5653
=======================================
Hits 4607 4607
Misses 1046 1046 Continue to review full report at Codecov.
|
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.
Early notes, I think I have the testability of this setup nicely. Scripts can run and access the MockNimbus
API. I have to think a little about the UIKit dependency, but I can do that later when this PR is in a ready state 🤷
components/support/nimbus-fml/fixtures/ios/tests/FeatureManifest.swift
Outdated
Show resolved
Hide resolved
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.
Small 🚲 🚗 🚜 🚌 Drive By review.
The Rust looks boring and regular; good job; otherwise, I haven't commented much.
I've added a few comments about the Swift. Keep going looks nice.
components/support/nimbus-fml/src/backends/swift/templates/EnumTemplate.swift
Show resolved
Hide resolved
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.
Drive-by review (I just read James' review and I didn't have much to add beyond his suggestions to make the code a little more "swifty").
OK tested against firefox-ios locally and verified there are no breaking changes for Nimbus (had to test against the places_uniffication and the glean update patches since those are on main here, but regardless, this patch doesn't introduce a breaking change) also added the changelog so this should be in a good place for review 😄 |
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.
Just a handful of minor nits, but this looks fantastic! Well done!
components/support/nimbus-fml/fixtures/ios/runtime/UIImage.swift
Outdated
Show resolved
Hide resolved
components/support/nimbus-fml/fixtures/ios/tests/FeatureManifest.swift
Outdated
Show resolved
Hide resolved
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.
Lovely.
I've left some comments which should be addressed, but nothing to hold up another review cycle.
if let s = s { | ||
return {{class_name}}(rawValue: s) | ||
} | ||
return nil |
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.
if let
is a nil
check, so it's redundant here.
if let s = s { | |
return {{class_name}}(rawValue: s) | |
} | |
return nil | |
return {{class_name}}(rawValue: s) |
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.
Yeah, the nil check is intentional here because the enumValue
in swift takes a String?
, since the v.getString("the-property")
returns a String?
components/support/nimbus-fml/src/backends/swift/templates/FeatureManifestTemplate.swift
Outdated
Show resolved
Hide resolved
components/support/nimbus-fml/src/backends/swift/templates/FeatureTemplate.swift
Show resolved
Hide resolved
components/support/nimbus-fml/src/backends/swift/templates/FeatureManifestTemplate.swift
Outdated
Show resolved
Hide resolved
return (k1, v1) | ||
} | ||
return [K1: V1](uniqueKeysWithValues: transformed) | ||
} |
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 not sure about these kotlin names; in general I've tried to keep naming schemes familiar to the platform, but this is all very internal.
@@ -0,0 +1,11 @@ | |||
import FeatureManifest |
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 … suprising. I'm not sure I understand why this is necessary.
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 only for the tests, the reason is that the scripts are run after the FeatureManifest, and all the Nimbus helpers are compiled together into a module that's later imported by the script. In the app, the FeatureManifest would be compiled together with the app so this wouldn't be needed
fixes EXP-1984
FeatureVariables
API so UIKit is imported again