@@ -23,8 +23,20 @@ void main() {
23
23
FakePackageConfigProvider packageConfigProvider;
24
24
PackageGraph packageGraph;
25
25
26
+ /// Dartdoc has a few indicator files it uses to verify that a directory
27
+ /// represents a Dart SDK. These include "bin/dart" and "bin/pub".
28
+ void writeSdkBinFiles (Folder root) {
29
+ var sdkBinFolder = root.getChildAssumingFolder ('bin' )..create ();
30
+ sdkBinFolder.getChildAssumingFile ('dart' ).writeAsStringSync ('' );
31
+ sdkBinFolder.getChildAssumingFile ('pub' ).writeAsStringSync ('' );
32
+ }
33
+
26
34
void writeSdk () {
27
35
mockSdk = MockSdk (resourceProvider: resourceProvider);
36
+ // The [MockSdk] only works in non-canonicalized paths, which include
37
+ // "C:\sdk", on Windows. Howerver, dartdoc works almost exclusively with
38
+ // canonical paths ("c:\sdk"). Copy all MockSdk files to the canonicalized
39
+ // path.
28
40
for (var l in mockSdk.sdkLibraries) {
29
41
var p = l.path;
30
42
resourceProvider
@@ -35,17 +47,18 @@ void main() {
35
47
.canonicalize (resourceProvider.convertPath (sdkRoot)))
36
48
..create ();
37
49
sdkFolder.getChildAssumingFile ('version' ).writeAsStringSync ('2.9.0' );
38
- var sdkBinFolder = sdkFolder.getChildAssumingFolder ('bin' )..create ();
39
- sdkBinFolder.getChildAssumingFile ('dart' ).writeAsStringSync ('' );
40
- sdkBinFolder.getChildAssumingFile ('pub' ).writeAsStringSync ('' );
41
50
42
- var sdkFolderNonCanon = resourceProvider
51
+ writeSdkBinFiles (sdkFolder);
52
+ writeSdkBinFiles (
53
+ resourceProvider.getFolder (resourceProvider.convertPath (sdkRoot)));
54
+
55
+ /*var sdkFolderNonCanon = resourceProvider
43
56
.getFolder(resourceProvider.convertPath(sdkRoot))
44
57
..create();
45
58
var sdkBinFolderNonCanon = sdkFolderNonCanon.getChildAssumingFolder('bin')
46
59
..create();
47
60
sdkBinFolderNonCanon.getChildAssumingFile('dart').writeAsStringSync('');
48
- sdkBinFolderNonCanon.getChildAssumingFile ('pub' ).writeAsStringSync ('' );
61
+ sdkBinFolderNonCanon.getChildAssumingFile('pub').writeAsStringSync('');*/
49
62
}
50
63
51
64
void writePackage () {
@@ -60,7 +73,6 @@ void main() {
60
73
name: $packageName
61
74
version: 0.0.1
62
75
''' );
63
- projectFolder.getChildAssumingFolder ('.dart_tool' ).create ();
64
76
projectFolder
65
77
.getChildAssumingFolder ('.dart_tool' )
66
78
.getChildAssumingFile ('package_config.json' )
0 commit comments