Skip to content

Commit

Permalink
initial import from mache
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed Mar 22, 2024
0 parents commit c891789
Show file tree
Hide file tree
Showing 62 changed files with 3,496 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.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/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 PaperMC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# sculptor

Gradle plugin for [Mâché](https://github.com/PaperMC/mache)

sculptor-root is applied to the root of Mâché, sculptor-version is applied to individual versions.
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tasks.register("printVersion") {
doFirst {
println(version)
}
}
21 changes: 21 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
}

repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
implementation(libs.gradle.shadow)
implementation(libs.gradle.kotlin.dsl)
implementation(libs.gradle.plugin.kotlin.withVersion(embeddedKotlinVersion))
implementation(libs.gradle.plugin.publish)
}

fun Provider<MinimalExternalModuleDependency>.withVersion(version: String): Provider<String> {
return map { "${it.module.group}:${it.module.name}:$version" }
}

9 changes: 9 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rootProject.name = "buildSrc"

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
63 changes: 63 additions & 0 deletions buildSrc/src/main/kotlin/config-kotlin.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
plugins {
idea
id("org.gradle.kotlin.kotlin-dsl")
}

java {
withSourcesJar()
}

tasks.withType(JavaCompile::class).configureEach {
options.release = 17
}

kotlin {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(17)
}
target {
compilations.configureEach {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf("-Xjvm-default=all", "-Xjdk-release=17", "-opt-in=kotlin.io.path.ExperimentalPathApi")
}
}
}
}

repositories {
maven("https://repo.papermc.io/repository/maven-releases/") {
name = "PaperMC"
mavenContent {
includeGroupAndSubgroups("io.papermc")
}
}
mavenCentral()
}

configurations.all {
if (name == "compileOnly") {
return@all
}
dependencies.remove(project.dependencies.gradleApi())
dependencies.removeIf { it.group == "org.jetbrains.kotlin" }
}

dependencies {
compileOnly(gradleApi())
compileOnly(kotlin("stdlib-jdk8"))
}

tasks.jar {
manifest {
attributes(
"Implementation-Version" to project.version
)
}
}

idea {
module {
isDownloadSources = true
}
}
99 changes: 99 additions & 0 deletions buildSrc/src/main/kotlin/config-publish.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
id("org.jetbrains.kotlin.jvm")
id("com.github.johnrengelman.shadow")
id("com.gradle.plugin-publish")
}

fun version(): String = version.toString()

val shade: Configuration by configurations.creating
configurations.implementation {
extendsFrom(shade)
}

fun ShadowJar.configureStandard() {
configurations = listOf(shade)

dependencies {
exclude(dependency("org.jetbrains.kotlin:.*:.*"))
}

exclude("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "OSGI-INF/**", "*.profile", "module-info.class", "ant_tasks/**")

mergeServiceFiles()
}

val sourcesJar by tasks.existing(AbstractArchiveTask::class) {
from(
zipTree(project(":sculptor-shared").tasks
.named("sourcesJar", AbstractArchiveTask::class)
.flatMap { it.archiveFile })
) {
exclude("META-INF/**")
}
}

val prefix = project.name.substringAfter("sculptor-")

gradlePlugin {
website.set("https://github.com/PaperMC/sculptor")
vcsUrl.set("https://github.com/PaperMC/sculptor")
plugins.create("sculptor-$prefix") {
id = "io.papermc.sculptor." + prefix
displayName = "sculptor $prefix"
tags.set(listOf("paper", "minecraft"))
}
}

val shadowJar by tasks.existing(ShadowJar::class) {
archiveClassifier.set(null as String?)
configureStandard()
}

publishing {
repositories {
maven("https://repo.papermc.io/repository/maven-snapshots/") {
credentials(PasswordCredentials::class)
name = "paper"
}
}

publications {
withType(MavenPublication::class).configureEach {
pom {
pomConfig()
}
}
}
}

fun MavenPom.pomConfig() {
val repoPath = "PaperMC/sculptor"
val repoUrl = "https://github.com/$repoPath"

name.set("sculptor")
description.set("Gradle plugin for the PaperMC project")
url.set(repoUrl)
inceptionYear.set("2024")

licenses {
license {
name.set("LGPLv2.1")
url.set("$repoUrl/blob/master/LICENSE")
distribution.set("repo")
}
}

issueManagement {
system.set("GitHub")
url.set("$repoUrl/issues")
}

scm {
url.set(repoUrl)
connection.set("scm:git:$repoUrl.git")
developerConnection.set("scm:git:[email protected]:$repoPath.git")
}
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
group = io.papermc.sculptor
version = 1.0.0-SNAPSHOT
24 changes: 24 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[versions]
ktlint = "0.49.1"
serialize = "1.5.1"
xml = "0.86.1"

[plugins]
spotless = "com.diffplug.spotless:6.20.0"

[libraries]
serialize-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialize" }
serialize-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialize" }
codebook = "io.papermc.codebook:codebook:1.0.7"
diffutils = "io.github.java-diff-utils:java-diff-utils:4.12"
coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2"
jgit = "org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r"

xml-core = { module = "io.github.pdvrieze.xmlutil:core-jvm", version.ref = "xml" }
xml-serialize = { module = "io.github.pdvrieze.xmlutil:serialization-jvm", version.ref = "xml" }

# gradle
gradle-shadow = "com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:8.1.1"
gradle-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:4.2.1"
gradle-plugin-kotlin = { module = "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin" }
gradle-plugin-publish = "com.gradle.publish:plugin-publish-plugin:1.2.1"
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit c891789

Please sign in to comment.