4

我正在尝试生成飞镖代码的文档。我注意到我无法通过 DartDoc 生成任何文档,因为在我的库中我有时需要导入一些外部库。

下面我有一个小例子来说明我的实际问题。

列表控制器.dart

part of controllers;

@NgController (
    selector: '[list-control]',
    publishAs: 'listCtrl'
)
class ListController {

}

控制器.dart

library controllers;

import 'package:angular/angular.dart';

part 'listController.dart';

控制台上的最终结果

Running dartdoc...
Using snapshot /Users/ecomtemarois/Downloads/dart/dart-sdk/bin/snapshots/utils_wrapper.dart.snapshot
Analyzing libraries...
../../../Documents/ecash.dart/ecash/controllers/controllers.dart:3:8: Error: Can't read 'package:angular/angular.dart' (Error reading 'packages/angular/angular.dart' (OS Error: No such file or directory, errno = 2)).
import 'package:angular/angular.dart';
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../Documents/ecash.dart/ecash/controllers/listController.dart:3:2: Error: Cannot resolve 'NgController'.
@NgController (
 ^^^^^^^^^^^^
../../../Documents/ecash.dart/ecash/controllers/listController.dart:3:1: Error: Not a compile-time constant.
@NgController (
^^^^^^^^^^^^^^^^
Error: generation failed: Bad state: Failed to create mirror system.
StackTrace: #0      analyze.<anonymous closure> (file:///Volumes/data/b/build/slave/dart-editor-mac-trunk/build/dart/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart:232)
#1      _Future._propagateToListeners.<anonymous closure> (dart:async/future_impl.dart:457)
#2      _rootRun (dart:async/zone.dart:720)
#3      _RootZone.run (dart:async/zone.dart:862)
#4      _Future._propagateToListeners (dart:async/future_impl.dart:449)
#5      _Future._complete (dart:async/future_impl.dart:302)
#6      Future.forEach.nextElement (dart:async/future.dart:269)
#7      _Future._propagateToListeners.<anonymous closure> (dart:async/future_impl.dart:457)
#8      _rootRun (dart:async/zone.dart:720)
#9      _RootZone.run (dart:async/zone.dart:862)
#10     _Future._propagateToListeners (dart:async/future_impl.dart:449)
#11     _Future._complete (dart:async/future_impl.dart:302)
#12     Future.forEach.nextElement (dart:async/future.dart:269)
#13     _Future._propagateToListeners.<anonymous closure> (dart:async/future_impl.dart:457)
#14     _rootRun (dart:async/zone.dart:720)
#15     _RootZone.run (dart:async/zone.dart:862)
#16     _Future._propagateToListeners (dart:async/future_impl.dart:449)
#17     _Future._complete (dart:async/future_impl.dart:302)
#18     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:358)
#19     _asyncRunCallback (dart:async/schedule_microtask.dart:18)
#20     _createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:11)
#21     _Timer._createTimerHandler._handleTimeout (timer_impl.dart:151)
#22     _Timer._createTimerHandler.<anonymous closure> (timer_impl.dart:166)
#23     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:93)

我想知道如何能够访问这些包并且仍然能够生成文档。

谢谢

4

1 回答 1

1

packages看起来您的 dart 文件旁边没有目录。如果您使用Pub,则应使用pub get命令创建此目录。如果你不这样做,你可以提供你的的路径--package-root=<path>选项。

注意:查看您的路径 ( ../../../Documents/ecash.dart/ecash/controllers/listController.dart),您似乎没有遵循包布局约定。我会建议遵循它。

于 2013-11-15T14:27:04.463 回答