fix(compiler): Fix look up of entryComponents in AOT Summaries (#24892)
Previously, when you attempted to bootstrap a component that had a router-outlet using ngsummaries, it would complain that the component was not provided by any module even if it was. This commit fixes a mistake (AFAICT) which caused the lookup of the component in the AOT summaries to fail. I believe this change is safe. I've run the affected tests within Google and there were no breakages caused by this change. PR Close #24892
This commit is contained in:
parent
21009b06a1
commit
00d3666d95
|
@ -196,7 +196,7 @@ export class JitCompiler {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
localModuleMeta.entryComponents.forEach((entryComponentType) => {
|
localModuleMeta.entryComponents.forEach((entryComponentType) => {
|
||||||
if (!this.hasAotSummary(entryComponentType.componentType.reference)) {
|
if (!this.hasAotSummary(entryComponentType.componentType)) {
|
||||||
const moduleMeta = moduleByJitDirective.get(entryComponentType.componentType) !;
|
const moduleMeta = moduleByJitDirective.get(entryComponentType.componentType) !;
|
||||||
templates.add(
|
templates.add(
|
||||||
this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
|
this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
load("//tools:defaults.bzl", "ts_library", "ts_web_test_suite")
|
||||||
|
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
|
||||||
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
|
ng_module(
|
||||||
|
name = "aot_routing_module",
|
||||||
|
srcs = ["aot_router_module.ts"],
|
||||||
|
deps = [
|
||||||
|
"//packages/core",
|
||||||
|
"//packages/router",
|
||||||
|
"@rxjs",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
ts_library(
|
||||||
|
name = "aot_test_lib",
|
||||||
|
testonly = 1,
|
||||||
|
srcs = ["aot_router_bootstrap.spec.ts"],
|
||||||
|
deps = [
|
||||||
|
":aot_routing_module",
|
||||||
|
"//packages/core",
|
||||||
|
"//packages/core/testing",
|
||||||
|
"//packages/router",
|
||||||
|
"//packages/router/testing",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
jasmine_node_test(
|
||||||
|
name = "test",
|
||||||
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
|
deps = [
|
||||||
|
":aot_test_lib",
|
||||||
|
"//tools/testing:node",
|
||||||
|
],
|
||||||
|
)
|
|
@ -0,0 +1,28 @@
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright Google Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
|
* found in the LICENSE file at https://angular.io/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {TestBed} from '@angular/core/testing';
|
||||||
|
|
||||||
|
import {RouterTestingModule} from '../../testing';
|
||||||
|
|
||||||
|
import {AotRouterModule, ROUTES} from './aot_router_module';
|
||||||
|
import {AotRouterModuleNgSummary} from './aot_router_module.ngsummary';
|
||||||
|
|
||||||
|
describe('The Aot Routing Component', () => {
|
||||||
|
it('should be able to compile the components while using aotSummaries', () => {
|
||||||
|
TestBed
|
||||||
|
.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
AotRouterModule,
|
||||||
|
RouterTestingModule.withRoutes(ROUTES),
|
||||||
|
],
|
||||||
|
aotSummaries: () => [AotRouterModuleNgSummary],
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright Google Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
|
* found in the LICENSE file at https://angular.io/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {Component, NgModule} from '@angular/core';
|
||||||
|
import {RouterModule, Routes} from '../../';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'aot-router',
|
||||||
|
template: '<router-outlet></router-outlet>',
|
||||||
|
})
|
||||||
|
export class AotRouterCmp {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'aot-router-child',
|
||||||
|
template: 'arc',
|
||||||
|
})
|
||||||
|
export class AotRouterChildCmp {
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ROUTES: Routes = [
|
||||||
|
{path: '', component: AotRouterChildCmp},
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
AotRouterCmp,
|
||||||
|
AotRouterChildCmp,
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
AotRouterCmp,
|
||||||
|
AotRouterChildCmp,
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
RouterModule.forRoot(ROUTES),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class AotRouterModule {
|
||||||
|
}
|
|
@ -12,6 +12,7 @@
|
||||||
"compiler/test",
|
"compiler/test",
|
||||||
"compiler-cli/integrationtest",
|
"compiler-cli/integrationtest",
|
||||||
"platform-server/integrationtest",
|
"platform-server/integrationtest",
|
||||||
|
"router/test/aot_ngsummary_test",
|
||||||
"common/locales",
|
"common/locales",
|
||||||
"examples",
|
"examples",
|
||||||
"**/*_spec.ts",
|
"**/*_spec.ts",
|
||||||
|
@ -23,4 +24,4 @@
|
||||||
"annotateForClosureCompiler": false,
|
"annotateForClosureCompiler": false,
|
||||||
"annotationsAs": "decorators"
|
"annotationsAs": "decorators"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
"compiler-cli/integrationtest",
|
"compiler-cli/integrationtest",
|
||||||
"elements/schematics",
|
"elements/schematics",
|
||||||
"examples/**/e2e_test/*",
|
"examples/**/e2e_test/*",
|
||||||
"platform-server/integrationtest"
|
"platform-server/integrationtest",
|
||||||
|
"router/test/aot_ngsummary_test",
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue