diff --git a/.editorconfig b/.editorconfig index ba49e3c234..81e0f98639 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,3 +3,6 @@ root = true [*] indent_style = tab indent_size = 4 + +[docssrc/**] +indent_style = space diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16f70bdab4..d43fec2ad4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,10 @@ # against bad commits. name: build -on: [push] +on: + push: + pull_request: + types: [opened, synchronize, reopened] jobs: build: @@ -19,42 +22,150 @@ jobs: os: [ubuntu-20.04] runs-on: ${{ matrix.os }} steps: - - name: checkout repository + + ### Set up ### + + - name: Checkout the CommandAPI repository uses: actions/checkout@v3 - - name: setup jdk ${{ matrix.java }} + + - name: Setup JDK ${{ matrix.java }} uses: actions/setup-java@v3 with: distribution: temurin java-version: ${{ matrix.java }} cache: maven - - name: build CommandAPI using maven - run: mvn clean install --batch-mode - - name: CommandAPI plugin artifact + + ### Compilation ### + + - name: Build the CommandAPI (Bukkit+Velocity) using maven + run: mvn clean install --batch-mode -P Platform.Bukkit,Platform.Velocity + + - name: Check NMS_Common compiles against all compatible Minecraft versions + run: | + mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_17_R1 + mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_18_R1 + mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_18_2_R2 + mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_19_R1 + mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_19_3_R2; + + # - name: validate version-specific dependencies (nms-common) + # run: | + # nms_common_path="commandapi-platforms/commandapi-bukkit/commandapi-bukkit-nms/commandapi-bukkit-nms-common/target/classes/dev/jorel/commandapi/nms/NMS_Common.class" + # if ! command -v javap &> /dev/null + # then + # echo "javap could not be found, skipping NMS Common validation check" + # exit + # else + # javapcommand=$(javap -v $nms_common_path | grep -E '#[0-9]+ = Class ' | cut -c 46- | sort | grep 'org/bukkit/craftbukkit') + # if [[ -n "$javapcommand" ]]; then + # echo "NMS Common has version-specific dependencies!" + # echo $javapcommand + # exit 1 + # else + # echo "NMS Common has no version-specific dependencies :)" + # fi + # fi + + ### Bukkit tests across all NMS versions ### + # Dev note: Yes, I know I could put this under one run section, but it's a million times easier + # to see which version failed when it's got the version name and subsection in GitHub Actions + + - name: Run Bukkit unit tests across all versions (1.19.4) + continue-on-error: true + run: mvn clean package -pl :commandapi-bukkit-test-tests -P Platform.Bukkit -Dmaven.javadoc.skip=true -P Minecraft_1_19_4 + + - name: Run Bukkit unit tests across all versions (1.19.2) + continue-on-error: true + run: | + mvn clean package -pl :commandapi-bukkit-test-tests -P Platform.Bukkit -Dmaven.javadoc.skip=true -P Minecraft_1_19_2 + mvn clean package -pl :commandapi-bukkit-test-tests-1.18 -P Platform.Bukkit -Dmaven.javadoc.skip=true -P Minecraft_1_19_2 + + - name: Run Bukkit unit tests across all versions (1.18) + continue-on-error: true + run: mvn clean package -pl :commandapi-bukkit-test-tests -P Platform.Bukkit -Dmaven.javadoc.skip=true -P Minecraft_1_18 + + - name: Run Bukkit unit tests across all versions (1.17) + continue-on-error: true + run: mvn clean package -pl :commandapi-bukkit-test-tests -P Platform.Bukkit -Dmaven.javadoc.skip=true -P Minecraft_1_17 + + - name: Run Bukkit unit tests across all versions (1.16.5) + continue-on-error: true + run: mvn clean package -pl :commandapi-bukkit-test-tests -P Platform.Bukkit -Dmaven.javadoc.skip=true -P Minecraft_1_16_5 + + # It doesn't matter which version the Kotlin DSL uses. It should be version independent + - name: Run Bukkit Kotlin DSL unit tests + continue-on-error: true + run: mvn clean package -pl :commandapi-bukkit-kotlin-test -P Platform.Bukkit -Dmaven.javadoc.skip=true -P Minecraft_1_19_2 + + ### Upload .jar artifacts ### + + - name: Upload CommandAPI (Bukkit) plugin artifact if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: CommandAPI (plugin) path: | - commandapi-plugin/target/CommandAPI*.jar - !commandapi-plugin/target/*sources.jar - !commandapi-plugin/target/*javadoc.jar - - name: CommandAPI core artifact - if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS - uses: actions/upload-artifact@v2 + commandapi-platforms/commandapi-bukkit/commandapi-bukkit-plugin/target/CommandAPI*.jar + !commandapi-platforms/commandapi-bukkit/commandapi-bukkit-plugin/target/*sources.jar + !commandapi-platforms/commandapi-bukkit/commandapi-bukkit-plugin/target/*javadoc.jar + + ### Examples ### + + - name: Build CommandAPI example Bukkit plugins in examples/ folder + run: cd ./examples; ./build.sh; + + ### Documentation ### + + - name: Run markdownlint on all documentation Markdown documents + uses: DavidAnson/markdownlint-cli2-action@v8 with: - name: CommandAPI (core) - path: | - commandapi-core/target/CommandAPI*.jar - !commandapi-core/target/*sources.jar - !commandapi-core/target/*javadoc.jar - - name: CommandAPI shade artifact - if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS - uses: actions/upload-artifact@v2 + globs: 'docssrc/src/*.md' + + - name: Build the documentation with mdBook + run: | + cd docssrc + curl -LJO https://github.com/JorelAli/mdBook/releases/download/v0.4.21-fa6/mdbook-fa6 && chmod +x mdbook-fa6 + mkdir -p mdbook-linkcheck && cd "$_" && curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip -o mdbook-linkcheck.zip && unzip "$_" && chmod +x mdbook-linkcheck && export PATH=$PWD:$PATH && cd .. + ./mdbook-fa6 build + + ### Save PR information for 'SonarAnalyze' + - name: Save PR number to file + if: github.event_name == 'pull_request' && ${{ matrix.os }} == 'ubuntu-latest' && ${{ matrix.java_version }} == '17' + run: echo ${{ github.event.number }} > PR_NUMBER.txt + - name: Archive PR number + if: github.event_name == 'pull_request' && ${{ matrix.os }} == 'ubuntu-latest' && ${{ matrix.java_version }} == '17' + uses: actions/upload-artifact@v3 with: - name: CommandAPI (shade) - path: | - commandapi-shade/target/CommandAPI*.jar - !commandapi-shade/target/*sources.jar - !commandapi-shade/target/*javadoc.jar - - name: build CommandAPI examples in examples/ - run: for folder in examples/*/; do ( cd $folder; mvn clean package ); done + name: PR_NUMBER + path: PR_NUMBER.txt + + snapshot-deploy: + needs: build # Only run if "build" succeeds + runs-on: ubuntu-latest + if: github.repository == 'JorelAli/CommandAPI' && github.ref == 'refs/heads/dev/dev' + + steps: + - name: Checkout the CommandAPI repository + uses: actions/checkout@v3 + + - name: Setup JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + server-id: ossrh # Needs to match the id in the main pom.xml file + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + java-version: 17 + cache: maven + + - name: Deploy snapshot version of the CommandAPI (Bukkit+Velocity) to the Sonatype snapshot repository + run: | + if mvn help:evaluate -Dexpression=project.version -q -DforceStdout | grep -E -q '\-SNAPSHOT$'; then + echo "SNAPSHOT version detected: $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" + mvn deploy --batch-mode -P Platform.Bukkit,Platform.Velocity -DskipTests=true + else + echo "Version is not a SNAPSHOT version, not deploying to Sonatype Snapshot repo" + fi + env: + MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index df84a7bc72..c5cead236c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.idea/** +**/.idea/ *.iml build-works/ libs/ @@ -7,9 +7,10 @@ bin .project .settings target -logs/latest.log -commandapi-plugin/dependency-reduced-pom.xml -commandapi-shade/dependency-reduced-pom.xml +build +**/logs/*.log +**/logs/*.log.gz .vscode -commandapi-plugin-test/command_registration.json -commandapi-plugin-test/logs/* \ No newline at end of file +.DS_Store +docssrc/src/.markdownlint-cli2.yaml +.gradle \ No newline at end of file diff --git a/Doxyfile b/Doxyfile index 411d2b2a5f..97866a27e5 100644 --- a/Doxyfile +++ b/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = CommandAPI # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 8.8.0 +PROJECT_NUMBER = 9.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a @@ -877,7 +877,8 @@ WARN_LOGFILE = INPUT = README.md \ commandapi-core\src\main\java \ ..\I-Al-Istannen\brigadier\src\main\java \ - commandapi-annotations\src\main\java + commandapi-annotations\src\main\java \ + commandapi-platforms\commandapi-bukkit\commandapi-bukkit-core\src\main\java # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/README.md b/README.md index 57836058bc..c9d7a86133 100644 --- a/README.md +++ b/README.md @@ -47,21 +47,21 @@ The list of what version of the CommandAPI you'll need to run on a specific vers | **1.13.x** | v1.0 - 5.12, 8.3.0 - 8.8.0 | 8.8.0 | 16 | | **1.14.1, 1.14.2** | v2.0 - 5.12, 8.3.0 - 8.8.0 | 8.8.0 | 16 | | **1.14.3, 1.14.4** | v2.1 - 5.12, 8.3.0 - 8.8.0 | 8.8.0 | 16 | -| **1.15.x** | v2.3a - 5.12, 8.3.0 - 8.8.0 | 8.8.0 | 16 | -| **1.16.1** | v3.0 - 5.12, 8.3.0 - 8.8.0 | 8.8.0 | 16 | -| **1.16.2** | v4.0 - 5.12, 8.3.0 - 8.8.0 | 8.8.0 | 16 | -| **1.16.3** | v4.2 - 5.12, 8.3.0 - 8.8.0 | 8.8.0 | 16 | -| **1.16.4** | v5.2 - 5.12, 8.3.0 - 8.8.0 | 8.8.0 | 16 | -| **1.16.5** | v5.7 - 7.0.0, 8.3.0 - 8.8.0 | 8.8.0 | 16 | -| **1.17** | 6.0.x - 8.8.0 | 8.8.0 | 16 | -| **1.17.1** | 6.1.x - 8.8.0 | 8.8.0 | 16 | -| **1.18, 1.18.1** | 6.5.2 - 8.8.0 | 8.8.0 | 16 | -| **1.18.2** | 6.5.4 - 8.8.0 | 8.8.0 | 16 | -| **1.19** | 8.3.0 - 8.8.0 | 8.8.0 | 16 | -| **1.19.1** | 8.5.0 - 8.8.0 | 8.8.0 | 16 | -| **1.19.2** | 8.5.1 - 8.8.0 | 8.8.0 | 16 | -| **1.19.3** | 8.7.0 - 8.8.0 | 8.8.0 | 16 | -| **1.19.4** | 8.8.0 | 8.8.0 | 16 | +| **1.15.x** | v2.3a - 5.12, 8.3.0 - 9.0.0 | 9.0.0 | 16 | +| **1.16.1** | v3.0 - 5.12, 8.3.0 - 9.0.0 | 9.0.0 | 16 | +| **1.16.2** | v4.0 - 5.12, 8.3.0 - 9.0.0 | 9.0.0 | 16 | +| **1.16.3** | v4.2 - 5.12, 8.3.0 - 9.0.0 | 9.0.0 | 16 | +| **1.16.4** | v5.2 - 5.12, 8.3.0 - 9.0.0 | 9.0.0 | 16 | +| **1.16.5** | v5.7 - 7.0.0, 8.3.0 - 9.0.0 | 9.0.0 | 16 | +| **1.17** | 6.0.x - 9.0.0 | 9.0.0 | 16 | +| **1.17.1** | 6.1.x - 9.0.0 | 9.0.0 | 16 | +| **1.18, 1.18.1** | 6.5.2 - 9.0.0 | 9.0.0 | 16 | +| **1.18.2** | 6.5.4 - 9.0.0 | 9.0.0 | 16 | +| **1.19** | 8.3.0 - 9.0.0 | 9.0.0 | 16 | +| **1.19.1** | 8.5.0 - 9.0.0 | 9.0.0 | 16 | +| **1.19.2** | 8.5.1 - 9.0.0 | 9.0.0 | 16 | +| **1.19.3** | 8.7.0 - 9.0.0 | 9.0.0 | 16 | +| **1.19.4** | 8.8.0 - 9.0.0 | 9.0.0 | 16 | ----- @@ -98,8 +98,8 @@ This project provides an API to help Bukkit/Spigot developers use the Minecraft Still not convinced? In addition to all of the above, the CommandAPI also provides: - **Built-in command converter** - Convert other plugin commands into `/execute`-compatible ones - no code required! -- **Compile-time annotation framework** - Don't like writing lots of code with builders? You don't have to! - **Tree-structure command registration** - Like Brigadier's code format? We've got you covered with `CommandTree` +- **Kotlin DSL** - Prefer writing plugins in Kotlin? The CommandAPI has an optional Kotlin DSL just for you - **Powerful suggestion generation** - Generate new suggestions for each argument, or add to existing suggestions - **Safe suggestion generation** - The CommandAPI offers compile-time type safety for specific arguments - **Precise permission support** - Apply permissions to specific arguments - you need perms to even _see_ the argument @@ -345,13 +345,9 @@ This is the current roadmap for the CommandAPI (as of 2nd November 2022): - **Future:** - **Optional arguments** - - One of the most requested features: adding support for optional arguments! This isn't a simple task, but development has begun into looking at how optional arguments can be incorporated into the CommandAPI. - **Argument conflict detection** - The CommandAPI simply uses the Brigadier system under the hood. This system is prone to _argument conflicts_, which is where certain arguments are given priority over other arguments. (For example "hello" and "123" are both valid string arguments, but if you have a command that has a string argument or an integer argument, Brigadier may ignore the integer argument). In this update, the CommandAPI will try to spot potential conflicts and add a warning in the console. The research required for this is also required in order to implement optional arguments (which is not coming out in this release). + The CommandAPI simply uses the Brigadier system under the hood. This system is prone to _argument conflicts_, which is where certain arguments are given priority over other arguments. (For example "hello" and "123" are both valid string arguments, but if you have a command that has a string argument or an integer argument, Brigadier may ignore the integer argument). In this update, the CommandAPI will try to spot potential conflicts and add a warning in the console. **'True' custom arguments and server-side argument implementations** @@ -370,6 +366,87 @@ This is the current roadmap for the CommandAPI (as of 2nd November 2022): + + 9.0.0 + April 2023 + + ⚠️ This version is incompatible with any plugin that used the CommandAPI version 8.X.X or below! (See documentation for more information)
+ New features: + + Kotlin DSL changes: + + Bug fixes: + + Testing and validation: + + Documentation changes: + + Other changes: + + GitHub Actions changes: +