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

refactor: Restructure project for single import #97

Conversation

Peetee06
Copy link
Contributor

@Peetee06 Peetee06 commented Mar 4, 2024

This PR restructures the project to align with official Flutter recommendations.

Using the package now requires only a single import:

import 'package:stomp_dart_client/stomp_dart_client.dart';

This makes working with stomp_dart_client.dart a little bit easier, because one can use things like VSCode code actions to automatically add an import to the package.

One note:
I couldn't run the tests in stomp_test.dart locally, because the spawnHybridCode method doesn't use the project's .dart_tool folder but rather a global one. The global one does not have the necessary packages installed, which is why the hybrid code can't be run. I couldn't find a way to fix this other than installing the necessary packages globally, which I don't want to do.

Please let me know if any further adjustments are desired. I'll be happy to fine-tune this PR further.

@KammererTob
Copy link
Contributor

Thanks for the PR, i will have a look in the next few days.

@KammererTob
Copy link
Contributor

@Peetee06 I tried to run the tests locally, but i ran into some issues. Maybe you have guidance for this:
In stomp_config_test.dart i do this: await platform.connect(config..resetSession());.

This currently throws the following error:

test/stomp_config_test.dart:23:34:
Error: The argument type 'StompConfig/*1*/' can't be assigned to the parameter type 'StompConfig/*2*/'.
 - 'StompConfig/*1*/' is from 'package:stomp_dart_client/src/stomp_config.dart' ('lib/src/stomp_config.dart').
 - 'StompConfig/*2*/' is from 'lib/src/stomp_config.dart'.
          await platform.connect(config..resetSession());
                                 ^
Error: Compilation failed.

If i try to use relative path for imports VSC complains (probably rightly so), that the path is not supposed to be relative.

Can't use a relative path to import a library in 'lib'.
Try fixing the relative path or changing the import to a 'package:' import.dart avoid_relative_lib_imports

Do you happen to know what to do with unit-tests?
Thanks!

@Peetee06
Copy link
Contributor Author

Peetee06 commented Mar 7, 2024

@KammererTob, thanks for reporting this. It seems like dart couldn't see, that _connect_io.dart imports the same StompConfig. I fixed the import and the test succeeds locally now. Let me know if they succeed for you as well.

Copy link
Contributor

@KammererTob KammererTob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a comment to one file, but this affects all files with hybrid tests. Can you please adjust those? For me they threw an error while testing.

Overall this is a breaking change, right? So i guess this would land in 2.0 then.

Thanks!

test/stomp_test.dart Outdated Show resolved Hide resolved
@Peetee06
Copy link
Contributor Author

Peetee06 commented Mar 8, 2024

@KammererTob true, this is a breaking change. Thank you for reviewing!

@KammererTob KammererTob merged commit 8fbaebb into blackhorse-one:master Mar 8, 2024
1 check passed
@KammererTob
Copy link
Contributor

Thank you. Looks good now. I will wait a few weeks if anything else comes up for a new release. I will release this as 2.0.0 then.

@Peetee06
Copy link
Contributor Author

Peetee06 commented Mar 8, 2024

Very nice! Thank you for creating this project! Happy that I got to contribute!

@Peetee06 Peetee06 deleted the ref/restructure_project_for_single_import branch March 8, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants