From 655c8d6a5c5fcafcd43790181793232f1ea26494 Mon Sep 17 00:00:00 2001
From: liach <7806504+liach@users.noreply.github.com>
Date: Sun, 5 Apr 2020 09:07:27 -0500
Subject: [PATCH] Fix javadoc jar generation and javadoc building (#550)

* Update build.gradle for testing

Signed-off-by: liach <liach@users.noreply.github.com>

* Fix javadocs

Signed-off-by: liach <liach@users.noreply.github.com>

Co-authored-by: liach <liach@users.noreply.github.com>
---
 build.gradle                                  | 69 ++++++++++---------
 .../net/fabricmc/fabric/api/util/NbtType.java |  6 +-
 .../fabric/api/dimension/v1/EntityPlacer.java |  2 +-
 .../particle/v1/FabricSpriteProvider.java     |  4 +-
 .../api/particle/v1/FabricParticleTypes.java  | 14 ++--
 .../api/renderer/v1/material/BlendMode.java   |  4 +-
 .../renderer/v1/material/RenderMaterial.java  |  7 +-
 .../api/renderer/v1/mesh/MutableQuadView.java |  2 +-
 .../renderer/v1/model/FabricBakedModel.java   |  2 +-
 .../render/fluid/v1/FluidRenderHandler.java   |  2 +-
 10 files changed, 60 insertions(+), 52 deletions(-)

diff --git a/build.gradle b/build.gradle
index 0bd88f10e..be6595f7c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -31,8 +31,8 @@ def getSubprojectVersion(project, version) {
 	}
 }
 
-def getBranch(){
-	if(System.getenv().GIT_BRANCH){
+def getBranch() {
+	if (System.getenv().GIT_BRANCH) {
 		def branch = System.getenv().GIT_BRANCH
 		return branch.substring(branch.lastIndexOf("/") + 1)
 	}
@@ -113,17 +113,33 @@ allprojects {
 }
 
 javadoc {
-	options.memberLevel = "PACKAGE"
-	allprojects.each{
-			source( it.sourceSets.main.allJava.srcDirs)
-		}
+	options {
+		source = "8"
+		encoding = 'UTF-8'
+		charSet = 'UTF-8'
+		memberLevel = JavadocMemberLevel.PACKAGE
+		links(
+				'https://guava.dev/releases/21.0/api/docs/',
+				'https://asm.ow2.io/javadoc/',
+				'https://docs.oracle.com/javase/8/docs/api/',
+				'http://jenkins.liteloader.com/job/Mixin/javadoc/',
+				'https://logging.apache.org/log4j/2.x/log4j-api/apidocs/'
+				// Need to add minecraft jd publication etc once there is one available
+		)
+		// Disable the crazy super-strict doclint tool in Java 8
+		addStringOption('Xdoclint:none', '-quiet')
+	}
+	allprojects.each {
+		source(it.sourceSets.main.allJava.srcDirs)
+	}
 	classpath = sourceSets.main.compileClasspath
-	include ("**/api/**")
+	include("**/api/**")
 	failOnError false
 }
 
 task javadocJar(type: Jar) {
-	from javadoc
+	dependsOn javadoc
+	from javadoc.destinationDir
 	//Set as `fatjavadoc` to prevent an ide form trying to use this javadoc, over using the modules javadoc
 	classifier = 'fatjavadoc'
 }
@@ -150,17 +166,7 @@ subprojects {
 			}
 		}
 
-		repositories {
-			maven {
-				url "http://mavenupload.modmuss50.me/"
-				if (project.hasProperty('mavenPass')) {
-					credentials {
-						username 'buildslave'
-						password project.getProperty('mavenPass')
-					}
-				}
-			}
-		}
+		setupRepositories(repositories)
 	}
 
 	javadoc.enabled = false
@@ -183,9 +189,7 @@ publishing {
 			artifact(sourcesJar) {
 				builtBy remapSourcesJar
 			}
-			artifact (javadocJar) {
-				builtBy javadocJar
-			}
+			artifact javadocJar
 			pom.withXml {
 				def depsNode = asNode().appendNode("dependencies")
 				subprojects.each {
@@ -199,14 +203,17 @@ publishing {
 		}
 	}
 
-	repositories {
-		maven {
+	setupRepositories(repositories)
+}
+
+void setupRepositories(RepositoryHandler repositories) {
+	//repositories.mavenLocal() // uncomment for testing
+	if (project.hasProperty('mavenPass')) {
+		repositories.maven {
 			url "http://mavenupload.modmuss50.me/"
-			if (project.hasProperty('mavenPass')) {
-				credentials {
-					username 'buildslave'
-					password project.getProperty('mavenPass')
-				}
+			credentials {
+				username 'buildslave'
+				password project.getProperty('mavenPass')
 			}
 		}
 	}
@@ -230,7 +237,7 @@ version = Globals.baseVersion + "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_
 logger.lifecycle("Building Fabric: " + version)
 
 curseforge {
-	if (project.hasProperty('curse_api_key')){
+	if (project.hasProperty('curse_api_key')) {
 		apiKey = project.getProperty('curse_api_key')
 	}
 	project {
@@ -245,7 +252,7 @@ curseforge {
 			uploadTask.dependsOn("remapJar")
 		}
 	}
-	options{
+	options {
 		forgeGradleIntegration = false
 	}
 }
diff --git a/fabric-api-base/src/main/java/net/fabricmc/fabric/api/util/NbtType.java b/fabric-api-base/src/main/java/net/fabricmc/fabric/api/util/NbtType.java
index 1329371c2..d5c8630e5 100644
--- a/fabric-api-base/src/main/java/net/fabricmc/fabric/api/util/NbtType.java
+++ b/fabric-api-base/src/main/java/net/fabricmc/fabric/api/util/NbtType.java
@@ -24,8 +24,8 @@ import net.minecraft.nbt.Tag;
  *
  * <p>For the current list of types, check with {@link Tag#TYPES}.
  *
- * @see CompoundTag#containsKey(String, int)
- * @see Tag#idToString(int)
+ * @see CompoundTag#contains(String, int)
+ * @see net.minecraft.nbt.TagReaders#of(int)
  */
 public final class NbtType {
 	public static final int END = 0;
@@ -45,7 +45,7 @@ public final class NbtType {
 	/**
 	 * Any numeric value: byte, short, int, long, float, double.
 	 *
-	 * @see CompoundTag#containsKey(String, int)
+	 * @see CompoundTag#contains(String, int)
 	 */
 	public static final int NUMBER = 99;
 
diff --git a/fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/v1/EntityPlacer.java b/fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/v1/EntityPlacer.java
index b5422706c..9c4aafbe8 100644
--- a/fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/v1/EntityPlacer.java
+++ b/fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/v1/EntityPlacer.java
@@ -32,7 +32,7 @@ import net.minecraft.util.math.Direction;
 public interface EntityPlacer {
 	/**
 	 * Handles the placement of an entity going to a dimension.
-	 * Utilized by {@link FabricDimensions#teleport(Entity, DimensionType, EntityPlacer)} to specify placement logic when needed.
+	 * Utilized by {@link FabricDimensions#teleport(Entity, net.minecraft.world.dimension.DimensionType, EntityPlacer)} to specify placement logic when needed.
 	 *
 	 * <p>This method may have side effects such as the creation of a portal in the target dimension,
 	 * or the creation of a chunk loading ticket.
diff --git a/fabric-particles-v1/src/main/java/net/fabricmc/fabric/api/client/particle/v1/FabricSpriteProvider.java b/fabric-particles-v1/src/main/java/net/fabricmc/fabric/api/client/particle/v1/FabricSpriteProvider.java
index bf788ae9b..0607be86a 100644
--- a/fabric-particles-v1/src/main/java/net/fabricmc/fabric/api/client/particle/v1/FabricSpriteProvider.java
+++ b/fabric-particles-v1/src/main/java/net/fabricmc/fabric/api/client/particle/v1/FabricSpriteProvider.java
@@ -18,9 +18,11 @@ package net.fabricmc.fabric.api.client.particle.v1;
 
 import java.util.List;
 
+import net.minecraft.client.particle.ParticleFactory;
 import net.minecraft.client.particle.SpriteProvider;
 import net.minecraft.client.texture.Sprite;
 import net.minecraft.client.texture.SpriteAtlasTexture;
+import net.minecraft.particle.ParticleType;
 
 /**
  * FabricSpriteProvider. It does the same thing as vanilla's SpriteProvider,
@@ -31,7 +33,7 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
  * interface containing the sprites set loaded for their particle from the
  * active resourcepacks.
  *
- * @see ParticleFactoryRegistry#register(type, constructor)
+ * @see ParticleFactoryRegistry#register(ParticleType, ParticleFactory)
  * @see ParticleFactoryRegistry.PendingParticleFactory
  */
 public interface FabricSpriteProvider extends SpriteProvider {
diff --git a/fabric-particles-v1/src/main/java/net/fabricmc/fabric/api/particle/v1/FabricParticleTypes.java b/fabric-particles-v1/src/main/java/net/fabricmc/fabric/api/particle/v1/FabricParticleTypes.java
index 271fb71cf..c4d66231c 100644
--- a/fabric-particles-v1/src/main/java/net/fabricmc/fabric/api/particle/v1/FabricParticleTypes.java
+++ b/fabric-particles-v1/src/main/java/net/fabricmc/fabric/api/particle/v1/FabricParticleTypes.java
@@ -24,15 +24,18 @@ import net.minecraft.particle.ParticleType;
  * Methods for creating particle types, both simple and using an existing attribute factory.
  *
  * <p>Usage:
- * <pre> {@code
+ * <blockquote>
+ * <pre>
  * public static final DefaultParticleType SIMPLE_TEST_PARTICLE = FabricParticleTypes.simple();
  * public static final DefaultParticleType CUSTOM_TEST_PARTICLE = FabricParticleTypes.simple();
  *
- * @Override
+ * {@literal @}Override
  * public void onInitialize() {
  *     Registry.register(Registry.PARTICLE_TYPE, new Identifier("testmod", "simple"), SIMPLE_TEST_PARTICLE);
  *     Registry.register(Registry.PARTICLE_TYPE, new Identifier("testmod", "custom"), CUSTOM_TEST_PARTICLE);
- * }}</pre>
+ * }}
+ * </pre>
+ * </blockquote>
  *
  * @see ParticleModClient in the fabric example mods for a more complete usage.
  */
@@ -41,8 +44,6 @@ public final class FabricParticleTypes {
 
 	/**
 	 * Creates a new, default particle type for the given id.
-	 *
-	 * @param id The particle id.
 	 */
 	public static DefaultParticleType simple() {
 		return simple(false);
@@ -51,7 +52,6 @@ public final class FabricParticleTypes {
 	/**
 	 * Creates a new, default particle type for the given id.
 	 *
-	 * @param id The particle id.
 	 * @param alwaysSpawn True to always spawn the particle regardless of distance.
 	 */
 	public static DefaultParticleType simple(boolean alwaysSpawn) {
@@ -61,7 +61,6 @@ public final class FabricParticleTypes {
 	/**
 	 * Creates a new particle type with a custom factory for packet/data serialization.
 	 *
-	 * @param id The particle id.
 	 * @param factory	 A factory for serializing packet data and string command parameters into a particle effect.
 	 */
 	public static <T extends ParticleEffect> ParticleType<T> complex(ParticleEffect.Factory<T> factory) {
@@ -71,7 +70,6 @@ public final class FabricParticleTypes {
 	/**
 	 * Creates a new particle type with a custom factory for packet/data serialization.
 	 *
-	 * @param id The particle id.
 	 * @param alwaysSpawn True to always spawn the particle regardless of distance.
 	 * @param factory	 A factory for serializing packet data and string command parameters into a particle effect.
 	 */
diff --git a/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/material/BlendMode.java b/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/material/BlendMode.java
index 4e71ddc53..4ee361c04 100644
--- a/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/material/BlendMode.java
+++ b/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/material/BlendMode.java
@@ -33,13 +33,13 @@ public enum BlendMode {
 	SOLID(RenderLayer.getSolid()),
 
 	/**
-	 * Pixels with alpha > 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
+	 * Pixels with alpha &gt; 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
 	 * Texture mip-map enabled.  Used for leaves.
 	 */
 	CUTOUT_MIPPED(RenderLayer.getCutoutMipped()),
 
 	/**
-	 * Pixels with alpha > 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
+	 * Pixels with alpha &gt; 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
 	 * Texture mip-map disabled.  Used for iron bars, glass and other cutout sprites with hard edges.
 	 */
 	CUTOUT(RenderLayer.getCutout()),
diff --git a/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/material/RenderMaterial.java b/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/material/RenderMaterial.java
index 33cde63dc..ba12bb416 100644
--- a/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/material/RenderMaterial.java
+++ b/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/material/RenderMaterial.java
@@ -16,7 +16,7 @@
 
 package net.fabricmc.fabric.api.renderer.v1.material;
 
-import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
 import net.minecraft.util.Identifier;
 
 import net.fabricmc.fabric.api.renderer.v1.Renderer;
@@ -67,8 +67,9 @@ public interface RenderMaterial {
 	 * This will be identical to the material that would be obtained by calling {@link MaterialFinder#find()}
 	 * on a new, unaltered, {@link MaterialFinder} instance.  It is defined here for clarity and convenience.
 	 *
-	 * <p>Quads using this material use {@link Block#getRenderLayer()} of the associated block to determine texture blending,
-	 * honor block color index, are non-emissive, and apply both diffuse and ambient occlusion shading to vertex colors.
+	 * <p>Quads using this material use {@link net.minecraft.client.render.RenderLayers#getBlockLayer(BlockState)} of
+	 * the associated block to determine texture blending, honor block color index, are non-emissive, and apply both
+	 * diffuse and ambient occlusion shading to vertex colors.
 	 *
 	 * <p>All standard, non-fluid baked models are rendered using this material.
 	 */
diff --git a/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/mesh/MutableQuadView.java b/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/mesh/MutableQuadView.java
index 7edef604f..f508fd2a6 100644
--- a/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/mesh/MutableQuadView.java
+++ b/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/mesh/MutableQuadView.java
@@ -127,7 +127,7 @@ public interface MutableQuadView extends QuadView {
 	 *
 	 * <p>Models may also find this useful as the face for texture UV locking and rotation semantics.
 	 *
-	 * @note This value is not persisted independently when the quad is encoded.
+	 * <p>Note: This value is not persisted independently when the quad is encoded.
 	 * When reading encoded quads, this value will always be the same as {@link #lightFace()}.
 	 */
 	MutableQuadView nominalFace(Direction face);
diff --git a/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/model/FabricBakedModel.java b/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/model/FabricBakedModel.java
index f51b03453..fee0bbf03 100644
--- a/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/model/FabricBakedModel.java
+++ b/fabric-renderer-api-v1/src/main/java/net/fabricmc/fabric/api/renderer/v1/model/FabricBakedModel.java
@@ -76,7 +76,7 @@ public interface FabricBakedModel {
 	 * neighboring blocks (if appropriate).  Models only need to consider "sides" to the
 	 * extent the model is driven by connection with neighbor blocks or other world state.
 	 *
-	 * @note with {@link BakedModel#getQuads(BlockState, net.minecraft.util.math.Direction, Random)}, the random
+	 * <p>Note: with {@link BakedModel#getQuads(BlockState, net.minecraft.util.math.Direction, Random)}, the random
 	 * parameter is normally initialized with the same seed prior to each face layer.
 	 * Model authors should note this method is called only once per block, and call the provided
 	 * Random supplier multiple times if re-seeding is necessary. For wrapped vanilla baked models,
diff --git a/fabric-rendering-fluids-v1/src/main/java/net/fabricmc/fabric/api/client/render/fluid/v1/FluidRenderHandler.java b/fabric-rendering-fluids-v1/src/main/java/net/fabricmc/fabric/api/client/render/fluid/v1/FluidRenderHandler.java
index 0d9abcce0..2d9def738 100644
--- a/fabric-rendering-fluids-v1/src/main/java/net/fabricmc/fabric/api/client/render/fluid/v1/FluidRenderHandler.java
+++ b/fabric-rendering-fluids-v1/src/main/java/net/fabricmc/fabric/api/client/render/fluid/v1/FluidRenderHandler.java
@@ -43,7 +43,7 @@ public interface FluidRenderHandler {
 	/**
 	 * Get the tint color for a fluid being rendered at a given position.
 	 *
-	 * @note As of right now, our hook cannot handle setting a custom alpha
+	 * <p>Note: As of right now, our hook cannot handle setting a custom alpha
 	 * tint here - as such, it must be contained in the texture itself!
 	 *
 	 * @param view The world view pertaining to the fluid. May be null!