Skip to content

Commit

Permalink
Remove more 'pub' references from analyzer/ and analysis_server/.
Browse files Browse the repository at this point in the history
Bug: #48682
Change-Id: If8821f92b10e7f65b590911fceedd79b54dfec08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240940
Reviewed-by: Samuel Rawlins <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
  • Loading branch information
scheglov authored and Commit Bot committed Apr 12, 2022
1 parent b7257ef commit 6780963
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
13 changes: 3 additions & 10 deletions pkg/analysis_server/lib/src/services/pub/pub_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class PubCommand {

final InstrumentationService _instrumentationService;
late final ProcessRunner _processRunner;
late final String _pubPath;
late final String _pubEnvironmentValue;

/// Active processes that should be killed when shutting down.
Expand All @@ -42,11 +41,6 @@ class PubCommand {
var _lastQueuedCommand = Future<void>.value();

PubCommand(this._instrumentationService, this._processRunner) {
_pubPath = path.join(
path.dirname(Platform.resolvedExecutable),
Platform.isWindows ? 'pub.bat' : 'pub',
);

// When calling the `pub` command, we must add an identifier to the
// PUB_ENVIRONMENT environment variable (joined with colons).
const _pubEnvString = 'analysis_server.pub_api';
Expand Down Expand Up @@ -114,10 +108,9 @@ class PubCommand {
await lastCommand.catchError((_) {});

try {
final command = [_pubPath, ...args];

_instrumentationService.logInfo('Starting pub command $command');
final process = await _processRunner.start(_pubPath, args,
_instrumentationService.logInfo('Starting pub command $args');
final process = await _processRunner.start(
Platform.resolvedExecutable, ['pub', ...args],
workingDirectory: workingDirectory,
environment: {_pubEnvironmentKey: _pubEnvironmentValue});
_activeProcesses.add(process);
Expand Down
7 changes: 2 additions & 5 deletions pkg/analysis_server/test/lsp/pub_package_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,11 @@ class PubCommandTest with ResourceProviderMixin {

Future<void> test_outdated_args() async {
processRunner.startHandler = (executable, args, {dir, env}) {
var expectedPubPath = path.join(
path.dirname(Platform.resolvedExecutable),
Platform.isWindows ? 'pub.bat' : 'pub',
);
expect(executable, equals(expectedPubPath));
expect(executable, Platform.resolvedExecutable);
expect(
args,
equals([
'pub',
'outdated',
'--show-all',
'--json',
Expand Down
11 changes: 0 additions & 11 deletions pkg/analyzer/test/src/dart/sdk/sdk_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator;
import 'package:analyzer/src/dart/sdk/sdk.dart';
import 'package:analyzer/src/generated/java_engine_io.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:pub_semver/pub_semver.dart';
Expand Down Expand Up @@ -192,13 +191,6 @@ class FolderBasedDartSdkTest with ResourceProviderMixin {
expect(directory.exists, isTrue);
}

void test_getPubExecutable() {
FolderBasedDartSdk sdk = _createDartSdk();
File executable = sdk.pubExecutable;
expect(executable, isNotNull);
expect(executable.exists, isTrue);
}

void test_getSdkVersion() {
FolderBasedDartSdk sdk = _createDartSdk();
String version = sdk.sdkVersion;
Expand All @@ -222,7 +214,6 @@ class FolderBasedDartSdkTest with ResourceProviderMixin {
content: _librariesFileContent());
_createFile(sdkDirectory, ['bin', 'dart']);
_createFile(sdkDirectory, ['bin', 'dart2js']);
_createFile(sdkDirectory, ['bin', 'pub']);
_createFile(sdkDirectory, ['lib', 'async', 'async.dart']);
_createFile(sdkDirectory, ['lib', 'core', 'core.dart']);
_createFile(sdkDirectory, ['lib', 'core', 'num.dart']);
Expand All @@ -231,8 +222,6 @@ class FolderBasedDartSdkTest with ResourceProviderMixin {
_createFile(sdkDirectory,
['lib', 'html', 'html_common', 'html_common_dart2js.dart']);
_createFile(sdkDirectory, ['lib', 'html', 'dart2js', 'html_dart2js.dart']);
_createFile(
sdkDirectory, ['bin', (OSUtilities.isWindows() ? 'pub.bat' : 'pub')]);
return FolderBasedDartSdk(resourceProvider, sdkDirectory);
}

Expand Down

0 comments on commit 6780963

Please sign in to comment.