Skip to content

Commit

Permalink
Release 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Rollczi committed Dec 11, 2023
1 parent 1497a43 commit badc806
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 23 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ maven("https://repo.panda-lang.org/releases")

### Dependency
```kts
implementation("dev.rollczi:{artifact}:3.1.2")
implementation("dev.rollczi:{artifact}:3.2.0")
```
```xml
<dependency>
<groupId>dev.rollczi</groupId>
<artifactId>{artifact}</artifactId>
<version>3.1.2</version>
<version>3.2.0</version>
</dependency>
```
`{artifact}` replace with [platform artifact](https://github.com/Rollczi/LiteCommands#platform-artifacts)
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repositories {
dependencies {
implementation("me.champeau.jmh:jmh-gradle-plugin:0.7.2")
implementation("net.kyori:indra-git:3.1.3")
implementation("com.google.guava:guava:30.1.1-jre")
}

sourceSets {
Expand Down
68 changes: 57 additions & 11 deletions buildSrc/src/main/kotlin/litecommands-compile-variables.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import com.google.common.io.Files

plugins {
id("java-library")
id("net.kyori.indra.git")
}

val litecommandsVariables = "src/dev/rollczi/litecommands/LiteCommandsVariables.java"
val sourceFile = file(litecommandsVariables)
var content: String = sourceFile.readText()
val input = file("src")
var output = File(project.layout.buildDirectory.get().asFile, "sources/java/")

val variablesInputFile = File(input, "dev/rollczi/litecommands/LiteCommandsVariables.java")
val variablesOutputFile = File(output, "dev/rollczi/litecommands/LiteCommandsVariables.java")
var variablesContent: String = variablesInputFile.readText()

tasks.withType(JavaCompile::class.java).configureEach {
dependsOn("generateLiteCommandsVariables")
setSource(output)
}

tasks.compileJava {
tasks.create("generateLiteCommandsVariables") {
if (!indraGit.isPresent) {
throw IllegalStateException("indra-git is not present")
}
Expand All @@ -21,18 +31,54 @@ tasks.compileJava {
?: System.getenv("GIT_COMMIT")
?: throw IllegalStateException("commit is null")

val newContent = content
val newContent = variablesContent
.replace("{litecommands-version}", version)
.replace("{litecommands-branch}", branchName)
.replace("{litecommands-commit}", commitHash)

doFirst {
sourceFile.writeText(newContent)

if (output.exists()) {
// Remove the output directory if it exists to prevent any possible conflicts
deleteDirectory(output);
}
}

tasks.classes {
doLast {
sourceFile.writeText(content)
output.mkdirs();
output = output.getCanonicalFile()

// copy all files

input.walkTopDown().forEach {
if (it.isFile) {
val relativePath = it.relativeTo(input)
val outputFile = File(output, relativePath.path.toString())

Files.createParentDirs(outputFile)

if (outputFile.path.equals(variablesOutputFile.path)) {
outputFile.createNewFile()
outputFile.writeText(newContent)
return@forEach
}


it.copyTo(outputFile)
}
}
}

fun deleteDirectory(directory: File): Boolean {
if (directory.exists()) {
val files = directory.listFiles()
if (files != null) {
for (file in files) {
if (file.isDirectory) {
deleteDirectory(file)
} else {
file.delete()
}
}
}
}

return directory.delete()
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/litecommands-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "dev.rollczi"
version = "3.2.0-SNAPSHOT"
version = "3.2.0"

java {
withSourcesJar()
Expand Down
4 changes: 2 additions & 2 deletions examples/bukkit-adventure-platform/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ repositories {
dependencies {
compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")

// implementation("dev.rollczi:litecommands-bukkit:3.1.2") // <-- uncomment in your project
// implementation("dev.rollczi:litecommands-adventure-platform:3.1.2") // <-- uncomment in your project
// implementation("dev.rollczi:litecommands-bukkit:3.2.0") // <-- uncomment in your project
// implementation("dev.rollczi:litecommands-adventure-platform:3.2.0") // <-- uncomment in your project
implementation("net.kyori:adventure-platform-bukkit:4.3.0")
implementation("net.kyori:adventure-text-minimessage:4.14.0")

Expand Down
4 changes: 2 additions & 2 deletions examples/bukkit-chatgpt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ repositories {
dependencies {
compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")

// implementation("dev.rollczi:litecommands-bukkit:3.1.2") // <-- uncomment in your project
// implementation("dev.rollczi:litecommands-chatgpt:3.1.2") // <-- uncomment in your project
// implementation("dev.rollczi:litecommands-bukkit:3.2.0") // <-- uncomment in your project
// implementation("dev.rollczi:litecommands-chatgpt:3.2.0") // <-- uncomment in your project
implementation(project(":litecommands-bukkit")) // don't use this line in your build.gradle
implementation(project(":litecommands-chatgpt")) // don't use this line in your build.gradle
}
Expand Down
2 changes: 1 addition & 1 deletion examples/bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repositories {
dependencies {
compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")

// implementation("dev.rollczi:litecommands-bukkit:3.1.2") // <-- uncomment in your project
// implementation("dev.rollczi:litecommands-bukkit:3.2.0") // <-- uncomment in your project
implementation(project(":litecommands-bukkit")) // don't use this line in your build.gradle
}

Expand Down
2 changes: 1 addition & 1 deletion examples/velocity/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {
compileOnly("com.velocitypowered:velocity-api:3.2.0-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.2.0-SNAPSHOT")

// implementation("dev.rollczi:litecommands-velocity:3.1.2") // <-- uncomment in your project
// implementation("dev.rollczi:litecommands-velocity:3.2.0") // <-- uncomment in your project
implementation(project(":litecommands-velocity")) // don't use this line in your build.gradle
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*/
public final class LiteCommandsVariables {

public static final String VERSION = "3.2.0-SNAPSHOT";
public static final String BRANCH = "master";
public static final String COMMIT = "3e05bcf3550cfac6b33a0b6a824226e46c50a109";
public static final String VERSION = "{litecommands-version}";
public static final String BRANCH = "{litecommands-branch}";
public static final String COMMIT = "{litecommands-commit}";

private LiteCommandsVariables() {
}
Expand Down

0 comments on commit badc806

Please sign in to comment.