mirror of
https://github.com/ProtonMail/protoncore_android.git
synced 2026-06-14 09:54:49 +00:00
build: Add core-platform module for aligning dependencies.
This commit is contained in:
@@ -88,6 +88,7 @@ Core libraries coordinates can be found under [coordinates section](#coordinates
|
||||
|me.proton.core:contact-data|
|
||||
|me.proton.core:contact-domain|
|
||||
|me.proton.core:contact-dagger|
|
||||
|me.proton.core:core-platform|
|
||||
|me.proton.core:country|
|
||||
|me.proton.core:country-dagger|
|
||||
|me.proton.core:country-data|
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import studio.forface.easygradle.dsl.android.*
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 Proton Technologies AG
|
||||
* This file is part of Proton AG and ProtonCore.
|
||||
*
|
||||
* ProtonCore is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ProtonCore is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
`java-platform`
|
||||
}
|
||||
|
||||
publishOption.shouldBePublishedAsLib = true
|
||||
|
||||
dependencies {
|
||||
constraints {
|
||||
api(activity)
|
||||
api(`android-ktx`)
|
||||
api(appcompat)
|
||||
api(drawerLayout)
|
||||
api(fragment)
|
||||
api(material)
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,6 @@ dependencies {
|
||||
project(Module.data),
|
||||
project(Module.authDomain),
|
||||
`coroutines-core`,
|
||||
appcompat, // TODO
|
||||
material, // TODO
|
||||
`room-ktx`,
|
||||
store4
|
||||
)
|
||||
|
||||
@@ -110,6 +110,8 @@ public val DependencyHandler.coordinatorlayout: Any
|
||||
get() = dependency("androidx.coordinatorlayout", module = "coordinatorlayout") version `coordinatorlayout version`
|
||||
public val DependencyHandler.datastore: Any
|
||||
get() = dependency("androidx.datastore", module = "datastore") version `datastore version`
|
||||
public val DependencyHandler.drawerLayout: Any
|
||||
get() = androidx("drawerlayout") version `drawerLayout version`
|
||||
public val DependencyHandler.googlePlayBilling: Any
|
||||
get() = dependency("com.android.billingclient", module = "billing") version `googlePlayBilling version`
|
||||
public val DependencyHandler.googleTink: Any
|
||||
|
||||
@@ -18,18 +18,29 @@
|
||||
|
||||
package me.proton.core.gradle.plugin
|
||||
|
||||
import Module.corePlatform
|
||||
import applyRepositories
|
||||
import initVersions
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||
import org.gradle.kotlin.dsl.dependencies
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.project
|
||||
import studio.forface.easygradle.dsl.*
|
||||
import javax.annotation.OverridingMethodsMustInvokeSuper
|
||||
|
||||
public abstract class BuildConventionPlugin : Plugin<Project> {
|
||||
@OverridingMethodsMustInvokeSuper
|
||||
override fun apply(target: Project) {
|
||||
final override fun apply(target: Project) {
|
||||
initVersions(target.rootProject.extensions.getByType<VersionCatalogsExtension>().named("libs"))
|
||||
target.applyRepositories()
|
||||
|
||||
onApplyPlugins(target)
|
||||
target.dependencies { api(platform(project(corePlatform))) }
|
||||
onPluginsApplied(target)
|
||||
}
|
||||
|
||||
protected abstract fun onApplyPlugins(target: Project)
|
||||
protected abstract fun onPluginsApplied(target: Project)
|
||||
}
|
||||
|
||||
+4
-4
@@ -31,13 +31,13 @@ public abstract class BaseAndroidPlugin<E> : BuildConventionPlugin() where E : K
|
||||
protected abstract fun createConventionSettings(): AndroidConventionSettings
|
||||
protected abstract fun createPluginExtension(target: Project): E
|
||||
|
||||
override fun apply(target: Project) {
|
||||
super.apply(target)
|
||||
val ext = createPluginExtension(target)
|
||||
|
||||
override fun onApplyPlugins(target: Project) {
|
||||
target.pluginManager.apply(androidPluginId)
|
||||
target.pluginManager.apply(PluginIds.kotlinAndroid)
|
||||
}
|
||||
|
||||
override fun onPluginsApplied(target: Project) {
|
||||
val ext = createPluginExtension(target)
|
||||
target.applyAndroidConvention(createConventionSettings())
|
||||
target.applyKotlinConvention(ext)
|
||||
}
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ public class ComposeUiLibraryPlugin : BaseAndroidPlugin<ComposeUiLibraryExtensio
|
||||
|
||||
override fun createPluginExtension(target: Project): ComposeUiLibraryExtension = target.createProtonExt()
|
||||
|
||||
override fun apply(target: Project) {
|
||||
super.apply(target)
|
||||
override fun onPluginsApplied(target: Project) {
|
||||
super.onPluginsApplied(target)
|
||||
target.applyComposeUiConvention()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ import org.gradle.api.Project
|
||||
|
||||
public class DaggerPlugin : BuildConventionPlugin() {
|
||||
|
||||
override fun apply(target: Project) {
|
||||
super.apply(target)
|
||||
val ext = target.createProtonExt<DaggerExtension>("protonDagger")
|
||||
|
||||
override fun onApplyPlugins(target: Project) {
|
||||
target.pluginManager.apply(PluginIds.kapt)
|
||||
target.pluginManager.apply(PluginIds.hilt)
|
||||
}
|
||||
|
||||
override fun onPluginsApplied(target: Project) {
|
||||
val ext = target.createProtonExt<DaggerExtension>("protonDagger")
|
||||
target.applyDaggerConvention(ext)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -27,15 +27,13 @@ import me.proton.core.gradle.plugin.createProtonExt
|
||||
import org.gradle.api.Project
|
||||
|
||||
public class KotlinLibraryPlugin : BuildConventionPlugin() {
|
||||
private lateinit var ext: KotlinLibraryExtension
|
||||
|
||||
override fun apply(target: Project) {
|
||||
super.apply(target)
|
||||
ext = target.createProtonExt()
|
||||
|
||||
override fun onApplyPlugins(target: Project) {
|
||||
target.pluginManager.apply(PluginIds.javaLibrary)
|
||||
target.pluginManager.apply(PluginIds.kotlinJvm)
|
||||
}
|
||||
|
||||
override fun onPluginsApplied(target: Project) {
|
||||
val ext = target.createProtonExt<KotlinLibraryExtension>()
|
||||
target.applyJavaConvention()
|
||||
target.applyKotlinConvention(ext)
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public object Module {
|
||||
// endregion
|
||||
|
||||
// region Shared
|
||||
public const val corePlatform: String = ":core-platform"
|
||||
public const val domain: String = ":domain"
|
||||
public const val presentation: String = ":presentation"
|
||||
public const val presentationCompose: String = ":presentation-compose"
|
||||
|
||||
@@ -69,6 +69,7 @@ public const val `compose version`: String = "1.2.0-alpha01"
|
||||
public const val `coordinatorlayout version`: String = "1.1.0"
|
||||
public const val `googlePlayBilling version`: String = "5.0.0"
|
||||
public const val `datastore version`: String = "1.0.0"
|
||||
public const val `drawerLayout version`: String = "1.1.1"
|
||||
public const val `hilt-navigation-compose version`: String = "1.0.0-rc01"
|
||||
public const val `material3 version`: String = "1.0.0-alpha03"
|
||||
public const val `navigation version`: String = "2.4.0-rc01"
|
||||
|
||||
@@ -60,8 +60,6 @@ dependencies {
|
||||
`coroutines-core`,
|
||||
|
||||
// Other
|
||||
appcompat, // TODO appcompat..
|
||||
material, // TODO ..and material libraries are only needed, so that libraries are compatible with the ones in androidTest; otherwise, the `implementation` would use old versions of those
|
||||
`room-ktx`,
|
||||
store4
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user