如何创建包含多个库包的docgen解决方案?与Dart类似,左侧垂直菜单包含指向每个库的链接。 示例:我有dart编辑器工作区,包含5个项目
mowbotnavrc_server (server)
mowbotnavrc_web (client)
mowbotnavrc (library)
mowbotnavrc_protocol (library)
osswebwidgets (library)
我想在index.html的左侧菜单中列出上面列出的3个库包。当我添加更多库时,它们每个都会在左侧菜单中获得一个链接。目前,我只能单独生成每个库,没有问题。
cd %project-folder%
:: <<< Run pub get to get the dependencies >>>
cmd /c %dart-sdk-bin%\pub get
cmd /c docgen.bat --verbose %OPTIONS% --out %ENV-PROJECT-DOCS% --no-include-sdk --no-include-dependent-packages --package-root=%project-folder%\packages %project-folder%\lib
根据文档的--append选项听起来像我需要但我从来没有让它工作。
--append
Use the same format used the last time the docs were generated,
as stated in library_list.json. Add the newly generated documentation
to the docs directory, library_list.json, and index.txt.
我正在使用Dart SDK版本1.4.0-dev.2.2。我认为 - 禁止在1.4之前弃用。任何建议表示赞赏。
答案 0 :(得分:2)
根据Günter的回答,我能够获得Windows命令版本。也许其他人也会觉得有帮助。
:: ===========================================================================
:: DOCGEN: MOWBOT Dart Project
:: ===========================================================================
mode con:cols=135 lines=50
:: --------------------------------------------
:: Initialize environment variables
:: --------------------------------------------
setlocal
set PATH-DARTSDKBIN=F:\Public\Downloads\Darteditor-windows-x64\dart\dart-sdk\bin
set PATH=%PATH%;%PATH-DARTSDKBIN%
set PATH-DARTPROJECTS=C:\Users\OSSDevYorgi\DartProjects
set PATH-DARTDOCS=C:\Users\OSSDevYorgi\DartDocs
set ERRORMSG=
:: --------------------------------------------
:: Initialize PATH-DARTDOCS & PATH-DARTDOCS-MOWBOT folders
:: --------------------------------------------
IF NOT EXIST %PATH-DARTDOCS% mkdir %PATH-DARTDOCS%
set PATH-DARTDOCS-MOWBOT=%PATH-DARTDOCS%\mowbot
IF NOT EXIST %PATH-DARTDOCS-MOWBOT% (
mkdir %PATH-DARTDOCS-MOWBOT% 1> nul
) ELSE (
del %PATH-DARTDOCS-MOWBOT% /s /q 1> nul
)
:: --------------------------------------------
:: MAIN DOC PROJECT:mowbotnavrc
:: --------------------------------------------
set PROJECT-NAME=mowbotnavrc
set PATH-PROJECT=%PATH-DARTPROJECTS%\libraries\%PROJECT-NAME%
set PROJECTLIBS=lib\mowbotnavrc.dart
set PROJECTLIBS=%PROJECTLIBS% %PATH-DARTPROJECTS%\libraries\mowbotnavrc_protocol\lib\protobufs\mowbot.pb.dart
set PROJECTLIBS=%PROJECTLIBS% %PATH-DARTPROJECTS%\webcomponents\osswebwidgets\lib\instruments.dart
::set PROJECTLIBS=%PROJECTLIBS% %PATH-DARTPROJECTS%\webcomponents\osswebwidgets\lib\guages.dart
::set STARTPAGE=%PROJECT-NAME%
:: --------------------------------------------
:: VERIFY FOLDERS EXIST
:: --------------------------------------------
@IF EXIST %PATH-PROJECT% goto :BUILDDOCS
@set ERRORMSG="PATH NOT FOUND "%PATH-PROJECT%
@goto :ERRORHANDLER
:: --------------------------------------------
:: SUBROUTINE:BUILDDOCS
:: --------------------------------------------
:BUILDDOCS
:: --------------------------------------------
:: Hack:Temporary workaround for pre-existing dartdoc-viewer causes "docgen --serve" to fail
:: --------------------------------------------
set ENV-PROJECT-DOCS=%PATH-PROJECT%\dartdoc-viewer
IF EXIST %ENV-PROJECT-DOCS% (
rmdir %ENV-PROJECT-DOCS% /s /q 1> nul
)
set ENV-PROJECT-DOCS=%PATH-PROJECT%\nobackup\docs
IF NOT EXIST %ENV-PROJECT-DOCS% (
mkdir %ENV-PROJECT-DOCS% 1> nul
) ELSE (
del %ENV-PROJECT-DOCS% /s /q 1> nul
)
cd %PATH-PROJECT%
:: <<< Run pub get to get the dependencies >>>
::cmd /c %PATH-DARTSDKBIN%\pub get
cmd /c docgen.bat --serve --verbose --no-include-sdk ^
--include-dependent-packages ^
--out %ENV-PROJECT-DOCS% ^
--package-root=%PATH-PROJECT%\packages ^
--introduction=README.md ^
%PROJECTLIBS%
goto :exit
:: --------------------------------------------
:: SUBROUTINE:ERRORHANDLER
:: --------------------------------------------
:ERRORHANDLER
@echo.
@echo --------------------------------------------
@echo ERROR:%ERRORMSG%
@echo --------------------------------------------
@echo.
:: --------------------------------------------
:: END OF JOB
:: --------------------------------------------
:exit
pause
答案 1 :(得分:0)
只需在命令行末尾添加要添加的每个库文件作为附加参数。