Permalink
Browse files

Generate type specification xml files

  • Loading branch information...
1 parent fd2ff81 commit 8b97987ace7e46d48899f3a7881e7f94c5faad80 @daleharvey committed Nov 26, 2011
Showing with 12 additions and 6 deletions.
  1. +12 −6 src/erldocs_core.erl
View
@@ -94,20 +94,26 @@ ensure_docsrc(AppDir, Conf) ->
% List any doc/src/*.xml files that exist in the source files
XMLFiles = filelib:wildcard(filename:join([AppDir, "doc", "src", "*.xml"])),
- Bnames = [bname(File, ".xml") || File <- XMLFiles],
+ HandWritten = [bname(File, ".xml") || File <- XMLFiles],
+
+ ErlFiles = filelib:wildcard(filename:join([AppDir, "*.erl"])) ++
+ filelib:wildcard(filename:join([AppDir, "src", "*.erl"])),
% Generate any missing module XML
- SrcFiles = [filename:absname(File)
- || File <- filelib:wildcard(filename:join([AppDir, "*.erl"])) ++
- filelib:wildcard(filename:join([AppDir, "src", "*.erl"])),
- not lists:member(bname(File, ".erl"), Bnames)],
+ SrcFiles = [filename:absname(File) ||
+ File <- ErlFiles,
+ not lists:member(bname(File, ".erl"), HandWritten)],
% Output XML files to destination folder
% This prevents polluting the source files
XMLDir = filename:join([dest(Conf), ".xml", bname(AppDir)]),
-
filelib:ensure_dir(XMLDir ++ "/"),
+ [ begin
+ log("Generating Type Specs for: ~s~n", [File]),
+ os:cmd("./priv/bin/specs_gen.escript -o.xml/ " ++ File)
+ end || File <- ErlFiles],
+
%% Return the complete list of XML files
XMLFiles ++ tmp_cd(XMLDir, fun() -> gen_docsrc(AppDir, SrcFiles, XMLDir) end).

0 comments on commit 8b97987

Please sign in to comment.