Skip to content

Refer to library by URL. #138

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

Closed
wants to merge 3 commits into from
Closed

Conversation

davidmorgan
Copy link
Contributor

This will let people get rid of 'library' statements.

Really looking forward to this change -- any plans for when we can make it? Do we need to wait for 1.23 to be in the stable channel?

I checked built_value's end to end tests with 1.23.0-dev.11.0 and it works fine. The analyzed currently complains, but we don't necessarily need to wait for that -- we can silence it with "// ignore: non_identifier_library_name".

Thanks!

@@ -4,7 +4,7 @@ author: Dart Team <[email protected]>
description: Automatic sourcecode generation for Dart
homepage: https://github.com/dart-lang/source_gen
environment:
sdk: '>=1.12.0 <2.0.0'
sdk: '>=1.23.0-dev.11.0 <2.0.0'
Copy link
Member

Choose a reason for hiding this comment

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

Is this about the SDK min value ... or pkg/analyzer min version?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably need both? SDK for supporting the output in tools/runtimes, analyzer for supporting parsing this file in later codegen steps etc?

Copy link
Member

Choose a reason for hiding this comment

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

Strictly speaking, this package doesn't need to align w/ the SDK version. Just the analyzer version.

One could generate code with SDK X that doesn't run in SDK X.

...right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we could generate code that doesn't run. I guess if we do that we would instead need to bump the source_gen major version? Maybe we should do that anyway?

--> no new SDK requirement
--> version bump to 0.6

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Friendly ping. Any ideas how we should ship this? Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should bump the min sdk version but not do a major version bump in this package (unless there is a breaking change I am missing).

There isn't much of a point in generating code that can't run in your current sdk imo, it would just lead to confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, kept it with just the SDK version bump.

@@ -160,7 +160,8 @@ class Customer { }

const _testGenPartContent = r'''// GENERATED CODE - DO NOT MODIFY BY HAND

part of test_lib;
part of 'test_lib.dart';

Copy link
Member

Choose a reason for hiding this comment

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

where is this extra new-line coming from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:/ don't know ... it may be some weirdness with dartfmt.

@@ -160,7 +160,8 @@ class Customer { }

const _testGenPartContent = r'''// GENERATED CODE - DO NOT MODIFY BY HAND

part of test_lib;
part of 'test_lib.dart';
Copy link
Member

Choose a reason for hiding this comment

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

Also: We could remove the library name from test_lib.dart, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. If we want to push this before the analyzer is fixed, we'll also want to generate the appropriate '// ignore: '. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Lets just generate it with the // ignore: for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the "ignore".

@davidmorgan
Copy link
Contributor Author

There seems to be an issue with dartfmt; it appears to be refusing to format the output altogether.

When I run dartfmt locally, it actually deletes the URL from 'part of'. So I think this CL will have to wait for a dartfmt fix. I'll see if there's an issue open.

@davidmorgan
Copy link
Contributor Author

dart-lang/dart_style#615

@matanlurey
Copy link
Contributor

@davidmorgan Ping. This was fixed as of May 9th 👍

@matanlurey
Copy link
Contributor

@davidmorgan I'm proposing to supersede this with #179.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants