diff --git a/about/build.gradle b/about/build.gradle deleted file mode 100644 index 480a887b1..000000000 --- a/about/build.gradle +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2018 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.dynamic-feature' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - } - - dataBinding { - enabled true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation project(':app') - implementation project(':core') - implementation project(':bypass') - - implementation "androidx.viewpager2:viewpager2:${versions.viewPager2}" - implementation "com.android.support:customtabs:${versions.supportLibrary}" - implementation "com.github.bumptech.glide:glide:${versions.glide}" - - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} diff --git a/about/build.gradle.kts b/about/build.gradle.kts new file mode 100644 index 000000000..9f95af7f9 --- /dev/null +++ b/about/build.gradle.kts @@ -0,0 +1,67 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.android.dynamic-feature") + kotlin("android") + kotlin("kapt") +} + +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") + +android { + compileSdkVersion(Versions.COMPILE_SDK) + + defaultConfig { + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + dataBinding.isEnabled = true +} + +dependencies { + api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) + + implementation(project(":app")) + implementation(project(":core")) + implementation(project(":bypass")) + + implementation(Libs.AX_VIEWPAGER2) + implementation(Libs.SUPPORT_CUSTOMTABS) + implementation(Libs.GLIDE) + + kapt("com.google.dagger:dagger-compiler") +} + +kapt { + useBuildCache = true +} diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index bfaaae63d..000000000 --- a/app/build.gradle +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2015 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.application' -apply plugin: 'io.fabric' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - applicationId names.applicationId - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - versionCode rootProject.gitCommitCount - versionName = '1.1.0' - archivesBaseName = 'plaid' - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - - resConfig 'en' - manifestPlaceholders += [ - crashlyticsEnabled: false - ] - } - - dataBinding { - enabled true - } - - buildTypes { - release { - // There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features - // The temporary workaround is to disable shrinking. - // This issue is tracked in: https://issuetracker.google.com/120517460 - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), - 'proguard-rules.pro' - manifestPlaceholders += [crashlyticsEnabled: true] - } - debug { - ext.alwaysUpdateBuildId = false - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } - - dynamicFeatures = [ - ':about', - ':designernews', - ':dribbble', - ':search' - ] -} - -dependencies { - implementation project(':core') - implementation "androidx.appcompat:appcompat:${versions.appcompat}" - implementation "com.crashlytics.sdk.android:crashlytics:${versions.crashlytics}" - implementation "com.google.firebase:firebase-core:${versions.firebase}" - implementation "com.github.bumptech.glide:glide:${versions.glide}" - implementation "com.github.bumptech.glide:recyclerview-integration:${versions.glide}" - - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} - -// Must be applied after dependencies. See https://stackoverflow.com/a/38018985 -apply plugin: 'com.google.gms.google-services' diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 000000000..636a358d2 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,105 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.android.application") + id("com.google.gms.google-services") + id("io.fabric") + kotlin("android") + id("kotlin-android-extensions") + kotlin("kapt") +} + +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") + +android { + compileSdkVersion(Versions.COMPILE_SDK) + + defaultConfig { + applicationId = Names.APPLICATION_ID + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) + versionCode = 100 + (runCmd("git", "rev-list", "--count", "HEAD")?.toIntOrNull() ?: 1) + versionName = "1.1.0" + + setProperty("archivesBaseName", "plaid") + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + resConfig("en") + manifestPlaceholders = mapOf("crashlyticsEnabled" to false) + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + buildTypes { + getByName("release") { + // There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features + // The temporary workaround is to disable shrinking + // This issue is tracked in: https://issuetracker.google.com/120517460 + isMinifyEnabled = false + manifestPlaceholders = mapOf("crashlyticsEnabled" to true) + + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), + "proguard-rules.pro" + ) + } + getByName("debug") { + (this as ExtensionAware).extra["alwaysUpdateBuildId"] = false + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + dynamicFeatures = hashSetOf( + ":about", + ":designernews", + ":dribbble", + ":search" + ) + + dataBinding.isEnabled = true + + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) + + implementation(project(":core")) + implementation(Libs.AX_APPCOMPAT) + implementation(Libs.AX_LIFECYCLE_EXTENSION) + implementation(Libs.CRASHLYTICS) + implementation(Libs.GLIDE) + implementation(Libs.GLIDE_RECYCLERVIEW) + implementation(Libs.FIREBASE_CORE) + + kapt(Libs.DAGGER_COMPILER) +} + +kapt.useBuildCache = true diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 7213ad721..000000000 --- a/build.gradle +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2015 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -buildscript { scriptHandler -> - apply from: 'repositories.gradle', - to: scriptHandler - ext.versions = [ - 'compileSdk' : 29, - 'minSdk' : 23, - 'targetSdk' : 29, - 'appcompat' : '1.1.0-rc01', - 'androidx' : '1.0.0', - 'androidxCollection' : '1.0.0', - 'androidxArch' : '2.0.0', - 'constraintLayout' : '2.0.0-alpha2', - 'coreKtx' : '1.2.0-alpha03', - 'coroutines' : '1.3.0', - 'crashlytics' : '2.10.1', - 'dagger' : '2.23.2', - 'espresso' : '3.1.0-beta02', - 'extJunit' : '1.1.0', - 'fabric' : '1.28.0', - 'firebase' : '17.0.0', - 'glide' : '4.9.0', - 'googleServices' : '4.3.0', - 'gson' : '2.8.5', - 'jsoup' : '1.11.3', - 'junit' : '4.12', - 'kotlin' : '1.3.50', - 'ktlint' : '0.36.0', - 'legacyCoreUtils' : '1.0.0', - 'lifecycle' : '2.2.0-alpha03', - 'material' : '1.1.0-alpha05', - 'mockito' : '2.23.0', - 'mockito_kotlin' : '2.0.0-RC3', - 'okhttp' : '4.0.0', - 'retrofit' : '2.6.0', - 'room' : '2.2.1', - 'supportLibrary' : '28.0.0', - 'test_rules' : '1.1.0-beta02', - 'test_runner' : '1.1.0-beta02', - 'ui_automator' : '2.2.0-beta02', - 'viewPager2' : '1.0.0' - ] - ext.names = [ - 'applicationId': 'io.plaidapp' - ] - - dependencies { - classpath 'com.android.tools.build:gradle:3.6.0-beta03' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" - classpath "com.google.gms:google-services:${versions.googleServices}" - classpath "io.fabric.tools:gradle:${versions.fabric}" - } -} - -plugins { - id 'com.diffplug.gradle.spotless' version '3.26.1' -} - -ext { - // query git for the commit count to automate versioning. - gitCommitCount = 100 + - Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim()) -} - -subprojects { - buildscript { - apply from: rootProject.file('repositories.gradle') - } - - apply plugin: 'com.diffplug.gradle.spotless' - spotless { - kotlin { - target '**/*.kt' - ktlint(versions.ktlint) - licenseHeaderFile project.rootProject.file('scripts/copyright.kt') - } - groovyGradle { - // same as groovy, but for .gradle (defaults to '*.gradle') - target '**/*.gradle' - paddedCell() // Avoid cyclic ambiguities - // the Groovy Eclipse formatter extends the Java Eclipse formatter, - // so it formats Java files by default (unless `excludeJava` is used). - greclipse().configFile(project.rootProject.file('scripts/greclipse.properties')) - licenseHeaderFile project.rootProject.file('scripts/copyright.kt'), '(buildscript|apply)' - } - } - - if (project.hasProperty( "kapt" )) { - kapt { - useBuildCache = true - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..a4e349faf --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,57 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.diffplug.gradle.spotless") version "3.26.1" +} + +buildscript { + + repositories { + addCommonRepositories() + } + + dependencies { + classpath("com.android.tools.build:gradle:3.6.0-rc01") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KOTLIN}") + classpath("com.google.gms:google-services:4.3.0") + classpath("io.fabric.tools:gradle:1.28.0") + } +} + +spotless { + val ktlintVer by extra("0.36.0") + + kotlin { + target("**/*.kt") + ktlint(ktlintVer) + licenseHeaderFile("$rootDir/scripts/copyright.txt", "(package |import |@file:|object |@Suppress)") + } + kotlinGradle { + // same as kotlin, but for .gradle.kts files (defaults to '*.gradle.kts') + target("**/*.gradle.kts") + + ktlint(ktlintVer) + + licenseHeaderFile("$rootDir/scripts/copyright.txt", "(plugins |import |include)") + } +} + +subprojects { + repositories { + addCommonRepositories() + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..69406b441 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,23 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + `kotlin-dsl` +} + +repositories { + gradlePluginPortal() +} diff --git a/buildSrc/src/main/java/AddCommonRepositories.kt b/buildSrc/src/main/java/AddCommonRepositories.kt new file mode 100644 index 000000000..43939ba6e --- /dev/null +++ b/buildSrc/src/main/java/AddCommonRepositories.kt @@ -0,0 +1,88 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.gradle.api.artifacts.dsl.RepositoryHandler +import org.gradle.kotlin.dsl.maven + +fun RepositoryHandler.addCommonRepositories() { + google().content { + includeGroupByRegex("com.android.*") + includeGroupByRegex("androidx.*") + + includeGroup("androidx.lifecycle") + includeGroup("androidx.core") + includeGroup("com.google.firebase") + includeGroup("com.google.android.gms") + includeGroup("com.google.android.material") + includeGroup("com.google.gms") + + includeGroup("zipflinger") + } + + jcenter().content { + includeGroupByRegex("com.google.*") + includeGroupByRegex("com.sun.*") + includeGroupByRegex("com.squareup.*") + includeGroupByRegex("com.jakewharton.*") + includeGroupByRegex("com.googlecode.*") + includeGroupByRegex("org.jetbrains.*") + includeGroupByRegex("org.codehaus.*") + includeGroupByRegex("org.apache.*") + includeGroupByRegex("net.sf.*") + includeGroupByRegex("javax.*") + includeGroupByRegex("org.ow2.*") + + includeGroup("com.github.bumptech.glide") + includeGroup("com.ibm.icu") + includeGroup("com.nhaarman.mockitokotlin2") + includeGroup("commons-io") + includeGroup("commons-codec") + includeGroup("commons-logging") + includeGroup("it.unimi.dsi") + includeGroup("junit") + includeGroup("me.eugeniomarletti.kotlin.metadata") + includeGroup("net.bytebuddy") + includeGroup("net.java") + includeGroup("org.abego.treelayout") + includeGroup("org.antlr") + includeGroup("org.bouncycastle") + includeGroup("org.checkerframework") + includeGroup("org.glassfish") + includeGroup("org.glassfish.jaxb") + includeGroup("org.hamcrest") + includeGroup("org.jvnet.staxex") + includeGroup("org.jsoup") + includeGroup("org.mockito") + includeGroup("org.objenesis") + includeGroup("org.sonatype.oss") + includeGroup("org.xerial") + includeGroup("net.ltgt.gradle.incap") + includeGroup("de.undercouch") + includeGroup("org.jdom") + excludeGroup("com.google.firebase") + excludeGroup("com.google.android.gms") + excludeGroup("com.google.android.material") + } + + maven("https://dl.bintray.com/kotlin/kotlin-eap/").content { + includeGroupByRegex("org.jetbrains.*") + } + + maven("https://maven.fabric.io/public").content { + includeGroupByRegex("io.fabric.*") + includeGroupByRegex("com.crashlytics.*") + } +} diff --git a/third_party/bypass/build.gradle b/buildSrc/src/main/java/Helper.kt similarity index 51% rename from third_party/bypass/build.gradle rename to buildSrc/src/main/java/Helper.kt index 302185c9f..fbfae0ce5 100644 --- a/third_party/bypass/build.gradle +++ b/buildSrc/src/main/java/Helper.kt @@ -14,27 +14,17 @@ * limitations under the License. */ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' +import java.io.ByteArrayOutputStream +import org.gradle.api.Project -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion 23 - targetSdkVersion versions.targetSdk - versionCode 1 - versionName '1.0' - } - buildTypes { - release { - minifyEnabled false - } +fun Project.runCmd(vararg command: String) = try { + val stdOut = ByteArrayOutputStream() + exec { + commandLine(*command) + standardOutput = stdOut } -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation "androidx.annotation:annotation:${versions.androidx}" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}" + stdOut.toString(Charsets.UTF_8.name()).trim() +} catch (e: Throwable) { + e.printStackTrace() + null } diff --git a/buildSrc/src/main/java/Libs.kt b/buildSrc/src/main/java/Libs.kt new file mode 100644 index 000000000..d306053d5 --- /dev/null +++ b/buildSrc/src/main/java/Libs.kt @@ -0,0 +1,70 @@ +/* + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +object Libs { + const val AX_ANNOTATION = "androidx.annotation:annotation" + const val AX_APPCOMPAT = "androidx.appcompat:appcompat" + const val AX_ARCH_CORE_RUNTIME = "androidx.arch.core:core-runtime" + const val AX_BROWSER = "androidx.browser:browser" + const val AX_COLLECTION = "androidx.collection:collection" + const val AX_CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout" + const val AX_CORE_COMMON = "androidx.arch.core:core-common" + const val AX_CORE_KTX = "androidx.core:core-ktx" + const val AX_LEGACY_CORE = "androidx.legacy:legacy-support-core-utils" + const val AX_LIFECYCLE_EXTENSION = "androidx.lifecycle:lifecycle-extensions" + const val AX_LIFECYCLE_LIVEDATA = "androidx.lifecycle:lifecycle-livedata-ktx" + const val AX_LIFECYCLE_RUNTIME = "androidx.lifecycle:lifecycle-runtime" + const val AX_LIFECYCLE_VM = "androidx.lifecycle:lifecycle-viewmodel" + const val AX_LIFECYCLE_VM_KTX = "androidx.lifecycle:lifecycle-viewmodel-ktx" + const val AX_ROOM_RUNTIME = "androidx.room:room-runtime" + const val AX_ROOM_KTX = "androidx.room:room-ktx" + const val AX_VIEWPAGER2 = "androidx.viewpager2:viewpager2" + const val COROUTINES_CORE = "org.jetbrains.kotlinx:kotlinx-coroutines-core" + const val COROUTINES_ANDROID = "org.jetbrains.kotlinx:kotlinx-coroutines-android" + const val CRASHLYTICS = "com.crashlytics.sdk.android:crashlytics" + const val DAGGER = "com.google.dagger:dagger" + const val DAGGER_COMPILER = "com.google.dagger:dagger-compiler" + const val GLIDE = "com.github.bumptech.glide:glide" + const val GLIDE_RECYCLERVIEW = "com.github.bumptech.glide:recyclerview-integration" + const val GLIDE_COMPILER = "com.github.bumptech.glide:compiler" + const val GMS_PLAY_SERVICES_GCM = "com.google.android.gms:play-services-gcm" + const val GOOGLE_GSON = "com.google.code.gson:gson" + const val FIREBASE_CORE = "com.google.firebase:firebase-core" + const val OKHTTP = "com.squareup.okhttp3:okhttp" + const val OKHTTP_LOGGING = "com.squareup.okhttp3:logging-interceptor" + const val JSOUP = "org.jsoup:jsoup" + const val KOTLIN_STDLIB = "org.jetbrains.kotlin:kotlin-stdlib-jdk7" + const val KOTLIN_REFLECT = "org.jetbrains.kotlin:kotlin-reflect" + const val MATERIAL = "com.google.android.material:material" + const val RETROFIT = "com.squareup.retrofit2:retrofit" + const val RETROFIT_CONVERTER_GSON = "com.squareup.retrofit2:converter-gson" + const val SUPPORT_CUSTOMTABS = "com.android.support:customtabs" + const val SUPPORT_DYN_ANIMATION = "com.android.support:support-dynamic-animation" + const val SUPPORT_PALETTE = "com.android.support:palette-v7" + const val TEST_AX_ESPRESSO_CONTRIB = "androidx.test.espresso:espresso-contrib" + const val TEST_AX_ESPRESSO_CORE = "androidx.test.espresso:espresso-core" + const val TEST_AX_JUNIT_EXT = "androidx.test.ext:junit" + const val TEST_AX_RULES = "androidx.test:rules" + const val TEST_AX_RUNNER = "androidx.test:runner" + const val TEST_AX_UIAUTOMATOR = "androidx.test.uiautomator:uiautomator" + const val TEST_CORE = "androidx.arch.core:core-testing" + const val TEST_COROUTINES = "org.jetbrains.kotlinx:kotlinx-coroutines-test" + const val TEST_JUNIT = "junit:junit" + const val TEST_MOCKITO_ANDROID = "org.mockito:mockito-android" + const val TEST_MOCKITO_CORE = "org.mockito:mockito-core" + const val TEST_MOCKITO_KT = "com.nhaarman.mockitokotlin2:mockito-kotlin" + const val TEST_RETROFIT_MOCK = "com.squareup.retrofit2:retrofit-mock" +} diff --git a/buildSrc/src/main/java/Names.kt b/buildSrc/src/main/java/Names.kt new file mode 100644 index 000000000..bb9f69647 --- /dev/null +++ b/buildSrc/src/main/java/Names.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +object Names { + const val APPLICATION_ID = "io.plaidapp" +} diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt new file mode 100644 index 000000000..775577b4d --- /dev/null +++ b/buildSrc/src/main/java/Versions.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +object Versions { + const val COMPILE_SDK = 29 + const val TARGET_SDK = 28 + const val MIN_SDK = 23 + + const val KOTLIN = "1.3.61" +} diff --git a/core/build.gradle b/core/build.gradle deleted file mode 100644 index 5876d21b0..000000000 --- a/core/build.gradle +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2018 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - - buildConfigField 'String', 'DESIGNER_NEWS_CLIENT_ID', "\"${designer_news_client_id}\"" - buildConfigField 'String', - 'DESIGNER_NEWS_CLIENT_SECRET', "\"${designer_news_client_secret}\"" - - buildConfigField 'String', - 'PRODUCT_HUNT_DEVELOPER_TOKEN', "\"${product_hunt_developer_token}\"" - - javaCompileOptions { - annotationProcessorOptions { - arguments << ['room.incremental': 'true'] - } - } - } - - dataBinding { - enabled true - } - - buildTypes { - release { - consumerProguardFiles 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } - - packagingOptions { - exclude 'META-INF/core_debug.kotlin_module' - } -} - -dependencies { - implementation project(':bypass') - implementation "com.google.code.gson:gson:${versions.gson}" - implementation "androidx.browser:browser:${versions.androidx}" - implementation "androidx.room:room-runtime:${versions.room}" - implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}" - implementation "com.android.support:palette-v7:${versions.supportLibrary}" - implementation "com.android.support:support-dynamic-animation:${versions.supportLibrary}" - implementation "com.github.bumptech.glide:glide:${versions.glide}" - implementation "com.squareup.okhttp3:okhttp:${versions.okhttp}" - implementation "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}" - implementation "org.jsoup:jsoup:${versions.jsoup}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutines}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutines}" - kapt "com.github.bumptech.glide:compiler:${versions.glide}" - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" - kapt "androidx.annotation:annotation:${versions.androidx}" -} - -androidExtensions { - experimental = true -} diff --git a/core/build.gradle.kts b/core/build.gradle.kts new file mode 100644 index 000000000..77080dd6d --- /dev/null +++ b/core/build.gradle.kts @@ -0,0 +1,104 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.android.library") + kotlin("android") + id("kotlin-android-extensions") + kotlin("kapt") +} + +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") + +android { + compileSdkVersion(Versions.COMPILE_SDK) + + defaultConfig { + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + val designer_news_client_id: String by project + val designer_news_client_secret: String by project + val product_hunt_developer_token: String by project + + buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "$designer_news_client_id") + buildConfigField("String", + "DESIGNER_NEWS_CLIENT_SECRET", "$designer_news_client_secret") + + buildConfigField("String", + "PRODUCT_HUNT_DEVELOPER_TOKEN", "$product_hunt_developer_token") + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + buildTypes { + getByName("release") { + consumerProguardFiles("proguard-rules.pro") + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + packagingOptions { + exclude("META-INF/core_debug.kotlin_module") + } + + dataBinding.isEnabled = true +} + +dependencies { + api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) + + implementation(project(":bypass")) + + implementation(Libs.GOOGLE_GSON) + implementation(Libs.AX_BROWSER) + implementation(Libs.AX_ROOM_RUNTIME) + implementation(Libs.AX_CONSTRAINT_LAYOUT) + implementation(Libs.SUPPORT_PALETTE) + implementation(Libs.SUPPORT_DYN_ANIMATION) + implementation(Libs.GLIDE) + implementation(Libs.OKHTTP) + implementation(Libs.OKHTTP_LOGGING) + implementation(Libs.JSOUP) + api(Libs.COROUTINES_CORE) + api(Libs.COROUTINES_ANDROID) + + kapt(Libs.GLIDE_COMPILER) + kapt(Libs.GLIDE) + kapt(Libs.DAGGER_COMPILER) +} + +kapt.useBuildCache = true +kapt.arguments { + mapOf( + "dagger.formatGeneratedSource" to "disabled", + "dagger.gradle.incremental" to "enabled" + ) +} + +androidExtensions.isExperimental = true diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro index 5021cc9b1..7c75a31e3 100644 --- a/core/proguard-rules.pro +++ b/core/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/depconstraints/build.gradle.kts b/depconstraints/build.gradle.kts new file mode 100644 index 000000000..c465306eb --- /dev/null +++ b/depconstraints/build.gradle.kts @@ -0,0 +1,116 @@ +/* + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("java-platform") + id("maven-publish") +} + +val appcompat = "1.1.0" +val androidx = "1.0.0" +val androidxCollection = "1.0.0" +val androidxCoreRuntime = "2.1.0" +val androidxArch = "2.0.0" +val constraintLayout = "2.0.0-beta3" +val coreKtx = "1.1.0" +val coroutines = "1.3.2" +val crashlytics = "2.10.1" +val dagger = "2.23.2" +val espresso = "3.1.0-beta02" +val extJunit = "1.1.0" +val fabric = "1.28.0" +val firebase = "17.2.1" +val glide = "4.9.0" +val gson = "2.8.5" +val jsoup = "1.11.3" +val junit = "4.12" +val legacyCoreUtils = "1.0.0" +val lifecycle = "2.2.0-rc03" +val material = "1.1.0-alpha05" +val mockito = "2.23.0" +val mockito_kotlin = "2.0.0-RC3" +val okhttp = "4.2.2" +val retrofit = "2.6.0" +val room = "2.2.2" +val supportLibrary = "28.0.0" +val test_rules = "1.1.0-beta02" +val test_runner = "1.1.0-beta02" +val ui_automator = "2.2.0-beta02" +val viewPager2 = "1.0.0-beta02" + +dependencies { + constraints { + api("${Libs.AX_ANNOTATION}:$androidx") + api("${Libs.AX_APPCOMPAT}:$appcompat") + api("${Libs.AX_ARCH_CORE_RUNTIME}:$androidxCoreRuntime") + api("${Libs.AX_CORE_COMMON}:$androidxCoreRuntime") + api("${Libs.AX_CORE_KTX}:$coreKtx") + api("${Libs.AX_BROWSER}:$androidx") + api("${Libs.AX_COLLECTION}:$androidxCollection") + api("${Libs.AX_CONSTRAINT_LAYOUT}:$constraintLayout") + api("${Libs.AX_LEGACY_CORE}:$legacyCoreUtils") + api("${Libs.AX_LIFECYCLE_EXTENSION}:$lifecycle") + api("${Libs.AX_LIFECYCLE_LIVEDATA}:$lifecycle") + api("${Libs.AX_LIFECYCLE_RUNTIME}:$lifecycle") + api("${Libs.AX_LIFECYCLE_VM}:$lifecycle") + api("${Libs.AX_LIFECYCLE_VM_KTX}:$lifecycle") + api("${Libs.AX_ROOM_RUNTIME}:$room") + api("${Libs.AX_ROOM_KTX}:$room") + api("${Libs.AX_VIEWPAGER2}:$viewPager2") + api("${Libs.COROUTINES_CORE}:$coroutines") + api("${Libs.COROUTINES_ANDROID}:$coroutines") + api("${Libs.CRASHLYTICS}:$crashlytics") + api("${Libs.DAGGER}:$dagger") + api("${Libs.DAGGER_COMPILER}:$dagger") + api("${Libs.GLIDE}:$glide") + api("${Libs.GLIDE_RECYCLERVIEW}:$glide") + api("${Libs.GLIDE_COMPILER}:$glide") + api("${Libs.GOOGLE_GSON}:$gson") + api("${Libs.FIREBASE_CORE}:$firebase") + api("${Libs.JSOUP}:$jsoup") + api("${Libs.KOTLIN_STDLIB}:${Versions.KOTLIN}") + api("${Libs.KOTLIN_REFLECT}:${Versions.KOTLIN}") + api("${Libs.MATERIAL}:$material") + api("${Libs.OKHTTP}:$okhttp") + api("${Libs.OKHTTP_LOGGING}:$okhttp") + api("${Libs.RETROFIT}:$retrofit") + api("${Libs.RETROFIT_CONVERTER_GSON}:$retrofit") + api("${Libs.SUPPORT_CUSTOMTABS}:$supportLibrary") + api("${Libs.SUPPORT_PALETTE}:$supportLibrary") + api("${Libs.SUPPORT_DYN_ANIMATION}:$supportLibrary") + api("${Libs.TEST_CORE}:$androidxArch") + api("${Libs.TEST_COROUTINES}:$coroutines") + api("${Libs.TEST_AX_ESPRESSO_CONTRIB}:$espresso") + api("${Libs.TEST_AX_ESPRESSO_CORE}:$espresso") + api("${Libs.TEST_JUNIT}:$junit") + api("${Libs.TEST_AX_JUNIT_EXT}:$extJunit") + api("${Libs.TEST_MOCKITO_ANDROID}:$mockito") + api("${Libs.TEST_MOCKITO_CORE}:$mockito") + api("${Libs.TEST_MOCKITO_KT}:$mockito_kotlin") + api("${Libs.TEST_RETROFIT_MOCK}:$retrofit") + api("${Libs.TEST_AX_RULES}:$test_rules") + api("${Libs.TEST_AX_RUNNER}:$test_runner") + api("${Libs.TEST_AX_UIAUTOMATOR}:$ui_automator") + } +} + +publishing { + publications { + create("JavaPlatform") { + from(components["javaPlatform"]) + } + } +} diff --git a/designernews/build.gradle b/designernews/build.gradle deleted file mode 100644 index 4082f9e50..000000000 --- a/designernews/build.gradle +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2018 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.dynamic-feature' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - resConfig 'en' - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - - javaCompileOptions { - annotationProcessorOptions { - arguments << ['room.incremental': 'true'] - } - } - } - - dataBinding { - enabled true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation project(':app') - implementation project(':core') - implementation project(':bypass') - - implementation "androidx.room:room-ktx:${versions.room}" - implementation "com.android.support:customtabs:${versions.supportLibrary}" - implementation "com.github.bumptech.glide:glide:${versions.glide}" - - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} - -// enabling experimental for Kotlin parcelize supports -androidExtensions { - experimental = true -} diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts new file mode 100644 index 000000000..408932ca8 --- /dev/null +++ b/designernews/build.gradle.kts @@ -0,0 +1,72 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.android.dynamic-feature") + kotlin("android") + id("kotlin-android-extensions") + kotlin("kapt") +} + +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") + +android { + compileSdkVersion(Versions.COMPILE_SDK) + + defaultConfig { + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) + resConfig("en") + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + dataBinding.isEnabled = true +} + +dependencies { + api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) + + implementation(project(":app")) + implementation(project(":core")) + implementation(project(":bypass")) + + implementation(Libs.AX_ROOM_KTX) + implementation(Libs.SUPPORT_CUSTOMTABS) + implementation(Libs.GLIDE) + + kapt(Libs.DAGGER_COMPILER) +} + +kapt.useBuildCache = true + +// enabling experimental for Kotlin parcelize supports +androidExtensions { + isExperimental = true +} diff --git a/dribbble/build.gradle b/dribbble/build.gradle deleted file mode 100644 index f46e56123..000000000 --- a/dribbble/build.gradle +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2018 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.dynamic-feature' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - def filesAuthorityValue = names.applicationId + '.shareprovider' - buildConfigField 'String', 'FILES_AUTHORITY', "\"${filesAuthorityValue}\"" - manifestPlaceholders = [filesAuthority: filesAuthorityValue] - } - - dataBinding { - enabled true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation project(':app') - implementation project(':core') - - implementation "com.android.support:customtabs:${versions.supportLibrary}" - implementation "com.android.support:palette-v7:${versions.supportLibrary}" - implementation "com.github.bumptech.glide:recyclerview-integration:${versions.glide}" - - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts new file mode 100644 index 000000000..b53bcde22 --- /dev/null +++ b/dribbble/build.gradle.kts @@ -0,0 +1,69 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.android.dynamic-feature") + kotlin("android") + kotlin("kapt") +} + +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") + +android { + compileSdkVersion(Versions.COMPILE_SDK) + + defaultConfig { + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) + + val filesAuthorityValue = Names.APPLICATION_ID + ".shareprovider" + buildConfigField("String", "FILES_AUTHORITY", "\"${filesAuthorityValue}\"") + + manifestPlaceholders = mapOf( + "filesAuthority" to filesAuthorityValue + ) + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + dataBinding.isEnabled = true +} + +dependencies { + api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) + + implementation(project(":app")) + implementation(project(":core")) + + implementation(Libs.SUPPORT_CUSTOMTABS) + implementation(Libs.SUPPORT_PALETTE) + implementation(Libs.GLIDE_RECYCLERVIEW) + + kapt(Libs.DAGGER_COMPILER) +} + +kapt.useBuildCache = true diff --git a/gradle.properties b/gradle.properties index 02b387f02..37cf742a6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,17 +16,14 @@ org.gradle.parallel=true # Use kapt incremental kapt.incremental.apt=true -# Use kapt in parallel -kapt.use.worker.api=true - # Kapt compile avoidance kapt.include.compile.classpath=false # Design News API -designer_news_client_id = -designer_news_client_secret = +designer_news_client_id = "" +designer_news_client_secret = "" # Product Hunt API -product_hunt_developer_token = +product_hunt_developer_token = "" android.useAndroidX=true android.enableJetifier=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 59b5f8928..609a8fc0a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Thu Dec 05 16:57:02 GMT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip diff --git a/repositories.gradle b/repositories.gradle deleted file mode 100644 index 991672618..000000000 --- a/repositories.gradle +++ /dev/null @@ -1,77 +0,0 @@ -repositories { - maven { - url "https://maven.google.com" - content { - includeGroupByRegex "com\\.android.*" - includeGroupByRegex "androidx.*" - includeGroup "android.arch.lifecycle" - includeGroup "android.arch.core" - includeGroup "com.google.firebase" - includeGroup "com.google.android.gms" - includeGroup "com.google.android.material" - includeGroup "com.google.gms" - includeGroup "zipflinger" - } - } - - maven { - url 'https://jcenter.bintray.com' - content { - includeGroupByRegex "com\\.google.*" - includeGroupByRegex "com\\.sun.*" - includeGroupByRegex "com\\.squareup.*" - includeGroupByRegex "com\\.jakewharton.*" - includeGroupByRegex "com\\.googlecode.*" - includeGroupByRegex "org\\.jetbrains.*" - includeGroupByRegex "org\\.codehaus.*" - includeGroupByRegex "org\\.apache.*" - includeGroupByRegex "net\\.sf.*" - includeGroupByRegex "javax.*" - includeGroup "com.github.bumptech.glide" - includeGroup "com.ibm.icu" - includeGroup "com.nhaarman.mockitokotlin2" - includeGroup "commons-io" - includeGroup "commons-codec" - includeGroup "commons-logging" - includeGroup "it.unimi.dsi" - includeGroup "junit" - includeGroup "me.eugeniomarletti.kotlin.metadata" - includeGroup "net.bytebuddy" - includeGroup "net.java" - includeGroup "org.abego.treelayout" - includeGroup "org.antlr" - includeGroup "org.bouncycastle" - includeGroup "org.checkerframework" - includeGroup "org.glassfish" - includeGroup "org.glassfish.jaxb" - includeGroup "org.hamcrest" - includeGroup "org.jvnet.staxex" - includeGroup "org.jsoup" - includeGroup "org.mockito" - includeGroup "org.objenesis" - includeGroup "org.ow2.asm" - includeGroup "org.sonatype.oss" - includeGroup "org.xerial" - includeGroup "net.ltgt.gradle.incap" - - excludeGroup "com.google.firebase" - excludeGroup "com.google.android.gms" - excludeGroup "com.google.android.material" - } - } - - maven { - url 'https://maven.fabric.io/public' - content { - includeGroupByRegex "io\\.fabric.*" - includeGroupByRegex "com\\.crashlytics.*" - } - } - - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap' - content { - includeGroupByRegex "org\\.jetbrains.*" - } - } -} diff --git a/scripts/copyright.kt b/scripts/copyright.txt similarity index 100% rename from scripts/copyright.kt rename to scripts/copyright.txt diff --git a/search/build.gradle b/search/build.gradle deleted file mode 100644 index dbd66b0cd..000000000 --- a/search/build.gradle +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2018 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.dynamic-feature' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - - javaCompileOptions { - annotationProcessorOptions { - arguments << ['dagger.gradle.incremental': 'true'] - } - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation project(':app') - implementation project(':core') - - implementation "com.github.bumptech.glide:recyclerview-integration:${versions.glide}" - implementation "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin}" - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} diff --git a/search/build.gradle.kts b/search/build.gradle.kts new file mode 100644 index 000000000..642eae5b9 --- /dev/null +++ b/search/build.gradle.kts @@ -0,0 +1,62 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.android.dynamic-feature") + kotlin("android") + kotlin("kapt") +} + +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") + +android { + compileSdkVersion(Versions.COMPILE_SDK) + + defaultConfig { + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) + + implementation(project(":app")) + implementation(project(":core")) + + implementation(Libs.GLIDE_RECYCLERVIEW) + implementation(Libs.KOTLIN_REFLECT) + kapt(Libs.DAGGER_COMPILER) +} + +kapt.useBuildCache = true diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 76a548844..000000000 --- a/settings.gradle +++ /dev/null @@ -1,4 +0,0 @@ -include ':app', ':bypass' -include ':about', ':core', ':dribbble', ':designernews', ':search' -include ':test_shared' -project(':bypass').projectDir = new File(rootDir, 'third_party/bypass') diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..af9bc5b92 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,21 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +include("depconstraints") +include(":app", ":bypass") +include(":about", ":core", ":dribbble", ":designernews", ":search") +include(":test_shared") +project(":bypass").projectDir = file("$rootDir/third_party/bypass") diff --git a/shared_dependencies.gradle b/shared_dependencies.gradle deleted file mode 100644 index 46d4dd095..000000000 --- a/shared_dependencies.gradle +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2018 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -dependencies { - implementation "com.google.android.material:material:${versions.material}" - implementation "com.google.dagger:dagger:${versions.dagger}" - implementation "androidx.core:core-ktx:${versions.coreKtx}" - implementation "com.squareup.retrofit2:retrofit:${versions.retrofit}" - implementation "com.squareup.retrofit2:converter-gson:${versions.retrofit}" - implementation "androidx.lifecycle:lifecycle-viewmodel:${versions.lifecycle}" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:${versions.lifecycle}" - implementation "androidx.lifecycle:lifecycle-extensions:${versions.lifecycle}" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.lifecycle}" -} diff --git a/shared_dependencies.gradle.kts b/shared_dependencies.gradle.kts new file mode 100644 index 000000000..6f8b67577 --- /dev/null +++ b/shared_dependencies.gradle.kts @@ -0,0 +1,37 @@ +/* + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.gradle.kotlin.dsl.dependencies + +val implementation by configurations +val testImplementation by configurations +val androidTestImplementation by configurations +val compile by configurations +val api by configurations + +dependencies { + api(platform(project(":depconstraints"))) + + implementation(Libs.AX_CORE_KTX) + implementation(Libs.AX_LIFECYCLE_VM) + implementation(Libs.AX_LIFECYCLE_LIVEDATA) + implementation(Libs.AX_LIFECYCLE_EXTENSION) + implementation(Libs.AX_LIFECYCLE_VM_KTX) + implementation(Libs.DAGGER) + implementation(Libs.MATERIAL) + implementation(Libs.RETROFIT) + implementation(Libs.RETROFIT_CONVERTER_GSON) +} diff --git a/test_dependencies.gradle b/test_dependencies.gradle deleted file mode 100644 index c5fa70b80..000000000 --- a/test_dependencies.gradle +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2018 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -dependencies { - testImplementation project(':test_shared') - testImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" - testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${versions.mockito_kotlin}" - testImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}" - testImplementation "junit:junit:${versions.junit}" - testImplementation "org.mockito:mockito-core:${versions.mockito}" - testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.coroutines}" - - // Work around issue with runtime classpath version conflict - implementation "androidx.arch.core:core-runtime:${versions.androidxCoreRuntime}" - implementation "androidx.collection:collection:${versions.androidxCollection}" - implementation "androidx.legacy:legacy-support-core-utils:${versions.legacyCoreUtils}" - implementation "androidx.lifecycle:lifecycle-runtime:${versions.lifecycle}" - - // Workaround for dependency conflict during assembleAndroidTest - androidTestImplementation("androidx.arch.core:core-runtime:2.0.1-alpha01") - - // Work around issue with runtime classpath version conflict - androidTestImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" - androidTestImplementation "androidx.legacy:legacy-support-core-utils:${versions.legacyCoreUtils}" - androidTestImplementation "androidx.lifecycle:lifecycle-runtime:${versions.lifecycle}" - - androidTestImplementation project(':test_shared') - androidTestImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" - androidTestImplementation "androidx.test.espresso:espresso-contrib:${versions.espresso}" - androidTestImplementation "androidx.test.espresso:espresso-core:${versions.espresso}" - androidTestImplementation "androidx.test.ext:junit:${versions.extJunit}" - androidTestImplementation "androidx.test:rules:${versions.test_rules}" - androidTestImplementation "androidx.test:runner:${versions.test_runner}" - androidTestImplementation "androidx.test.uiautomator:uiautomator:${versions.ui_automator}" - androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${versions.mockito_kotlin}" - androidTestImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}" - androidTestImplementation "org.mockito:mockito-android:${versions.mockito}" - androidTestImplementation "org.mockito:mockito-core:${versions.mockito}" - // Adding this to bring "google_play_services_version" into the test project - // without this, it fails on AGP 3.6.x. - androidTestImplementation "com.google.android.gms:play-services-gcm:16.0.0" -} diff --git a/test_dependencies.gradle.kts b/test_dependencies.gradle.kts new file mode 100644 index 000000000..2e62a366e --- /dev/null +++ b/test_dependencies.gradle.kts @@ -0,0 +1,60 @@ +/* + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.gradle.kotlin.dsl.dependencies + +val implementation by configurations +val testImplementation by configurations +val androidTestImplementation by configurations +val compile by configurations +val api by configurations + +dependencies { + api(platform(project(":depconstraints"))) + + testImplementation(project(":test_shared")) + testImplementation(Libs.TEST_CORE) + testImplementation(Libs.TEST_MOCKITO_KT) + testImplementation(Libs.TEST_RETROFIT_MOCK) + testImplementation(Libs.TEST_JUNIT) + testImplementation(Libs.TEST_MOCKITO_CORE) + testImplementation(Libs.TEST_COROUTINES) + + // Work around issue with runtime classpath version conflict + implementation(Libs.AX_CORE_COMMON) + implementation(Libs.AX_ARCH_CORE_RUNTIME) + implementation(Libs.AX_COLLECTION) + implementation(Libs.AX_LEGACY_CORE) + implementation(Libs.AX_LIFECYCLE_RUNTIME) + + // Work around issue with runtime classpath version conflict + androidTestImplementation(Libs.TEST_CORE) + androidTestImplementation(Libs.AX_LEGACY_CORE) + androidTestImplementation(Libs.AX_LIFECYCLE_RUNTIME) + + androidTestImplementation(project(":test_shared")) + androidTestImplementation(Libs.TEST_CORE) + androidTestImplementation(Libs.TEST_AX_ESPRESSO_CONTRIB) + androidTestImplementation(Libs.TEST_AX_ESPRESSO_CORE) + androidTestImplementation(Libs.TEST_AX_JUNIT_EXT) + androidTestImplementation(Libs.TEST_AX_RULES) + androidTestImplementation(Libs.TEST_AX_RUNNER) + androidTestImplementation(Libs.TEST_AX_UIAUTOMATOR) + androidTestImplementation(Libs.TEST_MOCKITO_KT) + androidTestImplementation(Libs.TEST_RETROFIT_MOCK) + androidTestImplementation(Libs.TEST_MOCKITO_ANDROID) + androidTestImplementation(Libs.TEST_MOCKITO_CORE) +} diff --git a/test_shared/build.gradle b/test_shared/build.gradle deleted file mode 100644 index 40074df6c..000000000 --- a/test_shared/build.gradle +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2019 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - } - packagingOptions { - exclude 'META-INF/test_shared_debug.kotlin_module' - } -} - -dependencies { - implementation project(':core') - - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutines}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutines}" - implementation "junit:junit:${versions.junit}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.coroutines}" -} - diff --git a/test_shared/build.gradle.kts b/test_shared/build.gradle.kts new file mode 100644 index 000000000..ef34ba413 --- /dev/null +++ b/test_shared/build.gradle.kts @@ -0,0 +1,51 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.android.library") + kotlin("android") +} + +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") + +android { + compileSdkVersion(Versions.COMPILE_SDK) + + defaultConfig { + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + packagingOptions { + exclude("META-INF/test_shared_debug.kotlin_module") + } +} + +dependencies { + api(platform(project(":depconstraints"))) + + implementation(project(":core")) + + implementation(Libs.KOTLIN_STDLIB) + implementation(Libs.COROUTINES_CORE) + implementation(Libs.COROUTINES_ANDROID) + implementation(Libs.TEST_JUNIT) + implementation(Libs.TEST_COROUTINES) +} diff --git a/third_party/bypass/build.gradle.kts b/third_party/bypass/build.gradle.kts new file mode 100644 index 000000000..3765a37b5 --- /dev/null +++ b/third_party/bypass/build.gradle.kts @@ -0,0 +1,46 @@ +/* + * Copyright 2019 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.android.library") + kotlin("android") +} + +android { + compileSdkVersion(Versions.COMPILE_SDK) + + defaultConfig { + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) + versionCode = 1 + versionName = "1.0" + } + buildTypes { + getByName("release") { + // There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features + // The temporary workaround is to disable shrinking + isMinifyEnabled = false + } + } +} + +dependencies { + api(platform(project(":depconstraints"))) + + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + implementation(Libs.AX_ANNOTATION) + implementation(Libs.KOTLIN_STDLIB) +}