Skip to content

Conversation

gsoltis
Copy link

@gsoltis gsoltis commented Dec 21, 2017

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.

#import <Foundation/Foundation.h>

// The version of the Firebase SDK.
extern NSString *const kFIRLibraryVersionID;
Copy link
Contributor

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?

Copy link
Author

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 =

@paulb777
Copy link
Member

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.

@wilhuff
Copy link
Contributor

wilhuff commented Dec 22, 2017

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.

@gsoltis
Copy link
Author

gsoltis commented Dec 22, 2017

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.

@paulb777
Copy link
Member

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.

@gsoltis
Copy link
Author

gsoltis commented Dec 22, 2017

I see. In that case, is there a way to get the correct version into Firebase.h?

@gsoltis
Copy link
Author

gsoltis commented Dec 22, 2017

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.

Copy link
Member

@paulb777 paulb777 left a 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 :

(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
Copy link
Member

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

Copy link
Author

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 @@
/*
Copy link
Member

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/

Copy link
Author

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 @@
/*
Copy link
Member

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 ?

Copy link
Author

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.

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'
Copy link
Member

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.

Copy link
Author

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 =
Copy link
Member

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?

@paulb777
Copy link
Member

If we want to defer the API question, FIRVersion.h could be added to Private instead.

Copy link
Member

@paulb777 paulb777 left a 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?

@gsoltis gsoltis changed the base branch from firestore-api-changes to master December 23, 2017 00:38
@gsoltis gsoltis changed the base branch from master to firestore-api-changes December 23, 2017 00:39
@gsoltis gsoltis force-pushed the expose_library_version branch from 6495eff to 82a9f33 Compare December 23, 2017 01:35
@googlebot
Copy link

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.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@gsoltis gsoltis changed the base branch from firestore-api-changes to master December 23, 2017 01:36
@googlebot
Copy link

CLAs look good, thanks!

@gsoltis
Copy link
Author

gsoltis commented Dec 23, 2017

Ok, I think I've managed to rebase on top of master.

Copy link
Member

@ryanwilson ryanwilson left a 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"
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@gsoltis gsoltis merged commit 412e759 into master Jan 2, 2018
@gsoltis gsoltis deleted the expose_library_version branch January 2, 2018 01:43
wilhuff pushed a commit that referenced this pull request Jan 3, 2018
* 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
minafarid pushed a commit to minafarid/firebase-ios-sdk that referenced this pull request Jun 6, 2018
* 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
@firebase firebase locked and limited conversation to collaborators Nov 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants