mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:07:11 +00:00
Use relative symlinks for self links and secondary "packages" dirs.
This lets you move a package directory without breaking all of those links. BUG=http://code.google.com/p/dart/issues/detail?id=8342 Review URL: https://codereview.chromium.org//12321020 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18785 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
e28a669679
commit
8b37852e8a
3 changed files with 66 additions and 2 deletions
|
@ -232,7 +232,7 @@ class Entrypoint {
|
|||
if (entryExists(linkPath)) return;
|
||||
ensureDir(packagesDir);
|
||||
return createPackageSymlink(root.name, root.dir, linkPath,
|
||||
isSelfLink: true);
|
||||
isSelfLink: true, relative: true);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ class Entrypoint {
|
|||
return defer(() {
|
||||
var symlink = path.join(dir, 'packages');
|
||||
if (entryExists(symlink)) return;
|
||||
return createSymlink(packagesDir, symlink);
|
||||
return createSymlink(packagesDir, symlink, relative: true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import '../../../../pkg/unittest/lib/unittest.dart';
|
|||
import '../test_pub.dart';
|
||||
|
||||
main() {
|
||||
initConfig();
|
||||
|
||||
group('requires', () {
|
||||
integration('a pubspec', () {
|
||||
dir(appPath, []).scheduleCreate();
|
||||
|
|
62
utils/tests/pub/install/relative_symlink_test.dart
Normal file
62
utils/tests/pub/install/relative_symlink_test.dart
Normal file
|
@ -0,0 +1,62 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
library pub_tests;
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import '../../../../pkg/unittest/lib/unittest.dart';
|
||||
import '../test_pub.dart';
|
||||
|
||||
main() {
|
||||
// Pub uses NTFS junction points to create links in the packages directory.
|
||||
// These (unlike the symlinks that are supported in Vista and later) do not
|
||||
// support relative paths. So this test, by design, will not pass on Windows.
|
||||
// So just skip it.
|
||||
if (Platform.operatingSystem == "windows") return;
|
||||
|
||||
initConfig();
|
||||
integration('uses a relative symlink for the self link', () {
|
||||
dir(appPath, [
|
||||
appPubspec([]),
|
||||
libDir('foo')
|
||||
]).scheduleCreate();
|
||||
|
||||
schedulePub(args: ['install'],
|
||||
output: new RegExp(r"Dependencies installed!$"));
|
||||
|
||||
scheduleRename(appPath, "moved");
|
||||
|
||||
dir("moved", [
|
||||
dir("packages", [
|
||||
dir("myapp", [
|
||||
file('foo.dart', 'main() => "foo";')
|
||||
])
|
||||
])
|
||||
]).scheduleValidate();
|
||||
});
|
||||
|
||||
integration('uses a relative symlink for secondary packages directory', () {
|
||||
dir(appPath, [
|
||||
appPubspec([]),
|
||||
libDir('foo'),
|
||||
dir("bin")
|
||||
]).scheduleCreate();
|
||||
|
||||
schedulePub(args: ['install'],
|
||||
output: new RegExp(r"Dependencies installed!$"));
|
||||
|
||||
scheduleRename(appPath, "moved");
|
||||
|
||||
dir("moved", [
|
||||
dir("bin", [
|
||||
dir("packages", [
|
||||
dir("myapp", [
|
||||
file('foo.dart', 'main() => "foo";')
|
||||
])
|
||||
])
|
||||
])
|
||||
]).scheduleValidate();
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue