mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:31:50 +00:00
Changed pkg option to package-root.
pkg will remain in a deprecated state for the time being. Review URL: https://codereview.chromium.org//13421002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20808 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
d52c9fe5f1
commit
8a8de00b90
|
@ -39,7 +39,7 @@ main() {
|
|||
|
||||
final Path libPath = scriptDir.append('../../../../');
|
||||
|
||||
Path pkgPath;
|
||||
Path packageRoot;
|
||||
|
||||
argParser.addFlag('no-code',
|
||||
help: 'Do not include source code in the documentation.',
|
||||
|
@ -160,12 +160,22 @@ main() {
|
|||
}
|
||||
}, allowMultiple: true);
|
||||
|
||||
argParser.addOption('pkg',
|
||||
argParser.addOption('package-root',
|
||||
help: 'Sets the package directory to the specified directory.\n'
|
||||
'If omitted the package directory is the SDK pkg/ dir',
|
||||
callback: (pkgDir) {
|
||||
if(pkgDir != null) {
|
||||
pkgPath = new Path(pkgDir);
|
||||
'If omitted the package directory is the closest packages directory to'
|
||||
' the entrypoint.',
|
||||
callback: (packageDir) {
|
||||
if(packageDir != null) {
|
||||
packageRoot = new Path(packageDir);
|
||||
}
|
||||
});
|
||||
|
||||
// TODO(amouravski): This method is deprecated. Remove on April 22.
|
||||
argParser.addOption('pkg',
|
||||
help: 'Deprecated: same as --package-root.',
|
||||
callback: (packageDir) {
|
||||
if(packageDir != null) {
|
||||
packageRoot = new Path(packageDir);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -210,13 +220,13 @@ main() {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if (pkgPath == null) {
|
||||
if (packageRoot == null) {
|
||||
// Check if there's a `packages` directory in the entry point directory.
|
||||
var script = path.normalize(path.absolute(entrypoints[0].toNativePath()));
|
||||
var dir = path.join(path.dirname(script), 'packages/');
|
||||
if (new Directory(dir).existsSync()) {
|
||||
// TODO(amouravski): convert all of dartdoc to use pathos.
|
||||
pkgPath = new Path(dir);
|
||||
packageRoot = new Path(dir);
|
||||
} else {
|
||||
// If there is not, then check if the entrypoint is somewhere in a `lib`
|
||||
// directory.
|
||||
|
@ -224,7 +234,7 @@ main() {
|
|||
var parts = path.split(dir);
|
||||
var libDir = parts.lastIndexOf('lib');
|
||||
if (libDir > 0) {
|
||||
pkgPath = new Path(path.join(path.joinAll(parts.take(libDir)),
|
||||
packageRoot = new Path(path.join(path.joinAll(parts.take(libDir)),
|
||||
'packages'));
|
||||
}
|
||||
}
|
||||
|
@ -233,7 +243,7 @@ main() {
|
|||
cleanOutputDirectory(dartdoc.outputDir);
|
||||
|
||||
// Start the analysis and documentation.
|
||||
dartdoc.documentLibraries(entrypoints, libPath, pkgPath)
|
||||
dartdoc.documentLibraries(entrypoints, libPath, packageRoot)
|
||||
.then((_) {
|
||||
print('Copying static files...');
|
||||
Future.wait([
|
||||
|
|
|
@ -403,15 +403,15 @@ class Dartdoc {
|
|||
return content;
|
||||
}
|
||||
|
||||
Future documentEntryPoint(Path entrypoint, Path libPath, Path pkgPath) {
|
||||
return documentLibraries(<Path>[entrypoint], libPath, pkgPath);
|
||||
Future documentEntryPoint(Path entrypoint, Path libPath, Path packageRoot) {
|
||||
return documentLibraries(<Path>[entrypoint], libPath, packageRoot);
|
||||
}
|
||||
|
||||
Future documentLibraries(List<Path> libraryList, Path libPath, Path pkgPath) {
|
||||
Future documentLibraries(List<Path> libraryList, Path libPath, Path packageRoot) {
|
||||
// TODO(amouravski): make all of these print statements into logging
|
||||
// statements.
|
||||
print('Analyzing libraries...');
|
||||
return dart2js.analyze(libraryList, libPath, packageRoot: pkgPath,
|
||||
return dart2js.analyze(libraryList, libPath, packageRoot: packageRoot,
|
||||
options: COMPILER_OPTIONS)
|
||||
.then((MirrorSystem mirrors) {
|
||||
print('Generating documentation...');
|
||||
|
|
|
@ -37,7 +37,7 @@ void main() {
|
|||
|
||||
List<String> excludedLibraries = <String>[];
|
||||
List<String> includedLibraries = <String>[];
|
||||
Path pkgPath;
|
||||
Path packageRoot;
|
||||
String version;
|
||||
|
||||
// Parse the command-line arguments.
|
||||
|
@ -64,8 +64,8 @@ void main() {
|
|||
includedLibraries.add(arg.substring('--include-lib='.length));
|
||||
} else if (arg.startsWith('--out=')) {
|
||||
outputDir = new Path(arg.substring('--out='.length));
|
||||
} else if (arg.startsWith('--pkg=')) {
|
||||
pkgPath = new Path(arg.substring('--pkg='.length));
|
||||
} else if (arg.startsWith('--package-root=')) {
|
||||
packageRoot = new Path(arg.substring('--package-root='.length));
|
||||
} else if (arg.startsWith('--version=')) {
|
||||
version = arg.substring('--version='.length);
|
||||
} else {
|
||||
|
@ -147,7 +147,8 @@ void main() {
|
|||
|
||||
// TODO(amouravski): make apidoc use roughly the same flow as bin/dartdoc.
|
||||
Future.wait([copiedStatic, copiedApiDocStatic, htmlDiff])
|
||||
.then((_) => apidoc.documentLibraries(apidocLibraries, libPath, pkgPath))
|
||||
.then((_) => apidoc.documentLibraries( apidocLibraries, libPath,
|
||||
packageRoot))
|
||||
.then((_) => compileScript(mode, outputDir, libPath))
|
||||
.then((_) => print(apidoc.status))
|
||||
.catchError((e) => print('Error: generation failed: ${e.error}'))
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
'apidoc.dart',
|
||||
'--out=<(PRODUCT_DIR)/api_docs',
|
||||
'--version=<!@(["python", "../../tools/print_version.py"])',
|
||||
'--pkg=<(PRODUCT_DIR)/packages',
|
||||
'--package-root=<(PRODUCT_DIR)/packages',
|
||||
'--mode=static',
|
||||
'--exclude-lib=analyzer_experimental',
|
||||
'--exclude-lib=browser',
|
||||
|
|
Loading…
Reference in a new issue