You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because mill statically building task dependencies graph, conditional code like this means that both tasks will be executed before current one (if condition can't be known beforehand).
if optimized() then fullLinkJS() else fastLinkJS()
And it lot of cases is possible to deal with that by implementing something like selectTaks() which should be executed instead of that expression with conditional value known at compilation time.
That by itself fascinating issue to deal with it if for your case you can't know condition at compile time and only can get it during build like if some application returning it).
But I'd like to discuss case with ScalaJS because with it it seems easy to hit need for it while it could be avoided.
I noticed that difference between fullLinkJS, fastLinkJS it just how it pass parameters to linkTask in implementation.
So if something like linkJS(isFullLinkJS = false|true) could be added then is no need to conditionally deal with ScalaJS compilation anymore for lot of user cases. As it will be possible to pass value directly to it.
Is it any other way to deal with that? I think currently is not possible to override linkTask for ScalaJSModule
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Because mill statically building task dependencies graph, conditional code like this means that both tasks will be executed before current one (if condition can't be known beforehand).
And it lot of cases is possible to deal with that by implementing something like selectTaks() which should be executed instead of that expression with conditional value known at compilation time.
That by itself fascinating issue to deal with it if for your case you can't know condition at compile time and only can get it during build like if some application returning it).
But I'd like to discuss case with ScalaJS because with it it seems easy to hit need for it while it could be avoided.
I noticed that difference between fullLinkJS, fastLinkJS it just how it pass parameters to linkTask in implementation.
mill/libs/scalajslib/src/mill/scalajslib/ScalaJSModule.scala
Line 112 in c0f5259
So if something like
linkJS(isFullLinkJS = false|true)could be added then is no need to conditionally deal with ScalaJS compilation anymore for lot of user cases. As it will be possible to pass value directly to it.Is it any other way to deal with that? I think currently is not possible to override linkTask for ScalaJSModule
see example here at branch
linker-conditions-demohttps://github.com/american-fable/demo-mill-assembly-invalidation-issue/tree/linker-conditions-demoBeta Was this translation helpful? Give feedback.
All reactions