Skip to content

Commit 32e9e95

Browse files
authored
LSC — Explicitly mark AOT incompatible targets via 'jit:true' (#6886)
## Motivation for features / changes This PR is for the LSC that will add `jit: true` to all `@Directive`, `@Component` and `@NgModule` classes that are not AOT compatible. Commonly in Google3, TypeScript test files are part of a `ts_library` or a `ng_module w/ testonly=True`. These targets simply run the TypeScript compiler from Microsoft, without any specific Angular processing. This allows code to exist that isn't necessarily compatible with Angular's compiler that strictly checks e.g. components This LSC adds `jit: true` to those components to clearly indicate that those components are not processed by the Angular compiler. This is a no-op because the Angular compiler doesn't even run on these files (as said above). In the future, we would like to change this, and need clear indication of what is incompatible or not. This is what the `jit: true` flag does. The `jit: true` flag basically tells the Angular compiler to ignore these components, so that their behavior is unchanged and everything continues to work like before.
1 parent a34563c commit 32e9e95

File tree

8 files changed

+9
-2
lines changed

8 files changed

+9
-2
lines changed

tensorboard/webapp/app_routing/effects/app_routing_effects_test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import {
4848
} from '../types';
4949
import {AppRoutingEffects, TEST_ONLY} from './app_routing_effects';
5050

51-
@Component({selector: 'test', template: ''})
51+
@Component({selector: 'test', template: '', jit: true})
5252
class TestableComponent {}
5353

5454
const testAction = createAction('[TEST] test action');

tensorboard/webapp/feature_flag/views/feature_flag_modal_trigger_container_test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
@Component({
3838
selector: 'testable-feature-flag-dialog-container',
3939
template: '<div>Test</div>',
40+
jit: true,
4041
})
4142
class TestableFeatureFlagDialogContainer {}
4243

tensorboard/webapp/plugins/testing/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ export class ExtraDashboardComponent {}
2626
imports: [
2727
PluginRegistryModule.forPlugin('extra-plugin', ExtraDashboardComponent),
2828
],
29+
jit: true,
2930
})
3031
export class ExtraDashboardModule {}

tensorboard/webapp/testing/integration_test_module.ts

+1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ export function provideRoute(): RouteDef[] {
6262
],
6363
declarations: [TestableComponent],
6464
exports: [TestableComponent],
65+
jit: true,
6566
})
6667
export class IntegrationTestSetupModule {}

tensorboard/webapp/webapp_data_source/tb_feature_flag_testing.ts

+1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ export class TestingTBFeatureFlagDataSource extends TBFeatureFlagDataSource {
4242
useExisting: TestingTBFeatureFlagDataSource,
4343
},
4444
],
45+
jit: true,
4546
})
4647
export class TBFeatureFlagTestingModule {}

tensorboard/webapp/webapp_data_source/tb_http_client_testing.ts

+1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ import {TBHttpClientModule} from './tb_http_client_module';
3434
),
3535
}),
3636
],
37+
jit: true,
3738
})
3839
export class TBHttpClientTestingModule {}

tensorboard/webapp/widgets/intersection_observer/intersection_observer_testing_module.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {Directive, EventEmitter, NgModule, Output} from '@angular/core';
1616
import {ComponentFixture} from '@angular/core/testing';
1717
import {By} from '@angular/platform-browser';
1818

19-
@Directive({selector: '[observeIntersection]'})
19+
@Directive({selector: '[observeIntersection]', jit: true})
2020
class IntersectionObserverTestingDirective {
2121
@Output() onVisibilityChange = new EventEmitter<{visible: boolean}>();
2222

@@ -28,6 +28,7 @@ class IntersectionObserverTestingDirective {
2828
@NgModule({
2929
exports: [IntersectionObserverTestingDirective],
3030
declarations: [IntersectionObserverTestingDirective],
31+
jit: true,
3132
})
3233
export class IntersectionObserverTestingModule {
3334
simulateVisibilityChange<T>(fixture: ComponentFixture<T>, visible: boolean) {

tensorboard/webapp/widgets/resize_detector_testing_module.ts

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class ResizeDetectorTestingDirective {
2929
@NgModule({
3030
exports: [ResizeDetectorTestingDirective],
3131
declarations: [ResizeDetectorTestingDirective],
32+
jit: true,
3233
})
3334
export class ResizeDetectorTestingModule {
3435
simulateResize<T>(fixture: ComponentFixture<T>) {

0 commit comments

Comments
 (0)