Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul project setup #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 100
tab_width = 4
ij_continuation_indent_size = 8
ij_any_line_comment_at_first_column = false
ij_any_line_comment_add_space = true
ij_smart_tabs = false
ij_wrap_on_typing = false

[plugin/Frecents/src/main/java/*.java]
ij_formatter_enabled = false

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ktlint_code_style = ktlint_official
ktlint_experimental = enabled
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_string-template-indent = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_function-expression-body = disabled
ktlint_function_signature_body_expression_wrapping = default
ktlint_chain_method_rule_force_multiline_when_chain_operator_count_greater_or_equal_than = 6
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 3
ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 6

[*.xml]
ij_xml_continuation_indent_size = 4

[*.yml]
indent_size = 2

This file was deleted.

zt64 marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

19 changes: 0 additions & 19 deletions ExamplePlugins/java/MyFirstPatch/build.gradle.kts

This file was deleted.

2 changes: 0 additions & 2 deletions ExamplePlugins/java/MyFirstPatch/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions ExamplePlugins/kotlin/MyFirstCommand/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ Template for an [Aliucord](https://github.com/Aliucord) plugin repo

⚠️ Make sure you check "Include all branches" when using this template


## Getting started with writing your first plugin

This template includes 2 example plugins demonstrating commands and patches which you can find in the ExamplePlugins folder.
This template includes 2 example plugins demonstrating commands and patches which you can find in
the ExamplePlugins folder.

1. Open the root build.gradle.kts, read the comments and replace all the placeholders
2. Familiarize yourself with the project structure. Most files are commented
3. Build or deploy your first plugin using:
- Windows: `.\gradlew.bat MyFirstCommand:make` or `.\gradlew.bat MyFirstCommand:deployWithAdb`
- Linux & Mac: `./gradlew MyFirstCommand:make` or `./gradlew MyFirstCommand:deployWithAdb`
- Windows: `.\gradlew.bat MyFirstCommand:make` or `.\gradlew.bat MyFirstCommand:deployWithAdb`
- Linux & Mac: `./gradlew MyFirstCommand:make` or `./gradlew MyFirstCommand:deployWithAdb`

## License

Everything in this repo is released into the public domain. You may use it however you want with no conditions whatsoever
Everything in this repo is released into the public domain. You may use it however you want with no
conditions whatsoever
97 changes: 8 additions & 89 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,89 +1,8 @@
import com.aliucord.gradle.AliucordExtension
import com.android.build.gradle.BaseExtension

buildscript {
repositories {
google()
mavenCentral()
// Aliucords Maven repo which contains our tools and dependencies
maven("https://maven.aliucord.com/snapshots")
// Shitpack which still contains some Aliucord dependencies for now. TODO: Remove
maven("https://jitpack.io")
}

dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
// Aliucord gradle plugin which makes everything work and builds plugins
classpath("com.aliucord:gradle:main-SNAPSHOT")
// Kotlin support. Remove if you want to use Java
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
}
}

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")
// Remove if using Java
apply(plugin = "kotlin-android")

// Fill out with your info
aliucord {
author("DISCORD USERNAME", 123456789L)
updateUrl.set("https://raw.githubusercontent.com/USERNAME/REPONAME/builds/updater.json")
buildUrl.set("https://raw.githubusercontent.com/USERNAME/REPONAME/builds/%s.zip")
}

android {
compileSdkVersion(31)

defaultConfig {
minSdk = 24
targetSdk = 31
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "11" // Required
// Disables some unnecessary features
freeCompilerArgs = freeCompilerArgs +
"-Xno-call-assertions" +
"-Xno-param-assertions" +
"-Xno-receiver-assertions"
}
}
}

dependencies {
val discord by configurations
val implementation by configurations

// Stubs for all Discord classes
discord("com.discord:discord:aliucord-SNAPSHOT")
implementation("com.aliucord:Aliucord:main-SNAPSHOT")

implementation("androidx.appcompat:appcompat:1.4.0")
implementation("com.google.android.material:material:1.4.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.2")
}
}

task<Delete>("clean") {
delete(rootProject.buildDir)
}
@file:Suppress("DSL_SCOPE_VIOLATION")

plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.aliucord) apply false
alias(libs.plugins.ktlint) apply false
}
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
# 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=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options=--illegal-access=permit
zt64 marked this conversation as resolved.
Show resolved Hide resolved
# 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
org.gradle.configureondemand=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
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
android.suppressUnsupportedCompileSdk=34
19 changes: 19 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[versions]
discord = "aliucord-SNAPSHOT"
aliucord = "main-SNAPSHOT"
#noinspection GradleDependency Aliucord uses Kotlin 1.5.21
kotlin = "1.5.21"
android = "7.4.2"
ktlintPlugin = "12.1.1"
#noinspection GradleDependency Newer versions incompatible with other plugins
ktlint = "0.50.0"

[libraries]
discord = { module = "com.discord:discord", version.ref = "discord" }
aliucord = { module = "com.aliucord:Aliucord", version.ref = "aliucord" }

[plugins]
android-library = { id = "com.android.library", version.ref = "android" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
aliucord = { id = "com.aliucord.gradle", version.ref = "aliucord" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlintPlugin" }
Loading