2
2
3
3
This guide provides essential information for working within the ` firebase-android-sdk ` repository.
4
4
5
+ ## Project Overview
6
+
7
+ This repository contains the source code for the Firebase Android SDKs. It is a large, multi-module
8
+ Gradle project. The project is written in a mix of Java and Kotlin.
9
+
10
+ The project is structured as a collection of libraries, each representing a Firebase product or a
11
+ shared component. These libraries are published as Maven artifacts to Google's Maven Repository.
12
+
5
13
## Project Structure
6
14
7
15
The ` subprojects.cfg ` file lists all the subprojects in this repository. Each line in this file
@@ -58,31 +66,78 @@ tool for this purpose.
58
66
would run ` sdkmanager " ndk;21.4.7075529" ` . Always refer to the project' s `README.md` for the
59
67
exact version required.
60
68
61
- ---
69
+ ## Building and Running
62
70
63
- ## Testing
71
+ The project is built using Gradle. The `gradlew` script is provided in the root directory.
64
72
65
- This repository uses two main types of tests:
73
+ ### Building
66
74
67
- 1. **Unit Tests** :
75
+ To build the entire project, you can run the following command :
68
76
69
- - These tests run on the local JVM.
70
- - To execute unit tests for a specific project, run:
71
- ```bash
72
- ./gradlew :<firebase-project>:check
73
- ```
77
+ ```bash
78
+ ./gradlew build
79
+ ```
74
80
75
- 2. **Integration Tests**:
76
- - These tests run on a hardware device or emulator.
77
- - Ensure a `google-services.json` file is present in the repository root.
78
- - To execute integration tests for a specific project, run:
79
- ```bash
80
- ./gradlew :<firebase-project>:connectedCheck
81
- ```
81
+ To build a specific project, you can run:
82
+
83
+ ```bash
84
+ ./gradlew :<firebase-project>:build
85
+ ```
86
+
87
+ ### Running Tests
88
+
89
+ The project has three types of tests: unit tests, integration tests, and smoke tests.
90
+
91
+ #### Unit Tests
92
+
93
+ Unit tests run on the local JVM. They can be executed with the following command:
94
+
95
+ ```bash
96
+ ./gradlew :<firebase-project>:check
97
+ ```
98
+
99
+ #### Integration Tests
100
+
101
+ Integration tests run on a hardware device or emulator. Before running integration tests, you need
102
+ to add a `google-services.json` file to the root of the project.
103
+
104
+ To run integration tests on a local emulator, use the following command:
105
+
106
+ ```bash
107
+ ./gradlew :<firebase-project>:connectedCheck
108
+ ```
109
+
110
+ To run integration tests on Firebase Test Lab, use the following command:
111
+
112
+ ```bash
113
+ ./gradlew :<firebase-project>:deviceCheck
114
+ ```
115
+
116
+ ### Publishing
117
+
118
+ To publish a project locally, you can use the following command:
119
+
120
+ ```bash
121
+ ./gradlew -PprojectsToPublish="<firebase-project>" publishReleasingLibrariesToMavenLocal
122
+ ```
123
+
124
+ ## Development Conventions
125
+
126
+ ### Code Formatting
82
127
83
- ---
128
+ The project uses Spotless for code formatting. To format the code, run the following command:
84
129
85
- ## API Surface
130
+ ```bash
131
+ ./gradlew spotlessApply
132
+ ```
133
+
134
+ To format a specific project, run:
135
+
136
+ ```bash
137
+ ./gradlew :<firebase-project>:spotlessApply
138
+ ```
139
+
140
+ ### API Surface
86
141
87
142
The public API of the Firebase SDKs is managed using a set of annotations:
88
143
@@ -92,9 +147,7 @@ The public API of the Firebase SDKs is managed using a set of annotations:
92
147
- `@Keep`: Marks APIs that need to be preserved at runtime, usually due to reflection. This
93
148
annotation should be used sparingly as it prevents Proguard from removing or renaming the code.
94
149
95
- ---
96
-
97
- ## Common Patterns
150
+ ### Common Patterns
98
151
99
152
This repository uses a combination of dependency injection frameworks:
100
153
@@ -107,7 +160,22 @@ This repository uses a combination of dependency injection frameworks:
107
160
the `ComponentRegistrar` of an SDK, which allows for the injection of dependencies from
108
161
`firebase-components` into the Dagger graph.
109
162
110
- ---
163
+ ### Proguarding
164
+
165
+ The project supports Proguarding. Proguard rules are defined in `proguard.txt` files within each
166
+ project.
167
+
168
+ ## External Dependencies
169
+
170
+ Do not add, under any circunstance, any new dependency to a SDK that does not already exists in the
171
+ `gradle/libs.versions.toml`, and even then, only do it if cxexplicitly asked to do so. The Firebase
172
+ SDKs are designed to be lightweight, and adding new dependencies can increase the size of the final
173
+ artifacts.
174
+
175
+ ## Contributing
176
+
177
+ Contributions are welcome. Please read the [contribution guidelines](/CONTRIBUTING.md) to get
178
+ started.
111
179
112
180
## Iteration Loop
113
181
@@ -123,20 +191,7 @@ After you make a change, here's the flow you should follow:
123
191
` ` `
124
192
- If necessary, run integration tests based on the instructions above.
125
193
126
- ---
127
-
128
- # # External Dependencies
129
-
130
- ---
131
-
132
- Do not add, under any circunstance, any new dependency to a SDK that does not already exists in the
133
- ` gradle/libs.versions.toml` , and even then, only do it if cxexplicitly asked to do so. The Firebase
134
- SDKs are designed to be lightweight, and adding new dependencies can increase the size of the final
135
- artifacts.
136
-
137
- ---
138
-
139
194
# # Updating this Guide
140
195
141
196
If new patterns or conventions are discovered, update this guide to ensure it remains a useful
142
- resource.
197
+ resource.
0 commit comments