Skip to content

Commit

Permalink
feat(everything): release 4.0 (MockBukkit#1163)
Browse files Browse the repository at this point in the history
Co-authored-by: Thorinwasher <37477983+Thorinwasher@users.noreply.github.com>
Co-authored-by: Thorinwasher <ragnarlol96@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: J3fftw <44972470+J3fftw1@users.noreply.github.com>
Co-authored-by: thelooter <evekolb2204@gmail.com>
Co-authored-by: Nirbose <62440475+Nirbose@users.noreply.github.com>
Co-authored-by: 4everTheOne <5434488+4everTheOne@users.noreply.github.com>
Co-authored-by: Trav <the.only.t.craft@gmail.com>
Co-authored-by: Afonso <5434488+4everTheOne@users.noreply.github.com>
Co-authored-by: Pierce Thompson <insprill@gmail.com>
Co-authored-by: Pierce Thompson <52843537+Insprill@users.noreply.github.com>
Co-authored-by: Hjalmar Gunnarsson <37477983+Thorinwasher@users.noreply.github.com>
  • Loading branch information
10 people authored Nov 9, 2024
1 parent 219186b commit 9897ab0
Show file tree
Hide file tree
Showing 858 changed files with 27,816 additions and 16,606 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and test with Gradle

on:
pull_request:
branches: [ 4.0* ]
push:
branches: [ "4.0" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'

- name: Restore caches
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', 'gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*' ,'gradle-wrapper.properties') }}
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -x test
- name: Run unit tests
run: ./gradlew test
30 changes: 5 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,11 @@ jobs:
- name: Run unit tests
run: ./gradlew test

- name: Store Private key
uses: DamianReeves/write-file-action@v1.3
if: ${{ github.ref_type == 'tag' }}
with:
path: private.key
contents: ${{ secrets.PRIV_KEY }}
write-mode: overwrite

- name: Publish
if: ${{ github.ref_type == 'tag' }}
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache -Pmockbukkit.version=$(echo ${{ github.ref_name }} | sed -e 's:v::')
env:
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGN_KEY: ${{ secrets.PRIV_KEY_PASS }}
run: |
mkdir -p $HOME/.gnupg
echo use-agent >> $HOME/.gnupg/gpg.conf
echo pinentry-mode loopback >> $HOME/.gnupg/gpg.conf
echo allow-loopback-pinentry >> $HOME/.gnupg/gpg-agent.conf
gpg --batch --import private.key
gpg --batch --export-secret-keys --passphrase $SIGN_KEY "Sebastiaan de Schaetzen <sebastiaan.de.schaetzen@gmail.com>" > private.gpg
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository \
-Pmockbukkit.version=$(echo ${{ github.ref_name }} | sed -e 's:v::') \
-PossrhUsername=Iu0XBMzI \
-PossrhPassword=$OSSRH_PASSWORD \
-Psigning.secretKeyRingFile=private.gpg \
-Psigning.keyId=${{ secrets.PRIV_KEY_ID }} \
-Psigning.password=$SIGN_KEY
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.KEY_PASS }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.PRIV_KEY }}
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
<a href="https://github.com/MockBukkit/MockBukkit/actions/">
<img alt="Build Status" src="https://github.com/MockBukkit/MockBukkit/actions/workflows/publish.yml/badge.svg" />
</a>
<a href="https://mockbukkit.readthedocs.io/en/v1.21/?badge=v1.21">
<img alt="Documentation Status" src="https://readthedocs.org/projects/mockbukkit/badge/?version=v1.21" />
</a>
<a href="https://search.maven.org/search?q=MockBukkit">
<img alt="Maven Central" src="https://img.shields.io/maven-central/v/com.github.seeseemelk/MockBukkit-v1.21?color=1bcc94&logo=apache-maven" />
<img alt="Maven Central" src="https://img.shields.io/maven-central/v/org.mockbukkit.mockbukkit/mockbukkit-v1.21?color=1bcc94&logo=apache-maven" />
</a>
<a href="https://javadoc.io/doc/com.github.seeseemelk/MockBukkit-v1.21">
<img alt="Javadocs" src="https://javadoc.io/badge2/com.github.seeseemelk/MockBukkit-v1.21/javadoc.svg" />
<a href="https://javadoc.io/doc/org.mockbukkit.mockbukkit/mockbukkit-v1.21">
<img alt="Javadocs" src="https://javadoc.io/badge2/org.mockbukkit.mockbukkit/mockbukkit-v1.21/javadoc.svg" />
</a>
<a href="https://sonarcloud.io/project/issues?resolved=false&types=CODE_SMELL&id=MockBukkit_MockBukkit">
<img alt="Code Smells" src="https://sonarcloud.io/api/project_badges/measure?project=MockBukkit_MockBukkit&metric=code_smells">
Expand Down Expand Up @@ -51,7 +48,7 @@ MockBukkit can easily be included in your project using either Maven or gradle.
> [!TIP]
> Currently, the newest version available is
>
> [![ALTERNATE-TEXT](https://img.shields.io/maven-central/v/com.github.seeseemelk/MockBukkit-v1.21?color=1bcc94&logo=apache-maven)](https://search.maven.org/search?q=MockBukkit)
> [![ALTERNATE-TEXT](https://img.shields.io/maven-central/v/org.mockbukkit.mockbukkit/mockbukkit-v1.21?color=1bcc94&logo=apache-maven)](https://search.maven.org/search?q=MockBukkit)

> Note: The Breaking Changes intended for 3.0 were already made in 2.145.1. Due to an Error it didn't get properly tagged
Expand All @@ -70,7 +67,7 @@ repositories {
}
dependencies {
testImplementation 'com.github.seeseemelk:MockBukkit-v1.21:[version]'
testImplementation 'org.mockbukkit.mockbukkit:mockbukkit-v1.21:[version]'
}
```

Expand Down Expand Up @@ -113,8 +110,8 @@ MockBukkit can easily be included in Maven using the default Maven Central and P

<dependencies>
<dependency>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.21</artifactId>
<groupId>org.mockbukkit.mockbukkit</groupId>
<artifactId>mockbukkit-v1.21</artifactId>
<version>[version]</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -191,7 +188,7 @@ This is useful when the plugin you are testing may be looking at other loaded pl
The following piece of code creates a placeholder plugin that extends JavaPlugin.

```java
MockPlugin plugin = MockBukkit.createMockPlugin()
MockPlugin plugin = MockBukkit.createMockPlugin();
```

### Mock Players
Expand Down Expand Up @@ -270,7 +267,7 @@ If you want to see some projects that are using MockBukkit right now, feel free

You can also have a look at our documentation where we outline various examples and tricks on how to use MockBukkit
already:
https://mockbukkit.readthedocs.io/en/latest/index.html
https://docs.mockbukkit.org

## :gift_heart: Sponsors

Expand Down
113 changes: 55 additions & 58 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import java.io.ByteArrayOutputStream
import com.vanniktech.maven.publish.SonatypeHost

plugins {
id("java-library")
id("jacoco")
id("maven-publish")
id("signing")
id("com.vanniktech.maven.publish") version "0.29.0"
id("net.kyori.blossom") version "2.1.0"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}

group = "com.github.seeseemelk"
group = "org.mockbukkit.mockbukkit"
version = this.getFullVersion()

repositories {
Expand All @@ -30,6 +29,7 @@ dependencies {
implementation("net.kyori:adventure-platform-bungeecord:4.3.4")
implementation("org.jetbrains:annotations:26.0.0")
implementation("net.bytebuddy:byte-buddy:1.15.4")
implementation("org.hamcrest:hamcrest:2.2")

// LibraryLoader dependencies
implementation("org.apache.maven:maven-resolver-provider:3.8.5")
Expand All @@ -41,14 +41,13 @@ tasks {
jar {
manifest {
attributes(
"Automatic-Module-Name" to "be.seeseemelk.mockbukkit"
"Automatic-Module-Name" to "org.mockbukkit.mockbukkit"
)
}
}

java {
withSourcesJar()
withJavadocJar()
}

javadoc {
Expand Down Expand Up @@ -121,61 +120,59 @@ java {
}
}

signing {
isRequired = !isFork() && isAction()
sign(publishing.publications)
}

nexusPublishing {
this.repositories {
sonatype {
username.set(findProperty("ossrhUsername") as String?)
password.set(findProperty("ossrhPassword") as String?)
mavenPublishing {
coordinates(project.group.toString(), "mockbukkit-v${property("paper.api.version")}", project.version.toString())

pom {
description.set("MockBukkit is a mocking framework for bukkit to allow the easy unit testing of Bukkit plugins.")
name.set("MockBukkit-v${property("paper.api.version")}")
url.set("https://github.com/MockBukkit/MockBukkit")
licenses {
license {
name.set("MIT License")
url.set("https://github.com/MockBukkit/MockBukkit/blob/v${property("paper.api.version")}/LICENSE")
}
}
}
}

publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "MockBukkit-v${property("paper.api.version")}"
from(components.getByName("java"))
pom {
name.set("MockBukkit-v${property("paper.api.version")}")
description.set("MockBukkit is a mocking framework for bukkit to allow the easy unit testing of Bukkit plugins.")
url.set("https://github.com/MockBukkit/MockBukkit")
scm {
connection.set("scm:git:git://github.com/MockBukkit/MockBukkit.git")
developerConnection.set("scm:git:ssh://github.com:MockBukkit/MockBukkit.git")
url.set("https://github.com/MockBukkit/MockBukkit/tree/v${property("paper.api.version")}")
}
licenses {
license {
name.set("MIT License")
url.set("https://github.com/MockBukkit/MockBukkit/blob/v${property("paper.api.version")}/LICENSE")
}
}
developers {
developer {
id.set("seeseemelk")
name.set("Sebastiaan de Schaetzen")
email.set("sebastiaan.de.schaetzen@gmail.com")
}
developer {
id.set("thebusybiscuit")
name.set("TheBusyBiscuit")
}
developer {
id.set("insprill")
name.set("Pierce Thompson")
}
developer {
id.set("thelooter")
name.set("Eve Kolb")
}
}
developers {
developer {
id.set("seeseemelk")
name.set("Sebastiaan de Schaetzen")
email.set("sebastiaan.de.schaetzen@gmail.com")
}
developer {
id.set("thebusybiscuit")
name.set("TheBusyBiscuit")
}
developer {
id.set("insprill")
name.set("Pierce Thompson")
email.set("pierce@insprill.net")
}
developer {
id.set("thelooter")
name.set("Eve Kolb")
email.set("me@thelooter.de")
}
developer{
id.set("thorinwasher")
name.set("Hjalmar Gunnarsson")
email.set("officialhjalmar.gunnarsson@outlook.com")
}
developer{
id.set("4everTheOne")
name.set("Afonso Oliveira")
}
}
scm {
connection.set("scm:git:git://github.com/MockBukkit/MockBukkit.git")
developerConnection.set("scm:git:ssh://github.com:MockBukkit/MockBukkit.git")
url.set("https://github.com/MockBukkit/MockBukkit/tree/v${property("paper.api.version")}")
}
}
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
// No key available to sign with for maven local
if (!project.gradle.startParameter.taskNames.any { it.contains("publishToMavenLocal") }) {
signAllPublications()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package be.seeseemelk.testplugin;
package org.mockbukkit.testplugin;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
Expand Down
2 changes: 1 addition & 1 deletion extra/TestPlugin/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: TestPlugin
main: be.seeseemelk.testplugin.TestPlugin
main: org.mockbukkit.testplugin.TestPlugin
version: 0.1.0
api-version: 1.15
author: Thorinwasher
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package be.seeseemelk.mockbukkit;
package org.mockbukkit.mockbukkit;

public class BuildParameters
{
Expand Down
35 changes: 0 additions & 35 deletions src/main/java/be/seeseemelk/mockbukkit/ThreadAccessException.java

This file was deleted.

Loading

0 comments on commit 9897ab0

Please sign in to comment.