Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into test-1
Browse files Browse the repository at this point in the history
  • Loading branch information
xteamlyer committed Feb 25, 2025
2 parents 0a67b79 + fe22f5a commit 0df7ca0
Show file tree
Hide file tree
Showing 18 changed files with 283 additions and 111 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: PR build check
on:
pull_request:
paths:
- '**'
- '!**.md'
- '!i18n/src/commonMain/moko-resources/**/strings.xml'
- '!i18n/src/commonMain/moko-resources/**/plurals.xml'
- 'i18n/src/commonMain/moko-resources/base/strings.xml'
- 'i18n/src/commonMain/moko-resources/base/plurals.xml'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Build app
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Dependency Review
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0

- name: Set up JDK
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: 17
distribution: temurin

- name: Set up gradle
uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0

- name: Check code format
run: ./gradlew spotlessCheck

- name: Build app
run: ./gradlew assembleRelease

- name: Run unit tests
run: ./gradlew testReleaseUnitTest

- name: Upload APK
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: arm64-v8a-${{ github.sha }}
path: app/build/outputs/apk/standard/release/app-standard-arm64-v8a-release-unsigned.apk

- name: Upload mapping
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: mapping-${{ github.sha }}
path: app/build/outputs/mapping/release
39 changes: 39 additions & 0 deletions .github/workflows/build_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI
on:
push:
workflow_call:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build app
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up JDK
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: 17
distribution: temurin

- name: Set up gradle
uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0

- name: Check code format
run: ./gradlew spotlessCheck

- name: Build app
run: ./gradlew assemblePreview

- name: Upload APK
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: Mihon
path: app/build/outputs/apk/*
34 changes: 0 additions & 34 deletions .github/workflows/main.yml

This file was deleted.

119 changes: 72 additions & 47 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("ChromeOsAbiSupport")

import mihon.buildlogic.getBuildTime
import mihon.buildlogic.getCommitCount
import mihon.buildlogic.getGitSha
Expand All @@ -12,9 +10,17 @@ plugins {
alias(libs.plugins.aboutLibraries)
}

shortcutHelper.setFilePath("./shortcuts.xml")
val includeAnalytics = project.hasProperty("with-analytics")
val includeUpdater = project.hasProperty("with-updater")

val supportedAbis = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
if (includeAnalytics) {
pluginManager.apply {
apply(libs.plugins.google.services.get().pluginId)
apply(libs.plugins.firebase.crashlytics.get().pluginId)
}
}

shortcutHelper.setFilePath("./shortcuts.xml")

android {
namespace = "eu.kanade.tachiyomi"
Expand All @@ -28,89 +34,101 @@ android {
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"")
buildConfigField("boolean", "INCLUDE_UPDATER", "false")
buildConfigField("boolean", "INCLUDE_ANALYTICS", "$includeAnalytics")
buildConfigField("boolean", "INCLUDE_UPDATER", "$includeUpdater")
buildConfigField("boolean", "PREVIEW", "false")

ndk {
abiFilters += supportedAbis
}

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

splits {
abi {
isEnable = true
reset()
include(*supportedAbis.toTypedArray())
isUniversalApk = true
}
}

buildTypes {
named("debug") {
val debug by getting {
applicationIdSuffix = ".dev"
versionNameSuffix = "-${getCommitCount()}"
applicationIdSuffix = ".debug"
isPseudoLocalesEnabled = true
}
named("release") {
isShrinkResources = true
val release by getting {
isMinifyEnabled = true
isShrinkResources = true

proguardFiles("proguard-android-optimize.txt", "proguard-rules.pro")
}
create("foss") {
initWith(release)

applicationIdSuffix = ".t-foss"

matchingFallbacks.add(release.name)
}
create("preview") {
initWith(getByName("release"))
buildConfigField("boolean", "PREVIEW", "true")
initWith(release)

versionNameSuffix = debug.versionNameSuffix
signingConfig = debug.signingConfig

signingConfig = signingConfigs.getByName("debug")
matchingFallbacks.add("release")
isDebuggable = false
isProfileable = true

matchingFallbacks.add(release.name)

buildConfigField("boolean", "PREVIEW", "true")
}
create("benchmark") {
initWith(getByName("release"))
initWith(release)

signingConfig = signingConfigs.getByName("debug")
matchingFallbacks.add("release")
isDebuggable = false
isProfileable = true
versionNameSuffix = "-benchmark"
applicationIdSuffix = ".benchmark"

signingConfig = debug.signingConfig

matchingFallbacks.add(release.name)
}
}

sourceSets {
val analyticsDir = if (includeAnalytics) "analytics-firebase" else "analytics-firebase-noop"
getByName("main").kotlin.srcDirs("src/$analyticsDir/kotlin")
getByName("preview").res.srcDirs("src/debug/res")
getByName("benchmark").res.srcDirs("src/debug/res")
}

flavorDimensions.add("default")

productFlavors {
create("standard") {
buildConfigField("boolean", "INCLUDE_UPDATER", "true")
dimension = "default"
}
create("dev") {
dimension = "default"
splits {
abi {
isEnable = true
isUniversalApk = true
reset()
include("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
}
}

packaging {
resources.excludes.addAll(
listOf(
jniLibs {
keepDebugSymbols += listOf(
"libandroidx.graphics.path",
"libarchive-jni",
"libconscrypt_jni",
"libimagedecoder",
"libquickjs",
"libsqlite3x",
)
.map { "**/$it.so" }
}
resources {
excludes += setOf(
"kotlin-tooling-metadata.json",
"META-INF/DEPENDENCIES",
"LICENSE.txt",
"META-INF/LICENSE",
"META-INF/**/*.properties",
"META-INF/**/LICENSE.txt",
"META-INF/*.properties",
"META-INF/**/*.properties",
"META-INF/README.md",
"META-INF/NOTICE",
"META-INF/*.version",
),
)
"META-INF/DEPENDENCIES",
"META-INF/LICENSE",
"META-INF/NOTICE",
"META-INF/README.md",
)
}
}

dependenciesInfo {
Expand Down Expand Up @@ -254,6 +272,13 @@ dependencies {
// Logging
implementation(libs.logcat)

// Crash reports/analytics
if (includeAnalytics) {
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics)
implementation(libs.firebase.crashlytics)
}

// Shizuku
implementation(libs.bundles.shizuku)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package mihon.core.firebase

import android.content.Context

object FirebaseConfig {
fun init(context: Context) = Unit

fun setAnalyticsEnabled(enabled: Boolean) = Unit

fun setCrashlyticsEnabled(enabled: Boolean) = Unit
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package mihon.core.firebase

import android.content.Context
import com.google.firebase.FirebaseApp
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.crashlytics.FirebaseCrashlytics

object FirebaseConfig {
private lateinit var analytics: FirebaseAnalytics
private lateinit var crashlytics: FirebaseCrashlytics

fun init(context: Context) {
analytics = FirebaseAnalytics.getInstance(context)
FirebaseApp.initializeApp(context)
crashlytics = FirebaseCrashlytics.getInstance()
}

fun setAnalyticsEnabled(enabled: Boolean) {
analytics.setAnalyticsCollectionEnabled(enabled)
}

fun setCrashlyticsEnabled(enabled: Boolean) {
crashlytics.isCrashlyticsCollectionEnabled = enabled
}
}
5 changes: 2 additions & 3 deletions app/src/main/java/eu/kanade/domain/ui/model/AppTheme.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package eu.kanade.domain.ui.model

import dev.icerock.moko.resources.StringResource
import eu.kanade.tachiyomi.util.system.isDevFlavor
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
import tachiyomi.i18n.MR

enum class AppTheme(val titleRes: StringResource?) {
Expand All @@ -13,7 +12,7 @@ enum class AppTheme(val titleRes: StringResource?) {
MIDNIGHT_DUSK(MR.strings.theme_midnightdusk),

// TODO: re-enable for preview
NORD(MR.strings.theme_nord.takeIf { isDevFlavor || isPreviewBuildType }),
NORD(MR.strings.theme_nord.takeUnless { isReleaseBuildType }),
STRAWBERRY_DAIQUIRI(MR.strings.theme_strawberrydaiquiri),
TAKO(MR.strings.theme_tako),
TEALTURQUOISE(MR.strings.theme_tealturquoise),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import androidx.compose.ui.platform.LocalConfiguration
import eu.kanade.presentation.components.TabbedDialog
import eu.kanade.presentation.components.TabbedDialogPaddings
import eu.kanade.tachiyomi.ui.library.LibrarySettingsScreenModel
import eu.kanade.tachiyomi.util.system.isDevFlavor
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.core.common.preference.TriState
import tachiyomi.domain.category.model.Category
Expand Down Expand Up @@ -118,10 +117,7 @@ private fun ColumnScope.FilterPage(
onClick = { screenModel.toggleFilter(LibraryPreferences::filterCompleted) },
)
// TODO: re-enable when custom intervals are ready for stable
if (
(isDevFlavor || isPreviewBuildType) &&
LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in autoUpdateMangaRestrictions
) {
if ((!isReleaseBuildType) && LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in autoUpdateMangaRestrictions) {
val filterIntervalCustom by screenModel.libraryPreferences.filterIntervalCustom().collectAsState()
TriStateItem(
label = stringResource(MR.strings.action_filter_interval_custom),
Expand Down
Loading

0 comments on commit 0df7ca0

Please sign in to comment.