commit
09e0aed124
@ -0,0 +1,6 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value="Copyright &#36;today.year The Android Open Source Project 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 https://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." />
|
||||||
|
<option name="myName" value="The Android Open Source Project" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
@ -0,0 +1,3 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="The Android Open Source Project" />
|
||||||
|
</component>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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 com.android.build.gradle.internal.dsl.BaseAppModuleExtension
|
||||||
|
import com.google.samples.apps.nowinandroid.configureAndroidCompose
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
|
||||||
|
class AndroidApplicationComposeConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
pluginManager.apply("com.android.application")
|
||||||
|
val extension = extensions.getByType<BaseAppModuleExtension>()
|
||||||
|
configureAndroidCompose(extension)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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 com.android.build.gradle.internal.dsl.BaseAppModuleExtension
|
||||||
|
import com.google.samples.apps.nowinandroid.configureKotlinAndroid
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
|
||||||
|
class AndroidApplicationConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
with(pluginManager) {
|
||||||
|
apply("com.android.application")
|
||||||
|
apply("org.jetbrains.kotlin.android")
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions.configure<BaseAppModuleExtension> {
|
||||||
|
configureKotlinAndroid(this)
|
||||||
|
defaultConfig.targetSdk = 32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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 com.android.build.api.variant.ApplicationAndroidComponentsExtension
|
||||||
|
import com.google.samples.apps.nowinandroid.configureJacoco
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
|
||||||
|
class AndroidApplicationJacocoConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
with(pluginManager) {
|
||||||
|
apply("org.gradle.jacoco")
|
||||||
|
apply("com.android.application")
|
||||||
|
}
|
||||||
|
val extension = extensions.getByType<ApplicationAndroidComponentsExtension>()
|
||||||
|
configureJacoco(extension)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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 com.android.build.gradle.LibraryExtension
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
|
||||||
|
class AndroidFeatureConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
pluginManager.apply {
|
||||||
|
apply("com.android.library")
|
||||||
|
apply("org.jetbrains.kotlin.android")
|
||||||
|
apply("org.jetbrains.kotlin.kapt")
|
||||||
|
}
|
||||||
|
extensions.configure<LibraryExtension> {
|
||||||
|
defaultConfig {
|
||||||
|
testInstrumentationRunner =
|
||||||
|
"com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
add("implementation", project(":core-model"))
|
||||||
|
add("implementation", project(":core-ui"))
|
||||||
|
add("implementation", project(":core-data"))
|
||||||
|
add("implementation", project(":core-common"))
|
||||||
|
add("implementation", project(":core-navigation"))
|
||||||
|
|
||||||
|
add("testImplementation", project(":core-testing"))
|
||||||
|
add("androidTestImplementation", project(":core-testing"))
|
||||||
|
|
||||||
|
add("implementation", libs.findLibrary("coil.kt").get())
|
||||||
|
add("implementation", libs.findLibrary("coil.kt.compose").get())
|
||||||
|
|
||||||
|
add("implementation", libs.findLibrary("androidx.hilt.navigation.compose").get())
|
||||||
|
add("implementation", libs.findLibrary("androidx.lifecycle.viewModelCompose").get())
|
||||||
|
|
||||||
|
add("implementation", libs.findLibrary("kotlinx.coroutines.android").get())
|
||||||
|
|
||||||
|
add("implementation", libs.findLibrary("hilt.android").get())
|
||||||
|
add("kapt", libs.findLibrary("hilt.compiler").get())
|
||||||
|
|
||||||
|
// TODO : Remove this dependency once we upgrade to Android Studio Dolphin b/228889042
|
||||||
|
// These dependencies are currently necessary to render Compose previews
|
||||||
|
add(
|
||||||
|
"debugImplementation",
|
||||||
|
libs.findLibrary("androidx.customview.poolingcontainer").get()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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 com.android.build.gradle.LibraryExtension
|
||||||
|
import com.google.samples.apps.nowinandroid.configureAndroidCompose
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
|
||||||
|
class AndroidLibraryComposeConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
pluginManager.apply("com.android.library")
|
||||||
|
val extension = extensions.getByType<LibraryExtension>()
|
||||||
|
configureAndroidCompose(extension)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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 com.android.build.gradle.LibraryExtension
|
||||||
|
import com.google.samples.apps.nowinandroid.configureFlavors
|
||||||
|
import com.google.samples.apps.nowinandroid.configureKotlinAndroid
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
|
||||||
|
class AndroidLibraryConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
with(pluginManager) {
|
||||||
|
apply("com.android.library")
|
||||||
|
apply("org.jetbrains.kotlin.android")
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions.configure<LibraryExtension> {
|
||||||
|
configureKotlinAndroid(this)
|
||||||
|
defaultConfig.targetSdk = 32
|
||||||
|
configureFlavors(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||||
|
dependencies {
|
||||||
|
configurations.configureEach {
|
||||||
|
resolutionStrategy {
|
||||||
|
force(libs.findLibrary("junit4").get())
|
||||||
|
// Temporary workaround for https://issuetracker.google.com/174733673
|
||||||
|
force("org.objenesis:objenesis:2.6")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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 com.android.build.api.variant.LibraryAndroidComponentsExtension
|
||||||
|
import com.google.samples.apps.nowinandroid.configureJacoco
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
|
||||||
|
class AndroidLibraryJacocoConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
with(pluginManager) {
|
||||||
|
apply("org.gradle.jacoco")
|
||||||
|
apply("com.android.library")
|
||||||
|
}
|
||||||
|
val extension = extensions.getByType<LibraryAndroidComponentsExtension>()
|
||||||
|
configureJacoco(extension)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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 com.android.build.gradle.TestExtension
|
||||||
|
import com.google.samples.apps.nowinandroid.configureKotlinAndroid
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
|
||||||
|
class AndroidTestConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
with(pluginManager) {
|
||||||
|
apply("com.android.test")
|
||||||
|
apply("org.jetbrains.kotlin.android")
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions.configure<TestExtension> {
|
||||||
|
configureKotlinAndroid(this)
|
||||||
|
defaultConfig.targetSdk = 31
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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 com.diffplug.gradle.spotless.SpotlessExtension
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
|
||||||
|
class SpotlessConventionPlugin : Plugin<Project> {
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
with(target) {
|
||||||
|
pluginManager.apply("com.diffplug.spotless")
|
||||||
|
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||||
|
|
||||||
|
extensions.configure<SpotlessExtension> {
|
||||||
|
kotlin {
|
||||||
|
target("**/*.kt")
|
||||||
|
targetExclude("**/build/**/*.kt")
|
||||||
|
ktlint(libs.findVersion("ktlint").get().toString()).userData(mapOf("android" to "true"))
|
||||||
|
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
|
||||||
|
}
|
||||||
|
format("kts") {
|
||||||
|
target("**/*.kts")
|
||||||
|
targetExclude("**/build/**/*.kts")
|
||||||
|
// Look for the first line that doesn't have a block comment (assumed to be the license)
|
||||||
|
licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")
|
||||||
|
}
|
||||||
|
format("xml") {
|
||||||
|
target("**/*.xml")
|
||||||
|
targetExclude("**/build/**/*.xml")
|
||||||
|
// Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)
|
||||||
|
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.google.samples.apps.nowinandroid
|
||||||
|
|
||||||
|
import com.android.build.api.dsl.CommonExtension
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
enum class FlavorDimension {
|
||||||
|
contentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// The content for the app can either come from local static data which is useful for demo
|
||||||
|
// purposes, or from a production backend server which supplies up-to-date, real content.
|
||||||
|
// These two product flavors reflect this behaviour.
|
||||||
|
enum class Flavor (val dimension : FlavorDimension, val applicationIdSuffix : String? = null) {
|
||||||
|
demo(FlavorDimension.contentType, ".demo"),
|
||||||
|
prod(FlavorDimension.contentType)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.configureFlavors(
|
||||||
|
commonExtension: CommonExtension<*, *, *, *>
|
||||||
|
) {
|
||||||
|
commonExtension.apply {
|
||||||
|
flavorDimensions += FlavorDimension.contentType.name
|
||||||
|
productFlavors {
|
||||||
|
Flavor.values().forEach{
|
||||||
|
create(it.name) {
|
||||||
|
dimension = it.dimension.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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 com.google.samples.apps.nowinandroid.configureAndroidCompose
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.application")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
configureAndroidCompose(this)
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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 com.google.samples.apps.nowinandroid.configureKotlinAndroid
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.application")
|
|
||||||
kotlin("android")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
configureKotlinAndroid(this)
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
targetSdk = 32
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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 com.google.samples.apps.nowinandroid.configureJacoco
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.application")
|
|
||||||
jacoco
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
androidComponents {
|
|
||||||
configureJacoco(this)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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 com.google.samples.apps.nowinandroid.configureKotlinAndroid
|
|
||||||
import org.gradle.kotlin.dsl.support.delegates.ProjectDelegate
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.library")
|
|
||||||
kotlin("android")
|
|
||||||
kotlin("kapt")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
defaultConfig {
|
|
||||||
testInstrumentationRunner =
|
|
||||||
"com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":core-model"))
|
|
||||||
implementation(project(":core-ui"))
|
|
||||||
implementation(project(":core-data"))
|
|
||||||
implementation(project(":core-common"))
|
|
||||||
implementation(project(":core-navigation"))
|
|
||||||
|
|
||||||
testImplementation(project(":core-testing"))
|
|
||||||
androidTestImplementation(project(":core-testing"))
|
|
||||||
|
|
||||||
add("implementation", libs.findLibrary("coil.kt").get())
|
|
||||||
add("implementation", libs.findLibrary("coil.kt.compose").get())
|
|
||||||
|
|
||||||
add("implementation", libs.findLibrary("androidx.hilt.navigation.compose").get())
|
|
||||||
add("implementation", libs.findLibrary("androidx.lifecycle.viewModelCompose").get())
|
|
||||||
|
|
||||||
add("implementation", libs.findLibrary("kotlinx.coroutines.android").get())
|
|
||||||
|
|
||||||
add("implementation", libs.findLibrary("hilt.android").get())
|
|
||||||
add("kapt", libs.findLibrary("hilt.compiler").get())
|
|
||||||
|
|
||||||
// TODO : Remove this dependency once we upgrade to Android Studio Dolphin b/228889042
|
|
||||||
// These dependencies are currently necessary to render Compose previews
|
|
||||||
add("debugImplementation", libs.findLibrary("androidx.customview.poolingcontainer").get())
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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 com.google.samples.apps.nowinandroid.configureAndroidCompose
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.library")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
configureAndroidCompose(this)
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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 com.google.samples.apps.nowinandroid.configureKotlinAndroid
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.library")
|
|
||||||
kotlin("android")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
configureKotlinAndroid(this)
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
targetSdk = 32
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// androidx.test is forcing JUnit, 4.12. This forces it to use 4.13
|
|
||||||
configurations.configureEach {
|
|
||||||
resolutionStrategy {
|
|
||||||
force(libs.findLibrary("junit4").get())
|
|
||||||
// Temporary workaround for https://issuetracker.google.com/174733673
|
|
||||||
force("org.objenesis:objenesis:2.6")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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 com.google.samples.apps.nowinandroid.configureJacoco
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.library")
|
|
||||||
jacoco
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
androidComponents {
|
|
||||||
configureJacoco(this)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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 com.google.samples.apps.nowinandroid.configureKotlinAndroid
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.test")
|
|
||||||
kotlin("android")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
configureKotlinAndroid(this)
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
targetSdk = 31
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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.spotless")
|
|
||||||
}
|
|
||||||
|
|
||||||
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
|
||||||
|
|
||||||
spotless {
|
|
||||||
kotlin {
|
|
||||||
target("**/*.kt")
|
|
||||||
targetExclude("**/build/**/*.kt")
|
|
||||||
ktlint(libs.findVersion("ktlint").get().toString()).userData(mapOf("android" to "true"))
|
|
||||||
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
|
|
||||||
}
|
|
||||||
format("kts") {
|
|
||||||
target("**/*.kts")
|
|
||||||
targetExclude("**/build/**/*.kts")
|
|
||||||
// Look for the first line that doesn't have a block comment (assumed to be the license)
|
|
||||||
licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")
|
|
||||||
}
|
|
||||||
format("xml") {
|
|
||||||
target("**/*.xml")
|
|
||||||
targetExclude("**/build/**/*.xml")
|
|
||||||
// Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)
|
|
||||||
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* https://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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.samples.apps.nowinandroid.core.network.di
|
||||||
|
|
||||||
|
import com.google.samples.apps.nowinandroid.core.network.NiANetwork
|
||||||
|
import com.google.samples.apps.nowinandroid.core.network.fake.FakeNiANetwork
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
import dagger.hilt.InstallIn
|
||||||
|
import dagger.hilt.components.SingletonComponent
|
||||||
|
import javax.inject.Singleton
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@InstallIn(SingletonComponent::class)
|
||||||
|
interface NetworkModule {
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
fun bindsNiANetwork(
|
||||||
|
niANetwork: FakeNiANetwork
|
||||||
|
): NiANetwork
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun providesNetworkJson(): Json = Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
@ -1,6 +1,5 @@
|
|||||||
#Thu Feb 24 14:19:14 GMT 2022
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"config:base"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in new issue