Cleanup and rework build logic (#3113)
# Conflicts: # app/build.gradle.kts # app/shortcuts.xml # app/src/main/res/xml/shortcuts.xml # app/src/main/shortcuts.xml # build.gradle.kts # buildSrc/src/main/kotlin/mihon/buildlogic/AndroidConfig.kt # core/archive/build.gradle.kts # core/common/build.gradle.kts # gradle/build-logic/src/main/kotlin/mihon/gradle/BuildConfig.kt # settings.gradle.kts # source-api/build.gradle.kts # source-local/build.gradle.kts # telemetry/build.gradle.kts
This commit is contained in:
+57
-37
@@ -1,16 +1,19 @@
|
|||||||
@file:Suppress("ChromeOsAbiSupport")
|
|
||||||
|
|
||||||
import mihon.buildlogic.getBuildTime
|
import mihon.gradle.getBuildTime
|
||||||
import mihon.buildlogic.getCommitCount
|
import mihon.gradle.getLatestCommitCount
|
||||||
import mihon.buildlogic.getGitSha
|
import mihon.gradle.getLatestCommitSha
|
||||||
|
import mihon.gradle.tasks.ReplaceShortcutsPlaceholderTask
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("mihon.android.application")
|
alias(mihonx.plugins.android.application)
|
||||||
id("mihon.android.application.compose")
|
alias(mihonx.plugins.compose)
|
||||||
|
alias(mihonx.plugins.spotless)
|
||||||
|
|
||||||
kotlin("plugin.parcelize")
|
kotlin("plugin.parcelize")
|
||||||
kotlin("plugin.serialization")
|
|
||||||
// id("com.github.zellius.shortcut-helper")
|
|
||||||
alias(libs.plugins.aboutLibraries)
|
alias(libs.plugins.aboutLibraries)
|
||||||
|
alias(libs.plugins.kotlin.serialization)
|
||||||
|
|
||||||
id("com.github.ben-manes.versions")
|
id("com.github.ben-manes.versions")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,10 +24,6 @@ if (gradle.startParameter.taskRequests.toString().contains("Standard")) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// shortcutHelper.setFilePath("./shortcuts.xml")
|
|
||||||
|
|
||||||
val supportedAbis = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "eu.kanade.tachiyomi"
|
namespace = "eu.kanade.tachiyomi"
|
||||||
|
|
||||||
@@ -34,29 +33,17 @@ android {
|
|||||||
versionCode = 77
|
versionCode = 77
|
||||||
versionName = "1.12.0"
|
versionName = "1.12.0"
|
||||||
|
|
||||||
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
buildConfigField("String", "COMMIT_COUNT", "\"${getLatestCommitCount()}\"")
|
||||||
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
|
buildConfigField("String", "COMMIT_SHA", "\"${getLatestCommitSha()}\"")
|
||||||
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime(useLastCommitTime = false)}\"")
|
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime(useLatestCommitTime = false)}\"")
|
||||||
buildConfigField("boolean", "INCLUDE_UPDATER", "false")
|
buildConfigField("boolean", "INCLUDE_UPDATER", "false")
|
||||||
|
|
||||||
ndk {
|
|
||||||
abiFilters += supportedAbis
|
|
||||||
}
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
splits {
|
|
||||||
abi {
|
|
||||||
isEnable = true
|
|
||||||
reset()
|
|
||||||
include(*supportedAbis.toTypedArray())
|
|
||||||
isUniversalApk = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
named("debug") {
|
named("debug") {
|
||||||
versionNameSuffix = "-${getCommitCount()}"
|
versionNameSuffix = "-${getLatestCommitCount()}"
|
||||||
applicationIdSuffix = ".debug"
|
applicationIdSuffix = ".debug"
|
||||||
isPseudoLocalesEnabled = true
|
isPseudoLocalesEnabled = true
|
||||||
}
|
}
|
||||||
@@ -72,7 +59,7 @@ android {
|
|||||||
isShrinkResources = true
|
isShrinkResources = true
|
||||||
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
|
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
|
||||||
|
|
||||||
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime(useLastCommitTime = true)}\"")
|
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime(useLatestCommitTime = true)}\"")
|
||||||
}
|
}
|
||||||
create("benchmark") {
|
create("benchmark") {
|
||||||
initWith(getByName("release"))
|
initWith(getByName("release"))
|
||||||
@@ -90,6 +77,15 @@ android {
|
|||||||
getByName("benchmark").res.srcDirs("src/debug/res")
|
getByName("benchmark").res.srcDirs("src/debug/res")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splits {
|
||||||
|
abi {
|
||||||
|
isEnable = true
|
||||||
|
isUniversalApk = true
|
||||||
|
reset()
|
||||||
|
include("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
flavorDimensions.add("default")
|
flavorDimensions.add("default")
|
||||||
|
|
||||||
productFlavors {
|
productFlavors {
|
||||||
@@ -106,21 +102,32 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
packaging {
|
packaging {
|
||||||
resources.excludes.addAll(
|
jniLibs {
|
||||||
listOf(
|
keepDebugSymbols += listOf(
|
||||||
|
"libandroidx.graphics.path",
|
||||||
|
"libarchive-jni",
|
||||||
|
"libconscrypt_jni",
|
||||||
|
"libimagedecoder",
|
||||||
|
"libquickjs",
|
||||||
|
"libsqlite3x",
|
||||||
|
)
|
||||||
|
.map { "**/$it.so" }
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
excludes += setOf(
|
||||||
"kotlin-tooling-metadata.json",
|
"kotlin-tooling-metadata.json",
|
||||||
"META-INF/DEPENDENCIES",
|
|
||||||
"LICENSE.txt",
|
"LICENSE.txt",
|
||||||
"META-INF/LICENSE",
|
"META-INF/**/*.properties",
|
||||||
"META-INF/**/LICENSE.txt",
|
"META-INF/**/LICENSE.txt",
|
||||||
"META-INF/*.properties",
|
"META-INF/*.properties",
|
||||||
"META-INF/**/*.properties",
|
|
||||||
"META-INF/README.md",
|
|
||||||
"META-INF/NOTICE",
|
|
||||||
"META-INF/*.version",
|
"META-INF/*.version",
|
||||||
),
|
"META-INF/DEPENDENCIES",
|
||||||
|
"META-INF/LICENSE",
|
||||||
|
"META-INF/NOTICE",
|
||||||
|
"META-INF/README.md",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependenciesInfo {
|
dependenciesInfo {
|
||||||
includeInApk = false
|
includeInApk = false
|
||||||
@@ -318,6 +325,19 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
androidComponents {
|
androidComponents {
|
||||||
|
onVariants { variant ->
|
||||||
|
val resSource = variant.sources.res ?: return@onVariants
|
||||||
|
|
||||||
|
val variantName = variant.name.replaceFirstChar { it.uppercase() }
|
||||||
|
val replaceShortcutsPlaceholderTask = tasks.register<ReplaceShortcutsPlaceholderTask>(
|
||||||
|
"replace${variantName}ShortcutPlaceholder",
|
||||||
|
) {
|
||||||
|
applicationId.set(variant.applicationId)
|
||||||
|
shortcutsFile.set(projectDir.resolve("src/main/shortcuts.xml"))
|
||||||
|
}
|
||||||
|
resSource.addGeneratedSourceDirectory(replaceShortcutsPlaceholderTask) { it.outputDir }
|
||||||
|
}
|
||||||
|
|
||||||
onVariants(selector().withFlavor("default" to "standard")) {
|
onVariants(selector().withFlavor("default" to "standard")) {
|
||||||
// Only excluding in standard flavor because this breaks
|
// Only excluding in standard flavor because this breaks
|
||||||
// Layout Inspector's Compose tree
|
// Layout Inspector's Compose tree
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
android:shortcutShortLabel="@string/label_library">
|
android:shortcutShortLabel="@string/label_library">
|
||||||
<intent
|
<intent
|
||||||
android:action="eu.kanade.tachiyomi.SHOW_LIBRARY"
|
android:action="eu.kanade.tachiyomi.SHOW_LIBRARY"
|
||||||
android:targetPackage="eu.kanade.tachiyomi.sy"
|
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity"
|
||||||
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" />
|
android:targetPackage="${applicationId}" />
|
||||||
</shortcut>
|
</shortcut>
|
||||||
<shortcut
|
<shortcut
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
android:shortcutShortLabel="@string/label_recent_updates">
|
android:shortcutShortLabel="@string/label_recent_updates">
|
||||||
<intent
|
<intent
|
||||||
android:action="eu.kanade.tachiyomi.SHOW_RECENTLY_UPDATED"
|
android:action="eu.kanade.tachiyomi.SHOW_RECENTLY_UPDATED"
|
||||||
android:targetPackage="eu.kanade.tachiyomi.sy"
|
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity"
|
||||||
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" />
|
android:targetPackage="${applicationId}" />
|
||||||
</shortcut>
|
</shortcut>
|
||||||
<shortcut
|
<shortcut
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
android:shortcutShortLabel="@string/label_recent_manga">
|
android:shortcutShortLabel="@string/label_recent_manga">
|
||||||
<intent
|
<intent
|
||||||
android:action="eu.kanade.tachiyomi.SHOW_RECENTLY_READ"
|
android:action="eu.kanade.tachiyomi.SHOW_RECENTLY_READ"
|
||||||
android:targetPackage="eu.kanade.tachiyomi.sy"
|
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity"
|
||||||
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" />
|
android:targetPackage="${applicationId}" />
|
||||||
</shortcut>
|
</shortcut>
|
||||||
<shortcut
|
<shortcut
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
android:shortcutShortLabel="@string/browse">
|
android:shortcutShortLabel="@string/browse">
|
||||||
<intent
|
<intent
|
||||||
android:action="eu.kanade.tachiyomi.SHOW_CATALOGUES"
|
android:action="eu.kanade.tachiyomi.SHOW_CATALOGUES"
|
||||||
android:targetPackage="eu.kanade.tachiyomi.sy"
|
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity"
|
||||||
android:targetClass="eu.kanade.tachiyomi.ui.main.MainActivity" />
|
android:targetPackage="${applicationId}" />
|
||||||
</shortcut>
|
</shortcut>
|
||||||
</shortcuts>
|
</shortcuts>
|
||||||
+14
-4
@@ -1,19 +1,29 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
// classpath(libs.android.shortcut.gradle)
|
|
||||||
classpath(sylibs.versionsx)
|
classpath(sylibs.versionsx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlin.serialization) apply false
|
|
||||||
alias(libs.plugins.aboutLibraries) apply false
|
alias(libs.plugins.aboutLibraries) apply false
|
||||||
|
alias(libs.plugins.android.application) apply false
|
||||||
|
alias(libs.plugins.android.library) apply false
|
||||||
|
alias(libs.plugins.android.test) apply false
|
||||||
alias(libs.plugins.firebase.crashlytics) apply false
|
alias(libs.plugins.firebase.crashlytics) apply false
|
||||||
alias(libs.plugins.google.services) apply false
|
alias(libs.plugins.google.services) apply false
|
||||||
|
alias(libs.plugins.kotlin.compose.compiler) apply false
|
||||||
|
alias(libs.plugins.kotlin.serialization) apply false
|
||||||
alias(libs.plugins.moko.resources) apply false
|
alias(libs.plugins.moko.resources) apply false
|
||||||
alias(libs.plugins.sqldelight) apply false
|
alias(libs.plugins.sqldelight) apply false
|
||||||
|
|
||||||
|
alias(mihonx.plugins.spotless)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Delete>("clean") {
|
val buildLogic: IncludedBuild = gradle.includedBuild("build-logic")
|
||||||
delete(rootProject.layout.buildDirectory)
|
tasks {
|
||||||
|
listOf("clean", "spotlessApply", "spotlessCheck").forEach { task ->
|
||||||
|
named(task) {
|
||||||
|
dependsOn(buildLogic.task(":$task"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
plugins {
|
|
||||||
`kotlin-dsl`
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(libs.android.gradle)
|
|
||||||
implementation(libs.kotlin.gradle)
|
|
||||||
implementation(libs.kotlin.compose.compiler.gradle)
|
|
||||||
implementation(libs.spotless.gradle)
|
|
||||||
implementation(gradleApi())
|
|
||||||
|
|
||||||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
gradlePluginPortal()
|
|
||||||
mavenCentral()
|
|
||||||
google()
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
dependencyResolutionManagement {
|
|
||||||
versionCatalogs {
|
|
||||||
create("libs") {
|
|
||||||
from(files("../gradle/libs.versions.toml"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rootProject.name = "mihon-buildSrc"
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import mihon.buildlogic.configureCompose
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.application")
|
|
||||||
kotlin("android")
|
|
||||||
|
|
||||||
id("mihon.code.lint")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
configureCompose(this)
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import mihon.buildlogic.AndroidConfig
|
|
||||||
import mihon.buildlogic.configureAndroid
|
|
||||||
import mihon.buildlogic.configureTest
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.application")
|
|
||||||
kotlin("android")
|
|
||||||
|
|
||||||
id("mihon.code.lint")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
defaultConfig {
|
|
||||||
targetSdk = AndroidConfig.TARGET_SDK
|
|
||||||
}
|
|
||||||
configureAndroid(this)
|
|
||||||
configureTest()
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import mihon.buildlogic.configureAndroid
|
|
||||||
import mihon.buildlogic.configureTest
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.test")
|
|
||||||
kotlin("android")
|
|
||||||
|
|
||||||
id("mihon.code.lint")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
configureAndroid(this)
|
|
||||||
configureTest()
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import org.gradle.accessors.dm.LibrariesForLibs
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.diffplug.spotless")
|
|
||||||
}
|
|
||||||
|
|
||||||
val libs = the<LibrariesForLibs>()
|
|
||||||
|
|
||||||
val xmlFormatExclude = buildList(2) {
|
|
||||||
add("**/build/**/*.xml")
|
|
||||||
|
|
||||||
projectDir
|
|
||||||
.resolve("src/commonMain/moko-resources")
|
|
||||||
.takeIf { it.isDirectory }
|
|
||||||
?.let(::fileTree)
|
|
||||||
?.matching { exclude("/base/**") }
|
|
||||||
?.let(::add)
|
|
||||||
}
|
|
||||||
.toTypedArray()
|
|
||||||
|
|
||||||
spotless {
|
|
||||||
kotlin {
|
|
||||||
target("**/*.kt", "**/*.kts")
|
|
||||||
targetExclude("**/build/**/*.kt")
|
|
||||||
ktlint(libs.ktlint.bom.get().version)
|
|
||||||
trimTrailingWhitespace()
|
|
||||||
endWithNewline()
|
|
||||||
}
|
|
||||||
format("xml") {
|
|
||||||
target("**/*.xml")
|
|
||||||
targetExclude(*xmlFormatExclude)
|
|
||||||
trimTrailingWhitespace()
|
|
||||||
endWithNewline()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import mihon.buildlogic.configureCompose
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.library")
|
|
||||||
|
|
||||||
id("mihon.code.lint")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
configureCompose(this)
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import mihon.buildlogic.configureAndroid
|
|
||||||
import mihon.buildlogic.configureTest
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.android.library")
|
|
||||||
|
|
||||||
id("mihon.code.lint")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
configureAndroid(this)
|
|
||||||
configureTest()
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package mihon.buildlogic
|
|
||||||
|
|
||||||
import org.gradle.api.JavaVersion as GradleJavaVersion
|
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget as KotlinJvmTarget
|
|
||||||
|
|
||||||
object AndroidConfig {
|
|
||||||
const val COMPILE_SDK = 36
|
|
||||||
const val TARGET_SDK = 36
|
|
||||||
const val MIN_SDK = 23
|
|
||||||
|
|
||||||
// https://youtrack.jetbrains.com/issue/KT-66995/JvmTarget-and-JavaVersion-compatibility-for-easier-JVM-version-setup
|
|
||||||
val JavaVersion = GradleJavaVersion.VERSION_17
|
|
||||||
val JvmTarget = KotlinJvmTarget.JVM_17
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
package mihon.buildlogic
|
|
||||||
|
|
||||||
import com.android.build.api.dsl.CommonExtension
|
|
||||||
import org.gradle.accessors.dm.LibrariesForLibs
|
|
||||||
import org.gradle.api.Project
|
|
||||||
import org.gradle.api.tasks.testing.Test
|
|
||||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
|
||||||
import org.gradle.kotlin.dsl.configure
|
|
||||||
import org.gradle.kotlin.dsl.dependencies
|
|
||||||
import org.gradle.kotlin.dsl.provideDelegate
|
|
||||||
import org.gradle.kotlin.dsl.the
|
|
||||||
import org.gradle.kotlin.dsl.withType
|
|
||||||
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
|
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
val Project.libs get() = the<LibrariesForLibs>()
|
|
||||||
|
|
||||||
internal fun Project.configureAndroid(commonExtension: CommonExtension<*, *, *, *, *, *>) {
|
|
||||||
commonExtension.apply {
|
|
||||||
compileSdk = AndroidConfig.COMPILE_SDK
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdk = AndroidConfig.MIN_SDK
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility = AndroidConfig.JavaVersion
|
|
||||||
targetCompatibility = AndroidConfig.JavaVersion
|
|
||||||
isCoreLibraryDesugaringEnabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<KotlinCompile>().configureEach {
|
|
||||||
compilerOptions {
|
|
||||||
jvmTarget.set(AndroidConfig.JvmTarget)
|
|
||||||
freeCompilerArgs.addAll(
|
|
||||||
"-Xcontext-parameters",
|
|
||||||
"-opt-in=kotlin.RequiresOptIn",
|
|
||||||
)
|
|
||||||
|
|
||||||
// Treat all Kotlin warnings as errors (disabled by default)
|
|
||||||
// Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties
|
|
||||||
val warningsAsErrors: String? by project
|
|
||||||
allWarningsAsErrors.set(warningsAsErrors.toBoolean())
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
"coreLibraryDesugaring"(libs.android.desugar)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun Project.configureCompose(commonExtension: CommonExtension<*, *, *, *, *, *>) {
|
|
||||||
pluginManager.apply(libs.plugins.kotlin.compose.compiler.get().pluginId)
|
|
||||||
|
|
||||||
commonExtension.apply {
|
|
||||||
buildFeatures {
|
|
||||||
compose = true
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
"implementation"(platform(libs.androidx.compose.bom))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extensions.configure<ComposeCompilerGradlePluginExtension> {
|
|
||||||
val enableMetrics = project.providers.gradleProperty("enableComposeCompilerMetrics").orNull.toBoolean()
|
|
||||||
val enableReports = project.providers.gradleProperty("enableComposeCompilerReports").orNull.toBoolean()
|
|
||||||
|
|
||||||
val rootBuildDir = rootProject.layout.buildDirectory.asFile.get()
|
|
||||||
val relativePath = projectDir.relativeTo(rootDir)
|
|
||||||
|
|
||||||
if (enableMetrics) {
|
|
||||||
rootBuildDir.resolve("compose-metrics").resolve(relativePath).let(metricsDestination::set)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enableReports) {
|
|
||||||
rootBuildDir.resolve("compose-reports").resolve(relativePath).let(reportsDestination::set)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun Project.configureTest() {
|
|
||||||
tasks.withType<Test> {
|
|
||||||
useJUnitPlatform()
|
|
||||||
testLogging {
|
|
||||||
events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val Project.generatedBuildDir: File get() = project.layout.buildDirectory.asFile.get().resolve("generated/mihon")
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package mihon.buildlogic.tasks
|
|
||||||
|
|
||||||
import org.gradle.api.Project
|
|
||||||
import org.gradle.api.Task
|
|
||||||
import org.gradle.api.tasks.TaskProvider
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
private val emptyResourcesElement = "<resources>\\s*</resources>|<resources\\s*/>".toRegex()
|
|
||||||
|
|
||||||
fun Project.getLocalesConfigTask(outputResourceDir: File): TaskProvider<Task> {
|
|
||||||
return tasks.register("generateLocalesConfig") {
|
|
||||||
val locales = fileTree("$projectDir/src/commonMain/moko-resources/")
|
|
||||||
.matching { include("**/strings.xml") }
|
|
||||||
.filterNot { it.readText().contains(emptyResourcesElement) }
|
|
||||||
.map {
|
|
||||||
it.parentFile.name
|
|
||||||
.replace("base", "en")
|
|
||||||
.replace("-r", "-")
|
|
||||||
.replace("+", "-")
|
|
||||||
}
|
|
||||||
.sorted()
|
|
||||||
.joinToString("\n") { "| <locale android:name=\"$it\"/>" }
|
|
||||||
|
|
||||||
val content = """
|
|
||||||
|<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
$locales
|
|
||||||
|</locale-config>
|
|
||||||
""".trimMargin()
|
|
||||||
|
|
||||||
outputResourceDir.resolve("xml/locales_config.xml").apply {
|
|
||||||
parentFile.mkdirs()
|
|
||||||
writeText(content)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,12 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.android.library)
|
||||||
kotlin("android")
|
alias(mihonx.plugins.spotless)
|
||||||
kotlin("plugin.serialization")
|
|
||||||
|
alias(libs.plugins.kotlin.serialization)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "tachiyomi.core.metadata"
|
namespace = "tachiyomi.core.metadata"
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
consumerProguardFiles("consumer-rules.pro")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
Vendored
-21
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.android.library)
|
||||||
kotlin("android")
|
alias(mihonx.plugins.spotless)
|
||||||
kotlin("plugin.serialization")
|
|
||||||
|
alias(libs.plugins.kotlin.serialization)
|
||||||
|
|
||||||
id("com.github.ben-manes.versions")
|
id("com.github.ben-manes.versions")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.android.library)
|
||||||
kotlin("android")
|
alias(mihonx.plugins.spotless)
|
||||||
kotlin("plugin.serialization")
|
|
||||||
|
alias(libs.plugins.kotlin.serialization)
|
||||||
alias(libs.plugins.sqldelight)
|
alias(libs.plugins.sqldelight)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "tachiyomi.data"
|
namespace = "tachiyomi.data"
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
consumerProguardFiles("consumer-rules.pro")
|
|
||||||
}
|
|
||||||
|
|
||||||
sqldelight {
|
sqldelight {
|
||||||
databases {
|
databases {
|
||||||
create("Database") {
|
create("Database") {
|
||||||
|
|||||||
Vendored
-21
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,16 +1,12 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.android.library)
|
||||||
kotlin("android")
|
alias(mihonx.plugins.spotless)
|
||||||
kotlin("plugin.serialization")
|
|
||||||
|
alias(libs.plugins.kotlin.serialization)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "tachiyomi.domain"
|
namespace = "tachiyomi.domain"
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
consumerProguardFiles("consumer-rules.pro")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
|||||||
Vendored
-21
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
plugins {
|
||||||
|
alias(libs.plugins.kotlin.jvm)
|
||||||
|
alias(libs.plugins.kotlin.samWithReceiver)
|
||||||
|
alias(libs.plugins.spotless)
|
||||||
|
`java-gradle-plugin`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configuration should be synced with [/gradle/build-logic/src/main/kotlin/PluginSpotless.kt]
|
||||||
|
val ktlintVersion = libs.ktlint.bom.get().version
|
||||||
|
val editorConfigFile = rootProject.file("../../.editorconfig")
|
||||||
|
spotless {
|
||||||
|
kotlin {
|
||||||
|
target("src/**/*.kt")
|
||||||
|
ktlint(ktlintVersion).setEditorConfigPath(editorConfigFile)
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
endWithNewline()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinGradle {
|
||||||
|
target("*.kts")
|
||||||
|
ktlint(ktlintVersion).setEditorConfigPath(editorConfigFile)
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
endWithNewline()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly(gradleKotlinDsl())
|
||||||
|
compileOnly(libs.android.gradle)
|
||||||
|
compileOnly(libs.kotlin.compose.compiler.gradle)
|
||||||
|
compileOnly(libs.kotlin.gradle)
|
||||||
|
implementation(libs.spotless.gradle)
|
||||||
|
implementation(libs.tapmoc.gradle)
|
||||||
|
|
||||||
|
// These allow us to reference the dependency catalog inside our compiled plugins
|
||||||
|
compileOnly(files(libs::class.java.superclass.protectionDomain.codeSource.location))
|
||||||
|
compileOnly(files(mihonx::class.java.superclass.protectionDomain.codeSource.location))
|
||||||
|
}
|
||||||
|
|
||||||
|
samWithReceiver {
|
||||||
|
annotation("org.gradle.api.HasImplicitReceiver")
|
||||||
|
}
|
||||||
|
|
||||||
|
gradlePlugin {
|
||||||
|
plugins {
|
||||||
|
register("android-application") {
|
||||||
|
id = mihonx.plugins.android.application.get().pluginId
|
||||||
|
implementationClass = "PluginAndroidApplication"
|
||||||
|
}
|
||||||
|
register("android-base") {
|
||||||
|
id = mihonx.plugins.android.base.get().pluginId
|
||||||
|
implementationClass = "PluginAndroidBase"
|
||||||
|
}
|
||||||
|
register("android-library") {
|
||||||
|
id = mihonx.plugins.android.library.get().pluginId
|
||||||
|
implementationClass = "PluginAndroidLibrary"
|
||||||
|
}
|
||||||
|
register("android-test") {
|
||||||
|
id = mihonx.plugins.android.test.get().pluginId
|
||||||
|
implementationClass = "PluginAndroidTest"
|
||||||
|
}
|
||||||
|
register("compose-android") {
|
||||||
|
id = mihonx.plugins.compose.get().pluginId
|
||||||
|
implementationClass = "PluginComposeAndroid"
|
||||||
|
}
|
||||||
|
register("kotlin-multiplatform") {
|
||||||
|
id = mihonx.plugins.kotlin.multiplatform.get().pluginId
|
||||||
|
implementationClass = "PluginKotlinMultiplatform"
|
||||||
|
}
|
||||||
|
register("spotless") {
|
||||||
|
id = mihonx.plugins.spotless.get().pluginId
|
||||||
|
implementationClass = "PluginSpotless"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
dependencyResolutionManagement {
|
||||||
|
@Suppress("UnstableApiUsage")
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
versionCatalogs {
|
||||||
|
create("libs") {
|
||||||
|
from(files("../libs.versions.toml"))
|
||||||
|
}
|
||||||
|
create("mihonx") {
|
||||||
|
from(files("../mihon.versions.toml"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "build-logic"
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import mihon.gradle.extensions.alias
|
||||||
|
import mihon.gradle.extensions.libs
|
||||||
|
import mihon.gradle.extensions.mihonx
|
||||||
|
import mihon.gradle.extensions.plugins
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
@Suppress("UNUSED")
|
||||||
|
class PluginAndroidApplication : Plugin<Project> {
|
||||||
|
override fun apply(target: Project): Unit = with(target) {
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(mihonx.plugins.android.base)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import mihon.gradle.configurations.configureAndroid
|
||||||
|
import mihon.gradle.configurations.configureKotlin
|
||||||
|
import mihon.gradle.extensions.alias
|
||||||
|
import mihon.gradle.extensions.configureTest
|
||||||
|
import mihon.gradle.extensions.libs
|
||||||
|
import mihon.gradle.extensions.plugins
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
@Suppress("UNUSED")
|
||||||
|
class PluginAndroidBase : Plugin<Project> {
|
||||||
|
override fun apply(target: Project): Unit = with(target) {
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
|
}
|
||||||
|
|
||||||
|
configureKotlin()
|
||||||
|
configureTest()
|
||||||
|
configureAndroid()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import mihon.gradle.extensions.alias
|
||||||
|
import mihon.gradle.extensions.libs
|
||||||
|
import mihon.gradle.extensions.mihonx
|
||||||
|
import mihon.gradle.extensions.plugins
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
@Suppress("UNUSED")
|
||||||
|
class PluginAndroidLibrary : Plugin<Project> {
|
||||||
|
override fun apply(target: Project): Unit = with(target) {
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.library)
|
||||||
|
alias(mihonx.plugins.android.base)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import mihon.gradle.extensions.alias
|
||||||
|
import mihon.gradle.extensions.libs
|
||||||
|
import mihon.gradle.extensions.mihonx
|
||||||
|
import mihon.gradle.extensions.plugins
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
@Suppress("UNUSED")
|
||||||
|
class PluginAndroidTest : Plugin<Project> {
|
||||||
|
override fun apply(target: Project): Unit = with(target) {
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.test)
|
||||||
|
alias(mihonx.plugins.android.base)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import mihon.gradle.extensions.alias
|
||||||
|
import mihon.gradle.extensions.android
|
||||||
|
import mihon.gradle.extensions.api
|
||||||
|
import mihon.gradle.extensions.debugApi
|
||||||
|
import mihon.gradle.extensions.implementation
|
||||||
|
import mihon.gradle.extensions.libs
|
||||||
|
import mihon.gradle.extensions.plugins
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
|
|
||||||
|
@Suppress("UNUSED")
|
||||||
|
class PluginComposeAndroid : Plugin<Project> {
|
||||||
|
override fun apply(target: Project): Unit = with(target) {
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.kotlin.compose.compiler)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
buildFeatures {
|
||||||
|
compose = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(platform(libs.androidx.compose.bom))
|
||||||
|
|
||||||
|
// Compose @Preview tooling
|
||||||
|
api(libs.androidx.compose.uiToolingPreview)
|
||||||
|
debugApi(libs.androidx.compose.uiTooling)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import mihon.gradle.configurations.configureAndroid
|
||||||
|
import mihon.gradle.configurations.configureKotlin
|
||||||
|
import mihon.gradle.extensions.alias
|
||||||
|
import mihon.gradle.extensions.configureTest
|
||||||
|
import mihon.gradle.extensions.libs
|
||||||
|
import mihon.gradle.extensions.plugins
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
|
|
||||||
|
@Suppress("UNUSED")
|
||||||
|
class PluginKotlinMultiplatform : Plugin<Project> {
|
||||||
|
override fun apply(target: Project): Unit = with(target) {
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.library)
|
||||||
|
alias(libs.plugins.kotlin.multiplatform)
|
||||||
|
}
|
||||||
|
|
||||||
|
configureKotlin()
|
||||||
|
configureTest()
|
||||||
|
configureAndroid()
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
applyDefaultHierarchyTemplate()
|
||||||
|
|
||||||
|
androidTarget()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Project.kotlin(block: KotlinMultiplatformExtension.() -> Unit) {
|
||||||
|
extensions.configure(block)
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import com.diffplug.gradle.spotless.SpotlessExtension
|
||||||
|
import mihon.gradle.extensions.alias
|
||||||
|
import mihon.gradle.extensions.libs
|
||||||
|
import mihon.gradle.extensions.plugins
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
|
||||||
|
@Suppress("UNUSED")
|
||||||
|
class PluginSpotless : Plugin<Project> {
|
||||||
|
override fun apply(target: Project): Unit = with(target) {
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.spotless)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configuration should be synced with [/gradle/build-logic/build.gradle.kts]
|
||||||
|
val ktlintVersion = libs.ktlint.bom.get().version
|
||||||
|
spotless {
|
||||||
|
kotlin {
|
||||||
|
target("src/**/*.kt")
|
||||||
|
ktlint(ktlintVersion)
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
endWithNewline()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinGradle {
|
||||||
|
target("*.kts")
|
||||||
|
ktlint(ktlintVersion)
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
endWithNewline()
|
||||||
|
}
|
||||||
|
|
||||||
|
format("xml") {
|
||||||
|
target("src/**/*.xml")
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
endWithNewline()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Project.spotless(block: SpotlessExtension.() -> Unit) {
|
||||||
|
extensions.configure(block)
|
||||||
|
}
|
||||||
+10
-10
@@ -1,4 +1,4 @@
|
|||||||
package mihon.buildlogic
|
package mihon.gradle
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@@ -8,33 +8,33 @@ import java.time.format.DateTimeFormatter
|
|||||||
|
|
||||||
// Git is needed in your system PATH for these commands to work.
|
// Git is needed in your system PATH for these commands to work.
|
||||||
// If it's not installed, you can return a random value as a workaround
|
// If it's not installed, you can return a random value as a workaround
|
||||||
fun Project.getCommitCount(): String {
|
fun Project.getLatestCommitCount(): String {
|
||||||
return runCommand("git rev-list --count HEAD")
|
return exec("git rev-list --count HEAD")
|
||||||
// return "1"
|
// return "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.getGitSha(): String {
|
fun Project.getLatestCommitSha(): String {
|
||||||
return runCommand("git rev-parse --short HEAD")
|
return exec("git rev-parse --short HEAD")
|
||||||
// return "1"
|
// return "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
private val BUILD_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")
|
private val BUILD_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param useLastCommitTime If `true`, the build time is based on the timestamp of the last Git commit;
|
* @param useLatestCommitTime If `true`, the build time is based on the timestamp of the last Git commit;
|
||||||
* otherwise, the current time is used. Both are in UTC.
|
* otherwise, the current time is used. Both are in UTC.
|
||||||
* @return A formatted string representing the build time. The format used is defined by [BUILD_TIME_FORMATTER].
|
* @return A formatted string representing the build time. The format used is defined by [BUILD_TIME_FORMATTER].
|
||||||
*/
|
*/
|
||||||
fun Project.getBuildTime(useLastCommitTime: Boolean): String {
|
fun Project.getBuildTime(useLatestCommitTime: Boolean): String {
|
||||||
return if (useLastCommitTime) {
|
return if (useLatestCommitTime) {
|
||||||
val epoch = runCommand("git log -1 --format=%ct").toLong()
|
val epoch = exec("git log -1 --format=%ct").toLong()
|
||||||
Instant.ofEpochSecond(epoch).atOffset(ZoneOffset.UTC).format(BUILD_TIME_FORMATTER)
|
Instant.ofEpochSecond(epoch).atOffset(ZoneOffset.UTC).format(BUILD_TIME_FORMATTER)
|
||||||
} else {
|
} else {
|
||||||
LocalDateTime.now(ZoneOffset.UTC).format(BUILD_TIME_FORMATTER)
|
LocalDateTime.now(ZoneOffset.UTC).format(BUILD_TIME_FORMATTER)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Project.runCommand(command: String): String {
|
fun Project.exec(command: String): String {
|
||||||
return providers.exec {
|
return providers.exec {
|
||||||
commandLine = command.split(" ")
|
commandLine = command.split(" ")
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package mihon.gradle.configurations
|
||||||
|
|
||||||
|
import com.android.build.api.dsl.ApplicationDefaultConfig
|
||||||
|
import mihon.gradle.extensions.android
|
||||||
|
import mihon.gradle.extensions.coreLibraryDesugaring
|
||||||
|
import mihon.gradle.extensions.libs
|
||||||
|
import mihon.gradle.extensions.mihonx
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
|
|
||||||
|
fun Project.configureAndroid() {
|
||||||
|
android {
|
||||||
|
defaultConfig {
|
||||||
|
minSdk = mihonx.versions.android.sdk.min.get().toInt()
|
||||||
|
if (this is ApplicationDefaultConfig) {
|
||||||
|
targetSdk = mihonx.versions.android.sdk.target.get().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
ndkVersion = mihonx.versions.android.ndk.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
compileSdk = mihonx.versions.android.sdk.compile.get().toInt()
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
isCoreLibraryDesugaringEnabled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
coreLibraryDesugaring(libs.android.desugar)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package mihon.gradle.configurations
|
||||||
|
|
||||||
|
import mihon.gradle.extensions.mihonx
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.HasConfigurableKotlinCompilerOptions
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions
|
||||||
|
import tapmoc.configureJavaCompatibility
|
||||||
|
|
||||||
|
fun Project.configureKotlin() {
|
||||||
|
configureJavaCompatibility(mihonx.versions.java.get().toInt())
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
freeCompilerArgs.add("-Xcontext-parameters")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Project.kotlin(block: KotlinBaseExtension.() -> Unit) {
|
||||||
|
extensions.configure(block)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun KotlinBaseExtension.compilerOptions(block: KotlinCommonCompilerOptions.() -> Unit) {
|
||||||
|
if (this is HasConfigurableKotlinCompilerOptions<*>) compilerOptions(block)
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package mihon.gradle.extensions
|
||||||
|
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.ExternalModuleDependencyBundle
|
||||||
|
import org.gradle.api.artifacts.MinimalExternalModuleDependency
|
||||||
|
import org.gradle.api.provider.Provider
|
||||||
|
import org.gradle.kotlin.dsl.DependencyHandlerScope
|
||||||
|
|
||||||
|
fun DependencyHandlerScope.api(dependencyNotation: Provider<MinimalExternalModuleDependency>) {
|
||||||
|
add("api", dependencyNotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun DependencyHandlerScope.coreLibraryDesugaring(dependencyNotation: Provider<MinimalExternalModuleDependency>) {
|
||||||
|
add("coreLibraryDesugaring", dependencyNotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun DependencyHandlerScope.debugApi(dependencyNotation: Provider<MinimalExternalModuleDependency>) {
|
||||||
|
add("debugApi", dependencyNotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmName("implementationBundle")
|
||||||
|
fun DependencyHandlerScope.implementation(dependencyNotation: Provider<ExternalModuleDependencyBundle>) {
|
||||||
|
add("implementation", dependencyNotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun DependencyHandlerScope.implementation(dependencyNotation: Provider<MinimalExternalModuleDependency>) {
|
||||||
|
add("implementation", dependencyNotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun DependencyHandlerScope.implementation(dependencyNotation: Project) {
|
||||||
|
add("implementation", dependencyNotation)
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package mihon.gradle.extensions
|
||||||
|
|
||||||
|
import org.gradle.api.plugins.PluginManager
|
||||||
|
import org.gradle.api.provider.Provider
|
||||||
|
import org.gradle.plugin.use.PluginDependency
|
||||||
|
|
||||||
|
fun PluginManager.alias(notation: Provider<PluginDependency>) {
|
||||||
|
apply(notation.get().pluginId)
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package mihon.gradle.extensions
|
||||||
|
|
||||||
|
import com.android.build.api.dsl.CommonExtension
|
||||||
|
import com.android.build.gradle.BaseExtension
|
||||||
|
import org.gradle.accessors.dm.LibrariesForLibs
|
||||||
|
import org.gradle.accessors.dm.LibrariesForMihonx
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.plugins.PluginManager
|
||||||
|
import org.gradle.api.tasks.testing.Test
|
||||||
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.the
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
|
||||||
|
internal val Project.libs get() = the<LibrariesForLibs>()
|
||||||
|
internal val Project.mihonx get() = the<LibrariesForMihonx>()
|
||||||
|
|
||||||
|
internal fun Project.plugins(block: PluginManager.() -> Unit) {
|
||||||
|
pluginManager.apply(block)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun Project.android(block: CommonExtension<*, *, *, *, *, *>.() -> Unit) {
|
||||||
|
extensions.configure<BaseExtension> {
|
||||||
|
if (this is CommonExtension<*, *, *, *, *, *>) apply(block)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.configureTest() {
|
||||||
|
tasks.withType<Test> {
|
||||||
|
useJUnitPlatform()
|
||||||
|
testLogging {
|
||||||
|
events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package mihon.gradle.tasks
|
||||||
|
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.file.DirectoryProperty
|
||||||
|
import org.gradle.api.tasks.OutputDirectory
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
|
||||||
|
abstract class GenerateLocalesConfigTask : DefaultTask() {
|
||||||
|
|
||||||
|
@get:OutputDirectory
|
||||||
|
abstract val outputDir: DirectoryProperty
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
fun action() {
|
||||||
|
val locales = project.fileTree("src/commonMain/moko-resources") {
|
||||||
|
matching { include("**/strings.xml") }
|
||||||
|
}
|
||||||
|
.asSequence()
|
||||||
|
.filterNot { it.readText().contains(emptyResourcesElement) }
|
||||||
|
.map {
|
||||||
|
it.parentFile.name
|
||||||
|
.replace("base", "en")
|
||||||
|
.replace("-r", "-")
|
||||||
|
.replace("+", "-")
|
||||||
|
}
|
||||||
|
.distinct()
|
||||||
|
.sorted()
|
||||||
|
.joinToString("\n") { "| <locale android:name=\"$it\"/>" }
|
||||||
|
|
||||||
|
val content = """
|
||||||
|
|<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
$locales
|
||||||
|
|</locale-config>
|
||||||
|
""".trimMargin()
|
||||||
|
|
||||||
|
outputDir.get().file("xml/locales_config.xml").asFile.apply {
|
||||||
|
parentFile.mkdirs()
|
||||||
|
writeText(content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val emptyResourcesElement = "<resources>\\s*</resources>|<resources\\s*/>".toRegex()
|
||||||
|
}
|
||||||
|
}
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
package mihon.gradle.tasks
|
||||||
|
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.file.DirectoryProperty
|
||||||
|
import org.gradle.api.file.RegularFileProperty
|
||||||
|
import org.gradle.api.provider.Property
|
||||||
|
import org.gradle.api.tasks.Input
|
||||||
|
import org.gradle.api.tasks.InputFile
|
||||||
|
import org.gradle.api.tasks.OutputDirectory
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
|
||||||
|
abstract class ReplaceShortcutsPlaceholderTask : DefaultTask() {
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
abstract val applicationId: Property<String>
|
||||||
|
|
||||||
|
@get:InputFile
|
||||||
|
abstract val shortcutsFile: RegularFileProperty
|
||||||
|
|
||||||
|
@get:OutputDirectory
|
||||||
|
abstract val outputDir: DirectoryProperty
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
fun action() {
|
||||||
|
val content = shortcutsFile.asFile.get()
|
||||||
|
.readText()
|
||||||
|
.replace($$"${applicationId}", applicationId.get())
|
||||||
|
|
||||||
|
outputDir.get().file("xml/shortcuts.xml").asFile.apply {
|
||||||
|
parentFile.mkdirs()
|
||||||
|
writeText(content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
aboutLibraries = "13.2.1"
|
aboutLibraries = "13.2.1"
|
||||||
android-desugar = "2.1.5"
|
android-desugar = "2.1.5"
|
||||||
android-gradle = "8.13.2"
|
android-gradle = "8.13.2"
|
||||||
android-shortcut = "0.1.2"
|
|
||||||
androidx-activity-compose = "1.13.0"
|
androidx-activity-compose = "1.13.0"
|
||||||
androidx-annotation = "1.9.1"
|
androidx-annotation = "1.9.1"
|
||||||
androidx-appCompat = "1.7.1"
|
androidx-appCompat = "1.7.1"
|
||||||
@@ -68,6 +67,7 @@ sqldelight-androidx-driver = "0.0.17"
|
|||||||
stringSimilarity = "0.1.0"
|
stringSimilarity = "0.1.0"
|
||||||
subsamplingScaleImageView = "66e0db195d"
|
subsamplingScaleImageView = "66e0db195d"
|
||||||
swipe = "1.3.0"
|
swipe = "1.3.0"
|
||||||
|
tapmoc = "0.4.0"
|
||||||
unifile = "e0def6b3dc"
|
unifile = "e0def6b3dc"
|
||||||
voyager = "1.1.0-beta03"
|
voyager = "1.1.0-beta03"
|
||||||
xmlutil = "0.91.3"
|
xmlutil = "0.91.3"
|
||||||
@@ -76,7 +76,6 @@ xmlutil = "0.91.3"
|
|||||||
aboutLibraries-compose = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutLibraries" }
|
aboutLibraries-compose = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutLibraries" }
|
||||||
android-desugar = { module = "com.android.tools:desugar_jdk_libs", version.ref = "android-desugar" }
|
android-desugar = { module = "com.android.tools:desugar_jdk_libs", version.ref = "android-desugar" }
|
||||||
android-gradle = { module = "com.android.tools.build:gradle", version.ref = "android-gradle" }
|
android-gradle = { module = "com.android.tools.build:gradle", version.ref = "android-gradle" }
|
||||||
android-shortcut-gradle = { module = "com.github.zellius:android-shortcut-gradle-plugin", version.ref = "android-shortcut" }
|
|
||||||
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity-compose" }
|
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity-compose" }
|
||||||
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" }
|
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" }
|
||||||
androidx-appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appCompat" }
|
androidx-appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appCompat" }
|
||||||
@@ -176,6 +175,7 @@ sqldelight-sqliteDialect338 = { module = "app.cash.sqldelight:sqlite-3-38-dialec
|
|||||||
stringSimilarity = { module = "com.aallam.similarity:string-similarity-kotlin", version.ref = "stringSimilarity" }
|
stringSimilarity = { module = "com.aallam.similarity:string-similarity-kotlin", version.ref = "stringSimilarity" }
|
||||||
subsamplingScaleImageView = { module = "com.github.tachiyomiorg:subsampling-scale-image-view", version.ref = "subsamplingScaleImageView" }
|
subsamplingScaleImageView = { module = "com.github.tachiyomiorg:subsampling-scale-image-view", version.ref = "subsamplingScaleImageView" }
|
||||||
swipe = { module = "me.saket.swipe:swipe", version.ref = "swipe" }
|
swipe = { module = "me.saket.swipe:swipe", version.ref = "swipe" }
|
||||||
|
tapmoc-gradle = { module = "com.gradleup.tapmoc:tapmoc-gradle-plugin", version.ref = "tapmoc" }
|
||||||
unifile = { module = "com.github.tachiyomiorg:unifile", version.ref = "unifile" }
|
unifile = { module = "com.github.tachiyomiorg:unifile", version.ref = "unifile" }
|
||||||
voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" }
|
voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" }
|
||||||
voyager-screenModel = { module = "cafe.adriel.voyager:voyager-screenmodel", version.ref = "voyager" }
|
voyager-screenModel = { module = "cafe.adriel.voyager:voyager-screenmodel", version.ref = "voyager" }
|
||||||
@@ -186,12 +186,19 @@ xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", v
|
|||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin.android", version.ref = "aboutLibraries" }
|
aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin.android", version.ref = "aboutLibraries" }
|
||||||
|
android-application = { id = "com.android.application", version.ref = "android-gradle" }
|
||||||
|
android-library = { id = "com.android.library", version.ref = "android-gradle" }
|
||||||
|
android-test = { id = "com.android.test", version.ref = "android-gradle" }
|
||||||
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebase-crashlytics" }
|
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebase-crashlytics" }
|
||||||
google-services = { id = "com.google.gms.google-services", version.ref = "google-services" }
|
google-services = { id = "com.google.gms.google-services", version.ref = "google-services" }
|
||||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-gradle" }
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-gradle" }
|
||||||
kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin-gradle" }
|
kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin-gradle" }
|
||||||
|
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-gradle" }
|
||||||
|
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-gradle" }
|
||||||
|
kotlin-samWithReceiver = { id = "org.jetbrains.kotlin.plugin.sam.with.receiver", version.ref = "kotlin-gradle" }
|
||||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-gradle" }
|
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-gradle" }
|
||||||
moko-resources = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "moko-resources" }
|
moko-resources = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "moko-resources" }
|
||||||
|
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
|
||||||
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
|
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
|
||||||
|
|
||||||
[bundles]
|
[bundles]
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
[versions]
|
||||||
|
# Used in [/gradle/build-config/src/main/kotlin/PluginKotlinMultiplatform.kt]
|
||||||
|
android-sdk-min = "23"
|
||||||
|
android-sdk-compile = "36"
|
||||||
|
android-sdk-target = "36"
|
||||||
|
android-ndk = "29.0.14206865"
|
||||||
|
java = "17"
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
android-application = { id = "mihon.plugins.android.application" }
|
||||||
|
android-base = { id = "mihon.plugins.android.base" }
|
||||||
|
android-library = { id = "mihon.plugins.android.library" }
|
||||||
|
android-test = { id = "mihon.plugins.android.test" }
|
||||||
|
compose = { id = "mihon.plugins.compose.android" }
|
||||||
|
kotlin-multiplatform = { id = "mihon.plugins.kotlin.multiplatform" }
|
||||||
|
spotless = { id = "mihon.plugins.spotless" }
|
||||||
+21
-24
@@ -1,35 +1,38 @@
|
|||||||
|
import mihon.gradle.tasks.GenerateLocalesConfigTask
|
||||||
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.kotlin.multiplatform)
|
||||||
kotlin("multiplatform")
|
alias(mihonx.plugins.spotless)
|
||||||
|
|
||||||
alias(libs.plugins.moko.resources)
|
alias(libs.plugins.moko.resources)
|
||||||
id("com.github.ben-manes.versions")
|
id("com.github.ben-manes.versions")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
androidTarget()
|
android {
|
||||||
|
namespace = "tachiyomi.i18n.sy"
|
||||||
|
}
|
||||||
|
|
||||||
applyDefaultHierarchyTemplate()
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
@Suppress("UnstableApiUsage")
|
||||||
sourceSets {
|
|
||||||
commonMain {
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(libs.moko.resources)
|
api(libs.moko.resources)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
compilerOptions {
|
||||||
|
freeCompilerArgs.add("-Xexpect-actual-classes")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
androidComponents {
|
||||||
namespace = "tachiyomi.i18n.sy"
|
onVariants { variant ->
|
||||||
|
val resSource = variant.sources.res ?: return@onVariants
|
||||||
|
|
||||||
sourceSets {
|
val variantName = variant.name.replaceFirstChar { it.uppercase() }
|
||||||
named("main") {
|
val task = tasks.register<GenerateLocalesConfigTask>("generate${variantName}LocalesConfig")
|
||||||
res.srcDir("src/commonMain/resources")
|
resSource.addGeneratedSourceDirectory(task) { it.outputDir }
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lint {
|
|
||||||
disable.addAll(listOf("MissingTranslation", "ExtraTranslation"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,9 +40,3 @@ multiplatformResources {
|
|||||||
resourcesClassName.set("SYMR")
|
resourcesClassName.set("SYMR")
|
||||||
resourcesPackage.set("tachiyomi.i18n.sy")
|
resourcesPackage.set("tachiyomi.i18n.sy")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
|
||||||
compilerOptions.freeCompilerArgs.addAll(
|
|
||||||
"-Xexpect-actual-classes",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|||||||
+15
-32
@@ -1,26 +1,24 @@
|
|||||||
import mihon.buildlogic.generatedBuildDir
|
import mihon.gradle.tasks.GenerateLocalesConfigTask
|
||||||
import mihon.buildlogic.tasks.getLocalesConfigTask
|
|
||||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.kotlin.multiplatform)
|
||||||
kotlin("multiplatform")
|
alias(mihonx.plugins.spotless)
|
||||||
|
|
||||||
alias(libs.plugins.moko.resources)
|
alias(libs.plugins.moko.resources)
|
||||||
id("com.github.ben-manes.versions")
|
id("com.github.ben-manes.versions")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
androidTarget()
|
android {
|
||||||
|
namespace = "tachiyomi.i18n"
|
||||||
|
}
|
||||||
|
|
||||||
applyDefaultHierarchyTemplate()
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
@Suppress("UnstableApiUsage")
|
||||||
sourceSets {
|
|
||||||
commonMain {
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(libs.moko.resources)
|
api(libs.moko.resources)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
compilerOptions {
|
compilerOptions {
|
||||||
@@ -28,31 +26,16 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val generatedAndroidResourceDir = generatedBuildDir.resolve("android/res")
|
androidComponents {
|
||||||
|
onVariants { variant ->
|
||||||
|
val resSource = variant.sources.res ?: return@onVariants
|
||||||
|
|
||||||
android {
|
val variantName = variant.name.replaceFirstChar { it.uppercase() }
|
||||||
namespace = "tachiyomi.i18n"
|
val task = tasks.register<GenerateLocalesConfigTask>("generate${variantName}LocalesConfig")
|
||||||
|
resSource.addGeneratedSourceDirectory(task) { it.outputDir }
|
||||||
sourceSets {
|
|
||||||
val main by getting
|
|
||||||
main.res.srcDirs(
|
|
||||||
"src/commonMain/resources",
|
|
||||||
generatedAndroidResourceDir,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
lint {
|
|
||||||
disable.addAll(listOf("MissingTranslation", "ExtraTranslation"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
multiplatformResources {
|
multiplatformResources {
|
||||||
resourcesPackage.set("tachiyomi.i18n")
|
resourcesPackage.set("tachiyomi.i18n")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
|
||||||
val localesConfigTask = project.getLocalesConfigTask(generatedAndroidResourceDir)
|
|
||||||
preBuild {
|
|
||||||
dependsOn(localesConfigTask)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("mihon.benchmark")
|
alias(mihonx.plugins.android.test)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.android.library)
|
||||||
id("mihon.library.compose")
|
alias(mihonx.plugins.compose)
|
||||||
kotlin("android")
|
|
||||||
|
alias(mihonx.plugins.spotless)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "tachiyomi.presentation.core"
|
namespace = "tachiyomi.presentation.core"
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
consumerProguardFiles("consumer-rules.pro")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
|||||||
Vendored
-21
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,16 +1,12 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.android.library)
|
||||||
id("mihon.library.compose")
|
alias(mihonx.plugins.compose)
|
||||||
kotlin("android")
|
|
||||||
|
alias(mihonx.plugins.spotless)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "tachiyomi.presentation.widget"
|
namespace = "tachiyomi.presentation.widget"
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
consumerProguardFiles("consumer-rules.pro")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
+6
-10
@@ -1,30 +1,26 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
resolutionStrategy {
|
includeBuild("gradle/build-logic")
|
||||||
eachPlugin {
|
|
||||||
val regex = "com.android.(library|application)".toRegex()
|
|
||||||
if (regex matches requested.id.id) {
|
|
||||||
useModule("com.android.tools.build:gradle:${requested.version}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
maven(url = "https://www.jitpack.io")
|
maven(url = "https://www.jitpack.io")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
versionCatalogs {
|
versionCatalogs {
|
||||||
|
create("mihonx") {
|
||||||
|
from(files("gradle/mihon.versions.toml"))
|
||||||
|
}
|
||||||
create("sylibs") {
|
create("sylibs") {
|
||||||
from(files("gradle/sy.versions.toml"))
|
from(files("gradle/sy.versions.toml"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
|
||||||
google()
|
google()
|
||||||
|
mavenCentral()
|
||||||
maven(url = "https://www.jitpack.io")
|
maven(url = "https://www.jitpack.io")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-20
@@ -1,23 +1,32 @@
|
|||||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.kotlin.multiplatform)
|
||||||
kotlin("multiplatform")
|
alias(mihonx.plugins.spotless)
|
||||||
kotlin("plugin.serialization")
|
|
||||||
|
alias(libs.plugins.kotlin.serialization)
|
||||||
|
|
||||||
id("com.github.ben-manes.versions")
|
id("com.github.ben-manes.versions")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
androidTarget()
|
android {
|
||||||
sourceSets {
|
namespace = "eu.kanade.tachiyomi.source"
|
||||||
val commonMain by getting {
|
|
||||||
|
defaultConfig {
|
||||||
|
consumerProguardFile("consumer-proguard.pro")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
@Suppress("UnstableApiUsage")
|
||||||
dependencies {
|
dependencies {
|
||||||
api(libs.kotlinx.serialization.json)
|
api(libs.kotlinx.serialization.json)
|
||||||
api(libs.injekt)
|
api(libs.injekt)
|
||||||
api(libs.rxJava)
|
api(libs.rxJava)
|
||||||
api(libs.jsoup)
|
api(libs.jsoup)
|
||||||
|
|
||||||
implementation(project.dependencies.platform(libs.androidx.compose.bom))
|
implementation(platform(libs.androidx.compose.bom))
|
||||||
implementation(libs.androidx.compose.runtime)
|
implementation(libs.androidx.compose.runtime)
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
@@ -26,14 +35,12 @@ kotlin {
|
|||||||
api(libs.kotlin.reflect)
|
api(libs.kotlin.reflect)
|
||||||
// SY <--
|
// SY <--
|
||||||
}
|
}
|
||||||
}
|
|
||||||
val androidMain by getting {
|
sourceSets {
|
||||||
|
androidMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.core.common)
|
implementation(projects.core.common)
|
||||||
api(libs.androidx.preference)
|
api(libs.androidx.preference)
|
||||||
|
|
||||||
// Workaround for https://youtrack.jetbrains.com/issue/KT-57605
|
|
||||||
implementation(libs.kotlinx.coroutines.android)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,11 +50,3 @@ kotlin {
|
|||||||
freeCompilerArgs.add("-Xexpect-actual-classes")
|
freeCompilerArgs.add("-Xexpect-actual-classes")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
|
||||||
namespace = "eu.kanade.tachiyomi.source"
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
consumerProguardFile("consumer-proguard.pro")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("mihon.library")
|
alias(mihonx.plugins.kotlin.multiplatform)
|
||||||
kotlin("multiplatform")
|
alias(mihonx.plugins.spotless)
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
androidTarget()
|
android {
|
||||||
sourceSets {
|
namespace = "tachiyomi.source.local"
|
||||||
val commonMain by getting {
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
@Suppress("UnstableApiUsage")
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.sourceApi)
|
implementation(projects.sourceApi)
|
||||||
api(projects.i18n)
|
api(projects.i18n)
|
||||||
@@ -18,8 +21,9 @@ kotlin {
|
|||||||
|
|
||||||
implementation(libs.unifile)
|
implementation(libs.unifile)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
val androidMain by getting {
|
sourceSets {
|
||||||
|
androidMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.core.common)
|
implementation(projects.core.common)
|
||||||
implementation(projects.coreMetadata)
|
implementation(projects.coreMetadata)
|
||||||
@@ -40,12 +44,3 @@ kotlin {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
|
||||||
namespace = "tachiyomi.source.local"
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
consumerProguardFiles("consumer-rules.pro")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Vendored
-21
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
Reference in New Issue
Block a user