-
Notifications
You must be signed in to change notification settings - Fork 640
[Infra] Enable simple formatter for md #7308
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
13149c2
[Infra] Enable simple formatter for md
rlazo 895a5da
Merge branch 'main' into rl.mark.form
rlazo 912107b
Actually apply the formatter to our md files
rlazo 7f5ba3a
Update configuration
rlazo c160ace
Commit additional changes by the formatter
rlazo 00d36e5
Exclude submodules in crashlytics
rlazo b68f954
Restrict the target to files within the same project
rlazo 7c5bcee
Ignore resources
rlazo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
# Firebase Android Open Source Development | ||
|
||
This repository contains the source code for all Android Firebase SDKs except | ||
Analytics and Auth. | ||
This repository contains the source code for all Android Firebase SDKs except Analytics and Auth. | ||
|
||
Firebase is an app development platform with tools to help you build, grow and | ||
monetize your app. More information about Firebase can be found at | ||
https://firebase.google.com. | ||
Firebase is an app development platform with tools to help you build, grow and monetize your app. | ||
More information about Firebase can be found at https://firebase.google.com. | ||
|
||
## Table of contents | ||
|
||
|
@@ -15,10 +13,8 @@ https://firebase.google.com. | |
1. [Integration Testing](#integration-testing) | ||
1. [Proguarding](#proguarding) | ||
1. [APIs used via reflection](#APIs-used-via-reflection) | ||
1. [APIs intended for developer | ||
consumption](#APIs-intended-for-developer-consumption) | ||
1. [APIs intended for other Firebase | ||
SDKs](#APIs-intended-for-other-firebase-sdks) | ||
1. [APIs intended for developer consumption](#APIs-intended-for-developer-consumption) | ||
1. [APIs intended for other Firebase SDKs](#APIs-intended-for-other-firebase-sdks) | ||
1. [Publishing](#publishing) | ||
1. [Dependencies](#dependencies) | ||
1. [Commands](#commands) | ||
|
@@ -27,23 +23,22 @@ https://firebase.google.com. | |
|
||
## Getting Started | ||
|
||
* Install the latest Android Studio (should be Meerkat | 2024.3.1 or later) | ||
* Clone the repo (`git clone --recurse-submodules [email protected]:firebase/firebase-android-sdk.git`) | ||
* When cloning the repo, it is important to get the submodules as well. If | ||
you have already cloned the repo without the submodules, you can update the | ||
submodules by running `git submodule update --init --recursive`. | ||
* Import the firebase-android-sdk gradle project into Android Studio using the | ||
**Import project(Gradle, Eclipse ADT, etc.)** option. | ||
* `firebase-crashlytics-ndk` must be built with NDK 21. See | ||
[firebase-crashlytics-ndk](firebase-crashlytics-ndk/README.md) for more | ||
details. | ||
- Install the latest Android Studio (should be Meerkat | 2024.3.1 or later) | ||
- Clone the repo (`git clone --recurse-submodules [email protected]:firebase/firebase-android-sdk.git`) | ||
- When cloning the repo, it is important to get the submodules as well. If you have already cloned | ||
the repo without the submodules, you can update the submodules by running | ||
`git submodule update --init --recursive`. | ||
- Import the firebase-android-sdk gradle project into Android Studio using the **Import | ||
project(Gradle, Eclipse ADT, etc.)** option. | ||
- `firebase-crashlytics-ndk` must be built with NDK 21. See | ||
[firebase-crashlytics-ndk](firebase-crashlytics-ndk/README.md) for more details. | ||
|
||
## Testing | ||
|
||
Firebase Android libraries exercise all three types of tests recommended by the | ||
[Android Testing Pyramid](https://developer.android.com/training/testing/fundamentals#testing-pyramid). | ||
Depending on the requirements of the specific project, some or all of these | ||
tests may be used to support changes. | ||
Depending on the requirements of the specific project, some or all of these tests may be used to | ||
support changes. | ||
|
||
> :warning: **Running tests with errorprone** | ||
> | ||
|
@@ -53,48 +48,46 @@ tests may be used to support changes. | |
|
||
### Unit Testing | ||
|
||
These are tests that run on your machine's local Java Virtual Machine (JVM). At | ||
runtime, these tests are executed against a modified version of android.jar | ||
where all final modifiers have been stripped off. This lets us sandbox behaviors | ||
at desired places and use popular mocking libraries. | ||
These are tests that run on your machine's local Java Virtual Machine (JVM). At runtime, these tests | ||
are executed against a modified version of android.jar where all final modifiers have been stripped | ||
off. This lets us sandbox behaviors at desired places and use popular mocking libraries. | ||
|
||
Unit tests can be executed on the command line by running | ||
|
||
```bash | ||
./gradlew :<firebase-project>:check | ||
``` | ||
|
||
### Integration Testing | ||
|
||
These are tests that run on a hardware device or emulator. These tests have | ||
access to Instrumentation APIs, give you access to information such as the | ||
[Android Context](https://developer.android.com/reference/android/content/Context). | ||
In Firebase, instrumentation tests are used at different capacities by different | ||
projects. Some tests may exercise device capabilities, while stubbing any calls | ||
to the backend, while some others may call out to nightly backend builds to | ||
ensure distributed API compatibility. | ||
These are tests that run on a hardware device or emulator. These tests have access to | ||
Instrumentation APIs, give you access to information such as the | ||
[Android Context](https://developer.android.com/reference/android/content/Context). In Firebase, | ||
instrumentation tests are used at different capacities by different projects. Some tests may | ||
exercise device capabilities, while stubbing any calls to the backend, while some others may call | ||
out to nightly backend builds to ensure distributed API compatibility. | ||
|
||
Along with Espresso, they are also used to test projects that have UI | ||
components. | ||
Along with Espresso, they are also used to test projects that have UI components. | ||
|
||
#### Project Setup | ||
|
||
Before you can run integration tests, you need to add a `google-services.json` | ||
file to the root of your checkout. You can use the `google-services.json` from | ||
any project that includes an Android App, though you'll likely want one that's | ||
separate from any production data you have because our tests write random data. | ||
Before you can run integration tests, you need to add a `google-services.json` file to the root of | ||
your checkout. You can use the `google-services.json` from any project that includes an Android App, | ||
though you'll likely want one that's separate from any production data you have because our tests | ||
write random data. | ||
|
||
If you don't have a suitable testing project already: | ||
|
||
* Open the [Firebase console](https://console.firebase.google.com/) | ||
* If you don't yet have a project you want to use for testing, create one. | ||
* Add an Android app to the project | ||
* Give the app any package name you like. | ||
* Download the resulting `google-services.json` file and put it in the root of | ||
your checkout. | ||
- Open the [Firebase console](https://console.firebase.google.com/) | ||
- If you don't yet have a project you want to use for testing, create one. | ||
- Add an Android app to the project | ||
- Give the app any package name you like. | ||
- Download the resulting `google-services.json` file and put it in the root of your checkout. | ||
|
||
#### Running Integration Tests on Local Emulator | ||
|
||
Integration tests can be executed on the command line by running | ||
|
||
```bash | ||
./gradlew :<firebase-project>:connectedCheck | ||
``` | ||
|
@@ -103,11 +96,12 @@ Integration tests can be executed on the command line by running | |
|
||
> You need additional setup for this to work: | ||
> | ||
> * `gcloud` needs to be [installed](https://cloud.google.com/sdk/install) on local machine | ||
> * `gcloud` needs to be configured with a project that has billing enabled | ||
> * `gcloud` needs to be authenticated with credentials that have 'Firebase Test Lab Admin' role | ||
> - `gcloud` needs to be [installed](https://cloud.google.com/sdk/install) on local machine | ||
> - `gcloud` needs to be configured with a project that has billing enabled | ||
> - `gcloud` needs to be authenticated with credentials that have 'Firebase Test Lab Admin' role | ||
|
||
Integration tests can be executed on the command line by running | ||
|
||
```bash | ||
./gradlew :<firebase-project>:deviceCheck | ||
``` | ||
|
@@ -134,92 +128,84 @@ Firebase SDKs use some special annotations for tooling purposes. | |
### @Keep | ||
|
||
APIs that need to be preserved up until the app's runtime can be annotated with | ||
[@Keep](https://developer.android.com/reference/android/support/annotation/Keep). | ||
The | ||
[@Keep](https://developer.android.com/reference/android/support/annotation/Keep) | ||
annotation is *blessed* to be honored by android's [default proguard | ||
configuration](https://developer.android.com/studio/write/annotations#keep). A common use for | ||
this annotation is because of reflection. These APIs should be generally **discouraged**, because | ||
they can't be proguarded. | ||
[@Keep](https://developer.android.com/reference/android/support/annotation/Keep). The | ||
[@Keep](https://developer.android.com/reference/android/support/annotation/Keep) annotation is | ||
_blessed_ to be honored by android's | ||
[default proguard configuration](https://developer.android.com/studio/write/annotations#keep). A | ||
common use for this annotation is because of reflection. These APIs should be generally | ||
**discouraged**, because they can't be proguarded. | ||
|
||
### @KeepForSdk | ||
|
||
APIs that are intended to be used by Firebase SDKs should be annotated with | ||
`@KeepForSdk`. The key benefit here is that the annotation is *blessed* to throw | ||
linter errors on Android Studio if used by the developer from a non firebase | ||
package, thereby providing a valuable guard rail. | ||
|
||
APIs that are intended to be used by Firebase SDKs should be annotated with `@KeepForSdk`. The key | ||
benefit here is that the annotation is _blessed_ to throw linter errors on Android Studio if used by | ||
the developer from a non firebase package, thereby providing a valuable guard rail. | ||
|
||
### @PublicApi | ||
|
||
We annotate APIs that meant to be used by developers with | ||
[@PublicAPI](firebase-common/src/main/java/com/google/firebase/annotations/PublicApi.java). This | ||
[@PublicAPI](firebase-common/src/main/java/com/google/firebase/annotations/PublicApi.java). This | ||
annotation will be used by tooling to help inform the version bump (major, minor, patch) that is | ||
required for the next release. | ||
|
||
## Proguarding | ||
|
||
Firebase SDKs do not proguard themselves, but support proguarding. Firebase SDKs themselves are | ||
Firebase SDKs do not proguard themselves, but support proguarding. Firebase SDKs themselves are | ||
proguard friendly, but the dependencies of Firebase SDKs may not be. | ||
|
||
### Proguard config | ||
|
||
In addition to preguard.txt, projects declare an additional set of proguard | ||
rules in a proguard.txt that are honored by the developer's app while building | ||
the app's proguarded apk. This file typically contains the keep rules that need | ||
to be honored during the app' s proguarding phase. | ||
In addition to preguard.txt, projects declare an additional set of proguard rules in a proguard.txt | ||
that are honored by the developer's app while building the app's proguarded apk. This file typically | ||
contains the keep rules that need to be honored during the app' s proguarding phase. | ||
|
||
As a best practice, these explicit rules should be scoped to only libraries | ||
whose source code is outside the firebase-android-sdk codebase making annotation | ||
based approaches insufficient.The combination of keep rules resulting from the | ||
annotations, the preguard.txt and the proguard.txt collectively determine the | ||
APIs that are preserved at **runtime**. | ||
As a best practice, these explicit rules should be scoped to only libraries whose source code is | ||
outside the firebase-android-sdk codebase making annotation based approaches insufficient.The | ||
combination of keep rules resulting from the annotations, the preguard.txt and the proguard.txt | ||
collectively determine the APIs that are preserved at **runtime**. | ||
|
||
## Publishing | ||
|
||
Firebase is published as a collection of libraries each of which either | ||
represents a top level product, or contains shared functionality used by one or | ||
more projects. The projects are published as managed maven artifacts available | ||
at [Google's Maven Repository](https://maven.google.com). This section helps | ||
reason about how developers may make changes to firebase projects and have their | ||
apps depend on the modified versions of Firebase. | ||
Firebase is published as a collection of libraries each of which either represents a top level | ||
product, or contains shared functionality used by one or more projects. The projects are published | ||
as managed maven artifacts available at [Google's Maven Repository](https://maven.google.com). This | ||
section helps reason about how developers may make changes to firebase projects and have their apps | ||
depend on the modified versions of Firebase. | ||
|
||
### Dependencies | ||
|
||
Any dependencies, within the projects, or outside of Firebase are encoded as | ||
[maven dependencies](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html) | ||
into the `pom` file that accompanies the published artifact. This allows the | ||
developer's build system (typically Gradle) to build a dependency graph and | ||
select the dependencies using its own [resolution | ||
strategy](https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html) | ||
into the `pom` file that accompanies the published artifact. This allows the developer's build | ||
system (typically Gradle) to build a dependency graph and select the dependencies using its own | ||
[resolution strategy](https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html) | ||
|
||
### Commands | ||
|
||
For more advanced use cases where developers wish to make changes to a project, | ||
but have transitive dependencies point to publicly released versions, individual | ||
projects may be published as follows. | ||
For more advanced use cases where developers wish to make changes to a project, but have transitive | ||
dependencies point to publicly released versions, individual projects may be published as follows. | ||
|
||
```bash | ||
# e.g. to publish Firestore and Functions | ||
./gradlew -PprojectsToPublish="firebase-firestore,firebase-functions" \ | ||
publishReleasingLibrariesToMavenLocal | ||
``` | ||
|
||
Developers may take a dependency on these locally published versions by adding | ||
the `mavenLocal()` repository to your [repositories | ||
block](https://docs.gradle.org/current/userguide/declaring_repositories.html) in | ||
your app module's build.gradle. | ||
Developers may take a dependency on these locally published versions by adding the `mavenLocal()` | ||
repository to your | ||
[repositories block](https://docs.gradle.org/current/userguide/declaring_repositories.html) in your | ||
app module's build.gradle. | ||
|
||
### Code Formatting | ||
|
||
Java and Kotlin are both formatted using `spotless`. | ||
|
||
To run formatting on a project, run | ||
|
||
```bash | ||
./gradlew :<firebase-project>:spotlessApply | ||
``` | ||
|
||
### Contributing | ||
|
||
We love contributions! Please read our | ||
[contribution guidelines](/CONTRIBUTING.md) to get started. | ||
We love contributions! Please read our [contribution guidelines](/CONTRIBUTING.md) to get started. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.