Move deprecated modules, create own maven BOM for the deprecated modules. (#2171)

* Move deprecated modules to a sub directory.
Remove deprecated modules from the default maven pom
Create a new "fabric-api-legacy" bom with the deprecated modules.

* Fix main "fabric" project not beign a dep for the legacy bom.

* rename artifact to fabric-api-deprecated

* Spotless

* Use the latest version of spotless.
This commit is contained in:
modmuss50 2022-05-01 15:44:16 +01:00 committed by GitHub
parent 6da09390b1
commit df3654b364
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 214 additions and 151 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
* text eol=lf

View file

@ -4,7 +4,7 @@ jobs:
build: build:
strategy: strategy:
matrix: matrix:
java: [17-jdk] java: [17-jdk, 18-jdk]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: container:
image: eclipse-temurin:${{ matrix.java }} image: eclipse-temurin:${{ matrix.java }}

View file

@ -8,7 +8,7 @@ jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: container:
image: eclipse-temurin:17-jdk image: eclipse-temurin:18-jdk
options: --user root options: --user root
steps: steps:
- run: apt update && apt install git -y && git --version - run: apt update && apt install git -y && git --version

27
HEADER
View file

@ -1,13 +1,16 @@
Copyright (c) 2016, 2017, 2018, 2019 FabricMC /*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -9,8 +9,8 @@ plugins {
id "eclipse" id "eclipse"
id "idea" id "idea"
id "maven-publish" id "maven-publish"
id "fabric-loom" version "0.11.33" apply false id "fabric-loom" version "0.12.19" apply false
id "org.cadixdev.licenser" version "0.6.1" id "com.diffplug.spotless" version "6.5.1"
id "org.ajoberstar.grgit" version "3.1.0" id "org.ajoberstar.grgit" version "3.1.0"
id "com.matthewprenger.cursegradle" version "1.4.0" id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "1.1.0" id "com.modrinth.minotaur" version "1.1.0"
@ -89,19 +89,42 @@ def moduleDependencies(project, List<String> depNames) {
} }
allprojects { allprojects {
group = "net.fabricmc.fabric-api"
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
if (signingEnabled) {
remoteSign {
requestUrl = ENV.SIGNING_SERVER
pgpAuthKey = ENV.SIGNING_PGP_KEY
jarAuthKey = ENV.SIGNING_JAR_KEY
afterEvaluate {
// PGP sign all maven publications.
sign publishing.publications.mavenJava
}
}
}
publishing {
setupRepositories(repositories)
}
if (it.name == "deprecated") return
apply plugin: "java-library" apply plugin: "java-library"
apply plugin: "checkstyle" apply plugin: "checkstyle"
apply plugin: "maven-publish" apply plugin: "maven-publish"
apply plugin: "fabric-loom" apply plugin: "fabric-loom"
apply plugin: "org.cadixdev.licenser" apply plugin: "com.diffplug.spotless"
apply plugin: "me.modmuss50.remotesign" apply plugin: "me.modmuss50.remotesign"
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
it.options.release = 17 it.options.release = 17
} }
group = "net.fabricmc.fabric-api"
sourceSets { sourceSets {
testmod { testmod {
compileClasspath += main.compileClasspath compileClasspath += main.compileClasspath
@ -138,10 +161,6 @@ allprojects {
shareRemapCaches = true shareRemapCaches = true
} }
repositories {
mavenLocal()
}
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
@ -150,9 +169,10 @@ allprojects {
} }
} }
license { spotless {
header rootProject.file("HEADER") java {
include "**/*.java" licenseHeaderFile(rootProject.file("HEADER"))
}
} }
java { java {
@ -169,22 +189,9 @@ allprojects {
reproducibleFileOrder = true reproducibleFileOrder = true
} }
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
if (signingEnabled) { if (signingEnabled) {
remoteSign { remoteSign {
requestUrl = ENV.SIGNING_SERVER
pgpAuthKey = ENV.SIGNING_PGP_KEY
jarAuthKey = ENV.SIGNING_JAR_KEY
sign remapJar sign remapJar
afterEvaluate {
// PGP sign all maven publications.
sign publishing.publications.mavenJava
}
} }
} }
@ -259,6 +266,8 @@ loom {
test.dependsOn runGametest test.dependsOn runGametest
subprojects { subprojects {
if (it.name == "deprecated") return
dependencies { dependencies {
testmodImplementation sourceSets.main.output testmodImplementation sourceSets.main.output
@ -286,8 +295,6 @@ subprojects {
} }
} }
} }
setupRepositories(repositories)
} }
// We manually handle the pom generation // We manually handle the pom generation
@ -332,6 +339,9 @@ publishing {
pom.withXml { pom.withXml {
def depsNode = asNode().appendNode("dependencies") def depsNode = asNode().appendNode("dependencies")
subprojects.each { subprojects.each {
// Dont depend on the deprecated modules in the main artifact.
if (it.path.startsWith(":deprecated")) return
def depNode = depsNode.appendNode("dependency") def depNode = depsNode.appendNode("dependency")
depNode.appendNode("groupId", it.group) depNode.appendNode("groupId", it.group)
depNode.appendNode("artifactId", it.name) depNode.appendNode("artifactId", it.name)
@ -341,8 +351,6 @@ publishing {
} }
} }
} }
setupRepositories(repositories)
} }
// Required until the deprecation is removed. Fabric API's main jar that is published to maven does not contain sub modules. // Required until the deprecation is removed. Fabric API's main jar that is published to maven does not contain sub modules.
@ -364,9 +372,11 @@ void setupRepositories(RepositoryHandler repositories) {
} }
} }
task licenseFormatAll subprojects.each {
subprojects { p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat") } if (it.name == "deprecated") return
subprojects.each { remapJar.dependsOn("${it.path}:remapJar") }
remapJar.dependsOn("${it.path}:remapJar")
}
sourceSets { sourceSets {
testmod testmod
@ -381,9 +391,11 @@ def devOnlyModules = [
dependencies { dependencies {
afterEvaluate { afterEvaluate {
subprojects.each { subprojects.each {
api project(path: ":${it.name}", configuration: "namedElements") if (it.name == "deprecated") return
testmodImplementation project("${it.name}:").sourceSets.testmod.output api project(path: "${it.path}", configuration: "namedElements")
testmodImplementation project("${it.path}:").sourceSets.testmod.output
} }
} }
} }
@ -391,10 +403,10 @@ dependencies {
remapJar { remapJar {
afterEvaluate { afterEvaluate {
subprojects.each { subprojects.each {
if (it.name in devOnlyModules) return if (it.name in devOnlyModules || it.name == "deprecated") return
// Include the signed or none signed jar from the sub project. // Include the signed or none signed jar from the sub project.
nestedJars.from project("${it.name}:").tasks.getByName(signingEnabled ? "signRemapJar" : "remapJar") nestedJars.from project("${it.path}").tasks.getByName(signingEnabled ? "signRemapJar" : "remapJar")
} }
} }
} }

38
deprecated/build.gradle Normal file
View file

@ -0,0 +1,38 @@
/**
* This project generates a maven bill of materials (BOM) that includes the deprecated modules, alongside the main project.
*/
apply plugin: "maven-publish"
version = rootProject.version
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'fabric-api-deprecated'
pom.withXml {
def depsNode = asNode().appendNode("dependencies")
allprojects.each {
if (it.name == "deprecated") return // Dont depend on yourself :)
// Depend on all of the deprecated projects
if (!it.path.startsWith(":deprecated")) return
def depNode = depsNode.appendNode("dependency")
depNode.appendNode("groupId", it.group)
depNode.appendNode("artifactId", it.name)
depNode.appendNode("version", it.version)
depNode.appendNode("scope", "compile")
}
// Depend on the main project.
def depNode = depsNode.appendNode("dependency")
depNode.appendNode("groupId", group)
depNode.appendNode("artifactId", "fabric-api")
depNode.appendNode("version", version)
depNode.appendNode("scope", "compile")
}
}
}
}

View file

@ -6,6 +6,6 @@ moduleDependencies(project, [
]) ])
dependencies { dependencies {
testmodImplementation project(path: ':fabric-renderer-registries-v1', configuration: 'namedElements') testmodImplementation project(path: ':fabric-rendering-v1', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-resource-loader-v0', configuration: 'namedElements') testmodImplementation project(path: ':fabric-resource-loader-v0', configuration: 'namedElements')
} }

View file

@ -22,7 +22,7 @@ import net.minecraft.util.Identifier;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import net.fabricmc.fabric.api.client.rendereregistry.v1.LivingEntityFeatureRendererRegistrationCallback; import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRendererRegistrationCallback;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
public class ModelTestModClient implements ClientModInitializer { public class ModelTestModClient implements ClientModInitializer {

View file

@ -8,6 +8,8 @@ import groovy.json.JsonSlurper
*/ */
subprojects { subprojects {
if (it.name == "deprecated") return
// Create the task // Create the task
task validateModules(type: ValidateModuleTask) task validateModules(type: ValidateModuleTask)
} }
@ -52,10 +54,14 @@ class ValidateModuleTask extends DefaultTask {
switch (moduleLifecycle) { switch (moduleLifecycle) {
case "stable": case "stable":
case "experimental": case "experimental":
break
case "deprecated": case "deprecated":
break; if (!project.path.startsWith(":deprecated")) {
throw new GradleException("Deprecated module ${project} must be in the deprecated sub directory.")
}
break
default: default:
throw new GradleException("Module ${project} has an invalid module lifecycle ${json.custom.get('fabric-api:module-lifecycle')}"); throw new GradleException("Module ${project} has an invalid module lifecycle ${json.custom.get('fabric-api:module-lifecycle')}")
} }
} }
} }

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

178
gradlew.bat vendored
View file

@ -1,89 +1,89 @@
@rem @rem
@rem Copyright 2015 the original author or authors. @rem Copyright 2015 the original author or authors.
@rem @rem
@rem Licensed under the Apache License, Version 2.0 (the "License"); @rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License. @rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at @rem You may obtain a copy of the License at
@rem @rem
@rem https://www.apache.org/licenses/LICENSE-2.0 @rem https://www.apache.org/licenses/LICENSE-2.0
@rem @rem
@rem Unless required by applicable law or agreed to in writing, software @rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS, @rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter. @rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:findJavaFromJavaHome :findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if "%ERRORLEVEL%"=="0" goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1 exit /b 1
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal
:omega :omega

View file

@ -16,35 +16,29 @@ include 'fabric-api-base'
include 'fabric-api-lookup-api-v1' include 'fabric-api-lookup-api-v1'
include 'fabric-biome-api-v1' include 'fabric-biome-api-v1'
include 'fabric-blockrenderlayer-v1' include 'fabric-blockrenderlayer-v1'
include 'fabric-commands-v0'
include 'fabric-command-api-v1' include 'fabric-command-api-v1'
include 'fabric-containers-v0'
include 'fabric-content-registries-v0' include 'fabric-content-registries-v0'
include 'fabric-crash-report-info-v1' include 'fabric-crash-report-info-v1'
include 'fabric-data-generation-api-v1' include 'fabric-data-generation-api-v1'
include 'fabric-dimensions-v1' include 'fabric-dimensions-v1'
include 'fabric-entity-events-v1' include 'fabric-entity-events-v1'
include 'fabric-events-interaction-v0' include 'fabric-events-interaction-v0'
include 'fabric-events-lifecycle-v0'
include 'fabric-game-rule-api-v1' include 'fabric-game-rule-api-v1'
include 'fabric-gametest-api-v1' include 'fabric-gametest-api-v1'
include 'fabric-item-api-v1' include 'fabric-item-api-v1'
include 'fabric-item-groups-v0' include 'fabric-item-groups-v0'
include 'fabric-keybindings-v0'
include 'fabric-key-binding-api-v1' include 'fabric-key-binding-api-v1'
include 'fabric-lifecycle-events-v1' include 'fabric-lifecycle-events-v1'
include 'fabric-loot-tables-v1' include 'fabric-loot-tables-v1'
include 'fabric-mining-level-api-v1' include 'fabric-mining-level-api-v1'
include 'fabric-models-v0' include 'fabric-models-v0'
include 'fabric-networking-v0'
include 'fabric-networking-api-v1' include 'fabric-networking-api-v1'
include 'fabric-object-builder-api-v1' include 'fabric-object-builder-api-v1'
include 'fabric-particles-v1' include 'fabric-particles-v1'
include 'fabric-registry-sync-v0' include 'fabric-registry-sync-v0'
include 'fabric-renderer-api-v1' include 'fabric-renderer-api-v1'
include 'fabric-renderer-indigo' include 'fabric-renderer-indigo'
include 'fabric-renderer-registries-v1'
include 'fabric-rendering-v0'
include 'fabric-rendering-v1' include 'fabric-rendering-v1'
include 'fabric-rendering-data-attachment-v1' include 'fabric-rendering-data-attachment-v1'
include 'fabric-rendering-fluids-v1' include 'fabric-rendering-fluids-v1'
@ -56,3 +50,12 @@ include 'fabric-textures-v0'
include 'fabric-transfer-api-v1' include 'fabric-transfer-api-v1'
include 'fabric-convention-tags-v1' include 'fabric-convention-tags-v1'
include 'fabric-transitive-access-wideners-v1' include 'fabric-transitive-access-wideners-v1'
include 'deprecated'
include 'deprecated:fabric-commands-v0'
include 'deprecated:fabric-containers-v0'
include 'deprecated:fabric-events-lifecycle-v0'
include 'deprecated:fabric-keybindings-v0'
include 'deprecated:fabric-networking-v0'
include 'deprecated:fabric-renderer-registries-v1'
include 'deprecated:fabric-rendering-v0'