Skip to content

Commit 133d414

Browse files
committed
Initial commit
0 parents  commit 133d414

17 files changed

+1877
-0
lines changed

.gitattributes

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Normalize as LF in the repository, OS native locally
2+
* text eol=lf
3+
4+
# These are explicitly windows files and should use crlf
5+
*.bat text eol=crlf
6+
7+
# These files are text and should be normalized (Convert crlf => lf)
8+
*.bash text eol=lf
9+
*.css text diff=css
10+
*.htm text diff=html
11+
*.html text diff=html
12+
*.java text diff=java
13+
*.sh text eol=lf
14+
15+
# These files are binary and should be left untouched
16+
# (binary is a macro for -text -diff)
17+
*.a binary
18+
*.lib binary
19+
*.icns binary
20+
*.png binary
21+
*.jpg binary
22+
*.jpeg binary
23+
*.gif binary
24+
*.ico binary
25+
*.mov binary
26+
*.mp4 binary
27+
*.mp3 binary
28+
*.flv binary
29+
*.fla binary
30+
*.swf binary
31+
*.gz binary
32+
*.zip binary
33+
*.jar binary
34+
*.tar binary
35+
*.tar.gz binary
36+
*.7z binary
37+
*.ttf binary
38+
*.pyc binary
39+
*.gpg binary
40+
*.bin binary
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Trigger Jitpack Build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags-ignore: [ "**" ]
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Trigger Jitpack Build
14+
run: curl "https://jitpack.io/com/github/CloudNetService/cloud-command-framework/main-SNAPSHOT/build.log"

.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# IJ
2+
.idea/*
3+
*.iml
4+
5+
# gradle
6+
.gradle/
7+
build/
8+
9+
# eclipse
10+
*.classpath
11+
*.project
12+
*.settings
13+
/bin/
14+
/subprojects/*/bin/
15+
.metadata/
16+
atlassian-ide-plugin.xml
17+
18+
# NetBeans
19+
.nb-gradle
20+
.nb-gradle-properties
21+
22+
# Vim
23+
*.sw[nop]
24+
25+
# Emacs
26+
*~
27+
\#*\#
28+
.\#*
29+
30+
# Textmate
31+
.textmate
32+
33+
# Sublime Text
34+
*.sublime-*
35+
36+
# jEnv
37+
.java-version
38+
39+
# macOS
40+
.DS_Store
41+
42+
# HPROF
43+
*.hprof
44+
45+
# Work dirs
46+
/incoming-distributions
47+
/intTestHomeDir
48+
49+
# Logs
50+
/*.log
51+
52+
# delombok
53+
*/src/main/lombok
54+
55+
# patched files
56+
patched-cloud/

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "cloud"]
2+
path = cloud
3+
url = https://github.com/Incendo/cloud.git
4+
branch = 1.8.0-dev

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Cloud Command Framework fork
2+
3+
A fork of the well known [cloud command framework](https://github.com/Incendo/cloud) which fixes some inconsistencies
4+
and makes it easier to integrate it into standalone applications.
5+
6+
## Dependencies
7+
8+
This project is available via [jitpack](https://jitpack.io):
9+
10+
```groovy
11+
repositories {
12+
maven {
13+
name = 'jitpack'
14+
url = 'https://jitpack.io/'
15+
}
16+
}
17+
18+
dependencies {
19+
implementation('com.github.cloudnetservice.cloud-command-framework', '<submodule>', 'main-SNAPSHOT')
20+
}
21+
```
22+
23+
## Building from source
24+
25+
After cloning the project you need to init the submodules and apply the patches using:
26+
27+
```
28+
git submodule update --init && ./gradlew applyPatches
29+
```
30+
31+
You can then publish cloud into your local maven repository for testing:
32+
33+
* Navigate into the `patched-cloud` folder using the command line
34+
* Build & publish the project using `./gradlew publishToMavenLocal`
35+
36+
**Java 17 is required to build the project!**
37+
38+
## Making changes
39+
40+
After applying the patches a new folder should appear named `patched-cloud`. You can make changes to the cloud sources
41+
in that folder. When you are done modifying them:
42+
43+
* Navigate into the `patched-cloud` folder using the command line
44+
* Commit your changes using a meaningful commit message
45+
* Move into the root project folder and build a patch from the created commit using `./gradlew rebuildPatches`
46+
47+
## Modifying an existing patch
48+
49+
To modify an existing patch:
50+
51+
* First make your changes in the `patched-cloud` folder as always
52+
* Find the commit hash of the commit you want to edit by for example using `git log`, `git blame` or the git history
53+
provided by your IDE or GitHub
54+
* Make a fixup commit: `git commit -a --fixup <commit hash of the patch to edit>`
55+
* You can also use `--squash` instead of `--fixup` to change the commit message of the patch as well
56+
* Rebase the changes: `git rebase -i --autosquash origin`. This will automatically move the fixup to the right place,
57+
you just need to confirm the action by "saving" the changes in the text editor that will open.
58+
* Move into the root project folder and rebuild the patch from the created commit using `./gradlew rebuildPatches`
59+
60+
## Patch formatting
61+
62+
In general, it is preferred to keep the patches as small as possible to make it easier to pull in changes made in the
63+
forked repository. Some general notes:
64+
65+
* Single line changes always have a `// cloudnet` suffix, optionally providing a description of the change
66+
like: `// cloudnet - private -> protected`
67+
* Multi line changes start with `// cloudnet start` and end with `// cloudnet end`, the start message can optionally
68+
contain a reason like: `// cloudnet start - easier access to caption registry`
69+
70+
Don't comment lines out unless necessary, you can make the diff smaller by (for example) inserting an `if (true)`
71+
before the code you want to prevent from happening like:
72+
73+
```java
74+
public @NonNull String getMessage() {
75+
// cloudnet start - no more heavy operations
76+
if (true) return "hello world";
77+
// cloudnet end
78+
return "hello" + " " + "world";
79+
}
80+
```
81+
82+
This is how a full change might look like:
83+
```java
84+
public @NonNull String getMessage(final @NonNull String input) { // cloudnet - private -> public
85+
final String partiallyFixed = input.replace('.', '-');
86+
final boolean empty = partiallyFixed.isBlank(); // cloudnet - was isEmpty but isBlank is better
87+
final Integer parsedValue = Ints.tryParse(partiallyFixed);
88+
// cloudnet start - no more heavy operations
89+
if (true) return "hello world " + partiallyFixed;
90+
// cloudnet end
91+
return "hello" + " " + partiallyFixed + " " + parsedValue + " " + "world";
92+
}
93+
```
94+
95+
## Contributing
96+
97+
If you think that something else should be changed in order to easier integrate this fork into your project, fell free
98+
to open a pull request. Contributions are always welcome.
99+
100+
## License
101+
102+
This project is based on [cloud](https://github.com/Incendo/cloud) which is licensed under the terms of
103+
the [MIT license](https://github.com/Incendo/cloud/blob/master/LICENSE) to Alexander Söderberg & Contributors. This
104+
includes all files pulled in from the `cloud` git submodule as well as the patched code in `patched-cloud`. The patches
105+
and all other files in this repository are licensed under the terms of the [Apache 2 license](license.txt) to the
106+
CloudNetService team & contributors.

build.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import net.minecrell.gitpatcher.PatchExtension
2+
3+
plugins {
4+
id("net.minecraftforge.gitpatcher") version "0.10.+"
5+
}
6+
7+
configure<PatchExtension> {
8+
submodule = "cloud"
9+
patches = file("patches")
10+
target = file("patched-cloud")
11+
}
12+
13+
tasks.register("rebuildPatches") {
14+
dependsOn(tasks.makePatches)
15+
}

cloud

Submodule cloud added at adbce86

gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
org.gradle.caching=true
2+
org.gradle.parallel=true
3+
org.gradle.warning.mode=all
4+
org.gradle.logging.level=info
5+
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8

gradle/wrapper/gradle-wrapper.jar

58.4 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)