Skip to content

Commit

Permalink
chore: add resources
Browse files Browse the repository at this point in the history
  • Loading branch information
MC-XiaoHei committed Apr 16, 2024
1 parent de04aa7 commit 608cb25
Show file tree
Hide file tree
Showing 11 changed files with 668 additions and 0 deletions.
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 LeavesMC

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.
File renamed without changes.
144 changes: 144 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.11"
}

val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"

repositories {
mavenCentral()
maven(paperMavenPublicUrl) {
content { onlyForConfigurations(configurations.paperclip.name) }
}
maven {
name = "leavesmcRepositorySnapshots"
url = uri("https://repo.leavesmc.top/snapshots")
}
}

dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
decompiler("org.quiltmc:quiltflower:1.9.0")
paperclip("top.leavesmc:leavesclip:1.0-SNAPSHOT")
}

subprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}

tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
}

tasks.withType<ProcessResources> {
filteringCharset = Charsets.UTF_8.name()
}

repositories {
mavenCentral()
maven(paperMavenPublicUrl)
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://ci.emc.gs/nexus/content/groups/aikar/")
maven("https://repo.aikar.co/content/groups/aikar")
maven("https://repo.md-5.net/content/repositories/releases/")
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
maven("https://jitpack.io")
maven("https://repo.codemc.io/repository/maven-public/")
}

}

tasks.generateDevelopmentBundle {
apiCoordinates.set("org.leavesmc.lumina:lumina-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
libraryRepositories.set(
listOf(
"https://repo.maven.apache.org/maven2/",
"https://maven.pkg.github.com/LeavesMC/Lumina",
)
)
}

paperweight {
serverProject.set(project(":lumina-server"))

remapRepo.set("https://maven.fabricmc.net/")
decompileRepo.set("https://maven.quiltmc.org/")

useStandardUpstream("folia") {
url.set(github("PaperMC", "Folia"))
ref.set(providers.gradleProperty("foliaCommit"))

withStandardPatcher {
apiSourceDirPath.set("Folia-API")
serverSourceDirPath.set("Folia-Server")


apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("Lumina-API"))

serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("Lumina-Server"))
}

patchTasks.register("generatedApi") {
isBareDirectory = true
upstreamDirPath = "paper-api-generator/generated"
patchDir = layout.projectDirectory.dir("patches/generatedApi")
outputDir = layout.projectDirectory.dir("paper-api-generator/generated")
}
}
}

tasks.generateDevelopmentBundle {
apiCoordinates.set("org.leavesmc.lumina:lumina-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,
)
}

allprojects {
publishing {
repositories {
maven {
name = "githubPackage"
url = uri("https://maven.pkg.github.com/LeavesMC/Lumina")

credentials.username = System.getenv("GITHUB_USERNAME")
credentials.password = System.getenv("GITHUB_TOKEN")
}

publications {
register<MavenPublication>("gpr") {
from(components["java"])
}
}
}
}
}

publishing {
if (project.hasProperty("publishDevBundle")) {
publications.create<MavenPublication>("devBundle") {
artifact(tasks.generateDevelopmentBundle) {
artifactId = "dev-bundle"
}
}
}
}

70 changes: 70 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Contributing to Lumina
===========

**English** | [中文](./CONTRIBUTING_ZH)

We're glad that you want to contribute to our project!
In general, our review of pull requests is very lenient.
And if you can follow the rules below, we can complete the review faster.

## Please fork using your personal account

We regularly merge existing PRs.
If there're some small problems, we'll help you solve them by editing your PR.

But, if your PR is from a organization, we can NOT edit your PR, so we must merge your PR manually.

So, don't use orgnization accounts for fork!

See also [This issue](https://github.com/isaacs/github/issues/1681), and then you'll know why we can't edit PRs from organizations.

## Development Environment

Before coding, you need these softwares / tools as Dev Environment.

- `git`
- `JDK 17 or higher`

## Understanding "Patches"

Lumina uses as the same patching system as Paper,
and has been divided into two directories for the purpose of modifying different parts of it:

- `lumina-api` - Modifications to `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit`.

The patching system is based on git, and you can learn about it at here: <https://git-scm.com/docs/gittutorial>

If you have forked the main repository, then you should follow the steps below:

1. Clone your repository to local
2. Run Gradle's `applyPatches` task in your IDE or terminal (You can run `./gradlew applyPatches` directly in terminal.)
3. Enter `lumina-api` directory to carry out modifications.

BTW, `lumina-api` and are not normal git repositories.

- Before applying patches, the base will point to unmodified source code.
- Every commit after the base is a patch.
- Only commits after the last commit of Paper will be considered Lumina patches.

## Adding new patches

It's very easy to to add patches by following the steps below:

1. Modify the code of `lumina-api`
2. Add these changes to the local git repository (For example, `git add .`)
3. Commit these changes using `git commit -m <Commit Message>`
4. Run Gradle's task `rebuildPatches` to convert your commits to a new patch
5. Push your patches to your repository

After pushing, you can open a PR to submit your patches.

## Modifying patches

You can modify a existing patch by following the steps below:

1. Modify code at HEAD
2. Run `git commit -a --fixup <hash>` in your terminal to make a fix-up commit
- If you want to edit the commit message, replace `--fixup` with `--squash`.
3. Run `git rebase -i --autosquash base` to rebase automatically, then just type `:q` to close the confirm page
4. Run Gradle's task `rebuildPatches` to modify existing patches
5. Push and PR again
67 changes: 67 additions & 0 deletions docs/CONTRIBUTING_ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
为Lumina贡献代码
===========

[English](./CONTRIBUTING) | **中文**

我们很开心您想为我们的项目做出贡献!一般来说,我们对PR的审核是十分宽松的;
但是如果您可以遵守下列的规则,我们可以更快地完成审核。

## 使用个人账户进行 For

我们会定期尝试合并已有的 PR,如果有一些小问题,会尝试帮您解决这些问题。

但是如果您使用了组织账号进行 PR,我们就不能对您的 PR 进行修改了。因此我们只能关闭你的PR然后进行手动合并。

所以,请不要使用组织账号进行 Fork!

您可以看看 [这个 Issue](https://github.com/isaacs/github/issues/1681) 来了解一下我们为什么无法修改组织账号的 PR。

## 开发环境

在开始开发之前,您首先需要拥有以下软件作为开发环境:

- `git`
- `JDK 17 或更高版本`

## 了解补丁(Patches)

Lumina 使用和 Folia 一样的补丁系统,并为了针对不同部分的修改分成了两个目录:

- `lumina-api` - 对 `Folia-API` / `Paper-API` / `Spigot-API` / `Bukkit` 进行的修改。

补丁系统是基于 git 的,你可以在这里了解 git 的基本内容: <https://git-scm.com/docs/gittutorial>

如果你已经 Fork 了主储存库,那么下面你应该这么做:

1. 将你的仓库 clone 到本地;
2. 在你的 IDE 或 终端 内执行 Gradle 的 `applyPatches` 任务,如果是在终端内,你可以执行 `./gradlew applyPatches`
3. 进入 `lumina-api` 文件夹进行修改。

顺便一提,`lumina-api` 并不是正常的 git 仓库:

- 在应用补丁前,基点将会指向未被更改的源码
- 在基点后的每一个提交都是一个补丁
- 只有在 Folia 最后一个提交后的提交才会被视为 Lumina 补丁

## 增加补丁

按照以下步骤增加一个补丁是非常简单的:

1.`lumina-api` 进行修改;
2. 使用 git 添加你的修改,比如 `git add .`
3. 使用 `git commit -m <提交信息>` 进行提交;
4. 运行 Gradle 任务 `rebuildPatches` 将你的提交转化为一个补丁;
5. 将你生成的补丁文件进行推送。

这样做以后,你就可以将你的补丁文件进行 PR 提交。

## 修改补丁

你可以使用以下方法来修改一个补丁的内容:

1. 在 HEAD 上直接进行修改;
2. 使用 `git commit -a --fixup <hash>` 来进行一个更正提交;
- 如果你想要更改提交信息,你也可以用 `--squash` 来代替 `--fixup`
3. 使用 `git rebase -i --autosquash base` 来进行自动变基,你只需要输入 `:q` 来关闭确认页面即可;
4. 运行 Gradle 任务 `rebuildPatches` 来修改已被修改的补丁;
5. 将修改后的补丁 PR 发回储存库。
9 changes: 9 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
group = org.leavesmc.lumina
version = 1.20.4-R0.1-SNAPSHOT

foliaCommit = ef2c6971891b7571261591cd22d27ff555c5d3f2

org.gradle.caching = true
org.gradle.parallel = true
org.gradle.vfs.watch = false
org.gradle.jvmargs = -Xmx3G
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 608cb25

Please sign in to comment.