{"action":"created","comment":{"url":"https://api.github.com/repos/dart-lang/build/pulls/comments/53212378","id":53212378,"diff_hunk":"@@ -126,40 +127,53 @@ class WatchImpl {\n       }\n       assert(_nextBuildScheduled == false);\n \n-      /// Remove any updates that were generated outputs or otherwise not\n-      /// interesting.\n-      var updatesToRemove = updatedInputs.keys.where(_shouldSkipInput).toList();\n-      updatesToRemove.forEach(updatedInputs.remove);\n-      if (updatedInputs.isEmpty && !force) {\n+      /// Copy [updatedInputs] so that it doesn't get modified after this point.\n+      /// Any further updates will be scheduled for the next build.\n+      ///\n+      /// Only copy the \"interesting\" outputs.\n+      var updatedInputsCopy = <AssetId, ChangeType>{};\n+      updatedInputs.forEach((input, changeType) {\n+        if (_shouldSkipInput(input)) return;\n+        updatedInputsCopy[input] = changeType;\n+      });\n+      updatedInputs.clear();\n+      if (updatedInputsCopy.isEmpty && !force) {\n         return;\n       }\n \n       _logger.info('Preparing for next build');\n-      _logger.info('Clearing cache for invalidated assets');\n-      void clearNodeAndDeps(AssetId id, ChangeType rootChangeType) {\n+      Future clearNodeAndDeps(\n+          AssetId id, AssetId primaryInput, ChangeType rootChangeType) async {\n         var node = _assetGraph.get(id);\n         if (node == null) return;\n-        if (node is GeneratedAssetNode) {\n-          node.needsUpdate = true;\n-        }\n         _assetCache.remove(id);\n         for (var output in node.outputs) {\n-          clearNodeAndDeps(output, rootChangeType);\n+          await clearNodeAndDeps(output, primaryInput, rootChangeType);\n         }\n \n         /// For deletes, prune the graph.\n-        if (rootChangeType == ChangeType.REMOVE) {\n+        if (id == primaryInput && rootChangeType == ChangeType.REMOVE) {\n           _assetGraph.remove(id);\n         }\n+        if (node is GeneratedAssetNode) {\n+          node.needsUpdate = true;\n+          if (rootChangeType == ChangeType.REMOVE &&\n+              node.primaryInput == primaryInput) {\n+            _assetGraph.remove(id);\n+            await _writer.delete(id);\n+          }\n+        }\n       }\n-      for (var input in updatedInputs.keys) {\n-        clearNodeAndDeps(input, updatedInputs[input]);\n-      }\n-      updatedInputs.clear();\n \n-      _logger.info('Starting build');\n-      _currentBuild = _buildImpl.runBuild();\n-      _currentBuild.then((result) {\n+      () async {","path":"lib/src/generate/watch_impl.dart","position":115,"original_position":113,"commit_id":"63d58f7bc0661e0608f917689bf8805f94f7fb81","original_commit_id":"8f75336555c31eb2cdf0a2a51d43b5adc4b192fa","user":{"login":"kegluneq","id":613610,"avatar_url":"https://avatars.githubusercontent.com/u/613610?v=3","gravatar_id":"","url":"https://api.github.com/users/kegluneq","html_url":"https://github.com/kegluneq","followers_url":"https://api.github.com/users/kegluneq/followers","following_url":"https://api.github.com/users/kegluneq/following{/other_user}","gists_url":"https://api.github.com/users/kegluneq/gists{/gist_id}","starred_url":"https://api.github.com/users/kegluneq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kegluneq/subscriptions","organizations_url":"https://api.github.com/users/kegluneq/orgs","repos_url":"https://api.github.com/users/kegluneq/repos","events_url":"https://api.github.com/users/kegluneq/events{/privacy}","received_events_url":"https://api.github.com/users/kegluneq/received_events","type":"User","site_admin":false},"body":"This still looks odd to me. If you prefer to leave the IIFE, please add a comment explaining why.","created_at":"2016-02-17T18:57:37Z","updated_at":"2016-02-17T18:57:37Z","html_url":"https://github.com/dart-lang/build/pull/50#discussion_r53212378","pull_request_url":"https://api.github.com/repos/dart-lang/build/pulls/50","_links":{"self":{"href":"https://api.github.com/repos/dart-lang/build/pulls/comments/53212378"},"html":{"href":"https://github.com/dart-lang/build/pull/50#discussion_r53212378"},"pull_request":{"href":"https://api.github.com/repos/dart-lang/build/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/dart-lang/build/pulls/50","id":59679230,"html_url":"https://github.com/dart-lang/build/pull/50","diff_url":"https://github.com/dart-lang/build/pull/50.diff","patch_url":"https://github.com/dart-lang/build/pull/50.patch","issue_url":"https://api.github.com/repos/dart-lang/build/issues/50","number":50,"state":"open","locked":false,"title":"Cache the asset graph after each build, and read it in at startup","user":{"login":"jakemac53","id":984921,"avatar_url":"https://avatars.githubusercontent.com/u/984921?v=3","gravatar_id":"","url":"https://api.github.com/users/jakemac53","html_url":"https://github.com/jakemac53","followers_url":"https://api.github.com/users/jakemac53/followers","following_url":"https://api.github.com/users/jakemac53/following{/other_user}","gists_url":"https://api.github.com/users/jakemac53/gists{/gist_id}","starred_url":"https://api.github.com/users/jakemac53/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakemac53/subscriptions","organizations_url":"https://api.github.com/users/jakemac53/orgs","repos_url":"https://api.github.com/users/jakemac53/repos","events_url":"https://api.github.com/users/jakemac53/events{/privacy}","received_events_url":"https://api.github.com/users/jakemac53/received_events","type":"User","site_admin":false},"body":"closes https://github.com/dart-lang/build/issues/7","created_at":"2016-02-17T17:30:24Z","updated_at":"2016-02-17T18:57:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0400a3f9bdd564945eb9fb7dc9ec52ea8e8d4143","assignee":{"login":"kegluneq","id":613610,"avatar_url":"https://avatars.githubusercontent.com/u/613610?v=3","gravatar_id":"","url":"https://api.github.com/users/kegluneq","html_url":"https://github.com/kegluneq","followers_url":"https://api.github.com/users/kegluneq/followers","following_url":"https://api.github.com/users/kegluneq/following{/other_user}","gists_url":"https://api.github.com/users/kegluneq/gists{/gist_id}","starred_url":"https://api.github.com/users/kegluneq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kegluneq/subscriptions","organizations_url":"https://api.github.com/users/kegluneq/orgs","repos_url":"https://api.github.com/users/kegluneq/repos","events_url":"https://api.github.com/users/kegluneq/events{/privacy}","received_events_url":"https://api.github.com/users/kegluneq/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dart-lang/build/milestones/4","html_url":"https://github.com/dart-lang/build/milestones/v0.1.3%20release","labels_url":"https://api.github.com/repos/dart-lang/build/milestones/4/labels","id":1534927,"number":4,"title":"v0.1.3 release","description":"Incremental builds from startup, compatible with watch and build modes.","creator":{"login":"jakemac53","id":984921,"avatar_url":"https://avatars.githubusercontent.com/u/984921?v=3","gravatar_id":"","url":"https://api.github.com/users/jakemac53","html_url":"https://github.com/jakemac53","followers_url":"https://api.github.com/users/jakemac53/followers","following_url":"https://api.github.com/users/jakemac53/following{/other_user}","gists_url":"https://api.github.com/users/jakemac53/gists{/gist_id}","starred_url":"https://api.github.com/users/jakemac53/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakemac53/subscriptions","organizations_url":"https://api.github.com/users/jakemac53/orgs","repos_url":"https://api.github.com/users/jakemac53/repos","events_url":"https://api.github.com/users/jakemac53/events{/privacy}","received_events_url":"https://api.github.com/users/jakemac53/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":1,"state":"open","created_at":"2016-01-22T15:51:47Z","updated_at":"2016-02-17T17:30:24Z","due_on":"2016-03-04T08:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/dart-lang/build/pulls/50/commits","review_comments_url":"https://api.github.com/repos/dart-lang/build/pulls/50/comments","review_comment_url":"https://api.github.com/repos/dart-lang/build/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dart-lang/build/issues/50/comments","statuses_url":"https://api.github.com/repos/dart-lang/build/statuses/63d58f7bc0661e0608f917689bf8805f94f7fb81","head":{"label":"dart-lang:cache-asset-graph","ref":"cache-asset-graph","sha":"63d58f7bc0661e0608f917689bf8805f94f7fb81","user":{"login":"dart-lang","id":1609975,"avatar_url":"https://avatars.githubusercontent.com/u/1609975?v=3","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":50053618,"name":"build","full_name":"dart-lang/build","owner":{"login":"dart-lang","id":1609975,"avatar_url":"https://avatars.githubusercontent.com/u/1609975?v=3","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dart-lang/build","description":"","fork":false,"url":"https://api.github.com/repos/dart-lang/build","forks_url":"https://api.github.com/repos/dart-lang/build/forks","keys_url":"https://api.github.com/repos/dart-lang/build/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dart-lang/build/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dart-lang/build/teams","hooks_url":"https://api.github.com/repos/dart-lang/build/hooks","issue_events_url":"https://api.github.com/repos/dart-lang/build/issues/events{/number}","events_url":"https://api.github.com/repos/dart-lang/build/events","assignees_url":"https://api.github.com/repos/dart-lang/build/assignees{/user}","branches_url":"https://api.github.com/repos/dart-lang/build/branches{/branch}","tags_url":"https://api.github.com/repos/dart-lang/build/tags","blobs_url":"https://api.github.com/repos/dart-lang/build/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dart-lang/build/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dart-lang/build/git/refs{/sha}","trees_url":"https://api.github.com/repos/dart-lang/build/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dart-lang/build/statuses/{sha}","languages_url":"https://api.github.com/repos/dart-lang/build/languages","stargazers_url":"https://api.github.com/repos/dart-lang/build/stargazers","contributors_url":"https://api.github.com/repos/dart-lang/build/contributors","subscribers_url":"https://api.github.com/repos/dart-lang/build/subscribers","subscription_url":"https://api.github.com/repos/dart-lang/build/subscription","commits_url":"https://api.github.com/repos/dart-lang/build/commits{/sha}","git_commits_url":"https://api.github.com/repos/dart-lang/build/git/commits{/sha}","comments_url":"https://api.github.com/repos/dart-lang/build/comments{/number}","issue_comment_url":"https://api.github.com/repos/dart-lang/build/issues/comments{/number}","contents_url":"https://api.github.com/repos/dart-lang/build/contents/{+path}","compare_url":"https://api.github.com/repos/dart-lang/build/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dart-lang/build/merges","archive_url":"https://api.github.com/repos/dart-lang/build/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dart-lang/build/downloads","issues_url":"https://api.github.com/repos/dart-lang/build/issues{/number}","pulls_url":"https://api.github.com/repos/dart-lang/build/pulls{/number}","milestones_url":"https://api.github.com/repos/dart-lang/build/milestones{/number}","notifications_url":"https://api.github.com/repos/dart-lang/build/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dart-lang/build/labels{/name}","releases_url":"https://api.github.com/repos/dart-lang/build/releases{/id}","deployments_url":"https://api.github.com/repos/dart-lang/build/deployments","created_at":"2016-01-20T19:12:37Z","updated_at":"2016-02-17T00:04:36Z","pushed_at":"2016-02-17T18:54:18Z","git_url":"git://github.com/dart-lang/build.git","ssh_url":"git@github.com:dart-lang/build.git","clone_url":"https://github.com/dart-lang/build.git","svn_url":"https://github.com/dart-lang/build","homepage":"https://pub.dartlang.org/packages/build","size":124,"stargazers_count":0,"watchers_count":0,"language":"Dart","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":10,"forks":1,"open_issues":10,"watchers":0,"default_branch":"master"}},"base":{"label":"dart-lang:master","ref":"master","sha":"7f0ce90bcd579bd4fadeacbaaf5b21cb0ff9807a","user":{"login":"dart-lang","id":1609975,"avatar_url":"https://avatars.githubusercontent.com/u/1609975?v=3","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":50053618,"name":"build","full_name":"dart-lang/build","owner":{"login":"dart-lang","id":1609975,"avatar_url":"https://avatars.githubusercontent.com/u/1609975?v=3","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dart-lang/build","description":"","fork":false,"url":"https://api.github.com/repos/dart-lang/build","forks_url":"https://api.github.com/repos/dart-lang/build/forks","keys_url":"https://api.github.com/repos/dart-lang/build/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dart-lang/build/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dart-lang/build/teams","hooks_url":"https://api.github.com/repos/dart-lang/build/hooks","issue_events_url":"https://api.github.com/repos/dart-lang/build/issues/events{/number}","events_url":"https://api.github.com/repos/dart-lang/build/events","assignees_url":"https://api.github.com/repos/dart-lang/build/assignees{/user}","branches_url":"https://api.github.com/repos/dart-lang/build/branches{/branch}","tags_url":"https://api.github.com/repos/dart-lang/build/tags","blobs_url":"https://api.github.com/repos/dart-lang/build/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dart-lang/build/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dart-lang/build/git/refs{/sha}","trees_url":"https://api.github.com/repos/dart-lang/build/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dart-lang/build/statuses/{sha}","languages_url":"https://api.github.com/repos/dart-lang/build/languages","stargazers_url":"https://api.github.com/repos/dart-lang/build/stargazers","contributors_url":"https://api.github.com/repos/dart-lang/build/contributors","subscribers_url":"https://api.github.com/repos/dart-lang/build/subscribers","subscription_url":"https://api.github.com/repos/dart-lang/build/subscription","commits_url":"https://api.github.com/repos/dart-lang/build/commits{/sha}","git_commits_url":"https://api.github.com/repos/dart-lang/build/git/commits{/sha}","comments_url":"https://api.github.com/repos/dart-lang/build/comments{/number}","issue_comment_url":"https://api.github.com/repos/dart-lang/build/issues/comments{/number}","contents_url":"https://api.github.com/repos/dart-lang/build/contents/{+path}","compare_url":"https://api.github.com/repos/dart-lang/build/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dart-lang/build/merges","archive_url":"https://api.github.com/repos/dart-lang/build/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dart-lang/build/downloads","issues_url":"https://api.github.com/repos/dart-lang/build/issues{/number}","pulls_url":"https://api.github.com/repos/dart-lang/build/pulls{/number}","milestones_url":"https://api.github.com/repos/dart-lang/build/milestones{/number}","notifications_url":"https://api.github.com/repos/dart-lang/build/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dart-lang/build/labels{/name}","releases_url":"https://api.github.com/repos/dart-lang/build/releases{/id}","deployments_url":"https://api.github.com/repos/dart-lang/build/deployments","created_at":"2016-01-20T19:12:37Z","updated_at":"2016-02-17T00:04:36Z","pushed_at":"2016-02-17T18:54:18Z","git_url":"git://github.com/dart-lang/build.git","ssh_url":"git@github.com:dart-lang/build.git","clone_url":"https://github.com/dart-lang/build.git","svn_url":"https://github.com/dart-lang/build","homepage":"https://pub.dartlang.org/packages/build","size":124,"stargazers_count":0,"watchers_count":0,"language":"Dart","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":10,"forks":1,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dart-lang/build/pulls/50"},"html":{"href":"https://github.com/dart-lang/build/pull/50"},"issue":{"href":"https://api.github.com/repos/dart-lang/build/issues/50"},"comments":{"href":"https://api.github.com/repos/dart-lang/build/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/dart-lang/build/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/dart-lang/build/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dart-lang/build/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/dart-lang/build/statuses/63d58f7bc0661e0608f917689bf8805f94f7fb81"}}}}