Skip to content
Draft
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
48 changes: 32 additions & 16 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
# Auto detect text files and perform LF normalization
* text=auto
*.bat text=crlf
* text=auto eol=lf
# Force Batch files to CRLF
*.bat eol=crlf -text

# Custom for Visual Studio
*.cs diff=csharp
# Java sources
*.java text diff=java
*.kt text diff=java
*.gradle text diff=java
*.gradle.kts text diff=java

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
# These files are text and should be normalized (Convert crlf => lf)
*.css text diff=css
*.df text
*.htm text diff=html
*.html text diff=html
*.js text
*.jsp text
*.jspf text
*.jspx text
*.properties text
*.tld text
*.tag text
*.tagx text
*.xml text

# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.class binary
*.dll binary
*.ear binary
*.jar binary
*.so binary
*.war binary
*.jks binary
50 changes: 47 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
# gradle
.gradle/
.kotlin/
build/
libs/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

*.log*
### IntelliJ IDEA ###
.fleet/
.idea/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
nbproject/
nbbuild/
nbdist/
dist/
!**/src/main/**/dist/
!**/src/test/**/dist/
.nb-gradle/

### VS Code ###
.vscode/

### Vim ###
.*.sw[a-p]

### Mac OS ###
.DS_Store
.DS_Store/

### Linux ###
*~
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ A generic command system, with tie-ins to many Minecraft platforms such as Bukki
Forge, and Sponge.

### Experimental Status
Piston is, as indicated by the Semantic Version, experimental, and all APIs are subject to break on minor version changes.

Piston is, as indicated by the Semantic Version, experimental, and all APIs are subject to break on minor version
changes.
It is recommended to not use Piston in the wild.

![Build Status](https://ci.enginehub.org/app/rest/builds/buildType:Piston_Build/statusIcon)
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`
}

repositories {
gradlePluginPortal()
maven {
name = "EngineHub Repository"
url = uri("https://maven.enginehub.org/repo/")
}
}

dependencies {
implementation(libs.levelHeadered)
implementation(libs.jfrog.buildinfo)
}
7 changes: 7 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
39 changes: 39 additions & 0 deletions build-logic/src/main/kotlin/buildlogic.artifactory.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask

plugins {
id("maven-publish")
id("com.jfrog.artifactory")
}

val ARTIFACTORY_CONTEXT_URL = "artifactory_contextUrl"
val ARTIFACTORY_USER = "artifactory_user"
val ARTIFACTORY_PASSWORD = "artifactory_password"

if (!project.hasProperty(ARTIFACTORY_CONTEXT_URL)) ext[ARTIFACTORY_CONTEXT_URL] = "http://localhost"
if (!project.hasProperty(ARTIFACTORY_USER)) ext[ARTIFACTORY_USER] = "guest"
if (!project.hasProperty(ARTIFACTORY_PASSWORD)) ext[ARTIFACTORY_PASSWORD] = ""

configure<ArtifactoryPluginConvention> {
setContextUrl("${project.property(ARTIFACTORY_CONTEXT_URL)}")
clientConfig.publisher.run {
repoKey = when {
"${project.version}".contains("SNAPSHOT") -> "libs-snapshot-local"
else -> "libs-release-local"
}
username = "${project.property(ARTIFACTORY_USER)}"
password = "${project.property(ARTIFACTORY_PASSWORD)}"
isMaven = true
isIvy = false
}
publish {
defaults {
publications("maven")
setPublishArtifacts(true)
}
}
}

tasks.named<ArtifactoryTask>("artifactoryPublish") {
skip = true
}
132 changes: 132 additions & 0 deletions build-logic/src/main/kotlin/buildlogic.common.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import buildlogic.getLibrary
import buildlogic.stringyLibs
import net.octyl.levelheadered.LevelHeaderedExtension
import org.gradle.plugins.ide.idea.model.IdeaModel

plugins {
id("eclipse")
id("idea")
id("net.octyl.level-headered")
id("checkstyle")
id("java-library")
id("maven-publish")
}

group = rootProject.group
version = rootProject.version

configurations.all {
resolutionStrategy {
cacheChangingModulesFor(1, TimeUnit.DAYS)
}
}

dependencies {
for (conf in listOf("implementation", "api")) {
if (!configurations.names.contains(conf)) {
continue
}

add(conf, platform(stringyLibs.getLibrary("log4j-bom")).map {
val dep = create(it)
dep.because("Mojang provides Log4j")
dep
})

constraints {
add(conf, stringyLibs.getLibrary("guava")) {
because("Mojang provides Guava")
}
add(conf, stringyLibs.getLibrary("gson")) {
because("Mojang provides Gson")
}
add(conf, stringyLibs.getLibrary("fastutil")) {
because("Mojang provides FastUtil")
}
}
}

"api"(stringyLibs.getLibrary("jsr305"))
"testImplementation"(platform(stringyLibs.getLibrary("junit-bom")))
"testImplementation"(stringyLibs.getLibrary("junit-jupiter-api"))
"testImplementation"(stringyLibs.getLibrary("junit-jupiter-params"))
"testImplementation"(platform(stringyLibs.getLibrary("mockito-bom")))
"testImplementation"(stringyLibs.getLibrary("mockito-core"))
"testImplementation"(stringyLibs.getLibrary("mockito-junit-jupiter"))
"testRuntimeOnly"(stringyLibs.getLibrary("junit-jupiter-engine"))
"testRuntimeOnly"(stringyLibs.getLibrary("junit-platform-launcher"))
}

configure<LevelHeaderedExtension> {
headerTemplate(rootProject.file("HEADER.txt"))
}

configure<CheckstyleExtension> {
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
toolVersion = "10.16.0"
}

configure<JavaPluginExtension> {
toolchain.languageVersion = JavaLanguageVersion.of(17)
withJavadocJar()
withSourcesJar()
}

configure<PublishingExtension> {
publications {
register<MavenPublication>("maven") {
from(components["java"])

versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
}
}
}

configure<IdeaModel> {
module {
isDownloadSources = true
isDownloadJavadoc = true
}
}

tasks {
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}

withType<Test>().configureEach {
useJUnitPlatform {
includeEngines("junit-jupiter")
}
}

// Java 8 turns on doclint which we fail
withType<Javadoc>().configureEach {
options.encoding = "UTF-8"
(options as StandardJavadocDocletOptions).apply {
addBooleanOption("Werror", true)
addBooleanOption("Xdoclint:all", true)
addBooleanOption("Xdoclint:-missing", true)
tags(
"apiNote:a:API Note:",
"implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:"
)
}
}

named<ProcessResources>("processTestResources") {
from(rootProject.file("common-test-resources"))
}

named("check").configure {
dependsOn("checkstyleMain", "checkstyleTest")
}
}
5 changes: 5 additions & 0 deletions build-logic/src/main/kotlin/buildlogic.core-ap.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plugins {
id("buildlogic.common")
}

group = "${group}.core-ap"
19 changes: 19 additions & 0 deletions build-logic/src/main/kotlin/buildlogic/GradleExtras.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package buildlogic

import org.gradle.api.Project
import org.gradle.api.artifacts.MinimalExternalModuleDependency
import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.plugins.ExtraPropertiesExtension
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.getByType

val Project.ext: ExtraPropertiesExtension
get() = extensions.getByType()

val Project.stringyLibs: VersionCatalog
get() = extensions.getByType<VersionCatalogsExtension>().named("libs")

fun VersionCatalog.getLibrary(name: String): Provider<MinimalExternalModuleDependency> = findLibrary(name).orElseThrow {
error("Library $name not found in version catalog")
}
Loading