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

Add support for custom package hosts #286

Open
julien-neon opened this issue Oct 24, 2024 · 0 comments
Open

Add support for custom package hosts #286

julien-neon opened this issue Oct 24, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@julien-neon
Copy link

Is your feature request related to a problem? Please describe.

I wrote a custom lint package with custom_lint_builder and published it to my private pub repo. When including my custom lint package locally, the lints show up as expected, but when I referenced the published version of my lint package:

my_lints:
    hosted: https://onepub.dev/api/my-repo-id/
    version: ^1.0.0+1

the lints did not show up anymore. When running flutter pub run custom_lint, I get the following error:

The request analysis.setContextRoots failed with the following error:
RequestErrorCode.PLUGIN_ERROR
Exception: Failed to run "pub get" in the client project:
Resolving dependencies...

Because custom_lint_client depends on my_lints any which doesn't exist (could not find package my_lints at https://pub.dev), version solving failed.

at:
#0      CustomLintWorkspace.runPubGet (package:custom_lint/src/workspace.dart:760:7)
<asynchronous suspension>
#1      CustomLintWorkspace.resolvePluginHost (package:custom_lint/src/workspace.dart:744:5)
<asynchronous suspension>
#2      SocketCustomLintServerToClientChannel._startProcess (package:custom_lint/src/v2/server_to_client_channel.dart:151:7)
<asynchronous suspension>
#3      SocketCustomLintServerToClientChannel.init (package:custom_lint/src/v2/server_to_client_channel.dart:111:21)
<asynchronous suspension>
#4      CustomLintServer._maybeSpawnCustomLintPlugin (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:394:5)
<asynchronous suspension>
#5      CustomLintServer._handleAnalysisSetContextRoots.<anonymous closure> (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:341:9)
<asynchronous suspension>
#6      PendingOperation.run (package:custom_lint/src/async_operation.dart:22:14)
<asynchronous suspension>
#7      CustomLintServer._handleRequest (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:173:22)
<asynchronous suspension>

_PrettyRequestFailure: {"code":"PLUGIN_ERROR","message":"Exception: Failed to run \"pub get\" in the client project:\nResolving dependencies...\n\nBecause custom_lint_client depends on my_lints any which doesn't exist (could not find package my_lints at https://pub.dev), version solving failed.\n","stackTrace":"#0      CustomLintWorkspace.runPubGet (package:custom_lint/src/workspace.dart:760:7)\n<asynchronous suspension>\n#1      CustomLintWorkspace.resolvePluginHost (package:custom_lint/src/workspace.dart:744:5)\n<asynchronous suspension>\n#2      SocketCustomLintServerToClientChannel._startProcess (package:custom_lint/src/v2/server_to_client_channel.dart:151:7)\n<asynchronous suspension>\n#3      SocketCustomLintServerToClientChannel.init (package:custom_lint/src/v2/server_to_client_channel.dart:111:21)\n<asynchronous suspension>\n#4      CustomLintServer._maybeSpawnCustomLintPlugin (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:394:5)\n<asynchronous suspension>\n#5      CustomLintServer._handleAnalysisSetContextRoots.<anonymous closure> (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:341:9)\n<asynchronous suspension>\n#6      PendingOperation.run (package:custom_lint/src/async_operation.dart:22:14)\n<asynchronous suspension>\n#7      CustomLintServer._handleRequest (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:173:22)\n<asynchronous suspension>\n"}
#0      ChannelBase.sendRequest (package:custom_lint/src/server_isolate_channel.dart:82:7)
<asynchronous suspension>
#1      CustomLintRunner.initialize.<anonymous closure> (package:custom_lint/src/runner.dart:43:5)
<asynchronous suspension>
#2      _runServer.<anonymous closure> (package:custom_lint/custom_lint.dart:96:7)
<asynchronous suspension>
#3      _AsyncCompleter.complete (dart:async/future_impl.dart:41:3)
<asynchronous suspension>
#4      _runServer.<anonymous closure> (package:custom_lint/custom_lint.dart:126:19)
<asynchronous suspension>
#5      _runServer (package:custom_lint/custom_lint.dart:86:3)
<asynchronous suspension>
#6      customLint (package:custom_lint/custom_lint.dart:50:5)
<asynchronous suspension>
#7      entrypoint (file:///Users/julien/.pub-cache/hosted/pub.dev/custom_lint-0.6.8/bin/custom_lint.dart:68:3)
<asynchronous suspension>
#8      main (file:///Users/julien/.pub-cache/hosted/pub.dev/custom_lint-0.6.8/bin/custom_lint.dart:80:5)
<asynchronous suspension>

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like

I would like the possibility to include private packages when running custom lints. I am currently using OnePub for my private pub repo and its CLI has me logged in all the time. So when I run flutter pub get in the command-line it works out of the box. Judging from the current implementation of custom_lint/src/workspace.dart the two options are: resolving package host locally and from pub.dev. Am I missing something? Otherwise I would request the support for custom hosts.

Describe alternatives you've considered
I cannot publish the linter package, as it is considered company property. Not sure if I am missing something.

Additional context
Add any other context or screenshots about the feature request here.

@julien-neon julien-neon added the enhancement New feature or request label Oct 24, 2024
@julien-neon julien-neon changed the title Add support for private Packages Add support for custom package hosts Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants