|
| 1 | +// Copyright 2018 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +plugins { |
| 16 | + id 'firebase-library' |
| 17 | + id 'com.google.protobuf' |
| 18 | +} |
| 19 | + |
| 20 | +firebaseLibrary { |
| 21 | + libraryGroup "firestore" |
| 22 | + publishSources = true |
| 23 | + testLab { |
| 24 | + enabled = true |
| 25 | + timeout = '30m' |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +protobuf { |
| 30 | + // Configure the protoc executable |
| 31 | + protoc { |
| 32 | + // Download from repositories |
| 33 | + artifact = "com.google.protobuf:protoc:$protocVersion" |
| 34 | + } |
| 35 | + plugins { |
| 36 | + grpc { |
| 37 | + artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion" |
| 38 | + } |
| 39 | + } |
| 40 | + generateProtoTasks { |
| 41 | + all().each { task -> |
| 42 | + task.builtins { |
| 43 | + java { option 'lite' } |
| 44 | + } |
| 45 | + task.plugins { |
| 46 | + grpc { |
| 47 | + option 'lite' |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +android { |
| 55 | + adbOptions { |
| 56 | + timeOutInMs 60 * 1000 |
| 57 | + } |
| 58 | + |
| 59 | + namespace "com.google.firebase.firestore.sdk34" |
| 60 | + compileSdkVersion 34 |
| 61 | + defaultConfig { |
| 62 | + targetSdkVersion 34 |
| 63 | + minSdkVersion 19 |
| 64 | + versionName version |
| 65 | + multiDexEnabled true |
| 66 | + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| 67 | + consumerProguardFiles 'proguard.txt' |
| 68 | + |
| 69 | + // Acceptable values are: 'emulator', 'qa', 'nightly', and 'prod'. |
| 70 | + def targetBackend = findProperty("targetBackend") ?: "emulator" |
| 71 | + buildConfigField("String", "TARGET_BACKEND", "\"$targetBackend\"") |
| 72 | + |
| 73 | + def targetDatabaseId = findProperty('targetDatabaseId') ?: "(default)" |
| 74 | + buildConfigField("String", "TARGET_DATABASE_ID", "\"$targetDatabaseId\"") |
| 75 | + |
| 76 | + def localProps = new Properties() |
| 77 | + |
| 78 | + try { |
| 79 | + file("local.properties").withInputStream { localProps.load(it) } |
| 80 | + } catch (FileNotFoundException e) { |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + sourceSets { |
| 85 | + main { |
| 86 | + proto { |
| 87 | + srcDir 'src/proto' |
| 88 | + } |
| 89 | + } |
| 90 | + test { |
| 91 | + java { |
| 92 | + srcDir 'src/testUtil/java' |
| 93 | + srcDir 'src/roboUtil/java' |
| 94 | + } |
| 95 | + } |
| 96 | + androidTest { |
| 97 | + java { |
| 98 | + srcDir 'src/testUtil/java' |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + compileOptions { |
| 103 | + sourceCompatibility JavaVersion.VERSION_17 |
| 104 | + targetCompatibility JavaVersion.VERSION_17 |
| 105 | + } |
| 106 | + testOptions.unitTests.includeAndroidResources = true |
| 107 | + |
| 108 | +} |
| 109 | + |
| 110 | +tasks.withType(Test) { |
| 111 | + maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 |
| 112 | +} |
| 113 | + |
| 114 | +googleJavaFormat { |
| 115 | + exclude 'src/testUtil/java/com/google/firebase/firestore/testutil/Assert.java' |
| 116 | + exclude 'src/testUtil/java/com/google/firebase/firestore/testutil/ThrowingRunnable.java' |
| 117 | +} |
| 118 | + |
| 119 | +dependencies { |
| 120 | +/* |
| 121 | + implementation 'com.google.firebase:firebase-annotations:16.2.0' |
| 122 | + implementation 'com.google.firebase:firebase-common:20.3.1' |
| 123 | + implementation project(':protolite-well-known-types') |
| 124 | + implementation 'com.google.firebase:firebase-database-collection:18.0.1' |
| 125 | + implementation 'com.google.firebase:firebase-components:17.1.0' |
| 126 | + implementation 'com.google.firebase:firebase-appcheck-interop:17.0.0' |
| 127 | +
|
| 128 | + //To provide @Generated annotations |
| 129 | + compileOnly 'javax.annotation:jsr250-api:1.0' |
| 130 | +
|
| 131 | + javadocClasspath 'com.google.auto.value:auto-value-annotations:1.6.6' |
| 132 | +
|
| 133 | + implementation 'androidx.annotation:annotation:1.1.0' |
| 134 | + implementation "io.grpc:grpc-stub:$grpcVersion" |
| 135 | + implementation "io.grpc:grpc-protobuf-lite:$grpcVersion" |
| 136 | + implementation "io.grpc:grpc-okhttp:$grpcVersion" |
| 137 | + implementation "io.grpc:grpc-android:$grpcVersion" |
| 138 | + implementation 'com.google.android.gms:play-services-basement:18.1.0' |
| 139 | + implementation 'com.google.android.gms:play-services-tasks:18.0.1' |
| 140 | + implementation 'com.google.android.gms:play-services-base:18.0.1' |
| 141 | +
|
| 142 | + implementation('com.google.firebase:firebase-auth-interop:19.0.2') { |
| 143 | + exclude group: "com.google.firebase", module: "firebase-common" |
| 144 | + } |
| 145 | +
|
| 146 | + compileOnly 'com.google.auto.value:auto-value-annotations:1.6.6' |
| 147 | + androidTestAnnotationProcessor 'com.google.auto.value:auto-value:1.6.5' |
| 148 | + annotationProcessor 'com.google.auto.value:auto-value:1.6.5' |
| 149 | +*/ |
| 150 | + |
| 151 | + //implementation project(':firebase-firestore') |
| 152 | + testImplementation project(':firebase-firestore-sdk34') |
| 153 | + testImplementation 'junit:junit:4.13.2' |
| 154 | + testImplementation "androidx.test:core:$androidxTestCoreVersion" |
| 155 | + testImplementation "org.hamcrest:hamcrest-junit:2.0.0.0" |
| 156 | + testImplementation 'org.mockito:mockito-core:2.25.0' |
| 157 | + testImplementation "org.robolectric:robolectric:4.10.3" |
| 158 | + testImplementation "com.google.truth:truth:$googleTruthVersion" |
| 159 | + testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8' |
| 160 | + testImplementation 'com.google.guava:guava-testlib:12.0-rc2' |
| 161 | + testImplementation project(path: ':firebase-firestore') |
| 162 | + testImplementation libs.google.gson |
| 163 | + |
| 164 | + androidTestImplementation 'junit:junit:4.13.2' |
| 165 | + androidTestImplementation("com.google.truth:truth:$googleTruthVersion") { |
| 166 | + exclude group: "org.codehaus.mojo", module: "animal-sniffer-annotations" |
| 167 | + } |
| 168 | + androidTestImplementation 'org.mockito:mockito-core:2.25.0' |
| 169 | + androidTestImplementation 'org.mockito:mockito-android:2.25.0' |
| 170 | + androidTestImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8' |
| 171 | + androidTestImplementation "androidx.annotation:annotation:1.1.0" |
| 172 | + androidTestImplementation 'androidx.test:runner:1.5.2' |
| 173 | + androidTestImplementation 'androidx.test:rules:1.5.0' |
| 174 | + androidTestImplementation "androidx.test.ext:junit:$androidxTestJUnitVersion" |
| 175 | +} |
| 176 | + |
| 177 | +gradle.projectsEvaluated { |
| 178 | + tasks.withType(JavaCompile) { |
| 179 | + // TODO(wuandy): Also add "-Xlint:unchecked". But currently that |
| 180 | + // enables 100+ warnings due to our generated source code. |
| 181 | + // TODO(wuandy): Re-enable error on warnings once errorprone issues are fixed. |
| 182 | + options.compilerArgs << "-Xlint:deprecation" // << "-Werror" |
| 183 | + } |
| 184 | +} |
0 commit comments