mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #2099 from abarth/deps_hooks
Remove unnecesary DEPS hooks
This commit is contained in:
commit
5efba966c9
21
DEPS
21
DEPS
@ -213,14 +213,6 @@ hooks = [
|
||||
'-s', 'src/buildtools/mac/clang-format.sha1',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'material_design_icons',
|
||||
'pattern': '.',
|
||||
'action': [
|
||||
'python',
|
||||
'src/sky/tools/download_material_design_icons',
|
||||
],
|
||||
},
|
||||
# Pull binutils for linux, enabled debug fission for faster linking /
|
||||
# debugging when used with clang on Ubuntu Precise.
|
||||
# https://code.google.com/p/chromium/issues/detail?id=352046
|
||||
@ -245,19 +237,6 @@ hooks = [
|
||||
'-s', 'src/build/linux/bin/eu-strip.sha1',
|
||||
],
|
||||
},
|
||||
# Run "pub get" on any directories with checked-in pubspec.yaml files
|
||||
# (excluding sky/, whose pubspec.yaml files are not intended for supporting
|
||||
# building in-place in the repo).
|
||||
{
|
||||
'name': 'run_dart_pub_get',
|
||||
'pattern': '',
|
||||
'action': [ 'python',
|
||||
'src/sky/tools/dart_pub_get.py',
|
||||
'--repository-root', '../..',
|
||||
'--dart-sdk-directory',
|
||||
'../../third_party/dart-sdk/dart-sdk'
|
||||
],
|
||||
},
|
||||
{
|
||||
# Ensure that we don't accidentally reference any .pyc files whose
|
||||
# corresponding .py files have already been deleted.
|
||||
|
||||
@ -1,90 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""This script runs "pub get" on all directories within the tree that have
|
||||
pubspec.yaml files.
|
||||
|
||||
See https://www.dartlang.org/tools/pub/get-started.html for information about
|
||||
the pub tool."""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
def pub_get(dart_sdk_path, target_directory, upgrade):
|
||||
cmd = [
|
||||
os.path.join(dart_sdk_path, "bin/pub")
|
||||
]
|
||||
if upgrade:
|
||||
cmd.extend(["upgrade"])
|
||||
else:
|
||||
cmd.extend(["get"])
|
||||
|
||||
try:
|
||||
subprocess.check_output(cmd, shell=False,
|
||||
stderr=subprocess.STDOUT,
|
||||
cwd=target_directory)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print('Error running pub get in %s' % target_directory)
|
||||
print(e.output)
|
||||
raise e
|
||||
|
||||
|
||||
|
||||
def main(repository_root, dart_sdk_path, dirs_to_ignore, upgrade):
|
||||
os.chdir(repository_root)
|
||||
|
||||
# Relativize dart_sdk_path to repository_root.
|
||||
dart_sdk_path_from_root = os.path.join(repository_root,
|
||||
os.path.relpath(dart_sdk_path, repository_root))
|
||||
|
||||
cmd = ["git", "ls-files", "*/pubspec.yaml"]
|
||||
pubspec_yaml_files = subprocess.check_output(cmd,
|
||||
shell=False,
|
||||
stderr=subprocess.STDOUT)
|
||||
|
||||
for f in pubspec_yaml_files.split():
|
||||
ignore = reduce(lambda x, y: x or f.startswith(y), dirs_to_ignore, False)
|
||||
if ignore:
|
||||
continue
|
||||
pub_get(dart_sdk_path_from_root, os.path.dirname(f), upgrade)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Run 'pub get' on all directories with checked-in "
|
||||
"pubspec.yaml files")
|
||||
parser.add_argument("--repository-root",
|
||||
metavar="<repository-root>",
|
||||
type=str,
|
||||
required=True,
|
||||
help="Path to the root of the Git repository, "
|
||||
"specified as a relative path from this directory.")
|
||||
parser.add_argument("--dart-sdk-directory",
|
||||
metavar="<dart-sdk-directory>",
|
||||
type=str,
|
||||
required=True,
|
||||
help="Path to the directory containing the Dart SDK, "
|
||||
"specified as a relative path from this directory.")
|
||||
parser.add_argument("--dirs-to-ignore",
|
||||
metavar="<dir>",
|
||||
nargs="+",
|
||||
default=[],
|
||||
type=str,
|
||||
help="Optional list of directories to ignore, specified "
|
||||
"relative to the root of the repo. 'pub get' will "
|
||||
"not be run for any subdirectories of these "
|
||||
"directories.")
|
||||
parser.add_argument("--upgrade",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Upgrade pub package dependencies")
|
||||
args = parser.parse_args()
|
||||
_current_path = os.path.dirname(os.path.realpath(__file__))
|
||||
_repository_root = os.path.join(_current_path, args.repository_root)
|
||||
_dart_sdk_path = os.path.join(_current_path, args.dart_sdk_directory)
|
||||
sys.exit(
|
||||
main(_repository_root, _dart_sdk_path, args.dirs_to_ignore, args.upgrade))
|
||||
@ -1,5 +0,0 @@
|
||||
name: flutter-pubspec-maintenance
|
||||
dependencies:
|
||||
den_api: ^0.1.0
|
||||
path: ^1.3.6
|
||||
pub_semver: ^1.2.2
|
||||
@ -1,110 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:den_api/den_api.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:pub_semver/pub_semver.dart';
|
||||
|
||||
// set this to true when we decide to ship 0.1.0
|
||||
const bool haveWeEverReleasedAPointRelease = false;
|
||||
|
||||
class FlutterPubspec {
|
||||
static Future<FlutterPubspec> load(String path) async {
|
||||
return new FlutterPubspec.fromPubspec(await Pubspec.load(path));
|
||||
}
|
||||
|
||||
FlutterPubspec.fromPubspec(this._data) {
|
||||
_openPubspecs.add(this);
|
||||
}
|
||||
|
||||
final Pubspec _data;
|
||||
|
||||
String get name => _data.name;
|
||||
Version get version => _data.version;
|
||||
|
||||
PackageDep get asDependency {
|
||||
return new PackageDep(name, 'hosted', version, '');
|
||||
}
|
||||
|
||||
void bumpVersion({ bool breakingChange }) {
|
||||
_data.bump(haveWeEverReleasedAPointRelease && breakingChange ? ReleaseType.minor : ReleaseType.patch);
|
||||
print('$name is now at $version');
|
||||
}
|
||||
|
||||
void setDependency(FlutterPubspec dependency) {
|
||||
_data.addDependency(dependency.asDependency);
|
||||
}
|
||||
|
||||
void setDependencyIfNecessary(FlutterPubspec dependency) {
|
||||
if (_data.dependencies.containsKey(dependency.name))
|
||||
_data.addDependency(dependency.asDependency);
|
||||
}
|
||||
|
||||
void _save() {
|
||||
_data.save();
|
||||
}
|
||||
|
||||
static List<FlutterPubspec> _openPubspecs = <FlutterPubspec>[];
|
||||
static void saveAll() {
|
||||
for (FlutterPubspec file in _openPubspecs)
|
||||
file._save();
|
||||
}
|
||||
}
|
||||
|
||||
main() async {
|
||||
bool breakingChange = true;
|
||||
|
||||
|
||||
// The published packages
|
||||
|
||||
FlutterPubspec flutterEngine = await FlutterPubspec.load('sky/packages/sky_engine')
|
||||
..bumpVersion(breakingChange: breakingChange);
|
||||
|
||||
FlutterPubspec flutterServices = await FlutterPubspec.load('sky/packages/sky_services')
|
||||
..bumpVersion(breakingChange: breakingChange);
|
||||
|
||||
FlutterPubspec flutterFlx = await FlutterPubspec.load('sky/packages/flx')
|
||||
..bumpVersion(breakingChange: breakingChange)
|
||||
..setDependency(flutterServices);
|
||||
|
||||
FlutterPubspec flutter = await FlutterPubspec.load('sky/packages/sky')
|
||||
..bumpVersion(breakingChange: breakingChange)
|
||||
..setDependency(flutterEngine)
|
||||
..setDependency(flutterServices);
|
||||
|
||||
FlutterPubspec flutterSprites = await FlutterPubspec.load('skysprites')
|
||||
..bumpVersion(breakingChange: breakingChange)
|
||||
..setDependency(flutter);
|
||||
|
||||
|
||||
// The internal packages
|
||||
|
||||
await FlutterPubspec.load('sky/packages/updater')
|
||||
..setDependency(flutter)
|
||||
..setDependency(flutterSprites);
|
||||
|
||||
await FlutterPubspec.load('sky/unit')
|
||||
..setDependency(flutter);
|
||||
|
||||
await FlutterPubspec.load('sky/packages/workbench')
|
||||
..setDependency(flutterServices)
|
||||
..setDependency(flutterFlx)
|
||||
..setDependency(flutter)
|
||||
..setDependency(flutterSprites);
|
||||
|
||||
Directory examples = new Directory('examples');
|
||||
await for (FileSystemEntity entity in examples.list(recursive: true, followLinks: false)) {
|
||||
if (entity is File && path.basename(entity.path) == Pubspec.basename) {
|
||||
await FlutterPubspec.load(entity.path)
|
||||
..setDependency(flutter)
|
||||
..setDependencyIfNecessary(flutterSprites);
|
||||
}
|
||||
}
|
||||
|
||||
// we don't update these, since they're their own things and don't depend on
|
||||
// the above packages:
|
||||
// sky/tools/pubspec_maintenance/pubspec.yaml
|
||||
// sky/packages/material_design_icons/pubspec.yaml
|
||||
|
||||
FlutterPubspec.saveAll();
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user