TOPdesk / dart-junitreport

An application to generate JUnit XML reports from dart test runs.
https://pub.dartlang.org/packages/junitreport
MIT License
31 stars 45 forks source link

Migrate package to Dart Nullsafety #24

Closed ueman closed 2 years ago

ueman commented 3 years ago

This package doesn't yet have a null safe version available and it would be nice to have one.

rspilker commented 3 years ago

Can you explain why it would be nice to have one? I mean, this project is a stand-alone tool that you run on the command-line or in a CD/CI environment. Why would you care if internally it is "null safe"?

I am not necessarily against it, but want to know how that would benefit our users?

It would help me and other Open Source maintainers if you would add such information when creating a ticket. I'll give an example using your phrasing that hopefully makes it more clear: "This package doesn't have a German version available and it would be nice to have one." Should I now create a German version? What about French, or Chinese?

ueman commented 3 years ago

If you depend on this in a nullsafe app or package, even as a dev dependency, and you also have a dependency on intl you currently can't compile the project. I guess this would also be a problem for the other dependencies of this package.

rspilker commented 3 years ago

I did hear that some users have this as a dev dependency.

When I created the tool, I expected users to install it using the instructions from the readme.

I'm not up-to-date on the current state of null-safety. Is it possible to use a null-safe dependency in a non-null-safe project? Or do I need to split?

ueman commented 3 years ago

When I created the tool, I expected users to install it using the instructions from the readme.

I found that it is easier to have as a dev dependency, because then you don't have to install it on your CI tool of choice.

Is it possible to use a null-safe dependency in a non-null-safe project?

You have to bump the minimal Dart version to opt in on null safety. However you can also opt out of null safety. So you kinda can but you would still need to bump the Dart version. See https://dart.dev/null-safety/unsound-null-safety

Or do I need to split?

I'm not really sure what you mean by split.

rspilker commented 3 years ago

By split, I meant: do I need to maintain two versions for a while, one that can be used in null safe projects, and one that can be used in null unsafe projects?

This also has to do with version numbering. Is this a backwards incompatible change.

Finally, if the minimal SDK version is changed, I need to find out if flutter is already updated to that version.

This is just some notes on what to investigate, I plan to make this project null-safe.

rspilker commented 3 years ago

Unrelated to this issue, I wonder if it is possible to have a different version of your dependency as a dev dependency. The lock file would support that scenario.

That could be a workaround, to use a different version of intl.

Also, I wouldn't mind to see if I can remove the intl dependency in this project, IIRC, it is only used to parse and render a date, using a specified format and locale. String parsing and interpolation would not be too hard.

ueman commented 3 years ago

By split, I meant: do I need to maintain two versions for a while, one that can be used in null safe projects, and one that can be used in null unsafe projects?

Well, one can always just use the version before null safety was introduced. This is the approach used by most core libraries.

This also has to do with version numbering. Is this a backwards incompatible change.

Most libraries bump their major version.

Finally, if the minimal SDK version is changed, I need to find out if flutter is already updated to that version.

The current stable does not. The next beta version is already null safe. Also see https://medium.com/flutter/announcing-dart-null-safety-beta-4491da22077a

This is just some notes on what to investigate, I plan to make this project null-safe.

Thanks, I appreciate it.

maxregan commented 3 years ago

Hi, I just encountered the same issue.

At this point, the only dependency that requires an update is testreport, which it seems @rspilker also maintains. I attempted briefly to migrate that package, however I'm too inexperienced with dart to say for certain if the results the tools produced are correct and unfortunately it doesn't have tests.

maxregan commented 3 years ago

Oh, I see that #28 is already written.

MilesAdamson commented 3 years ago

Any news? This is blocking my upgrade to flutter 2

rspilker commented 3 years ago

I expect to be able to work on this next week.

yuanhuiliu commented 3 years ago

Hello, when could we get the null safety version? I tried to install it as a tool according to installation in readme to a null safety environment, error Bad state: not started was thrown when running test cases by command flutter test --machine | tojunit --output xml-result.xml. My environment is a docker container started from https://hub.docker.com/r/cirrusci/flutter, I used this image: cirrusci/flutter:2.2.3, flutter version is 2.13.0

rspilker commented 2 years ago

A null-safe version 2.0.0 has just been released.