mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 13:35:05 +00:00
Remove package root target and support scripts
BUG=https://github.com/dart-lang/sdk/issues/23565 R=kustermann@google.com Review URL: https://codereview.chromium.org/2346163005 .
This commit is contained in:
parent
3bdc62bfe3
commit
0695b1db3a
12
dart.gyp
12
dart.gyp
|
@ -13,7 +13,6 @@
|
|||
'dart2js',
|
||||
'dartanalyzer',
|
||||
'dartdevc',
|
||||
'packages',
|
||||
'runtime',
|
||||
'samples',
|
||||
],
|
||||
|
@ -29,7 +28,6 @@
|
|||
'runtime/dart-runtime.gyp:dart_bootstrap#host',
|
||||
'runtime/dart-runtime.gyp:run_vm_tests',
|
||||
'runtime/dart-runtime.gyp:process_test',
|
||||
'packages',
|
||||
'runtime/dart-runtime.gyp:test_extension',
|
||||
'runtime/dart-runtime.gyp:sample_extension',
|
||||
],
|
||||
|
@ -43,7 +41,6 @@
|
|||
'dependencies': [
|
||||
'runtime/dart-runtime.gyp:dart_precompiled_runtime',
|
||||
'runtime/dart-runtime.gyp:dart_bootstrap#host',
|
||||
'packages',
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -58,7 +55,6 @@
|
|||
'runtime/dart-runtime.gyp:dart_bootstrap#host',
|
||||
'runtime/dart-runtime.gyp:run_vm_tests',
|
||||
'runtime/dart-runtime.gyp:process_test',
|
||||
'packages',
|
||||
'runtime/dart-runtime.gyp:test_extension',
|
||||
'runtime/dart-runtime.gyp:sample_extension',
|
||||
],
|
||||
|
@ -113,7 +109,6 @@
|
|||
'type': 'none',
|
||||
'dependencies': [
|
||||
'create_sdk',
|
||||
'packages',
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -129,12 +124,5 @@
|
|||
],
|
||||
]
|
||||
},
|
||||
{
|
||||
'target_name': 'packages',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'pkg/pkg.gyp:pkg_packages',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
35
pkg/BUILD.gn
35
pkg/BUILD.gn
|
@ -1,35 +0,0 @@
|
|||
# Copyright (c) 2016, 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.
|
||||
|
||||
action("pkg") {
|
||||
# TODO(zra): Add third_party/pkg, third_party/pkg_tested, and
|
||||
# third_party/observatory_pub_packages/packages/charted/lib.
|
||||
list_script = "../tools/list_pkg_directories.py"
|
||||
pkg_list = exec_script(list_script, [rebase_path(".")], "list lines")
|
||||
runtime_list = exec_script(
|
||||
list_script, [rebase_path("../runtime")], "list lines")
|
||||
|
||||
inputs = pkg_list +
|
||||
runtime_list +
|
||||
[rebase_path("../sdk/lib/_internal/js_runtime/lib"),
|
||||
rebase_path("../sdk/lib/_internal/sdk_library_metadata/lib"),]
|
||||
|
||||
timestamp_file = "$target_gen_dir/packages.stamp"
|
||||
outputs = [
|
||||
timestamp_file,
|
||||
"$root_out_dir/.packages",
|
||||
]
|
||||
|
||||
script = "../tools/make_links.py"
|
||||
args = [
|
||||
"--create-links",
|
||||
"--create-package-file",
|
||||
"--quiet",
|
||||
"--timestamp_file",
|
||||
rebase_path(timestamp_file),
|
||||
] + inputs +
|
||||
# Pub imports dart2js as compiler_unsupported so it can work outside
|
||||
# the SDK. Map that to the compiler package.
|
||||
[rebase_path("compiler/lib") + ":compiler_unsupported",]
|
||||
}
|
45
pkg/pkg.gyp
45
pkg/pkg.gyp
|
@ -1,45 +0,0 @@
|
|||
# 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.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'pkg_packages',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'make_pkg_packages',
|
||||
'inputs': [
|
||||
'../tools/make_links.py',
|
||||
'<!@(["python", "../tools/list_pkg_directories.py", "."])',
|
||||
# Exclude DDC's old location in case folks didn't remove it.
|
||||
'<!@(["python", "../tools/list_pkg_directories.py", '
|
||||
'"../third_party/pkg", "--exclude=dev_compiler"])',
|
||||
'<!@(["python", "../tools/list_pkg_directories.py", '
|
||||
'"../third_party/pkg_tested"])',
|
||||
'<!@(["python", "../tools/list_pkg_directories.py", '
|
||||
'"../runtime"])',
|
||||
'../sdk/lib/_internal/js_runtime/lib',
|
||||
'../sdk/lib/_internal/sdk_library_metadata/lib',
|
||||
'../third_party/observatory_pub_packages/packages/charted/lib',
|
||||
],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<(PRODUCT_DIR)/.packages',
|
||||
],
|
||||
'action': [
|
||||
'python', '../tools/make_links.py', '--create-links',
|
||||
'--create-package-file',
|
||||
'--timestamp_file=<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<(PRODUCT_DIR)',
|
||||
'<@(_inputs)',
|
||||
# Pub imports dart2js as compiler_unsupported so it can work outside
|
||||
# the SDK. Map that to the compiler package.
|
||||
'compiler/lib:compiler_unsupported'
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
|
@ -467,7 +467,6 @@ if (defined(is_fuchsia) && is_fuchsia) {
|
|||
"../vm:libdart_platform",
|
||||
"..:libdart",
|
||||
":dart_snapshot_cc",
|
||||
"../../pkg:pkg", # Pull this out to top-level for a real SDK build.
|
||||
"//third_party/zlib",
|
||||
]
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ set -v
|
|||
set -x
|
||||
cd src
|
||||
ninja -C out/Release forwarder2
|
||||
ninja -C out/Release pkg_packages
|
||||
cp -R out/Release/packages out/ReleaseARM
|
||||
export PATH=$PATH:third_party/android_tools/sdk/platform-tools/\
|
||||
:third_party/android_tools/sdk/tools/
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ ALL_TARGETS = [
|
|||
'content_shell',
|
||||
'chrome',
|
||||
'blink_tests',
|
||||
'pkg_packages',
|
||||
]
|
||||
|
||||
def main():
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# 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.
|
||||
|
||||
"""Tool for listing the directories under pkg, with their lib directories.
|
||||
Used in pkg.gyp. Lists all of the directories in the directory passed in as an
|
||||
argument to this script which have a lib subdirectory.
|
||||
|
||||
Usage:
|
||||
python tools/list_pkg_directories.py OPTIONS DIRECTORY
|
||||
"""
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
def get_options():
|
||||
result = optparse.OptionParser()
|
||||
result.add_option("--exclude",
|
||||
help='A comma-separated list of directory names to exclude.')
|
||||
return result.parse_args()
|
||||
|
||||
def main(argv):
|
||||
(options, args) = get_options()
|
||||
directory = args[0]
|
||||
exclude = options.exclude.split(',') if options.exclude else []
|
||||
|
||||
paths = [
|
||||
path + '/lib' for path in os.listdir(directory)
|
||||
if path not in exclude and os.path.isdir(os.path.join(directory, path))
|
||||
]
|
||||
|
||||
for lib in filter(lambda x: os.path.exists(os.path.join(directory, x)),
|
||||
paths):
|
||||
print '%s/%s' % (directory, lib)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
|
@ -1,161 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# 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.
|
||||
|
||||
|
||||
"""Tool for creating symlinks from SOURCES to TARGET.
|
||||
|
||||
For each SOURCE in SOURCES create a link from SOURCE to TARGET. If a
|
||||
SOURCE ends with .../lib, the lib suffix is ignored when determining
|
||||
the name of the target link.
|
||||
|
||||
If a SOURCE contains ":", the left side is the path and the right side is the
|
||||
name of the package symlink.
|
||||
|
||||
Before creating any links, the old entries of the TARGET directory will be
|
||||
removed.
|
||||
|
||||
Usage:
|
||||
python tools/make_links.py OPTIONS TARGET SOURCES...
|
||||
|
||||
"""
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib
|
||||
import urlparse
|
||||
import utils
|
||||
|
||||
# Useful messages when we find orphaned checkouts.
|
||||
old_directories = {
|
||||
'package_config': 'Please remove third_party/pkg/package_config.',
|
||||
'analyzer_cli': 'Please remove third_party/pkg/analyzer_cli.'}
|
||||
|
||||
def get_options():
|
||||
result = optparse.OptionParser()
|
||||
result.add_option("--timestamp_file", "",
|
||||
help='Create a timestamp file when done creating the links.',
|
||||
default='')
|
||||
result.add_option("-q", "--quiet",
|
||||
help="Don't print any messages",
|
||||
action="store_true",
|
||||
dest="quiet",
|
||||
default=False)
|
||||
result.add_option("--create-links",
|
||||
help='Create links to the package lib directories in "packages/".',
|
||||
action='store_false',
|
||||
default=True)
|
||||
result.add_option("--create-package-file",
|
||||
help='Create a ".packages" file pointing to the packages.',
|
||||
action='store_false',
|
||||
default=True)
|
||||
|
||||
return result.parse_args()
|
||||
|
||||
def make_link(quiet, source, target, orig_source):
|
||||
if os.path.islink(target):
|
||||
if not quiet:
|
||||
print 'Removing %s' % target
|
||||
sys.stdout.flush()
|
||||
os.unlink(target)
|
||||
|
||||
if os.path.isdir(target):
|
||||
if not quiet:
|
||||
print 'Removing %s' % target
|
||||
sys.stdout.flush()
|
||||
os.rmdir(target)
|
||||
|
||||
if os.path.isfile(orig_source):
|
||||
if not quiet:
|
||||
print 'Copying file from %s to %s' % (orig_source, target)
|
||||
sys.stdout.flush()
|
||||
shutil.copyfile(orig_source, target)
|
||||
return 0
|
||||
else:
|
||||
if not quiet:
|
||||
print 'Creating link from %s to %s' % (source, target)
|
||||
sys.stdout.flush()
|
||||
|
||||
if utils.GuessOS() == 'win32':
|
||||
return subprocess.call(['mklink', '/j', target, source], shell=True)
|
||||
else:
|
||||
return subprocess.call(['ln', '-s', source, target])
|
||||
|
||||
def create_timestamp_file(options):
|
||||
if options.timestamp_file != '':
|
||||
dir_name = os.path.dirname(options.timestamp_file)
|
||||
if not os.path.exists(dir_name):
|
||||
os.mkdir(dir_name)
|
||||
open(options.timestamp_file, 'w').close()
|
||||
|
||||
def main(argv):
|
||||
(options, args) = get_options()
|
||||
target_dir = os.path.relpath(args[0])
|
||||
target = os.path.join(target_dir, 'packages')
|
||||
if os.path.exists(target):
|
||||
# If the packages directory already exists, delete the current links in
|
||||
# it. This is necessary, otherwise we can end up having links in there
|
||||
# pointing to directories which no longer exist (on incremental builds).
|
||||
for link in os.listdir(target):
|
||||
full_link = os.path.join(target, link)
|
||||
if os.path.isdir(full_link) and utils.IsWindows():
|
||||
# It seems like python on Windows is treating pseudo symlinks to
|
||||
# directories as directories.
|
||||
os.rmdir(full_link)
|
||||
else:
|
||||
os.remove(full_link)
|
||||
else:
|
||||
os.makedirs(target)
|
||||
target = os.path.join(target_dir, '.packages')
|
||||
if os.path.exists(target):
|
||||
os.remove(target)
|
||||
|
||||
linked_names = {};
|
||||
package_file_contents = '# .package file created by tools/make_links.py\n'
|
||||
for source in args[1:]:
|
||||
# Assume the source directory is named ".../NAME/lib".
|
||||
split = source.split(':')
|
||||
name = None
|
||||
if len(split) == 2: (source, name) = split
|
||||
|
||||
(path, lib) = os.path.split(source)
|
||||
if lib != 'lib':
|
||||
path = source
|
||||
# Remove any additional path components preceding NAME, if one wasn't
|
||||
# specified explicitly.
|
||||
if not name: (_, name) = os.path.split(path)
|
||||
# We have an issue with left-behind checkouts in third_party/pkg and
|
||||
# third_party/pkg_tested when we move entries in DEPS. This reports them.
|
||||
if name in linked_names:
|
||||
print 'Duplicate directory %s is linked to both %s and %s.' % (
|
||||
name, linked_names[name], path)
|
||||
if name in old_directories:
|
||||
print old_directories[name]
|
||||
return 1
|
||||
linked_names[name] = path
|
||||
orig_source = source
|
||||
if options.create_links:
|
||||
if utils.GuessOS() == 'win32':
|
||||
source = os.path.relpath(source)
|
||||
else:
|
||||
source = os.path.relpath(source, start=target)
|
||||
exit_code = make_link(options.quiet,
|
||||
source, os.path.join(target, name), orig_source)
|
||||
if exit_code != 0:
|
||||
return exit_code
|
||||
abs_source = os.path.abspath(orig_source)
|
||||
source_url = urlparse.urljoin('file:', urllib.pathname2url(abs_source))
|
||||
package_file_contents += '%s:%s\n' % (name, source_url)
|
||||
if options.create_package_file:
|
||||
with open(os.path.join(target_dir, '.packages'), 'w') as package_file:
|
||||
package_file.write(package_file_contents)
|
||||
create_timestamp_file(options)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
|
@ -17,7 +17,6 @@
|
|||
'inputs': [
|
||||
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
|
||||
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/pkg_files.stamp',
|
||||
],
|
||||
'outputs': [
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../runtime/lib", "../../sdk/lib/_internal/dartdoc"])',
|
||||
'create_snapshot.dart',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/dart2js_files.stamp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'../../tools/VERSION',
|
||||
],
|
||||
'outputs': [
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
'inputs': [
|
||||
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
|
||||
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/analyzer_cli"])',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/analyzer"])',
|
||||
],
|
||||
|
@ -33,7 +32,6 @@
|
|||
'action_name': 'generate_summary_spec',
|
||||
'inputs': [
|
||||
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../sdk/lib"])',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/analyzer"])',
|
||||
],
|
||||
|
@ -51,7 +49,6 @@
|
|||
'action_name': 'generate_summary_strong',
|
||||
'inputs': [
|
||||
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../sdk/lib"])',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/analyzer"])',
|
||||
],
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
|
||||
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/dev_compiler/bin"])',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/pkg_files.stamp',
|
||||
],
|
||||
'outputs': [
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
'inputs': [
|
||||
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
|
||||
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../third_party/pkg/dartdoc"])',
|
||||
],
|
||||
'outputs': [
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
'inputs': [
|
||||
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
|
||||
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../third_party/pkg_tested/dart_style"])',
|
||||
],
|
||||
'outputs': [
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/dart2js_files.stamp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/pkg_files.stamp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/pub.dart.snapshot',
|
||||
|
|
Loading…
Reference in a new issue