@@ -21,11 +21,11 @@ https://firebase.google.com.
21
21
1 . [ Unit Testing] ( #unit-testing )
22
22
1 . [ Integration Testing] ( #integration-testing )
23
23
1 . [ Proguarding] ( #proguarding )
24
- 1 . [ APIs used via reflection] ( #apis -used-via-reflection )
24
+ 1 . [ APIs used via reflection] ( #APIs -used-via-reflection )
25
25
1 . [ APIs intended for developer
26
- consumption] ( #apis -intended-for-developer-consumption )
26
+ consumption] ( #APIs -intended-for-developer-consumption )
27
27
1 . [ APIs intended for other Firebase
28
- SDKs] ( #apis -intended-for-other-firebase-sdks )
28
+ SDKs] ( #APIs -intended-for-other-firebase-sdks )
29
29
1 . [ Publishing] ( #publishing )
30
30
1 . [ Dependencies] ( #dependencies )
31
31
1 . [ Commands] ( #commands )
@@ -87,70 +87,47 @@ If you don't have a suitable testing project already:
87
87
* Download the resulting ` google-services.json ` file and put it in the root of
88
88
your checkout.
89
89
90
- For now, you have to disable security rule enforcement for the Realtime
91
- Database, Cloud Firestore, and Cloud Storage in your test project (if running
92
- the integration tests for any of those). Re-enable your security rules after
93
- your test run.
94
-
95
90
#### Running Integration Tests
96
91
97
92
Integration tests can be executed on the command line by running
98
93
``` bash
99
94
./gradlew :< firebase-project> :connectedCheck
100
95
```
101
96
102
- ## Proguarding
97
+ ## Annotations
103
98
104
- Firebase Android SDKs operate under the assumption that a vast majority of
105
- developers do not proguard their apps. Artifacts published via the
106
- [ Publishing] ( #publishing ) section are pre-proguarded (preguarded?) to reduce the
107
- size impact on apps that consume them. There are three levels of retention that
108
- APIs have, depending on how they are used.
99
+ Firebase SDKs use some special annotations for tooling purposes.
109
100
110
- ### APIs used via reflection
101
+ ### @ Keep
111
102
112
103
APIs that need to be preserved up until the app's runtime can be annotated with
113
104
[ @Keep ] ( https://developer.android.com/reference/android/support/annotation/Keep ) .
114
105
The
115
106
[ @Keep ] ( https://developer.android.com/reference/android/support/annotation/Keep )
116
107
annotation is * blessed* to be honored by android's [ default proguard
117
- configuration] ( https://developer.android.com/studio/write/annotations#keep ) .
118
- These APIs should be generally ** discouraged** , because they can't be
119
- proguarded.
120
-
121
- #### Usage
122
-
123
- - Annotate APIs with
124
- [ @Keep ] ( https://developer.android.com/reference/android/support/annotation/Keep )
108
+ configuration] ( https://developer.android.com/studio/write/annotations#keep ) . A common use for
109
+ this annotation is because of reflection. These APIs should be generally ** discouraged** , because
110
+ they can't be proguarded.
125
111
126
- ### APIs intended for developer consumption
127
-
128
- The
129
- [ @Keep ] ( https://developer.android.com/reference/android/support/annotation/Keep )
130
- mechanism described above is too restrictive for APIs that are not used via
131
- reflection, which is the case for a vast majority of the Firebase public APIs.
132
- We annotate these APIs with
133
- [ @PublicAPI ] ( firebase-common/src/main/java/com/google/firebase/annotations/PublicApi.java ) .
112
+ ### @KeepForSdk
134
113
135
- #### Usage
114
+ APIs that are intended to be used by Firebase SDKs should be annotated with
115
+ ` @KeepForSdk ` . The key benefit here is that the annotation is * blessed* to throw
116
+ linter errors on Android Studio if used by the developer from a non firebase
117
+ package, thereby providing a valuable guard rail.
136
118
137
- - Annotate the necessary APIs with firebase-common's
138
- [ @PublicApi ] ( firebase-common/src/main/java/com/google/firebase/annotations/PublicApi.java )
139
119
140
- ### APIs intended for other Firebase SDKs
120
+ ### @ PublicApi
141
121
142
- APIs that are intended to be used by Firebase SDKs may be annotated with
143
- ` @KeepForSdk ` . Much like the custom annotation mechanism, the idea is to let
144
- these APIs pass through preguarding, but not restrict the developer's app from
145
- proguarding. The key benefit here is that the annotation is * blessed* to throw
146
- linter errors on Android Studio if used by the developer from a non firebase
147
- package, thereby providing a valuable guard rail.
122
+ We annotate APIs that meant to be used by developers with
123
+ [ @PublicAPI ] ( firebase-common/src/main/java/com/google/firebase/annotations/PublicApi.java ) . This
124
+ annotation will be used by tooling to help inform the version bump (major, minor, patch) that is
125
+ required for the next release.
148
126
149
- #### Usage
127
+ ## Proguarding
150
128
151
- - Annotate the APIs with ` @KeepForSdk `
152
- - This method may be used in conjunction with @Keep annotations to annotate APIs
153
- consumed by Firebase SDKs through reflection.
129
+ Firebase SDKs do not proguard themselves, but support proguarding. Firebase SDKs themselves are
130
+ proguard friendly, but the dependencies of Firebase SDKs may not be.
154
131
155
132
### Proguard config
156
133
@@ -209,9 +186,6 @@ projects may be published as follows.
209
186
publishProjectsToMavenLocal
210
187
```
211
188
212
- To generate the Maven dependency tree under ` build/ ` instead, you can replace
213
- ` publishProjectsToMavenLocal ` in the above command with ` firebasePublish ` .
214
-
215
189
### Code Formatting
216
190
217
191
Code in this repo is formatted with the google-java-format tool. You can enable
0 commit comments