-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expose library version, move it out of options #588
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
Conversation
Firebase/Core/Public/FIRVersion.h
Outdated
#import <Foundation/Foundation.h> | ||
|
||
// The version of the Firebase SDK. | ||
extern NSString *const kFIRLibraryVersionID; |
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 see your declaration of kFIRLibraryVersionID here but I don't see a definition. Are you missing a 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.
No, it turns out it did already exist. It's in FIROptions.m[0]. It is possible that we would like a new home for it though. I'm hoping someone from the core team can give some guidance there.
This constant is also not currently tied to the one actually used to build the sdk by anything other than policy. That being said, it does appear to be current, so that might be good enough for now.
0:
NSString *const kFIRLibraryVersionID = |
Can you explain more about the reasoning for this change? Why do you care about the FirebaseCore version? If anything, I would like to see FirebaseCore adopt the FirebaseFirestore versioning approach using build time compile flags that don't require source changes. |
The issue here is that we're supposed to be reporting the Firebase-wide version to the backend. We also want to include the Firebase version in our log lines. The Firestore version is largely an implementation detail that nobody really cares about. Logging the Firebase-wide version makes it possible to go back to release notes, see if you're up-to-date, etc. This change makes that version accessible to us. |
Indeed, I think an even better approach would be to make available entire-SDK version that is used to build the whole thing. But, I couldn't see a way to thread it through easily. At the same time, I noticed that this constant is supposed to be kept in sync, so I figured it might work for now. It also seemed slightly misplaced on FIROptions and with a setter. Different options instances would never have different sdk versions, so I think it is better as just a simple constant. And obviously we would not ever want to programmatically set the version. |
OK, but the FIROptions version isn't the Firebase-wide version - It's the FirebaseCore version. A Firebase-wide version would need to be implemented in Firebase.h since that is the only file that is part of overall Firebase. I'd like to see us merge FirebaseCore into Firebase, but that is not currently the implementation. |
I see. In that case, is there a way to get the correct version into Firebase.h? |
Ok, please take another look. I've added both Firebase_VERSION and FIRCore_VERSION to the podspec, as well as FIRVersion.h. If this is accepted, we'll need to add them to the internal build as well. I've reverted the changes to FIROptions and test, although it seems like those might be nice as an independent change? This change also includes adding the version to FIRLogger output. I have no strong preferences on the format of the log line, so if anyone would prefer something different, I'm happy to change it. Once this is accepted, I will update Firestore to send the proper version in the GRPC header. |
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! Generally looks good to me.
A few nits and an API process question :
Firebase/Core/Private/FIRVersion.m
Outdated
(const unsigned char *const)STR(Firebase_VERSION); | ||
|
||
const unsigned char *const FirebaseCoreVersionString = | ||
(const unsigned char *const)STR(FIRCore_VERSION); No newline at end of 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.
Add newline to end of 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.
Done.
@@ -0,0 +1,39 @@ | |||
/* |
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.
Current convention is Private directory is only for headers. FIRVersion.m should be in Firebase/Core/
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.
Ah, got it. Done.
@@ -0,0 +1,23 @@ | |||
/* |
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.
Putting FIRVersion.h may require an API review. @ryanwilson ?
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 moved it to Private. It probably would make sense to move it to Public/ at some point though.
FirebaseCore.podspec
Outdated
s.framework = 'SystemConfiguration' | ||
s.dependency 'GoogleToolboxForMac/NSData+zlib', '~> 2.1' | ||
s.pod_target_xcconfig = { | ||
'OTHER_CFLAGS' => '-DFIRCore_VERSION=' + s.version.to_s + ' -DFirebase_VERSION=0.0.1-dev' |
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.
Firebase version should be 4.8.0. Part of the iCore release process is synchronizing the open source development build with the official last Firebase public release with the glue in Example/Podfile and Firestore/ExamplePodfile.
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.
Done.
const unsigned char *const FirebaseVersionString = | ||
(const unsigned char *const)STR(Firebase_VERSION); | ||
|
||
const unsigned char *const FirebaseCoreVersionString = |
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 the idea to modify the FIROptions FirebaseCore option handling in a separate PR?
If we want to defer the API question, FIRVersion.h could be added to Private instead. |
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.
LGTM.
Why not a PR to master instead of firestore-api-changes?
6495eff
to
82a9f33
Compare
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
CLAs look good, thanks! |
Ok, I think I've managed to rebase on top of master. |
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.
LGTM with one minor question for Paul.
|
||
|
||
#ifndef Firebase_VERSION | ||
#error "Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation" |
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.
@paulb777 Will this cause trouble for future build systems that don't use CocoaPods?
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.
@ryanwilson This should be fine. We already require any build system to add -D versions for multiple Firebase components. This ifndef is a great way to catch it at build time.
Separately, we do often use #ifdef COCOAPODS in a binary way that will have to be reviewed with a third build system.
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!
* slight cleanup * Use -D defines for versions * Undo FIROptionsTest change * Drop failed macro attempt * Add correct version to podspec * Add newline * Shuffle files around * Bring back log change * Fix change * Fix space
* slight cleanup * Use -D defines for versions * Undo FIROptionsTest change * Drop failed macro attempt * Add correct version to podspec * Add newline * Shuffle files around * Bring back log change * Fix change * Fix space
Expose library version as a constant. Remove it from FIROptions, since it is not per-options instance, and it doesn't make sense to set it.