Skip to content

Commit

Permalink
Fix BuildConstants
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Feb 6, 2024
1 parent 7b5f286 commit 787f4fd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'application'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.6.1'
id "com.github.gmazzo.buildconfig" version "5.2.0"
}

def legacyVersion = "1.7.6"
Expand Down Expand Up @@ -32,16 +33,14 @@ dependencies {
implementation group: 'commons-io', name: 'commons-io', version: '2.8.0'
}

task generateSources(type: Copy) {
from 'src/replaceme/java/net/fabricmc/meta/web/models/MetaServerInfo.java'
into "$buildDir/generated-src"
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
'VERSION': project.version
])
buildConfig {
className("BuildConstants")
packageName("net.legacyfabric.meta")

useJavaOutput()

buildConfigField(String.class, "VERSION", "$project.version")
}
// the following lines are important to wire the task in with the compileJava task
compileJava.source "$buildDir/generated-src"
compileJava.dependsOn generateSources

jar {
manifest {
Expand All @@ -62,7 +61,7 @@ tasks.withType(JavaCompile).configureEach {
}

license {
matching(includes: ['**/legacyfabric/**']) {
matching(excludes: ['**/BuildConstants.java'], includes: ['**/legacyfabric/**']) {
header = file("LF-ONLY-HEADER")
}
matching(includes: ['**/VersionDatabase.java', '**/MinecraftLauncherMeta.java','**/EndpointsV2.java',
Expand All @@ -72,6 +71,7 @@ license {
}
header file('HEADER')
include '**/*.java'
exclude '**/BuildConstants.java'
}

publishing {
Expand Down
11 changes: 11 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal {
content {
excludeGroup("org.apache.logging.log4j")
}
}
}
}

rootProject.name = 'legacy-meta'

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.fabricmc.meta.web.EndpointsV2;
import net.fabricmc.meta.web.WebServer;

import net.legacyfabric.meta.web.models.MetaServerInfo;
import net.legacyfabric.meta.BuildConstants;
import org.apache.commons.io.IOUtils;

import java.io.IOException;
Expand All @@ -32,7 +32,7 @@

public class LegacyEndpointsV2 extends EndpointsV2 {
public static void setup() {
WebServer.jsonGet("/v2/meta", () -> MetaServerInfo.INSTANCE);
WebServer.jsonGet("/v2/meta", () -> BuildConstants.VERSION);

LegacyWebServer.stringGet("/v2/manifest/:game_version", LegacyEndpointsV2::getVersionManifest);
WebServer.jsonGet("/v2/versions/manifest", context -> FabricMeta.database.launcherMeta);
Expand Down

This file was deleted.

0 comments on commit 787f4fd

Please sign in to comment.