@@ -30,64 +30,80 @@ let rec collectModules pn pu nn nu (m: ApiDocEntity) =
3030
3131let loader ( projectRoot : string ) ( siteContet : SiteContents ) =
3232 try
33- // Try to find FSharpLint.Core.dll in the project build output
33+ // Try multiple possible locations for the assembly
3434 let projectDir = Path.Combine( projectRoot, " .." , " src" , " FSharpLint.Core" )
35- let binDir = Path.Combine( projectDir, " bin" , " Release" , " net9.0" )
36- let dllPath = Path.Combine( binDir, " FSharpLint.Core.dll" )
35+ let possiblePaths = [
36+ // Release build
37+ Path.Combine( projectDir, " bin" , " Release" , " net9.0" , " FSharpLint.Core.dll" )
38+ // Debug build
39+ Path.Combine( projectDir, " bin" , " Debug" , " net9.0" , " FSharpLint.Core.dll" )
40+ // Default build output (no custom output path)
41+ Path.Combine( projectDir, " bin" , " Release" , " FSharpLint.Core.dll" )
42+ Path.Combine( projectDir, " bin" , " Debug" , " FSharpLint.Core.dll" )
43+ ]
3744
38- let dlls =
39- [
40- " FSharpLint.Core" , dllPath
41- ]
42- let libs =
43- [
44- binDir
45- ]
46- for ( label, dll) in dlls do
47- if File.Exists dll then
48- let inputs = [ ApiDocInput.FromFile( dll)]
49- let output = ApiDocs.GenerateModel( inputs, label, [], libDirs = libs)
50-
51- let allModules =
52- output.Collection.Namespaces
53- |> List.collect ( fun n ->
54- List.collect ( collectModules n.Name n.Name n.Name n.Name) n.Entities
55- )
45+ let foundDll = possiblePaths |> List.tryFind File.Exists
46+
47+ match foundDll with
48+ | Some dllPath ->
49+ let binDir = Path.GetDirectoryName( dllPath)
50+ printfn " Found assembly at: %s " dllPath
51+ printfn " Using lib directory: %s " binDir
52+
53+ let libs = [ binDir]
54+
55+ // Try to load with minimal dependencies first
56+ let inputs = [ ApiDocInput.FromFile( dllPath)]
57+ try
58+ let output = ApiDocs.GenerateModel( inputs, " FSharpLint.Core" , [], libDirs = libs)
59+
60+ let allModules =
61+ output.Collection.Namespaces
62+ |> List.collect ( fun n ->
63+ List.collect ( collectModules n.Name n.Name n.Name n.Name) n.Entities
64+ )
5665
57- let allTypes =
58- [
59- yield !
60- output.Collection.Namespaces
61- |> List.collect ( fun n ->
62- n.Entities |> List.choose ( fun t ->
63- if t.IsTypeDefinition then
64- Some { ParentName = n.Name; ParentUrlName = n.Name; NamespaceName = n.Name; NamespaceUrlName = n.Name; Info = t}
65- else
66- None)
67- )
68- yield !
69- allModules
70- |> List.collect ( fun n ->
71- // Get nested types from nested entities
72- n.Info.NestedEntities
73- |> List.choose ( fun e ->
74- if e.IsTypeDefinition then
75- Some { ParentName = n.Info.Name; ParentUrlName = n.Info.UrlBaseName; NamespaceName = n.NamespaceName; NamespaceUrlName = n.NamespaceUrlName; Info = e}
76- else
77- None)
78- )
79- ]
80- let entities = {
81- Label = label
82- Modules = allModules
83- Types = allTypes
84- GeneratorOutput = output
85- }
86- siteContet.Add entities
87- else
88- printfn " Warning: Could not find assembly at %s " dll
66+ let allTypes =
67+ [
68+ yield !
69+ output.Collection.Namespaces
70+ |> List.collect ( fun n ->
71+ n.Entities |> List.choose ( fun t ->
72+ if t.IsTypeDefinition then
73+ Some { ParentName = n.Name; ParentUrlName = n.Name; NamespaceName = n.Name; NamespaceUrlName = n.Name; Info = t}
74+ else
75+ None)
76+ )
77+ yield !
78+ allModules
79+ |> List.collect ( fun n ->
80+ // Get nested types from nested entities
81+ n.Info.NestedEntities
82+ |> List.choose ( fun e ->
83+ if e.IsTypeDefinition then
84+ Some { ParentName = n.Info.Name; ParentUrlName = n.Info.UrlBaseName; NamespaceName = n.NamespaceName; NamespaceUrlName = n.NamespaceUrlName; Info = e}
85+ else
86+ None)
87+ )
88+ ]
89+ let entities = {
90+ Label = " FSharpLint.Core"
91+ Modules = allModules
92+ Types = allTypes
93+ GeneratorOutput = output
94+ }
95+ siteContet.Add entities
96+ printfn " Successfully loaded API documentation for FSharpLint.Core"
97+ with
98+ | ex ->
99+ printfn " Failed to generate API docs from %s : %A " dllPath ex
100+ printfn " Continuing without API documentation..."
101+ | None ->
102+ printfn " Warning: Could not find FSharpLint.Core.dll in any of the expected locations:"
103+ possiblePaths |> List.iter ( printfn " - %s " )
104+ printfn " API documentation will not be generated."
89105 with
90106 | ex ->
91- printfn " %A " ex
107+ printfn " Error in API reference loader: %A " ex
92108
93109 siteContet
0 commit comments