Skip to content

Commit

Permalink
Finagle with the poms to make special source cooperate
Browse files Browse the repository at this point in the history
Special source wasn't remapping createCommandSourceStack() in ServerPlayerOpWrapper because it didn't know it extended ServerPlayer (See SpecialSource#83). This was fixed by shading 1_19-common into 1_19 and 1_19_1.

Maven was then complaining about 1_19-common and 1_19-common-mojang-mapped classes being included multiple times, so that was fixed by filtering them out of the shaded version of nms-dependency.
  • Loading branch information
willkroboth committed Aug 13, 2022
1 parent d6d33e3 commit 45f1243
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# build files
/ConfigCommands-core/target/
/ConfigCommands-nms/ConfigCommands-1_16_5/target/
/ConfigCommands-nms/ConfigCommands-1_17/target/
/ConfigCommands-nms/ConfigCommands-1_18/target/
/ConfigCommands-nms/ConfigCommands-1_18_2/target/
/ConfigCommands-nms/ConfigCommands-1_19-common/target/
/ConfigCommands-nms/ConfigCommands-1_19/target/
/ConfigCommands-nms/ConfigCommands-1_19/dependency-reduced-pom.xml
/ConfigCommands-nms/ConfigCommands-1_19_1/target/
/ConfigCommands-nms/ConfigCommands-1_19_1/dependency-reduced-pom.xml
/ConfigCommands-nms/ConfigCommands-nms-dependency/target/
/ConfigCommands-nms/ConfigCommands-nms-dependency/dependency-reduced-pom.xml
/ConfigCommands-plugin/target/
/ConfigCommands-plugin/dependency-reduced-pom.xml

# IntelliJ project configuration files
/.idea/
/ConfigCommands.iml
/ConfigCommands-nms/ConfigCommands-1_16_5/ConfigCommands-1_16_5.iml
Expand Down
19 changes: 18 additions & 1 deletion ConfigCommands-nms/ConfigCommands-1_19/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,29 @@
<artifactId>ConfigCommands-1_19-common</artifactId>
<version>${project.version}</version>
<classifier>mojang-mapped</classifier>
<scope>provided</scope>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Shade in 1_19-common -->
<!-- This helps specialsource recognize that ServerPlayerOpWrapper extends ServerPlayer -->
<!-- The reference to different versions of 1_19-common will be resolved in nms-dependency -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Remap classes -->
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
Expand Down
19 changes: 18 additions & 1 deletion ConfigCommands-nms/ConfigCommands-1_19_1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,29 @@
<artifactId>ConfigCommands-1_19-common</artifactId>
<version>${project.version}</version>
<classifier>mojang-mapped</classifier>
<scope>provided</scope>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Shade in 1_19-common -->
<!-- This helps specialsource recognize that ServerPlayerOpWrapper extends ServerPlayer -->
<!-- The reference to different versions of 1_19-common will be resolved in nms-dependency -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Remap classes -->
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
Expand Down
44 changes: 43 additions & 1 deletion ConfigCommands-nms/ConfigCommands-nms-dependency/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
</parent>

<artifactId>ConfigCommands-nms-dependency</artifactId>
<packaging>pom</packaging>

<dependencies>
<!-- Version implementations -->
Expand All @@ -30,6 +29,13 @@
<artifactId>ConfigCommands-1_19-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>me.willkroboth</groupId>
<artifactId>ConfigCommands-1_19-common</artifactId>
<version>${project.version}</version>
<classifier>mojang-mapped</classifier>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>me.willkroboth</groupId>
Expand All @@ -54,4 +60,40 @@
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
<!-- remove duplicate references to 1_19_common -->
<filters>
<filter>
<artifact>${project.groupId}:ConfigCommands-1_19</artifact>
<excludes>
<exclude>me/willkroboth/ConfigCommands/NMS/V1_19_common/**</exclude>
</excludes>
</filter>
<filter>
<artifact>${project.groupId}:ConfigCommands-1_19_1</artifact>
<excludes>
<exclude>me/willkroboth/ConfigCommands/NMS/V1_19_common/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion ConfigCommands-nms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<groupId>me.willkroboth</groupId>
<artifactId>ConfigCommands-core</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/dev.jorel/commandapi-core -->
Expand Down
3 changes: 1 addition & 2 deletions ConfigCommands-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<groupId>me.willkroboth</groupId>
<artifactId>ConfigCommands-nms-dependency</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>

<!-- https://mvnrepository.com/artifact/dev.jorel/commandapi-core -->
Expand Down Expand Up @@ -61,7 +60,7 @@
<filter>
<artifact>me.willkroboth:ConfigCommands-core</artifact>
<excludes>
<exclude>me/willkroboth/ConfigCommands/VersionHandler**</exclude>
<exclude>me/willkroboth/ConfigCommands/NMS/VersionHandler**</exclude>
</excludes>
</filter>
</filters>
Expand Down

1 comment on commit 45f1243

@willkroboth
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.