Skip to content
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

Apply 193 #197

Merged
merged 3 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions packages/custom_lint/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Improve the command line's output (thanks to @kuhnroyal)
- Update uuid to 4.0.0
- Fixed a port leak
- Fix connection issues on Docker/windows (thanks to @hamsbrar)

## 0.5.3 - 2023-08-29

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class SocketCustomLintServerToClientChannel {
[
if (_server.watchMode) '--enable-vm-service=${await port}',
join('lib', 'custom_lint_client.dart'),
_serverSocket.address.host,
_serverSocket.port.toString(),
],
workingDirectory: tempDir.path,
Expand Down Expand Up @@ -213,10 +214,12 @@ import 'package:custom_lint_builder/src/channel.dart';
$imports

void main(List<String> args) async {
final port = int.parse(args.single);
final host = args[0];
final port = int.parse(args[1]);

runSocket(
port: port,
host: host,
includeBuiltInLints: ${_server.includeBuiltInLints},
{$plugins},
);
Expand Down
4 changes: 2 additions & 2 deletions packages/custom_lint/test/cli_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ invalid;
^^^^^^^
'''),
matchIgnoringAnsi(contains, '''
lib/custom_lint_client.dart:13:29: Error: Undefined name 'createPlugin'.
lib/custom_lint_client.dart:15:29: Error: Undefined name 'createPlugin'.
{'test_lint': test_lint.createPlugin,
^^^^^^^^^^^^
'''),
Expand Down Expand Up @@ -296,7 +296,7 @@ int x = 'oy';
^
'''),
matchIgnoringAnsi(contains, '''
lib/custom_lint_client.dart:15:26: Error: Undefined name 'createPlugin'.
lib/custom_lint_client.dart:17:26: Error: Undefined name 'createPlugin'.
'test_lint2': test_lint2.createPlugin,
^^^^^^^^^^^^
'''),
Expand Down
3 changes: 2 additions & 1 deletion packages/custom_lint_builder/lib/src/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ typedef CreatePluginMain = PluginBase Function();
Future<void> runSocket(
Map<String, CreatePluginMain> pluginMains, {
required int port,
required String host,
required bool includeBuiltInLints,
}) async {
late Future<CustomLintPluginClient> client;

await asyncRunZonedGuarded(
() => client = Future(() async {
// ignore: close_sinks, connection stays open until the plugin is killed
final socket = await Socket.connect(InternetAddress.loopbackIPv6, port);
final socket = await Socket.connect(host, port);
final socketChannel = JsonSocketChannel(Future.value(socket));
final registeredPlugins = <String, PluginBase>{};

Expand Down