-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
161 additions
and
3 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/main/kotlin/xyz/srnyx/gradlegalaxy/data/AdventureDependency.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package xyz.srnyx.gradlegalaxy.data | ||
|
||
import org.gradle.api.Action | ||
import org.gradle.api.artifacts.ExternalModuleDependency | ||
|
||
import xyz.srnyx.gradlegalaxy.enums.AdventureComponent | ||
import xyz.srnyx.gradlegalaxy.enums.Component | ||
|
||
|
||
/** | ||
* Represents a dependency on a component of Adventure | ||
* | ||
* @param component The component to depend on | ||
* @param version The version of the component to depend on | ||
* @param configuration The configuration to add the dependency to | ||
* @param configurationAction The action to apply to the dependency | ||
*/ | ||
data class AdventureDependency(val component: Component, val version: String, val configuration: String? = null, val configurationAction: Action<ExternalModuleDependency> = Action {}) { | ||
companion object { | ||
/** | ||
* Gets the default dependencies for Adventure for Annoying API | ||
* | ||
* @param configuration The configuration to add the dependencies to | ||
* @param apiVersion The version of [AdventureComponent.API] to depend on | ||
* @param textMinimessageVersion The version of [AdventureComponent.Text.MINIMESSAGE] to depend on | ||
* @param textSerializerLegacyVersion The version of [AdventureComponent.Text.Serializer.LEGACY] to depend on | ||
* @param platformBungeecordVersion The version of [AdventureComponent.Platform.BUNGEECORD] to depend on | ||
* | ||
* @return The default dependencies for Adventure for Annoying API | ||
*/ | ||
fun getDefaultAnnoying( | ||
configuration: String = "implementation", | ||
apiVersion: String = "4.14.0", | ||
textMinimessageVersion: String = "4.14.0", | ||
textSerializerLegacyVersion: String = "4.14.0", | ||
platformBungeecordVersion: String = "4.3.0", | ||
): Array<AdventureDependency> = arrayOf( | ||
AdventureDependency(AdventureComponent.API, apiVersion, configuration), | ||
AdventureDependency(AdventureComponent.Text.MINIMESSAGE, textMinimessageVersion, configuration), | ||
AdventureDependency(AdventureComponent.Text.Serializer.LEGACY, textSerializerLegacyVersion, configuration), | ||
AdventureDependency(AdventureComponent.Platform.BUNGEECORD, platformBungeecordVersion, configuration)) | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
src/main/kotlin/xyz/srnyx/gradlegalaxy/enums/AdventureComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package xyz.srnyx.gradlegalaxy.enums | ||
|
||
|
||
/** | ||
* A parent interface for all components | ||
*/ | ||
fun interface Component { | ||
/** | ||
* Returns the full component name used for the dependency notation | ||
*/ | ||
fun getComponent(): String | ||
} | ||
|
||
/** | ||
* `adventure-<component>` | ||
*/ | ||
enum class AdventureComponent : Component { | ||
API, | ||
NBT, | ||
KEY, | ||
BOM, | ||
ANNOTATION_PROCESSORS; | ||
|
||
override fun getComponent(): String = "adventure-" + name.lowercase().replace("_", "-") | ||
|
||
/** | ||
* `adventure-platform-<component>` | ||
*/ | ||
enum class Platform : Component { | ||
API, | ||
BUKKIT, | ||
BUNGEECORD, | ||
SPONGEAPI, | ||
FABRIC, | ||
VIAVERSION, | ||
FACET; | ||
|
||
override fun getComponent(): String = "adventure-platform-" + name.lowercase() | ||
} | ||
|
||
/** | ||
* `adventure-extra-<component>` | ||
*/ | ||
enum class Extra : Component { | ||
KOTLIN; | ||
|
||
override fun getComponent(): String = "adventure-extra-" + name.lowercase() | ||
} | ||
|
||
/** | ||
* `adventure-text-<component>` | ||
*/ | ||
enum class Text : Component { | ||
MINIMESSAGE; | ||
|
||
override fun getComponent(): String = "adventure-text-" + name.lowercase() | ||
|
||
/** | ||
* `adventure-text-serializer-<component>` | ||
*/ | ||
enum class Serializer : Component { | ||
LEGACY, | ||
BUNGEECORD, | ||
CONFIGURATE3, | ||
CONFIGURATE4, | ||
JSON, | ||
GSON, | ||
ANSI, | ||
PLAIN; | ||
|
||
override fun getComponent(): String = "adventure-text-serializer-" + name.lowercase() | ||
|
||
/** | ||
* `adventure-text-serializer-<component>-impl` | ||
*/ | ||
enum class Implementation : Component { | ||
JSON, | ||
GSON; | ||
|
||
override fun getComponent(): String = "adventure-text-serializer-" + name.lowercase() + "-impl" | ||
} | ||
} | ||
|
||
/** | ||
* `adventure-text-logger-<component>` | ||
*/ | ||
enum class Logger : Component { | ||
SLF4J; | ||
|
||
override fun getComponent(): String = "adventure-text-logger-" + name.lowercase() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters