| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package com.google.dart.compiler.end2end.inc; | 5 package com.google.dart.compiler.end2end.inc; |
| 6 | 6 |
| 7 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; | 7 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; |
| 8 import static com.google.dart.compiler.backend.js.AbstractJsBackend.EXTENSION_AP
P_JS; | 8 import static com.google.dart.compiler.backend.js.AbstractJsBackend.EXTENSION_AP
P_JS; |
| 9 import static com.google.dart.compiler.backend.js.AbstractJsBackend.EXTENSION_JS
; | 9 import static com.google.dart.compiler.backend.js.AbstractJsBackend.EXTENSION_JS
; |
| 10 | 10 |
| 11 import com.google.common.collect.Lists; | 11 import com.google.common.collect.Lists; |
| 12 import com.google.dart.compiler.CommandLineOptions.CompilerOptions; |
| 12 import com.google.dart.compiler.CompilerTestCase; | 13 import com.google.dart.compiler.CompilerTestCase; |
| 13 import com.google.dart.compiler.DartCompilationError; | 14 import com.google.dart.compiler.DartCompilationError; |
| 14 import com.google.dart.compiler.DartCompiler; | 15 import com.google.dart.compiler.DartCompiler; |
| 15 import com.google.dart.compiler.DartCompilerListener; | 16 import com.google.dart.compiler.DartCompilerListener; |
| 16 import com.google.dart.compiler.DefaultCompilerConfiguration; | 17 import com.google.dart.compiler.DefaultCompilerConfiguration; |
| 17 import com.google.dart.compiler.LibrarySource; | 18 import com.google.dart.compiler.LibrarySource; |
| 18 import com.google.dart.compiler.MockArtifactProvider; | 19 import com.google.dart.compiler.MockArtifactProvider; |
| 19 import com.google.dart.compiler.MockBundleLibrarySource; | 20 import com.google.dart.compiler.MockBundleLibrarySource; |
| 20 import com.google.dart.compiler.Source; | 21 import com.google.dart.compiler.Source; |
| 21 import com.google.dart.compiler.backend.js.JavascriptBackend; | 22 import com.google.dart.compiler.backend.js.JavascriptBackend; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 private IncMockArtifactProvider provider; | 61 private IncMockArtifactProvider provider; |
| 61 | 62 |
| 62 private MockBundleLibrarySource myAppSource; | 63 private MockBundleLibrarySource myAppSource; |
| 63 private MockBundleLibrarySource someLibSource; | 64 private MockBundleLibrarySource someLibSource; |
| 64 private MockBundleLibrarySource someImplLibSource; | 65 private MockBundleLibrarySource someImplLibSource; |
| 65 | 66 |
| 66 private final List<DartCompilationError> errors = Lists.newArrayList(); | 67 private final List<DartCompilationError> errors = Lists.newArrayList(); |
| 67 | 68 |
| 68 @Override | 69 @Override |
| 69 protected void setUp() throws Exception { | 70 protected void setUp() throws Exception { |
| 70 config = new DefaultCompilerConfiguration(new JavascriptBackend()) { | 71 CompilerOptions compilerOptions = new CompilerOptions() { |
| 72 // TODO(zundel): Update these tests to run without requiring code generati
on |
| 73 @Override |
| 74 public boolean checkOnly() { |
| 75 return false; |
| 76 } |
| 77 }; |
| 78 config = new DefaultCompilerConfiguration(new JavascriptBackend(), |
| 79 compilerOptions) { |
| 71 @Override | 80 @Override |
| 72 public boolean incremental() { | 81 public boolean incremental() { |
| 73 return true; | 82 return true; |
| 74 } | 83 } |
| 75 }; | 84 }; |
| 76 provider = new IncMockArtifactProvider(); | 85 provider = new IncMockArtifactProvider(); |
| 77 | 86 |
| 78 myAppSource = new MockBundleLibrarySource(IncrementalCompilationTest.class.g
etClassLoader(), | 87 myAppSource = new MockBundleLibrarySource(IncrementalCompilationTest.class.g
etClassLoader(), |
| 79 TEST_BASE_PATH, TEST_APP); | 88 TEST_BASE_PATH, TEST_APP); |
| 80 someLibSource = myAppSource.getImportFor("some.lib.dart"); | 89 someLibSource = myAppSource.getImportFor("some.lib.dart"); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 177 } |
| 169 | 178 |
| 170 public void testNormalizationTracking() { | 179 public void testNormalizationTracking() { |
| 171 compile(); | 180 compile(); |
| 172 | 181 |
| 173 provider.resetReadsAndWrites(); | 182 provider.resetReadsAndWrites(); |
| 174 myAppSource.touchSource("myother7.dart"); | 183 myAppSource.touchSource("myother7.dart"); |
| 175 compile(); | 184 compile(); |
| 176 | 185 |
| 177 // Test against normalization having an effect on hashcodes | 186 // Test against normalization having an effect on hashcodes |
| 178 // SomeInterface2 is an empty interface that can have an extra default const
ructor added by | 187 // SomeInterface2 is an empty interface that can have an extra default const
ructor added by |
| 179 // the dartc backend normalization process. By depending on a class that im
plements the interface, | 188 // the dartc backend normalization process. By depending on a class that im
plements the interface, |
| 180 // my.app.dart.deps will transitively depend on the empty interface. If som
ething changes | 189 // my.app.dart.deps will transitively depend on the empty interface. If som
ething changes |
| 181 // with how hashcodes are generated, this test should be updated. | 190 // with how hashcodes are generated, this test should be updated. |
| 182 | 191 |
| 183 // We just bumped the timestamp on myother7.dart, so only myother7.dart.js a
nd my.app.js should | 192 // We just bumped the timestamp on myother7.dart, so only myother7.dart.js a
nd my.app.js should |
| 184 // be changed. At present, the app's deps and api will be rewritten. | 193 // be changed. At present, the app's deps and api will be rewritten. |
| 185 | 194 |
| 186 didWrite("myother7.dart", EXTENSION_JS); | 195 didWrite("myother7.dart", EXTENSION_JS); |
| 187 didWrite("my.app.dart", EXTENSION_APP_JS); | 196 didWrite("my.app.dart", EXTENSION_APP_JS); |
| 188 didWrite("my.app.dart", EXTENSION_DEPS); | 197 didWrite("my.app.dart", EXTENSION_DEPS); |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 private void didWrite(String sourceName, String extension) { | 651 private void didWrite(String sourceName, String extension) { |
| 643 String spec = sourceName + "/" + extension; | 652 String spec = sourceName + "/" + extension; |
| 644 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); | 653 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); |
| 645 } | 654 } |
| 646 | 655 |
| 647 private void didNotWrite(String sourceName, String extension) { | 656 private void didNotWrite(String sourceName, String extension) { |
| 648 String spec = sourceName + "/" + extension; | 657 String spec = sourceName + "/" + extension; |
| 649 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); | 658 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); |
| 650 } | 659 } |
| 651 } | 660 } |
| OLD | NEW |