jhass / crystal-gobject

gobject-introspection for Crystal
BSD 3-Clause "New" or "Revised" License
127 stars 13 forks source link

Cannot generate docs #101

Open phil294 opened 2 years ago

phil294 commented 2 years ago

After a clean clone, shards run gi-doc shows

Dependencies are satisfied
Building: gi-doc
Error target gi-doc failed to compile:
Showing last frame. Use --error-trace for full trace.

In /usr/lib/crystal/compiler/crystal/program.cr:23:9

 23 | class Program < NonGenericModuleType
            ^
Error: superclass mismatch for class Crystal::Program (Crystal::NonGenericModuleType for Reference)
error trace
In src/generator/doc.cr:5:1

 5 | require "compiler/crystal/**"
     ^
Error: while requiring "compiler/crystal/**"

In /usr/lib/crystal/compiler/crystal/command.cr:13:1

 13 | require "./tools/*"
      ^
Error: while requiring "./tools/*"

In /usr/lib/crystal/compiler/crystal/tools/context.cr:3:1

 3 | require "../semantic/*"
     ^
Error: while requiring "../semantic/*"

In /usr/lib/crystal/compiler/crystal/semantic/fix_missing_types.cr:1:1

 1 | require "../semantic"
     ^
Error: while requiring "../semantic"

In /usr/lib/crystal/compiler/crystal/semantic.cr:1:1

 1 | require "./program"
     ^
Error: while requiring "./program"

In /usr/lib/crystal/compiler/crystal/program.cr:23:9

 23 | class Program < NonGenericModuleType
            ^
Error: superclass mismatch for class Crystal::Program (Crystal::NonGenericModuleType for Reference)
x86_64 Linux 5.4.200-1-MANJARO, Xfce4/Xfwm4, Crystal 1.4.1 (2022-04-23), Shards 0.17.0 (2022-03-25)

Thanks for all your work. This shard is so meta, it's fascinating to read through the source.

jhass commented 2 years ago

Might need to declare it a failed experiment, at least in the current approach. Given the compiler packages don't ship the vendored in markd sources, I don't see a sane way to go forward. That said:

diff --git a/src/generator/doc.cr b/src/generator/doc.cr
index 6d039a98..ac4c257a 100644
--- a/src/generator/doc.cr
+++ b/src/generator/doc.cr
@@ -2,7 +2,7 @@ require "xml"
 require "option_parser"
 require "../g_i_repository"
 require "./namespace"
-require "compiler/crystal/**"
+require "compiler/requires"

 module Crystal::Config
   def self.path
$ cd /opt/homebrew/Cellar/crystal/1.5.0/share/crystal/
$ mkdir lib
$ cd lib
$ git clone https://github.com/icyleaf/markd.git
$ cd ~/projects/crystal-gobject
$ shards build gi-doc
$ CRYSTAL_PATH="$(crystal env CRYSTAL_PATH):samples/lib" CRYSTAL_LIBRARY_PATH="$(crystal env CRYSTAL_LIBRARY_PATH)" bin/gi-doc -g $(brew --prefix)/share/gir-1.0 GObject
Docs written to docs/gobject
$ ls docs/gobject
404.html        Float32.html    GLib.html       Gio.html        Int8.html       String.html     UInt8.html      index.json      toplevel.html
Bool.html       Float64.html    GObject         Int32.html      Object.html     UInt32.html     css             js
Enum.html       GLib            GObject.html    Int64.html      Pointer.html    UInt64.html     index.html      search-index.js

😅 🤣