Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Issue 1448333004: Checks for entry point existence and supports warning suppression. (Closed)

Created:
5 years, 1 month ago by eernst
Modified:
5 years, 1 month ago
Reviewers:
jakemac, sigurdm
CC:
eernst+reviews_google.com, reviews_dartlang.org, floitsch
Base URL:
https://github.com/dart-lang/reflectable.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Checks for entry point existence and supports warning suppression. We've had issue #17 forever, because we have no way to check whether a certain entry point actually exists (we do not know the root directory of a package when it is transformed). This CL checks whether a specified entry point file exists, which eliminates all the warnings previously given for entry points in the local package (the one where `pub build..` or `pub serve..` is executed) because of the arguments given to pub (we would warn about missing 'test/*.dart' when running `pub build web`, because pub does not deliver 'test/*.dart' to the transformer in that case). However, this approach used to fail for transformation of other packages (the ones that the local package depends on), because the root directory of such a package is unknown (and it is not the current working directory of the process that runs the transformer). However, I have made many attempts to reproduce this problem, and it never occurred. It is possible that `pub` has been modified. On top of that, this CL provides support for suppression of warnings, using a setting in 'pubspec.yaml'. Those two elements together should make it possible for users of this package to avoid the Info message about 'Missing entry point', and we may then close the issue. R=sigurdm@google.com Committed: https://github.com/dart-lang/reflectable/commit/2dc5e46ef6aa17daab9240a73f79fd7364c76193

Patch Set 1 #

Total comments: 2

Patch Set 2 : Review response; eliminated "allWarnings". Landing now. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -16 lines) Patch
M reflectable/lib/src/transformer_implementation.dart View 1 13 chunks +62 lines, -15 lines 1 comment Download
M reflectable/lib/transformer.dart View 1 3 chunks +54 lines, -1 line 0 comments Download

Messages

Total messages: 10 (3 generated)
eernst
Dealing with #17 (unwanted warnings about 'Missing entry point').
5 years, 1 month ago (2015-11-17 13:49:37 UTC) #3
sigurdm
LGTM https://codereview.chromium.org/1448333004/diff/1/reflectable/lib/src/transformer_implementation.dart File reflectable/lib/src/transformer_implementation.dart (right): https://codereview.chromium.org/1448333004/diff/1/reflectable/lib/src/transformer_implementation.dart#newcode30 reflectable/lib/src/transformer_implementation.dart:30: allWarnings, allWarnings is not really a kind of ...
5 years, 1 month ago (2015-11-17 14:05:21 UTC) #4
eernst
Review response. https://codereview.chromium.org/1448333004/diff/1/reflectable/lib/src/transformer_implementation.dart File reflectable/lib/src/transformer_implementation.dart (right): https://codereview.chromium.org/1448333004/diff/1/reflectable/lib/src/transformer_implementation.dart#newcode30 reflectable/lib/src/transformer_implementation.dart:30: allWarnings, On 2015/11/17 14:05:21, sigurdm wrote: > ...
5 years, 1 month ago (2015-11-17 14:38:13 UTC) #5
eernst
Committed patchset #2 (id:20001) manually as 2dc5e46ef6aa17daab9240a73f79fd7364c76193 (presubmit successful).
5 years, 1 month ago (2015-11-17 14:48:04 UTC) #6
jakemac
https://codereview.chromium.org/1448333004/diff/20001/reflectable/lib/src/transformer_implementation.dart File reflectable/lib/src/transformer_implementation.dart (right): https://codereview.chromium.org/1448333004/diff/20001/reflectable/lib/src/transformer_implementation.dart#newcode3026 reflectable/lib/src/transformer_implementation.dart:3026: bool entryPointFileExists = await new File(entryPointPath).exists(); This is definitely ...
5 years, 1 month ago (2015-11-17 14:58:07 UTC) #8
eernst
On 2015/11/17 14:58:07, jakemac wrote: > https://codereview.chromium.org/1448333004/diff/20001/reflectable/lib/src/transformer_implementation.dart > File reflectable/lib/src/transformer_implementation.dart (right): > > https://codereview.chromium.org/1448333004/diff/20001/reflectable/lib/src/transformer_implementation.dart#newcode3026 > ...
5 years, 1 month ago (2015-11-17 15:22:40 UTC) #9
jakemac
5 years, 1 month ago (2015-11-17 15:26:58 UTC) #10
Message was sent while issue was closed.
On 2015/11/17 15:22:40, eernst wrote:
> On 2015/11/17 14:58:07, jakemac wrote:
> >
>
https://codereview.chromium.org/1448333004/diff/20001/reflectable/lib/src/tra...
> > File reflectable/lib/src/transformer_implementation.dart (right):
> > 
> >
>
https://codereview.chromium.org/1448333004/diff/20001/reflectable/lib/src/tra...
> > reflectable/lib/src/transformer_implementation.dart:3026: bool
> > entryPointFileExists = await new File(entryPointPath).exists();
> > This is definitely an anti-pattern for transformers in general... I guess it
> > doesn't hurt though as long as you are checking for the entry point in the
> > provided assets first (it could be generated by a previous phase, and would
> not
> > live on disk).
> 
> You're right that transformers shouldn't bypass an asset and read from disk.
> However, in this particular situation each of the 'entry_points:' is written
> manually by a programmer, and the package documentation describes the meaning
of
> such an entry as 'The path to your main file', and there is no corresponding
> asset (we only reach this point because the asset is missing). So the entry
> point really does refer to the file. On top of that we will not do anything
with
> the file, we just detect that it exists in order to suppress a message, and
then
> never touch it again. So we won't incorrectly bypass an asset here.

Ya, I think I agree that this is an exception to the general rule, only because
you aren't actually using this for anything other than as an attempt to not emit
false warnings. I am sure there are some situations in which it won't work, but
it will prevent the warning in the general case and won't make those cases any
worse than they are already.

Powered by Google App Engine
This is Rietveld 408576698