refactor: update to aliucord-gradle 2
This commit is contained in:
parent
2b687cea21
commit
5df56646c7
20 changed files with 150 additions and 141 deletions
122
build.gradle.kts
122
build.gradle.kts
|
|
@ -1,86 +1,78 @@
|
|||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
import com.aliucord.gradle.AliucordExtension
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import com.android.build.gradle.LibraryExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidExtension
|
||||
import org.jlleitschuh.gradle.ktlint.KtlintExtension
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven("https://maven.aliucord.com/snapshots")
|
||||
gradlePluginPortal() // remove when gradle 8
|
||||
maven("https://jitpack.io")
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.android) apply false
|
||||
alias(libs.plugins.android.library) apply false
|
||||
alias(libs.plugins.aliucord.plugin) apply true
|
||||
alias(libs.plugins.ktlint) apply false
|
||||
alias(libs.plugins.shadow) apply false
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:7.1.3")
|
||||
classpath("com.aliucord:gradle:main-SNAPSHOT")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
|
||||
// classpath("com.gradleup.shadow:shadow-gradle-plugin:8.3.8")
|
||||
classpath("com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:7.1.2") // For Gradle 7 compat
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven("https://maven.aliucord.com/snapshots")
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.aliucord(configuration: AliucordExtension.() -> Unit) = extensions.getByName<AliucordExtension>("aliucord").configuration()
|
||||
|
||||
fun Project.android(configuration: BaseExtension.() -> Unit) = extensions.getByName<BaseExtension>("android").configuration()
|
||||
|
||||
subprojects {
|
||||
apply(plugin = "com.android.library")
|
||||
apply(plugin = "com.aliucord.gradle")
|
||||
apply(plugin = "kotlin-android")
|
||||
val libs = rootProject.libs
|
||||
|
||||
aliucord {
|
||||
author("Lava", 368398754077868032L)
|
||||
updateUrl.set("https://raw.githubusercontent.com/LavaDesu/Awoocord/builds/updater.json")
|
||||
buildUrl.set("https://raw.githubusercontent.com/LavaDesu/Awoocord/builds/%s.zip")
|
||||
apply {
|
||||
plugin(libs.plugins.android.library.get().pluginId)
|
||||
plugin(libs.plugins.aliucord.plugin.get().pluginId)
|
||||
plugin(libs.plugins.kotlin.android.get().pluginId)
|
||||
plugin(libs.plugins.ktlint.get().pluginId)
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion(31)
|
||||
configure<LibraryExtension> {
|
||||
compileSdk = 36
|
||||
namespace = "moe.lava.awoocord"
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 24
|
||||
targetSdk = 31
|
||||
minSdk = 21
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
aidl = false
|
||||
buildConfig = true
|
||||
renderScript = false
|
||||
shaders = false
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
// Disables some unnecessary features
|
||||
freeCompilerArgs = freeCompilerArgs +
|
||||
"-Xno-call-assertions" +
|
||||
"-Xno-param-assertions" +
|
||||
"-Xno-receiver-assertions"
|
||||
}
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
}
|
||||
|
||||
configure<AliucordExtension> {
|
||||
author("Lava", 368398754077868032L, hyperlink = true)
|
||||
github("https://github.com/LavaDesu/Awoocord")
|
||||
}
|
||||
|
||||
configure<KtlintExtension> {
|
||||
version.set(libs.versions.ktlint.asProvider())
|
||||
|
||||
coloredOutput.set(true)
|
||||
outputColorName.set("RED")
|
||||
ignoreFailures.set(true)
|
||||
}
|
||||
|
||||
configure<KotlinAndroidExtension> {
|
||||
compilerOptions {
|
||||
jvmTarget = JvmTarget.JVM_21
|
||||
optIn.add("kotlin.RequiresOptIn")
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
dependencies {
|
||||
val discord by configurations
|
||||
val compileOnly by configurations
|
||||
val implementation by configurations
|
||||
|
||||
// Stubs for all Discord classes
|
||||
discord("com.discord:discord:aliucord-SNAPSHOT")
|
||||
implementation("com.aliucord:Aliucord:2.5.0")
|
||||
|
||||
implementation("androidx.appcompat:appcompat:1.4.0")
|
||||
implementation("com.google.android.material:material:1.4.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.2")
|
||||
compileOnly(libs.discord)
|
||||
compileOnly(libs.aliucord)
|
||||
compileOnly(libs.aliuhook)
|
||||
compileOnly(libs.kotlin.stdlib)
|
||||
}
|
||||
}
|
||||
|
||||
task<Delete>("clean") {
|
||||
delete(rootProject.buildDir)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|||
version = "8.8.0"
|
||||
description = "Beta backport of ComponentsV2"
|
||||
|
||||
android {
|
||||
namespace = "moe.lava.corenary.componentsv2"
|
||||
}
|
||||
|
||||
aliucord {
|
||||
// Changelog of your plugin
|
||||
changelog.set("""
|
||||
|
|
@ -28,11 +32,12 @@ aliucord {
|
|||
* Initial release >w<
|
||||
""".trimIndent())
|
||||
|
||||
excludeFromUpdaterJson.set(false)
|
||||
deploy.set(true)
|
||||
}
|
||||
|
||||
//apply(plugin = "com.gradleup.shadow")
|
||||
apply(plugin = "com.github.johnrengelman.shadow") // remove when gradle 8
|
||||
apply {
|
||||
plugin(libs.plugins.shadow.get().pluginId)
|
||||
}
|
||||
|
||||
val shadowDir = File(buildDir, "intermediates/shadowed")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="moe.lava.awoocanary.componentsv2" />
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
@file:Suppress("MISSING_DEPENDENCY_CLASS", "MISSING_DEPENDENCY_SUPERCLASS")
|
||||
|
||||
package com.aliucord.coreplugins.componentsv2.selectsheet
|
||||
|
||||
import android.os.Bundle
|
||||
|
|
@ -16,6 +14,7 @@ import com.discord.utilities.view.extensions.ViewExtensions
|
|||
import com.discord.utilities.view.recycler.MaxHeightRecyclerView
|
||||
import com.discord.widgets.botuikit.views.select.`SelectComponentBottomSheet$binding$2`
|
||||
import com.lytefast.flexinput.R
|
||||
import b.a.k.b as FormatUtils
|
||||
|
||||
internal class SelectSheet : AppBottomSheet {
|
||||
val entry: BotUiComponentV2Entry?
|
||||
|
|
@ -71,7 +70,7 @@ internal class SelectSheet : AppBottomSheet {
|
|||
|
||||
if (state.isMultiSelect) {
|
||||
subtitle.text =
|
||||
b.a.k.b.k(
|
||||
FormatUtils.k(
|
||||
this,
|
||||
R.h.message_select_component_select_requirement,
|
||||
arrayOf(state.minSelections),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
@file:Suppress("MISSING_DEPENDENCY_CLASS", "MISSING_DEPENDENCY_SUPERCLASS")
|
||||
|
||||
package com.aliucord.coreplugins.componentsv2.selectsheet
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
@file:Suppress("MISSING_DEPENDENCY_CLASS", "MISSING_DEPENDENCY_SUPERCLASS")
|
||||
|
||||
package com.aliucord.coreplugins.componentsv2.views
|
||||
|
||||
import android.content.Context
|
||||
|
|
|
|||
|
|
@ -18,11 +18,12 @@ aliucord {
|
|||
* Initial port >w< thanks @jedenastka
|
||||
""".trimIndent())
|
||||
|
||||
excludeFromUpdaterJson.set(false)
|
||||
deploy.set(true)
|
||||
}
|
||||
|
||||
//apply(plugin = "com.gradleup.shadow")
|
||||
apply(plugin = "com.github.johnrengelman.shadow") // remove when gradle 8
|
||||
apply {
|
||||
plugin(libs.plugins.shadow.get().pluginId)
|
||||
}
|
||||
|
||||
val shadowDir = File(buildDir, "intermediates/shadowed")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="moe.lava.corenary.slashcommandsfix" />
|
||||
|
|
@ -1,19 +1,12 @@
|
|||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# 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.
|
||||
# Gradle
|
||||
org.gradle.caching=true
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.configureondemand=true
|
||||
org.gradle.parallel=true
|
||||
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
|
||||
# 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
|
||||
|
||||
# Kotlin
|
||||
kotlin.code.style=official
|
||||
|
||||
# Android
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
|
|
|
|||
25
gradle/libs.versions.toml
Normal file
25
gradle/libs.versions.toml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[versions]
|
||||
aliucord = "2.6.0"
|
||||
aliuhook = "1.1.4"
|
||||
aliucord-gradle = "2.3.0"
|
||||
android = "8.13.0"
|
||||
discord = "126021"
|
||||
kotlin = "2.2.20"
|
||||
#noinspection GradleDependency
|
||||
kotlin-stdlib = "1.5.21"
|
||||
ktlint = "1.7.1"
|
||||
ktlint-plugin = "13.1.0"
|
||||
shadow = "8.3.8"
|
||||
|
||||
[libraries]
|
||||
aliucord = { module = "com.aliucord:Aliucord", version.ref = "aliucord" }
|
||||
aliuhook = { module = "com.aliucord:Aliuhook", version.ref = "aliuhook" }
|
||||
discord = { module = "com.discord:discord", version.ref = "discord" }
|
||||
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-stdlib" }
|
||||
|
||||
[plugins]
|
||||
aliucord-plugin = { id = "com.aliucord.plugin", version.ref = "aliucord-gradle" }
|
||||
android-library = { id = "com.android.library", version.ref = "android" }
|
||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-plugin" }
|
||||
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,8 @@
|
|||
#Wed May 28 17:22:29 GMT 2025
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
version = "1.3.0"
|
||||
description = "Backported and improved search functionality"
|
||||
|
||||
android {
|
||||
namespace = "moe.lava.awoocord.scout"
|
||||
}
|
||||
|
||||
aliucord {
|
||||
// Changelog of your plugin
|
||||
changelog.set("""
|
||||
|
|
@ -43,5 +47,5 @@ aliucord {
|
|||
* Initial release >w<
|
||||
""".trimIndent())
|
||||
|
||||
excludeFromUpdaterJson.set(false)
|
||||
deploy.set(true)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="moe.lava.awoocord.scout" />
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
package com.discord.restapi
|
||||
|
||||
// Stub
|
||||
@Suppress("ClassName")
|
||||
abstract class `RequiredHeadersInterceptor$HeadersProvider` {}
|
||||
|
|
@ -13,20 +13,15 @@ import com.aliucord.utils.DimenUtils.dp
|
|||
import com.aliucord.utils.ViewUtils.findViewById
|
||||
import com.aliucord.wrappers.ChannelWrapper.Companion.id
|
||||
import com.discord.BuildConfig
|
||||
import com.discord.api.channel.Channel
|
||||
import com.discord.api.channel.ChannelUtils
|
||||
import com.discord.api.channel.`ChannelUtils$getSortByNameAndType$1`
|
||||
import com.discord.api.channel.*
|
||||
import com.discord.api.permission.Permission
|
||||
import com.discord.databinding.WidgetSearchSuggestionsItemHasBinding
|
||||
import com.discord.models.member.GuildMember
|
||||
import com.discord.models.user.User
|
||||
import com.discord.restapi.RequiredHeadersInterceptor
|
||||
import com.discord.restapi.RequiredHeadersInterceptor.HeadersProvider
|
||||
import com.discord.restapi.RestAPIBuilder
|
||||
import com.discord.simpleast.core.parser.*
|
||||
import com.discord.stores.StoreSearch
|
||||
import com.discord.stores.StoreSearchInput
|
||||
import com.discord.stores.StoreStream
|
||||
import com.discord.stores.*
|
||||
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
||||
import com.discord.utilities.mg_recycler.SingleTypePayload
|
||||
import com.discord.utilities.rest.RestAPI.AppHeadersProvider
|
||||
|
|
@ -34,10 +29,7 @@ import com.discord.utilities.search.network.`SearchFetcher$getRestObservable$3`
|
|||
import com.discord.utilities.search.network.SearchQuery
|
||||
import com.discord.utilities.search.query.FilterType
|
||||
import com.discord.utilities.search.query.node.QueryNode
|
||||
import com.discord.utilities.search.query.node.answer.ChannelNode
|
||||
import com.discord.utilities.search.query.node.answer.HasAnswerOption
|
||||
import com.discord.utilities.search.query.node.answer.HasNode
|
||||
import com.discord.utilities.search.query.node.answer.UserNode
|
||||
import com.discord.utilities.search.query.node.answer.*
|
||||
import com.discord.utilities.search.query.node.content.ContentNode
|
||||
import com.discord.utilities.search.query.node.filter.FilterNode
|
||||
import com.discord.utilities.search.query.parsing.QueryParser
|
||||
|
|
@ -57,6 +49,7 @@ import moe.lava.awoocord.scout.api.SearchAPIInterface
|
|||
import moe.lava.awoocord.scout.parsing.*
|
||||
import moe.lava.awoocord.scout.ui.*
|
||||
import java.util.regex.Pattern
|
||||
import b.a.k.b as FormatUtils
|
||||
|
||||
@AliucordPlugin()
|
||||
@Suppress("unused", "unchecked_cast")
|
||||
|
|
@ -97,8 +90,7 @@ class Scout : Plugin() {
|
|||
|
||||
// Creates a new custom search API implementation, for the extra `min_id` param in search queries
|
||||
private fun buildSearchApi(context: Context): SearchAPIInterface {
|
||||
@Suppress("cast_never_succeeds")
|
||||
val appHeadersProvider = AppHeadersProvider.INSTANCE as HeadersProvider
|
||||
val appHeadersProvider = AppHeadersProvider.INSTANCE
|
||||
val requiredHeadersInterceptor = RequiredHeadersInterceptor(appHeadersProvider)
|
||||
val persistentCookieJar = PersistentCookieJar(SetCookieCache(), SharedPrefsCookiePersistor(context))
|
||||
val restAPIBuilder = RestAPIBuilder(BuildConfig.HOST_API, persistentCookieJar)
|
||||
|
|
@ -552,7 +544,7 @@ class Scout : Plugin() {
|
|||
// Patch formatting utils to use our custom lowercase strings
|
||||
// This is called by FilterViewHolder.onConfigure, using the results from getAnswerText and getFilterText
|
||||
patcher.patch(
|
||||
b.a.k.b::class.java.getDeclaredMethod("c",
|
||||
FormatUtils::class.java.getDeclaredMethod("c",
|
||||
Resources::class.java,
|
||||
Int::class.javaPrimitiveType!!,
|
||||
Array::class.java,
|
||||
|
|
@ -568,12 +560,7 @@ class Scout : Plugin() {
|
|||
else -> null
|
||||
}
|
||||
override?.let {
|
||||
// Why invoke? Becuase I can't for the life of me get Function1 to cast properly
|
||||
param.result = b.a.k.b::class.java.getDeclaredMethod("g",
|
||||
CharSequence::class.java,
|
||||
Array::class.java,
|
||||
Function1::class.java
|
||||
).invoke(null, it, objArr.copyOf(), param.args[3])
|
||||
param.result = FormatUtils.g(it, objArr.copyOf(), param.args[3] as b.a.k.`b$b`)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package moe.lava.awoocord.scout.parsing
|
||||
|
||||
import android.content.Context
|
||||
import com.discord.simpleast.core.parser.ParseSpec
|
||||
import com.discord.simpleast.core.parser.Parser
|
||||
import com.discord.simpleast.core.parser.Rule
|
||||
import com.discord.simpleast.core.parser.*
|
||||
import com.discord.utilities.search.query.node.QueryNode
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
|
|
@ -13,15 +11,15 @@ internal class SimpleParserRule(
|
|||
regex: Pattern,
|
||||
private val parseMethod: (
|
||||
matcher: Matcher,
|
||||
parser: Parser<Context, in QueryNode, Any>,
|
||||
obj: Any
|
||||
) -> ParseSpec<Context, Any>
|
||||
parser: Parser<Context, in QueryNode, Any?>,
|
||||
obj: Any?
|
||||
) -> ParseSpec<Context, Any?>
|
||||
) : ParserRule(regex) {
|
||||
override fun parse(
|
||||
matcher: Matcher?,
|
||||
parser: Parser<Context, in QueryNode, in Any>,
|
||||
obj: Any
|
||||
): ParseSpec<Context, in Any> {
|
||||
parser: Parser<Context, in QueryNode, in Any?>,
|
||||
obj: Any?
|
||||
): ParseSpec<Context, in Any?> {
|
||||
checkNotNull(matcher) { "matcher" }
|
||||
checkNotNull(parser) { "parser" }
|
||||
return parseMethod(matcher, parser, obj)
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ aliucord {
|
|||
* Initial release >w<
|
||||
""".trimIndent())
|
||||
|
||||
excludeFromUpdaterJson.set(false)
|
||||
deploy.set(true)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="moe.lava.awoocord.zinnia" />
|
||||
|
|
@ -62,7 +62,6 @@ object ZinniaSettings {
|
|||
var blockApcaThreshold by api.delegate(75.0)
|
||||
var blockWcagThreshold by api.delegate(4.5)
|
||||
|
||||
@Suppress("MISSING_DEPENDENCY_CLASS", "MISSING_DEPENDENCY_SUPERCLASS")
|
||||
class Page : SettingsPage() {
|
||||
private lateinit var manager: RadioManager
|
||||
private lateinit var mRoleDot: CheckedSetting
|
||||
|
|
|
|||
|
|
@ -1,3 +1,24 @@
|
|||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.aliucord.com/releases")
|
||||
maven("https://maven.aliucord.com/snapshots")
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven("https://maven.aliucord.com/releases")
|
||||
maven("https://maven.aliucord.com/snapshots")
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Awoocord"
|
||||
|
||||
val plugins = mapOf(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue