Improve build process

This commit is contained in:
md_5 2020-04-22 11:50:23 +10:00
parent a8ec1d60f3
commit e1335932a7
2 changed files with 21 additions and 11 deletions

28
pom.xml
View File

@ -14,9 +14,6 @@
<api.version>unknown</api.version> <api.version>unknown</api.version>
<minecraft.version>1.15.2</minecraft.version> <minecraft.version>1.15.2</minecraft.version>
<minecraft_version>1_15_R1</minecraft_version> <minecraft_version>1_15_R1</minecraft_version>
<buildtag.prefix>git-Bukkit-</buildtag.prefix>
<buildtag.suffix></buildtag.suffix>
<maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
</properties> </properties>
@ -106,7 +103,7 @@
<plugin> <plugin>
<groupId>net.md-5</groupId> <groupId>net.md-5</groupId>
<artifactId>scriptus</artifactId> <artifactId>scriptus</artifactId>
<version>0.3.2</version> <version>0.4.1</version>
<configuration> <configuration>
<format>git-Bukkit-%s</format> <format>git-Bukkit-%s</format>
</configuration> </configuration>
@ -122,14 +119,17 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>2.4</version> <version>3.2.0</version>
<configuration> <configuration>
<archive> <archive>
<manifest>
<addDefaultEntries>false</addDefaultEntries>
</manifest>
<manifestEntries> <manifestEntries>
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class> <Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
<Implementation-Title>CraftBukkit</Implementation-Title> <Implementation-Title>CraftBukkit</Implementation-Title>
<Implementation-Version>${describe}</Implementation-Version> <Implementation-Version>${describe}</Implementation-Version>
<Implementation-Vendor>${maven.build.timestamp}</Implementation-Vendor> <Implementation-Vendor>${project.build.outputTimestamp}</Implementation-Vendor>
<Specification-Title>Bukkit</Specification-Title> <Specification-Title>Bukkit</Specification-Title>
<Specification-Version>${api.version}</Specification-Version> <Specification-Version>${api.version}</Specification-Version>
<Specification-Vendor>Bukkit Team</Specification-Vendor> <Specification-Vendor>Bukkit Team</Specification-Vendor>
@ -160,7 +160,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version> <version>3.2.3</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -169,6 +169,16 @@
</goals> </goals>
<configuration> <configuration>
<createSourcesJar>${shadeSourcesJar}</createSourcesJar> <createSourcesJar>${shadeSourcesJar}</createSourcesJar>
<filters>
<filter>
<artifact>org.spigotmc:minecraft-server</artifact>
<excludes>
<exclude>com/google/common/**</exclude>
<exclude>com/google/gson/**</exclude>
<exclude>com/google/thirdparty/**</exclude>
</excludes>
</filter>
</filters>
<relocations> <relocations>
<!-- Cannot be relocated as it breaks translation property keys --> <!-- Cannot be relocated as it breaks translation property keys -->
<!-- <!--
@ -271,7 +281,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version> <version>3.1.1</version>
<executions> <executions>
<execution> <execution>
<phase>process-classes</phase> <phase>process-classes</phase>
@ -288,7 +298,7 @@
<dependency> <dependency>
<groupId>com.puppycrawl.tools</groupId> <groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId> <artifactId>checkstyle</artifactId>
<version>8.29</version> <version>8.31</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>

View File

@ -178,10 +178,10 @@ public class Main {
} }
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
Date buildDate = new SimpleDateFormat("yyyyMMdd-HHmm").parse(Main.class.getPackage().getImplementationVendor()); Date buildDate = new Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L);
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -14); deadline.add(Calendar.DAY_OF_YEAR, -21);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***"); System.err.println("*** Error, this build is outdated ***");
System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");