Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Build
/local.properties
/.kotlin/
/.gradle/
**/.kotlin/
**/.gradle/
**/build/
**/.cxx/
**/.externalNativeBuild/
Expand Down
16 changes: 16 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
`kotlin-dsl`
}

dependencies {
compileOnly(libs.aliucord.gradle)
}

gradlePlugin {
plugins {
create("aliucord-plugins-repo") {
id = "com.aliucord.plugins-repo"
implementationClass = "com.aliucord.gradle.repo.RepoPlugin"
}
}
}
18 changes: 18 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@file:Suppress("UnstableApiUsage")

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
name = "aliucord"
url = uri("https://maven.aliucord.com/releases")
}
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
55 changes: 55 additions & 0 deletions build-logic/src/main/kotlin/com/aliucord/gradle/repo/Authors.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.aliucord.gradle.repo

import com.aliucord.gradle.AliucordExtension

/**
* A list of all currently known authors, used in the plugin buildscripts
* to specify plugin authors. Add yourself to this list rather than duplicating
* your author information in each separate plugin.
*
* Entries are not required to use standard Kotlin naming conventions.
*
* Example usage from a plugin's `build.gradle.kts`:
* ```kotlin
* import com.aliucord.gradle.Authors
* import com.aliucord.gradle.author
*
* // ...
*
* aliucord {
* author(Authors.xyz)
*
* // ...
* }
* ```
*/
@Suppress("SpellCheckingInspection", "unused", "RedundantSuppression")
object Authors {
val Aliucord = Author(name = "Aliucord")
}

/**
* Represents a plugin author.
*
* @param name The user-facing name to display
* @param id The Discord ID of the author, optional.
* This also will allow Aliucord to show a badge on your profile if the plugin is installed.
* @param hyperlink Whether to hyperlink the Discord profile specified by [id].
* Set this to false if you don't want to be spammed for support.
*/
data class Author(
val name: String,
val id: Long = 0L,
val hyperlink: Boolean = true,
)

/**
* Specifies an already-known author of this plugin.
*/
fun AliucordExtension.author(author: Author) {
author(
name = author.name,
id = author.id,
hyperlink = author.hyperlink,
)
}
13 changes: 13 additions & 0 deletions build-logic/src/main/kotlin/com/aliucord/gradle/repo/RepoPlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.aliucord.gradle.repo

import org.gradle.api.Plugin
import org.gradle.api.Project

/**
* A dummy Gradle plugin applied to Aliucord plugin buildscripts.
* ID: `com.aliucord.plugins-repo`
*/
@Suppress("unused")
class RepoPlugin : Plugin<Project> {
override fun apply(target: Project) {}
}
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ktlint-plugin = "14.2.0"

[libraries]
aliucord = { module = "com.aliucord:Aliucord", version.ref = "aliucord" }
aliucord-gradle = { module = "com.aliucord:gradle", version.ref = "aliucord-gradle" }
discord = { module = "com.discord:discord", version.ref = "discord" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-stdlib" }

Expand Down
9 changes: 9 additions & 0 deletions plugins/Template/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import com.aliucord.gradle.repo.Authors
import com.aliucord.gradle.repo.author

plugins {
id("com.aliucord.plugins-repo")
}

version = "1.0.0"
description = "Template plugin"

aliucord {
author(Authors.Aliucord)

changelog.set(
"""
# 1.0.0
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@file:Suppress("UnstableApiUsage")

pluginManagement {
includeBuild("build-logic")
repositories {
google()
gradlePluginPortal()
Expand Down