Skip to content

dependency_services #3304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 44 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f535cf7
WIP
sigurdm Sep 27, 2021
142ae7a
initial commit
sigurdm Sep 27, 2021
7d7e6bc
work work
sigurdm Sep 27, 2021
f6cf2e6
Merge branch 'master' of https://github.com/dart-lang/pub into depend…
jonasfj Sep 27, 2021
0bc8a3d
Fixed issues after merging master
jonasfj Sep 27, 2021
c1d4131
Merge branch 'dependency_services' of https://github.com/sigurdm/pub …
jonasfj Sep 27, 2021
b69089b
Fixed tests
jonasfj Sep 27, 2021
ef220ae
cleanup
jonasfj Sep 28, 2021
50910ca
Deleted packages are transitive
sigurdm Sep 28, 2021
9d29da6
Merge remote-tracking branch 'origin/dependency_services' into depend…
sigurdm Sep 28, 2021
dd6b7aa
Handle missing pubspec.lock
sigurdm Sep 28, 2021
4ccaca8
Fix
sigurdm Sep 28, 2021
f307524
changes -> dependencyChanges
sigurdm Sep 28, 2021
4c46ede
Remove noise from output
sigurdm Sep 28, 2021
400e1ce
Remove noise from output
sigurdm Sep 28, 2021
c5c4874
Merge
sigurdm Nov 2, 2021
bf5fe87
Improve tests
sigurdm Nov 4, 2021
38a5db1
Make bin/dependency_services.dart
sigurdm Nov 5, 2021
2bca192
Fix multibreaking
sigurdm Nov 5, 2021
0a7db13
Fix resolution after applying
sigurdm Nov 5, 2021
744e0af
Add missing file
sigurdm Nov 8, 2021
4c58440
Don't stringify null
sigurdm Nov 8, 2021
0f1be7b
Report previous versions
sigurdm Nov 16, 2021
652ea7a
single-breaking -> singleBreaking, multi-breaking -> multiBreaking
sigurdm Nov 16, 2021
b8ed240
dependency_services list will do resolution if no pubspec.lock
sigurdm Nov 16, 2021
bb3a965
dependency_servicapply will not modify a non-existing pubspec.lock
sigurdm Nov 16, 2021
ef17602
Fix bug in compatible (#3242)
sigurdm Nov 30, 2021
2ceb96a
Handle explicit constraints (#3254)
sigurdm Dec 10, 2021
0a6252c
Merge dependency services (#3303)
sigurdm Feb 4, 2022
bb4af2b
Revert "Merge dependency services (#3303)"
sigurdm Feb 4, 2022
1e09526
Merge remote-tracking branch 'origin/master' into dependency_services
sigurdm Feb 4, 2022
0155d4d
fixes after merge
sigurdm Feb 4, 2022
bb68e48
fixes
sigurdm Feb 7, 2022
94dbcf8
simplify snapshot creation in tests
sigurdm Feb 7, 2022
05a01a3
lints
sigurdm Feb 7, 2022
0810567
fix some quoting
sigurdm Feb 7, 2022
df70de4
Start processing stdout/stderr while process is running
sigurdm Feb 8, 2022
46e56e0
Update bin/dependency_services.dart
sigurdm Feb 10, 2022
ef4407c
Improve docstring lib/src/system_cache.dart
sigurdm Feb 10, 2022
06bb088
Make private
sigurdm Feb 10, 2022
469aa6a
Simplify verbosity
sigurdm Feb 10, 2022
4955934
Better name protectArgument -> escapeShellArgument
sigurdm Feb 10, 2022
8ec754f
remove default value for argument
sigurdm Feb 10, 2022
984fec8
Check for removal of non-existing package. Improve tests
sigurdm Feb 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions bin/dependency_services.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright (c) 2021, 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.

/// Support for automated upgrades.
///
/// For now this is not a finalized interface. Don't rely on this.
library dependency_services;

import 'dart:async';

import 'package:args/args.dart';
import 'package:args/command_runner.dart';
import 'package:pub/src/command.dart';
import 'package:pub/src/command/dependency_services.dart';
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:pub/src/io.dart';
import 'package:pub/src/log.dart' as log;

class _DependencyServicesCommandRunner extends CommandRunner<int>
implements PubTopLevel {
@override
String? get directory => argResults['directory'];

@override
bool get captureStackChains => argResults['verbose'];

@override
bool get trace => argResults['verbose'];

ArgResults? _argResults;

/// The top-level options parsed by the command runner.
@override
ArgResults get argResults {
final a = _argResults;
if (a == null) {
throw StateError(
'argResults cannot be used before Command.run is called.');
}
return a;
}

_DependencyServicesCommandRunner()
: super('dependency_services', 'Support for automatic upgrades',
usageLineLength: lineLength) {
argParser.addFlag('verbose',
abbr: 'v', negatable: false, help: 'Shortcut for "--verbosity=all".');
argParser.addOption(
'directory',
abbr: 'C',
help: 'Run the subcommand in the directory<dir>.',
defaultsTo: '.',
valueHelp: 'dir',
);

addCommand(DependencyServicesListCommand());
addCommand(DependencyServicesReportCommand());
addCommand(DependencyServicesApplyCommand());
}

@override
Future<int> run(Iterable<String> args) async {
try {
_argResults = parse(args);
return await runCommand(argResults) ?? exit_codes.SUCCESS;
} on UsageException catch (error) {
log.exception(error);
return exit_codes.USAGE;
}
}

@override
void printUsage() {
log.message(usage);
}

@override
log.Verbosity get verbosity => log.Verbosity.normal;
}

Future<void> main(List<String> arguments) async {
await flushThenExit(await _DependencyServicesCommandRunner().run(arguments));
}
3 changes: 1 addition & 2 deletions lib/src/command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:meta/meta.dart';
import 'package:path/path.dart' as p;

import 'authentication/token_store.dart';
import 'command_runner.dart';
import 'entrypoint.dart';
import 'exceptions.dart';
import 'exit_codes.dart' as exit_codes;
Expand Down Expand Up @@ -127,7 +126,7 @@ abstract class PubCommand extends Command<int> {
}

PubTopLevel get _pubTopLevel =>
_pubEmbeddableCommand ?? runner as PubCommandRunner;
_pubEmbeddableCommand ?? runner as PubTopLevel;

PubAnalytics? get analytics => _pubEmbeddableCommand?.analytics;

Expand Down
Loading