-
Notifications
You must be signed in to change notification settings - Fork 232
add web compiler option to pubspec.yaml, change --compiler to --web-compiler #1624
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
Conversation
Ok, after some offline discussion I will update this to change the arg to web:
compiler:
debug: dartdevc
release: dart2js |
Updated now to reflect the new configuration. |
👍 to the name change. |
lib/src/command/barback.dart
Outdated
"Prefer using the --web-compiler arg as --[no]-dart2js is " | ||
"deprecated."); | ||
} | ||
if (argResults['dart2js']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this produce a warning as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lib/src/command/barback.dart
Outdated
} else if (argResults.options.contains("compiler")) { | ||
return Compiler.byName(argResults["compiler"]); | ||
} else if (argResults.options.contains("web-compiler") && | ||
argResults.wasParsed("web-compiler")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just argResults["web-compiler"]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed, there was a default value but I removed it as well.
lib/src/pubspec.dart
Outdated
'"compiler" keys may only contain letters, ' | ||
'numbers, hyphens and underscores.', | ||
key.span); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this restriction? As far as I remember, there aren't any such restrictions on Barback mode names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok, I guess I was just assuming this, removed.
lib/src/pubspec.dart
Outdated
/// the value is the name of the web compiler to use in that mode. | ||
/// | ||
/// Valid compiler values are all of [Compiler.names]. | ||
Map<String, String> get webCompiler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not Map<String, Compiler>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sure, I like that, updated.
test("can be empty", () { | ||
var pubspec = new Pubspec.parse('web: {}', sources); | ||
expect(pubspec.webCompiler, isEmpty); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also can be null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get a YamlMap in that case, but I added this to the "throws if not a map" test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe in general we allow users to explicitly specify null
for fields that are allowed to not exist, which means web:
without anything after it is valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, done. I also added a test for a null compiler value
test("can be empty", () { | ||
var pubspec = new Pubspec.parse('web: {}', sources); | ||
expect(pubspec.webCompiler, isEmpty); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe in general we allow users to explicitly specify null
for fields that are allowed to not exist, which means web:
without anything after it is valid.
} | ||
} else if (argResults.options.contains("web-compiler") && | ||
argResults.wasParsed("web-compiler")) { | ||
} else if (argResults.options.contains("web-compiler")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not quite sure why this isn't just argResults["web-compiler"]
with a default value of false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't feel right to have a default value that isn't a valid compiler name to me. If you want I can do that though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, I was thinking this was a boolean value for some reason.
Cherry pick request to sdk?
From mobile. Sorry for brevity and/or spelling.
…On May 26, 2017 5:54 PM, "Jacob MacDonald" ***@***.***> wrote:
Merged #1624 <#1624>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1624 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABCilGAk-rgWLS7WI-lDswYM8Fkwt4hks5r93RcgaJpZM4NmpgN>
.
|
cl out to merge into sdk here https://codereview.chromium.org/2908783003/ then I will send out the cherry pick request |
With the top level key in the pubspec being called
js-compiler
, it no longer makes sense for the command line arg to be justcompiler
(same argument holds about future compilers conflicting). Sincejs-compiler
is really long I talked with @munificent and we landed on just--js
.Let me know if there are objections to changing the flag from
--compiler
to--js
. If we could come up with a single character shorthand for--js-compiler
that might be preferable, but I don't know of one that really makes sense.cc @kevmoo @munificent @jwren @devoncarew
EDIT: See comment below about naming changes