From a58909ed394c59e5ece93ba8a2552f8f50320734 Mon Sep 17 00:00:00 2001 From: Frotty Date: Wed, 25 Feb 2026 10:07:48 +0100 Subject: [PATCH] remove hotdoc --- de.peeeq.wurstscript/build.gradle | 33 +-- .../src/main/java/de/peeeq/wurstio/Main.java | 7 - .../peeeq/wurstio/hotdoc/HotdocGenerator.java | 279 ------------------ .../de/peeeq/wurstio/hotdoc/package-info.java | 3 - .../java/de/peeeq/wurstscript/RunArgs.java | 6 - .../src/main/resources/hotdoc/document.html | 64 ---- .../src/main/resources/hotdoc/navbar.html | 13 - .../src/main/resources/hotdoc/package.html | 3 - .../src/main/resources/hotdoc/structure.html | 5 - .../src/main/resources/hotdoc/var.html | 5 - 10 files changed, 8 insertions(+), 410 deletions(-) delete mode 100644 de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/hotdoc/HotdocGenerator.java delete mode 100644 de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/hotdoc/package-info.java delete mode 100644 de.peeeq.wurstscript/src/main/resources/hotdoc/document.html delete mode 100644 de.peeeq.wurstscript/src/main/resources/hotdoc/navbar.html delete mode 100644 de.peeeq.wurstscript/src/main/resources/hotdoc/package.html delete mode 100644 de.peeeq.wurstscript/src/main/resources/hotdoc/structure.html delete mode 100644 de.peeeq.wurstscript/src/main/resources/hotdoc/var.html diff --git a/de.peeeq.wurstscript/build.gradle b/de.peeeq.wurstscript/build.gradle index 4a0e5b2e2..67f3b0f06 100644 --- a/de.peeeq.wurstscript/build.gradle +++ b/de.peeeq.wurstscript/build.gradle @@ -103,15 +103,18 @@ dependencies { implementation 'org.eclipse.lsp4j:org.eclipse.lsp4j:0.24.0' implementation 'org.eclipse.jdt:org.eclipse.jdt.annotation:2.1.0' implementation 'com.google.code.gson:gson:2.10.1' - implementation 'org.apache.velocity:velocity:1.7' + implementation 'commons-lang:commons-lang:2.6' implementation 'com.github.albfernandez:juniversalchardet:2.4.0' implementation 'com.github.inwc3:jmpq3:29b55f2c32' implementation 'com.github.inwc3:wc3libs:bab65b961b' - implementation 'com.github.wurstscript:wurstsetup:393cf5ea39' + implementation('com.github.wurstscript:wurstsetup:393cf5ea39') { + exclude group: 'org.eclipse.jgit', module: 'org.eclipse.jgit' + exclude group: 'org.eclipse.jgit', module: 'org.eclipse.jgit.ssh.apache' + } implementation 'org.slf4j:slf4j-api:2.0.17' implementation 'ch.qos.logback:logback-classic:1.5.20' - implementation 'org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r' - implementation 'org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.7.0.202309050840-r' + testImplementation 'org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r' + testImplementation 'org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.7.0.202309050840-r' implementation 'it.unimi.dsi:fastutil:8.5.16' // Smallcheck @@ -339,27 +342,7 @@ tasks.register('create_zips') { } } -/** -------- Hotdoc generation -------- */ - -tasks.register('generate_hotdoc') { - dependsOn 'compileJava', 'downloadAndUnzipFile' - - doLast { - ExecOperations execOps = project.services.get(ExecOperations) - - copy { - from("src/main/resources/") - // Gradle 9 output classes dir - into("build/classes/java/main/") - } - execOps.javaexec { - classpath = sourceSets.main.runtimeClasspath - mainClass.set('de.peeeq.wurstio.Main') - args("--hotdoc", "./build/deps/", "../downloads/hotdoc") - } - } -} - +// TODO add a modern documentation generator replacement for the removed legacy hotdoc pipeline. tasks.named("coveralls") { notCompatibleWithConfigurationCache("coveralls plugin task uses Project at execution time") } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/Main.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/Main.java index 7bf555997..ce68adcb5 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/Main.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/Main.java @@ -7,7 +7,6 @@ import de.peeeq.wurstio.compilationserver.WurstServer; import de.peeeq.wurstio.gui.AboutDialog; import de.peeeq.wurstio.gui.WurstGuiImpl; -import de.peeeq.wurstio.hotdoc.HotdocGenerator; import de.peeeq.wurstio.languageserver.LanguageServerStarter; import de.peeeq.wurstio.languageserver.ProjectConfigBuilder; import de.peeeq.wurstio.languageserver.WFile; @@ -97,12 +96,6 @@ public static void main(String[] args) { return; } - if (runArgs.createHotDoc()) { - HotdocGenerator hg = new HotdocGenerator(runArgs.getFiles()); - hg.generateDoc(); - return; - } - if (runArgs.isGui()) { gui = new WurstGuiImpl(); // use the error reporting with GUI diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/hotdoc/HotdocGenerator.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/hotdoc/HotdocGenerator.java deleted file mode 100644 index c019c5310..000000000 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/hotdoc/HotdocGenerator.java +++ /dev/null @@ -1,279 +0,0 @@ -package de.peeeq.wurstio.hotdoc; - -import com.google.common.collect.Lists; -import de.peeeq.wurstio.WurstCompilerJassImpl; -import de.peeeq.wurstio.utils.FileUtils; -import de.peeeq.wurstscript.RunArgs; -import de.peeeq.wurstscript.WLogger; -import de.peeeq.wurstscript.ast.*; -import de.peeeq.wurstscript.attributes.CompileError; -import de.peeeq.wurstscript.gui.WurstGui; -import de.peeeq.wurstscript.gui.WurstGuiCliImpl; -import de.peeeq.wurstscript.utils.Utils; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.VelocityEngine; -import org.eclipse.jdt.annotation.Nullable; - -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Properties; - -public class HotdocGenerator { - - private final List files; - private final File outputfolder; - // private WurstModel model; -// private ArrayList packages; - private final VelocityEngine ve; - private final Template variableTemplate; - private final Template navbarTemplate; - private final Template structureTemplate; - - public HotdocGenerator(List files) { - this.files = Lists.newArrayList(files); - this.outputfolder = new File(this.files.remove(files.size() - 1)); - ve = new VelocityEngine(); - Properties p = new Properties(); - p.setProperty("runtime.references.strict", "true"); - p.setProperty("resource.loader", "class"); - p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - ve.init(p); - variableTemplate = ve.getTemplate("/hotdoc/var.html"); - navbarTemplate = ve.getTemplate("/hotdoc/navbar.html"); - structureTemplate = ve.getTemplate("/hotdoc/structure.html"); - } - - public void generateDoc() { - try { - WLogger.info("Generating hotdoc into " + outputfolder.getAbsolutePath()); - for (String f : files) { - WLogger.info(" input: " + f); - } - if (outputfolder.exists()) { - // clean folder - for (File f : outputfolder.listFiles()) { - if (f.getName().endsWith(".html")) { - f.delete(); - } - } - } else { - if (!outputfolder.mkdirs()) { - throw new Error("could not create output directory"); - } - } - - RunArgs runArgs = new RunArgs(); - WurstGui gui = new WurstGuiCliImpl(); - WurstCompilerJassImpl compiler = new WurstCompilerJassImpl(null, gui, null, runArgs); - compiler.loadFiles(Utils.getResourceFile("common.j")); - compiler.loadFiles(Utils.getResourceFile("blizzard.j")); - for (String file : files) { - File f = new File(file); - if (!f.exists()) { - WLogger.info("Folder " + f + " does not exist"); - throw new RuntimeException(f.getAbsolutePath()); - } - if (f.isDirectory()) { - compiler.loadWurstFilesInDir(f); - } else if (Utils.isWurstFile(f)) { - compiler.loadFiles(f); - } - } - WurstModel model = compiler.parseFiles(); - if (model == null) { - WLogger.info("Hotdoc model is null."); - for (CompileError e : gui.getErrorList()) { - WLogger.info(e); - } - throw new RuntimeException("Could not analyze program correctly."); - } - - ArrayList packages = Lists.newArrayList(model.attrPackages().values()); - if (packages.size() == 0) { - throw new RuntimeException("Cannot generate for empty model: " + files.get(0)); - } - WLogger.info("Found " + packages.size() + "´packages."); - packages.sort(Comparator.comparing(o -> o.getSource().shortFile())); - - createIndex(packages); - for (WPackage p : packages) { - createPackageDoc(p, packages); - } - gui.clearErrors(); - } catch (Throwable t) { - System.err.println("Error in creating documentation: "); - t.printStackTrace(); - throw new RuntimeException(t); - } - } - - private void createIndex(List packages) { - Template t = ve.getTemplate("/hotdoc/document.html"); - - VelocityContext context = new VelocityContext(); - context.put("title", "HotDoc Wurst Documentation"); - context.put("navbar", getNavbarWithHighlight(null, packages)); - context.put("content", ""); - String s = render(t, context); - WLogger.info(s); - // TODO - try { - FileUtils.write(render(t, context), new File(outputfolder + "/index.html")); - } catch (IOException e) { - throw new RuntimeException(e); - } - - } - - private void createPackageDoc(WPackage pack, List packages) { - - Template t = ve.getTemplate("/hotdoc/document.html"); - - VelocityContext context = new VelocityContext(); - context.put("title", pack.getName() + " HotDoc Wurst Documentation"); - context.put("navbar", getNavbarWithHighlight(pack, packages)); - context.put("content", getPackageContent(pack)); - String s = render(t, context); - WLogger.info(s); - // TODO - try { - FileUtils.write(render(t, context), new File(outputfolder + "/" + pack.getName() + ".html")); - } catch (IOException e) { - throw new RuntimeException(e); - } - - } - - private String getPackageContent(WPackage pack) { - Template t = ve.getTemplate("/hotdoc/package.html"); - VelocityContext context = new VelocityContext(); - context.put("currentPackage", pack); - StringWriter writer = new StringWriter(); - t.merge(context, writer); - - documentVars(getElements(pack, VarDef.class), writer, false); - documentFuncs(getElements(pack, FunctionDefinition.class), writer, false); - documentStructures(pack, writer); - - return writer.toString(); - } - - private void documentStructures(WPackage pack, StringWriter writer) { - List sorted = Utils.sortByName(getElements(pack, StructureDef.class)); - for (StructureDef v : sorted) { - if (!v.attrIsPublic()) { - continue; - } - - VelocityContext context = new VelocityContext(); - context.put("name", Utils.printElement(v)); - context.put("type", ""); - context.put("comment", v.attrComment()); - context.put("source", v.getSource()); - - structureTemplate.merge(context, writer); - - documentVars(v.getVars(), writer, true); - documentFuncs(v.getMethods(), writer, true); - } - - } - - private void documentFuncs(List funcs, StringWriter writer, boolean includeNonPublic) { - funcs = Utils.sortByName(funcs); - for (FunctionDefinition f : funcs) { - if (!f.attrIsPublic()) { - if (!includeNonPublic || f.attrIsPrivate()) { - continue; - } - } - - VelocityContext context = new VelocityContext(); - - StringBuilder descr = new StringBuilder(); - descr.append("function "); - if (f instanceof ExtensionFuncDef) { - ExtensionFuncDef ex = (ExtensionFuncDef) f; - descr.append(ex.getExtendedType().attrTyp()); - descr.append("."); - } - descr.append(f.getName()); - descr.append("("); - boolean first = true; - for (WParameter p : f.getParameters()) { - if (!first) { - descr.append(", "); - } - descr.append(p.attrTyp()).append(" ").append(p.getName()); - first = false; - } - descr.append(")"); - if (f.attrReturnTyp().isVoid()) { - - } else { - descr.append(" returns "); - descr.append(f.attrReturnTyp()); - } - - context.put("name", descr); - context.put("type", ""); - context.put("comment", f.attrComment()); - context.put("source", f.getSource()); - - variableTemplate.merge(context, writer); - } - } - - private void documentVars(List vardefs, StringWriter writer, boolean includeNonPublic) { - List sorted = Utils.sortByName(vardefs); - for (VarDef v : sorted) { - if (!v.attrIsPublic()) { - if (!includeNonPublic || v.attrIsPrivate()) { - continue; - } - } - - VelocityContext context = new VelocityContext(); - context.put("name", v.getName()); - context.put("type", v.attrTyp()); - context.put("comment", v.attrComment()); - context.put("source", v.getSource()); - - variableTemplate.merge(context, writer); - } - } - - private List getElements(WPackage pack, Class clazz) { - List result = Lists.newArrayList(); - for (WEntity e : pack.getElements()) { - WLogger.info(Utils.printElement(e)); - if (clazz.isAssignableFrom(e.getClass())) { - @SuppressWarnings("unchecked") - T t = (T) e; - result.add(t); - } - } - return result; - } - - private String render(Template t, VelocityContext context) { - StringWriter writer = new StringWriter(); - t.merge(context, writer); - String s = writer.toString(); - return s; - } - - private String getNavbarWithHighlight(@Nullable WPackage pack, List packages) { - VelocityContext context = new VelocityContext(); - context.put("packages", packages); - context.put("currentPackage", pack); - return render(navbarTemplate, context); - } - - -} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/hotdoc/package-info.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/hotdoc/package-info.java deleted file mode 100644 index 52f086024..000000000 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/hotdoc/package-info.java +++ /dev/null @@ -1,3 +0,0 @@ -@org.eclipse.jdt.annotation.NonNullByDefault -package de.peeeq.wurstio.hotdoc; - diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/RunArgs.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/RunArgs.java index b8e02a5cf..ad1d65893 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/RunArgs.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/RunArgs.java @@ -31,7 +31,6 @@ public class RunArgs { private final RunOption optionRuntests; private final RunOption optionGui; private final RunOption optionAbout; - private final RunOption optionHotdoc; private final RunOption optionShowErrors; private final RunOption optionRunCompileTimeFunctions; private final RunOption optionStacktraces; @@ -107,7 +106,6 @@ public RunArgs(String... args) { optionFixInstall = addOption("-fixInstallation", "Checks your wc3 installation and applies compatibility fixes"); optionCopyMap = addOption("-copyMap", "copies map"); optionStartServer = addOption("-startServer", "Starts the compilation server."); - optionHotdoc = addOption("-hotdoc", "Generate hotdoc html documentation."); optionShowErrors = addOption("-showerrors", "(currently not implemented.) Show errors generated by last compile."); optionExtractImports = addOptionWithArg("-extractImports", "Extract all files from a map into a folder next to the mapp.", arg -> mapFile = arg); optionShowVersion = addOption("-version", "Shows the version of the compiler"); @@ -253,10 +251,6 @@ public boolean runCompiletimeFunctions() { } - public boolean createHotDoc() { - return optionHotdoc.isSet; - } - public boolean isNullsetting() { return isOptimize(); } diff --git a/de.peeeq.wurstscript/src/main/resources/hotdoc/document.html b/de.peeeq.wurstscript/src/main/resources/hotdoc/document.html deleted file mode 100644 index e96cfa440..000000000 --- a/de.peeeq.wurstscript/src/main/resources/hotdoc/document.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - $title - - - - - - - - - - - - Your browser does not support HTML5 canvas. - -Fork me on GitHub - -
-
-
$navbar
-
$content
-
-
- - - - \ No newline at end of file diff --git a/de.peeeq.wurstscript/src/main/resources/hotdoc/navbar.html b/de.peeeq.wurstscript/src/main/resources/hotdoc/navbar.html deleted file mode 100644 index 0f9767dd9..000000000 --- a/de.peeeq.wurstscript/src/main/resources/hotdoc/navbar.html +++ /dev/null @@ -1,13 +0,0 @@ -

Available Packages:

- \ No newline at end of file diff --git a/de.peeeq.wurstscript/src/main/resources/hotdoc/package.html b/de.peeeq.wurstscript/src/main/resources/hotdoc/package.html deleted file mode 100644 index ee3990219..000000000 --- a/de.peeeq.wurstscript/src/main/resources/hotdoc/package.html +++ /dev/null @@ -1,3 +0,0 @@ -

$currentPackage.getName()

-Source \ No newline at end of file diff --git a/de.peeeq.wurstscript/src/main/resources/hotdoc/structure.html b/de.peeeq.wurstscript/src/main/resources/hotdoc/structure.html deleted file mode 100644 index 457387e54..000000000 --- a/de.peeeq.wurstscript/src/main/resources/hotdoc/structure.html +++ /dev/null @@ -1,5 +0,0 @@ -

$name

-Source - -

$comment

\ No newline at end of file diff --git a/de.peeeq.wurstscript/src/main/resources/hotdoc/var.html b/de.peeeq.wurstscript/src/main/resources/hotdoc/var.html deleted file mode 100644 index ff746c046..000000000 --- a/de.peeeq.wurstscript/src/main/resources/hotdoc/var.html +++ /dev/null @@ -1,5 +0,0 @@ -

$type $name

-Source - -

$comment

\ No newline at end of file