Skip to content
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

~fastOptJS runs non-stop #1491

Closed
japgolly opened this issue Feb 15, 2015 · 5 comments
Closed

~fastOptJS runs non-stop #1491

japgolly opened this issue Feb 15, 2015 · 5 comments
Assignees
Labels
bug Confirmed bug. Needs to be fixed.
Milestone

Comments

@japgolly
Copy link
Contributor

In my SBT build, I have a Scala.JS-based webapp-client module, which is part of an aggregate module called webapp, which itself is part of the root aggregate module.

;project webapp-client; ~fastOptJS works as expected by only building once, then waiting for changes.

root> ;project webapp-client; ~fastOptJS
[debug] > ;project webapp-client; ~fastOptJS
[debug] > project webapp-client
[info] Set current project to webapp-client (in build file:/home/golly/xxx/projects/xxx/Code/)
[debug] > ~fastOptJS
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] > sbtClearOnFailure
[debug] > fastOptJS
[debug] Evaluating tasks: webapp-client/compile:fastOptJS
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug]
[debug] Initial source changes:
[debug]     removed:Set()
[debug]     added: Set()
[debug]     modified: Set()
[debug] Removed products: Set()
[debug] External API changes: API Changes: Set()
[debug] Modified binary dependencies: Set()
[debug] Initial directly invalidated sources: Set()
[debug]
[debug] Sources indirectly invalidated by:
[debug]     product: Set()
[debug]     binary dep: Set()
[debug]     external source: Set()
[debug] All initially invalidated sources: Set()
[debug] Copy resource mappings:
[debug]
[info] Fast optimizing /home/golly/xxx/projects/xxx/Code/webapp-client/target/scala-2.11/webapp-client-fastopt.js
[debug] Linker: Read info: 18926 us
[debug] Linker: Compute reachability: 312984 us
[debug] Linker: Assemble LinkedClasses: 724995 us
[debug] Linker: cache stats: reused: 11939 -- invalidated: 0 -- trees read: 0
[debug] Linker: 1061742 us
[debug] Inc. optimizer: Batch mode: false
[debug] Inc. optimizer: Incremental part: 60393 us
[debug] Inc. optimizer: Optimizing 5260 methods.
[debug] Inc. optimizer: Optimizer part: 525288 us
[debug] Inc. optimizer: 596637 us
[debug] Refiner: Compute reachability: 236624 us
[debug] Refiner: Assemble LinkedClasses: 12735 us
[debug] Refiner: 249558 us
[debug] Emitter: Class tree cache stats: reused: 2220 -- invalidated: 0
[debug] Emitter: Method tree cache stats: resued: 7079 -- invalidated: 3446
[debug] Emitter (write output): 622613 us
[success] Total time: 3 s, completed 15/02/2015 5:19:28 PM
[debug] > resumeFromFailure
[debug] > ~ fastOptJS
1. Waiting for source changes... (press enter to interrupt)
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false

However from one of the aggregate modules, ~webapp-client/fastOptJS keeps regenerating the JS again and again. This wasn't the case before 0.6.0.

root> ~webapp-client/fastOptJS
[debug] > ~webapp-client/fastOptJS
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] > sbtClearOnFailure
[debug] > webapp-client/fastOptJS
[debug] Evaluating tasks: webapp-client/compile:fastOptJS
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug]
[debug] Initial source changes:
[debug]     removed:Set()
[debug]     added: Set()
[debug]     modified: Set()
[debug] Removed products: Set()
[debug] External API changes: API Changes: Set()
[debug] Modified binary dependencies: Set()
[debug] Initial directly invalidated sources: Set()
[debug]
[debug] Sources indirectly invalidated by:
[debug]     product: Set()
[debug]     binary dep: Set()
[debug]     external source: Set()
[debug] All initially invalidated sources: Set()
[debug] Copy resource mappings:
[debug]
[info] Fast optimizing /home/golly/xxx/projects/xxx/Code/webapp-client/target/scala-2.11/webapp-client-fastopt.js
[debug] Linker: Read info: 18732 us
[debug] Linker: Compute reachability: 298272 us
[debug] Linker: Assemble LinkedClasses: 828397 us
[debug] Linker: cache stats: reused: 11939 -- invalidated: 0 -- trees read: 0
[debug] Linker: 1150278 us
[debug] Inc. optimizer: Batch mode: false
[debug] Inc. optimizer: Incremental part: 52745 us
[debug] Inc. optimizer: Optimizing 5260 methods.
[debug] Inc. optimizer: Optimizer part: 496159 us
[debug] Inc. optimizer: 558223 us
[debug] Refiner: Compute reachability: 217834 us
[debug] Refiner: Assemble LinkedClasses: 12241 us
[debug] Refiner: 230259 us
[debug] Emitter: Class tree cache stats: reused: 2220 -- invalidated: 0
[debug] Emitter: Method tree cache stats: resued: 7079 -- invalidated: 3446
[debug] Emitter (write output): 662503 us
[success] Total time: 4 s, completed 15/02/2015 5:21:46 PM
[debug] > resumeFromFailure
[debug] > ~ webapp-client/fastOptJS
1. Waiting for source changes... (press enter to interrupt)
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug] > sbtClearOnFailure
[debug] > webapp-client/fastOptJS
[debug] Evaluating tasks: webapp-client/compile:fastOptJS
[debug] Running task... Cancel: sbt.TaskCancellationStrategy$Null$@497aec8c, check cycles: false
[debug]
[debug] Initial source changes:
[debug]     removed:Set()
[debug]     added: Set()
[debug]     modified: Set()
[debug] Removed products: Set()
[debug] External API changes: API Changes: Set()
[debug] Modified binary dependencies: Set()
[debug] Initial directly invalidated sources: Set()
[debug]
[debug] Sources indirectly invalidated by:
[debug]     product: Set()
[debug]     binary dep: Set()
[debug]     external source: Set()
[debug] All initially invalidated sources: Set()
[debug] Copy resource mappings:
[debug]
[info] Fast optimizing /home/golly/xxx/projects/xxx/Code/webapp-client/target/scala-2.11/webapp-client-fastopt.js
[debug] Linker: Read info: 17924 us
[debug] Linker: Compute reachability: 277079 us
[debug] Linker: Assemble LinkedClasses: 718636 us
[debug] Linker: cache stats: reused: 11939 -- invalidated: 0 -- trees read: 0
[debug] Linker: 1018147 us
[debug] Inc. optimizer: Batch mode: false
[debug] Inc. optimizer: Incremental part: 52086 us
[debug] Inc. optimizer: Optimizing 5260 methods.
[debug] Inc. optimizer: Optimizer part: 533436 us
[debug] Inc. optimizer: 592874 us
[debug] Refiner: Compute reachability: 213372 us
[debug] Refiner: Assemble LinkedClasses: 13168 us
[debug] Refiner: 226738 us
[debug] Emitter: Class tree cache stats: reused: 2220 -- invalidated: 0
[debug] Emitter: Method tree cache stats: resued: 7079 -- invalidated: 3446
[debug] Emitter (write output): 607172 us
[success] Total time: 3 s, completed 15/02/2015 5:21:50 PM
[debug] > resumeFromFailure
[debug] > ~ webapp-client/fastOptJS
2. Waiting for source changes... (press enter to interrupt)
@sjrd
Copy link
Member

sjrd commented Feb 15, 2015

Would the output of fastOptJS perchance appear in the watched sources of the enclosing project?

@japgolly
Copy link
Contributor Author

No, but do you know of a means by which I can verify that?

What may be relevant is that there is a symlink in webapp-server/src/main/webapp/assets that points to stuff in webapp-client/target/scala-2.11. It's managed by SBT, in fact I can show you my build setup here ↓
https://github.com/japgolly/sbt/tree/skeleton with potentially relevant part here.

I wouldn't think the symlink would be the cause because 1) it worked in 0.5.x, and 2) the symlink itself doesn't change when is running ~fastOptJS, just its target.

@sjrd
Copy link
Member

sjrd commented Feb 16, 2015

Hum, OK, I'll investigate this.

@sjrd sjrd added the bug Confirmed bug. Needs to be fixed. label Feb 23, 2015
@sjrd sjrd added this to the v0.6.1 milestone Feb 23, 2015
@sjrd sjrd self-assigned this Feb 23, 2015
@sjrd
Copy link
Member

sjrd commented Feb 25, 2015

Well, I think we broke this in 07b8871. By turning the classes representing the JS_DEPENDENCIES from case classes to normal classes, we broke their == test, which is used here to avoid rewriting the JS_DEPENDENCIES file if it's going to be same. This means this file is always rewritten. Therefore, the version of the Classpath given to the ScalaJSOptimizer in fastOptJS is always different from the previous one, causing fastOptJS to recreate an output file. Because this file changes every time, I guess the whatchSources of sbt think something's changed, and retriggers everything.

@sjrd sjrd closed this as completed in be96e2b Feb 25, 2015
sjrd added a commit that referenced this issue Feb 25, 2015
Fix #1491: Give proper equals/hashCode to JSDependencyManifest.
@japgolly
Copy link
Contributor Author

👍

sjrd added a commit to sjrd/jsdependencies that referenced this issue Jun 1, 2017
…cyManifest.

This is necessary for the sbt plugin to avoid recreating the
JS_DEPENDENCIES file over and over again, constantly invalidating
the output of fastOptJS and fullOptJS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug. Needs to be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants