Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- name: Build with Maven
run: mvn -B -f VotingPlugin/pom.xml package

- name: Build standalone vote core
run: mvn -B -f VotingPluginCore/pom.xml clean package

# Only submit dependency snapshot on push (not on pull_request)
- name: Submit Dependency Snapshot
if: github.event_name == 'push'
Expand Down
1 change: 1 addition & 0 deletions VotingPluginCore/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
73 changes: 73 additions & 0 deletions VotingPluginCore/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bencodez</groupId>
<artifactId>votingplugin-vote-core</artifactId>
<version>7.1.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>VotingPlugin Vote Core</name>

<properties>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<!-- Compile the same sources the Bukkit plugin compiles; do not fork vote behavior. -->
<sourceDirectory>${project.basedir}/../VotingPlugin/src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>21</release>
<includes>
<include>com/bencodez/votingplugin/core/vote/**/*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.4</version>
<executions>
<execution>
<id>default-test</id>
<configuration>
<excludes><exclude>**/VoteCoreArtifactTest.java</exclude></excludes>
</configuration>
</execution>
<execution>
<id>packaged-artifact-test</id>
<phase>package</phase>
<goals><goal>test</goal></goals>
<configuration>
<includes><include>**/VoteCoreArtifactTest.java</include></includes>
<reportsDirectory>${project.build.directory}/packaged-artifact-reports</reportsDirectory>
<systemPropertyVariables>
<votingplugin.voteCoreJar>${project.build.directory}/${project.build.finalName}.jar</votingplugin.voteCoreJar>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.12.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.12.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.bencodez.votingplugin.core.vote;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.net.URLClassLoader;
import java.nio.file.Path;
import java.util.List;
import java.util.jar.JarFile;

import org.junit.jupiter.api.Test;

class VoteCoreArtifactTest {
@Test
void packagedVoteCoreContainsOnlyStandaloneSharedClasses() throws Exception {
Path path = Path.of(System.getProperty("votingplugin.voteCoreJar"));
try (JarFile jar = new JarFile(path.toFile());
URLClassLoader loader = new URLClassLoader(new java.net.URL[] { path.toUri().toURL() }, null)) {
List<String> entries = jar.stream().filter(entry -> !entry.isDirectory())
.map(entry -> entry.getName()).toList();
assertTrue(entries.contains("com/bencodez/votingplugin/core/vote/SharedVoteProcessor.class"));
assertTrue(entries.contains("com/bencodez/votingplugin/core/vote/SharedVotePolicy.class"));
assertFalse(entries.contains("plugin.yml"));
for (String entry : entries) {
if (entry.startsWith("META-INF/")) continue;
assertTrue(entry.startsWith("com/bencodez/votingplugin/core/vote/") && entry.endsWith(".class"),
() -> "Unexpected vote core JAR entry: " + entry);
Class.forName(entry.substring(0, entry.length() - 6).replace('/', '.'), false, loader);
}
}
}
}
27 changes: 27 additions & 0 deletions docs/platform-core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Standalone vote core

`VotingPluginCore/pom.xml` builds a JDK 21-only JAR from the same
`com.bencodez.votingplugin.core.vote` Java sources compiled into the existing
`VotingPlugin` plugin. The sources stay in one place so the two artifacts cannot
silently acquire different vote policies. The standalone artifact has no Bukkit,
proxy, or AdvancedCore compile dependency.

```sh
mvn -B -f VotingPlugin/pom.xml clean package
mvn -B -f VotingPluginCore/pom.xml clean package
```

The first command remains the Bukkit/proxy plugin build. The second produces
`VotingPluginCore/target/votingplugin-vote-core-7.1.2-SNAPSHOT.jar`; its package
test checks that only shared vote classes are present and that they load without
platform libraries. CI builds both artifacts. Keep the version in both POMs
aligned when changing the plugin version.

This JAR is a library boundary for future platform adapters. It contains no
Fabric or NeoForge entry point, vote ingress, storage adapter, or reward executor.
The Bukkit listener still owns its existing vote and reward behavior. In
particular, `SharedVoteProcessor` is not the production Bukkit path; its
prepared-plan and keyed-delivery contracts must not be mistaken for guarantees
of the existing reward system. Future platform work must preserve live reward
configuration behavior and verify the native adapter against current code and
tests before changing production ownership.
Loading