Compare commits

..

9 Commits

Author SHA1 Message Date
Pun Butrach
e4d896f7f0 build: Remove style ratchet from build script again again 2025-09-03 17:16:25 +07:00
Pun Butrach
c26adf5dca chore: Ratcheteer!
This reverts commit b1e5f25341.
2025-07-15 23:10:24 +07:00
Pun Butrach
0aad586933 fix: cursed space 2025-07-15 23:08:12 +07:00
Pun Butrach
7d495e3cd2 Merge branch 'compose-dev' into build/spotless 2025-07-15 23:04:30 +07:00
Pun Butrach
b1e5f25341 build: Remove ratchet!! (sigh) 2025-07-06 02:19:42 +07:00
Pun Butrach
e85efceb39 build: Use ktlint (Android Studio configuration) 2025-07-06 02:13:33 +07:00
Pun Butrach
bfe207e682 build: Try to format when needed, not all the time (for now) 2025-07-06 01:52:37 +07:00
Pun Butrach
a150fdb147 ci: Merge Spotless CI with Build PR 2025-07-06 01:46:08 +07:00
Pun Butrach
23d39c0e93 build: Spotless check 2025-07-06 01:45:07 +07:00
18 changed files with 170 additions and 108 deletions

23
.editorconfig Normal file
View File

@@ -0,0 +1,23 @@
[*.{kt,kts}]
end_of_line = lf
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_imports_layout = *
ij_kotlin_indent_before_arrow_on_new_line = false
ij_kotlin_line_break_after_multiline_when_entry = true
ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**
indent_size = 4
indent_style = space
insert_final_newline = true
ktlint_annotation_handle_annotations_with_parameters_same_as_annotations_without_parameters = [unset]
ktlint_argument_list_wrapping_ignore_when_parameter_count_greater_or_equal_than = 8
ktlint_chain_method_rule_force_multiline_when_chain_operator_count_greater_or_equal_than = 4
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = unset
ktlint_code_style = android_studio
ktlint_enum_entry_name_casing = upper_or_camel_cases
ktlint_function_naming_ignore_when_annotated_with = [unset]
ktlint_function_signature_body_expression_wrapping = default
ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = unset
ktlint_ignore_back_ticked_identifier = false
ktlint_property_naming_constant_naming = screaming_snake_case
max_line_length = 100

View File

@@ -5,7 +5,6 @@ on:
pull_request:
branches:
- dev
- compose-dev
jobs:
release:
@@ -13,16 +12,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Java
uses: actions/setup-java@v5
uses: actions/checkout@v4
with:
distribution: 'temurin'
java-version: '17'
fetch-depth: 0
- name: Cache Gradle
uses: burrunan/gradle-cache-action@v3
uses: burrunan/gradle-cache-action@v1
- name: Spotless Check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew spotlessCheck --no-daemon
- name: Build
env:

View File

@@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Open pull request
uses: repo-sync/pull-request@v2

View File

@@ -17,16 +17,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v5
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Gradle
uses: burrunan/gradle-cache-action@v3
uses: burrunan/gradle-cache-action@v1
- name: Build
env:
@@ -34,7 +36,7 @@ jobs:
run: ./gradlew assembleRelease
- name: Setup Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'npm'
@@ -54,7 +56,7 @@ jobs:
echo "${{ secrets.KEYSTORE }}" | base64 --decode > "app/keystore.jks"
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v5
uses: cycjimmy/semantic-release-action@v4
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -64,7 +66,7 @@ jobs:
- name: Attest
if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/attest-build-provenance@v3
uses: actions/attest-build-provenance@v2
with:
subject-name: 'ReVanced Manager ${{ steps.release.outputs.new_release_git_tag }}'
subject-path: app/build/outputs/apk/release/revanced-manager*.apk

View File

@@ -1,4 +1,3 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.io.IOException
plugins {
@@ -59,7 +58,7 @@ tasks.matching { it.name.startsWith("publish") }.configureEach {
android {
namespace = "app.revanced.manager.plugin.downloader"
compileSdk = 36
compileSdk = 35
defaultConfig {
minSdk = 26
@@ -82,10 +81,8 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.fromTarget("17")
}
kotlinOptions {
jvmTarget = "17"
}
buildFeatures {

View File

@@ -1,4 +1,3 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import kotlin.random.Random
plugins {
@@ -53,6 +52,7 @@ dependencies {
// Room
implementation(libs.room.runtime)
implementation(libs.room.ktx)
annotationProcessor(libs.room.compiler)
ksp(libs.room.compiler)
// ReVanced
@@ -60,7 +60,7 @@ dependencies {
implementation(libs.revanced.library)
// Downloader plugins
implementation(projects.api)
implementation(project(":api"))
// Native processes
implementation(libs.kotlin.process)
@@ -111,21 +111,19 @@ dependencies {
android {
namespace = "app.revanced.manager"
compileSdk = 36
buildToolsVersion = "36.0.0"
compileSdk = 35
buildToolsVersion = "35.0.1"
defaultConfig {
applicationId = "app.revanced.manager"
minSdk = 26
targetSdk = 36
targetSdk = 35
versionCode = 1
versionName = "0.0.1"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
configureEach {
}
debug {
applicationIdSuffix = ".debug"
resValue("string", "app_name", "ReVanced Manager (Debug)")
@@ -201,11 +199,8 @@ android {
arg("room.schemaLocation", "$projectDir/schemas")
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.fromTarget("17")
jvmToolchain(17)
}
kotlinOptions {
jvmTarget = "17"
}
buildFeatures {
@@ -228,6 +223,10 @@ android {
}
}
kotlin {
jvmToolchain(17)
}
tasks {
// Needed by gradle-semantic-release-plugin.
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435.

View File

@@ -1,14 +1,63 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
-dontobfuscate
-keep class app.revanced.manager.patcher.runtime.process.* { *; }
-keep class app.revanced.manager.plugin.** { *; }
-keep class app.revanced.patcher.** { *; }
-keep class com.android.tools.smali.** { *; }
-keep class kotlin.** { *; }
-keepnames class com.android.apksig.internal.** { *; }
-keepnames class org.xmlpull.** { *; }
# Required for serialization to work properly
-if @kotlinx.serialization.Serializable class **
-keepclassmembers class <1> {
static <1>$Companion Companion;
}
-if @kotlinx.serialization.Serializable class ** {
static **$* *;
}
-keepclassmembers class <2>$<3> {
kotlinx.serialization.KSerializer serializer(...);
}
-if @kotlinx.serialization.Serializable class ** {
public static ** INSTANCE;
}
-keepclassmembers class <1> {
public static <1> INSTANCE;
kotlinx.serialization.KSerializer serializer(...);
}
-dontwarn com.google.j2objc.annotations.*
# This required for the process runtime.
-keep class app.revanced.manager.patcher.runtime.process.* {
*;
}
# Required for the patcher to function correctly
-keep class app.revanced.patcher.** {
*;
}
-keep class brut.** {
*;
}
-keep class org.xmlpull.** {
*;
}
-keep class kotlin.** {
*;
}
-keep class org.jf.** {
*;
}
-keep class com.android.** {
*;
}
-keep class app.revanced.manager.plugin.** {
*;
}
-dontwarn com.google.auto.value.**
-dontwarn java.awt.**
-dontwarn javax.**
-dontwarn org.slf4j.**
-dontwarn org.slf4j.**
-dontwarn it.skrape.fetcher.*
-dontwarn com.google.j2objc.annotations.*
-keepattributes RuntimeVisibleAnnotations,AnnotationDefault

View File

@@ -8,6 +8,7 @@ import app.revanced.manager.util.tag
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.request.HttpRequestBuilder
import io.ktor.client.request.get
import io.ktor.client.request.prepareGet
import io.ktor.client.request.request
import io.ktor.client.statement.bodyAsText
@@ -16,12 +17,8 @@ import io.ktor.http.isSuccess
import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.core.isNotEmpty
import io.ktor.utils.io.core.readBytes
import io.ktor.utils.io.core.remaining
import io.ktor.utils.io.exhausted
import io.ktor.utils.io.readRemaining
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import kotlinx.io.asSink
import kotlinx.serialization.json.Json
import java.io.File
import java.io.OutputStream
@@ -73,14 +70,14 @@ class HttpService(
) {
http.prepareGet(builder).execute { httpResponse ->
if (httpResponse.status.isSuccess()) {
val stream = outputStream.asSink()
val channel: ByteReadChannel = httpResponse.body()
var count = 0L
stream.use {
while (!channel.exhausted()) {
val chunk = channel.readRemaining()
count += chunk.remaining
chunk.transferTo(stream)
withContext(Dispatchers.IO) {
while (!channel.isClosedForRead) {
val packet = channel.readRemaining(DEFAULT_BUFFER_SIZE.toLong())
while (packet.isNotEmpty) {
val bytes = packet.readBytes()
outputStream.write(bytes)
}
}
}
@@ -95,5 +92,9 @@ class HttpService(
builder: HttpRequestBuilder.() -> Unit
) = saveLocation.outputStream().use { streamTo(it, builder) }
suspend fun getHtml(builder: HttpRequestBuilder.() -> Unit) = htmlDocument(
html = http.get(builder).bodyAsText()
)
class HttpException(status: HttpStatusCode) : Exception("Failed to fetch: http status: $status")
}

View File

@@ -2,9 +2,7 @@ package app.revanced.manager.ui.component
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
import com.mikepenz.markdown.compose.Markdown
import com.mikepenz.markdown.m3.markdownColor
import com.mikepenz.markdown.m3.markdownTypography
@@ -20,29 +18,15 @@ fun Markdown(
colors = markdownColor(
text = MaterialTheme.colorScheme.onSurfaceVariant,
codeBackground = MaterialTheme.colorScheme.secondaryContainer,
codeText = MaterialTheme.colorScheme.onSecondaryContainer,
linkText = MaterialTheme.colorScheme.primary
),
typography = markdownTypography(
h1 = MaterialTheme.typography.headlineSmall.copy(fontWeight = FontWeight.Bold),
h2 = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Bold),
h3 = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold),
text = MaterialTheme.typography.bodyMedium,
code = markdownTypography().code.copy(color = MaterialTheme.colorScheme.onSecondaryContainer),
list = MaterialTheme.typography.bodyMedium,
textLink = TextLinkStyles(
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold, textDecoration = TextDecoration.Underline,
color = MaterialTheme.colorScheme.primary
).toSpanStyle(),
hoveredStyle = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold, textDecoration = TextDecoration.Underline,
color = MaterialTheme.colorScheme.secondary
).toSpanStyle(),
pressedStyle = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold, textDecoration = TextDecoration.Underline,
color = MaterialTheme.colorScheme.tertiary
).toSpanStyle()
),
list = MaterialTheme.typography.bodyMedium
)
)
}

View File

@@ -87,7 +87,7 @@ class UpdateViewModel(
url(release.downloadUrl)
onDownload { bytesSentTotal, contentLength ->
downloadedSize = bytesSentTotal
totalSize = contentLength ?: 0
totalSize = contentLength
}
}
installUpdate()

View File

@@ -42,6 +42,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.launch
import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.format.MonthNames
@@ -52,7 +53,6 @@ import java.util.Locale
import kotlin.properties.PropertyDelegateProvider
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
import kotlin.time.ExperimentalTime
typealias PatchSelection = Map<Int, Set<String>>
typealias Options = Map<Int, Map<String, Map<String, Any?>>>
@@ -141,10 +141,9 @@ suspend fun <T> Flow<Iterable<T>>.collectEach(block: suspend (T) -> Unit) {
}
}
@OptIn(ExperimentalTime::class)
fun LocalDateTime.relativeTime(context: Context): String {
try {
val now = kotlin.time.Clock.System.now()
val now = Clock.System.now()
val duration = now - this.toInstant(TimeZone.UTC)
return when {

View File

@@ -7,4 +7,12 @@ plugins {
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.about.libraries) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.spotless)
}
spotless {
kotlin {
target("app/src/*/java/**/*.kt", "api/src/*/kotlin/**/*.kt")
ktlint().setEditorConfigPath("$projectDir/.editorconfig")
}
}

View File

@@ -6,11 +6,11 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx3072m -XX:MaxMetaspaceSize=1024m -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn

View File

@@ -1,32 +1,32 @@
[versions]
ktx = "1.17.0"
ktx = "1.16.0"
material3 = "1.3.2"
ui-tooling = "1.9.1"
viewmodel-lifecycle = "2.9.4"
ui-tooling = "1.8.1"
viewmodel-lifecycle = "2.9.0"
splash-screen = "1.0.1"
activity = "1.11.0"
appcompat = "1.7.1"
preferences-datastore = "1.1.7"
work-runtime = "2.10.4"
compose-bom = "2025.09.00"
navigation = "2.9.4"
accompanist = "0.37.3"
placeholder = "2.0.0"
reorderable = "2.5.1"
serialization = "1.9.0"
collection = "0.4.0"
datetime = "0.7.1"
room-version = "2.8.0"
activity = "1.10.1"
appcompat = "1.7.0"
preferences-datastore = "1.1.2"
work-runtime = "2.10.1"
compose-bom = "2025.05.00"
navigation = "2.8.6"
accompanist = "0.37.0"
placeholder = "1.1.2"
reorderable = "2.4.3"
serialization = "1.8.0"
collection = "0.3.8"
datetime = "0.6.1"
room-version = "2.7.1"
revanced-patcher = "21.0.0"
revanced-library = "3.0.2"
koin = "4.1.1"
ktor = "3.3.0"
markdown-renderer = "0.37.0"
koin = "3.5.3"
ktor = "2.3.9"
markdown-renderer = "0.30.0"
fading-edges = "1.0.4"
kotlin = "2.2.20"
android-gradle-plugin = "8.13.0"
dev-tools-gradle-plugin = "2.2.20-2.0.2"
about-libraries-gradle-plugin = "12.2.4"
kotlin = "2.1.10"
android-gradle-plugin = "8.9.1"
dev-tools-gradle-plugin = "2.1.10-1.0.29"
about-libraries-gradle-plugin = "12.1.2"
coil = "2.7.0"
app-icon-loader-coil = "1.5.0"
libsu = "6.0.0"
@@ -34,8 +34,9 @@ scrollbars = "1.0.4"
enumutil = "1.1.1"
compose-icons = "1.2.4"
kotlin-process = "1.5.1"
hidden-api-stub = "4.4.0"
binary-compatibility-validator = "0.18.1"
hidden-api-stub = "4.3.3"
binary-compatibility-validator = "0.17.0"
spotless-gradle-plugin = "7.0.4"
[libraries]
# AndroidX Core
@@ -139,3 +140,4 @@ compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "
devtools = { id = "com.google.devtools.ksp", version.ref = "dev-tools-gradle-plugin" }
about-libraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "about-libraries-gradle-plugin" }
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless-gradle-plugin" }

Binary file not shown.

View File

@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=a17ddd85a26b6a7f5ddb71ff8b05fc5104c0202c6e64782429790c933686c806
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
distributionSha256Sum=61ad310d3c7d3e5da131b76bbf22b5a4c0786e9d892dae8c1658d4b484de3caa
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

2
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -22,7 +22,5 @@ dependencyResolutionManagement {
}
}
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
rootProject.name = "revanced-manager"
include(":app", ":api")