test: fix several bazel compiler-cli tests in windows (#30189)
``` //packages/compiler-cli/integrationtest:integrationtest //packages/compiler-cli/test/compliance:compliance ``` Partially addresses #29785 PR Close #30189
This commit is contained in:
parent
b40f6f3eae
commit
1660b34e2d
@ -23,3 +23,4 @@ steps:
|
|||||||
- yarn bazel test //tools/ts-api-guardian:all //packages/language-service/test
|
- yarn bazel test //tools/ts-api-guardian:all //packages/language-service/test
|
||||||
- yarn test-ivy-aot //packages/animations/test //packages/common/test //packages/forms/test //packages/http/test //packages/platform-browser/test //packages/platform-browser-dynamic/test //packages/router/test
|
- yarn test-ivy-aot //packages/animations/test //packages/common/test //packages/forms/test //packages/http/test //packages/platform-browser/test //packages/platform-browser-dynamic/test //packages/router/test
|
||||||
- yarn bazel test //tools/public_api_guard/...
|
- yarn bazel test //tools/public_api_guard/...
|
||||||
|
- yarn bazel test //packages/compiler-cli/integrationtest:integrationtest //packages/compiler-cli/test/compliance:compliance
|
||||||
|
@ -98,13 +98,8 @@ function symlinkNodeModules() {
|
|||||||
Object.keys(requiredNodeModules).forEach(importName => {
|
Object.keys(requiredNodeModules).forEach(importName => {
|
||||||
const outputPath = path.join(tmpDir, 'node_modules', importName);
|
const outputPath = path.join(tmpDir, 'node_modules', importName);
|
||||||
const moduleDir = requiredNodeModules[importName];
|
const moduleDir = requiredNodeModules[importName];
|
||||||
|
shx.mkdir('-p', path.dirname(outputPath));
|
||||||
findFilesWithinDirectory(moduleDir).forEach(filePath => {
|
fs.symlinkSync(moduleDir, outputPath, 'junction');
|
||||||
const outputFilePath = path.join(outputPath, path.relative(moduleDir, filePath));
|
|
||||||
|
|
||||||
shx.mkdir('-p', path.dirname(outputFilePath));
|
|
||||||
fs.symlinkSync(filePath, outputFilePath);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,5 +157,5 @@ function resolveNpmTreeArtifact(manifestPath, resolveFile = 'package.json') {
|
|||||||
|
|
||||||
/** Finds all files within a specified directory. */
|
/** Finds all files within a specified directory. */
|
||||||
function findFilesWithinDirectory(directoryPath) {
|
function findFilesWithinDirectory(directoryPath) {
|
||||||
return shx.find(directoryPath).filter(filePath => !fs.statSync(filePath).isDirectory());
|
return shx.find(directoryPath).filter(filePath => !fs.lstatSync(filePath).isDirectory());
|
||||||
}
|
}
|
||||||
|
@ -576,8 +576,8 @@ function readBazelWrittenFilesFrom(
|
|||||||
function processDirectory(dir: string, dest: string) {
|
function processDirectory(dir: string, dest: string) {
|
||||||
const entries = fs.readdirSync(dir);
|
const entries = fs.readdirSync(dir);
|
||||||
for (const name of entries) {
|
for (const name of entries) {
|
||||||
const fullName = path.join(dir, name);
|
const fullName = path.posix.join(dir, name);
|
||||||
const destName = path.join(dest, name);
|
const destName = path.posix.join(dest, name);
|
||||||
const stat = fs.statSync(fullName);
|
const stat = fs.statSync(fullName);
|
||||||
if (!skip(name, fullName)) {
|
if (!skip(name, fullName)) {
|
||||||
if (stat.isDirectory()) {
|
if (stat.isDirectory()) {
|
||||||
@ -590,11 +590,11 @@ function readBazelWrittenFilesFrom(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
processDirectory(bazelPackageRoot, path.join('/node_modules/@angular', packageName));
|
processDirectory(bazelPackageRoot, path.posix.join('/node_modules/@angular', packageName));
|
||||||
// todo: check why we always need an index.d.ts
|
// todo: check why we always need an index.d.ts
|
||||||
if (fs.existsSync(path.join(bazelPackageRoot, `${packageName}.d.ts`))) {
|
if (fs.existsSync(path.join(bazelPackageRoot, `${packageName}.d.ts`))) {
|
||||||
const content = fs.readFileSync(path.join(bazelPackageRoot, `${packageName}.d.ts`), 'utf8');
|
const content = fs.readFileSync(path.join(bazelPackageRoot, `${packageName}.d.ts`), 'utf8');
|
||||||
map.set(path.join('/node_modules/@angular', packageName, 'index.d.ts'), content);
|
map.set(path.posix.join('/node_modules/@angular', packageName, 'index.d.ts'), content);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(
|
console.error(
|
||||||
@ -632,24 +632,25 @@ export function setup(options: {
|
|||||||
if (options.compileAngular) {
|
if (options.compileAngular) {
|
||||||
// If this fails please add //packages/core:npm_package as a test data dependency.
|
// If this fails please add //packages/core:npm_package as a test data dependency.
|
||||||
readBazelWrittenFilesFrom(
|
readBazelWrittenFilesFrom(
|
||||||
path.join(sources, 'angular/packages/core/npm_package'), 'core', angularFiles,
|
resolveNpmTreeArtifact('angular/packages/core/npm_package'), 'core', angularFiles,
|
||||||
skipDirs);
|
skipDirs);
|
||||||
}
|
}
|
||||||
if (options.compileFakeCore) {
|
if (options.compileFakeCore) {
|
||||||
readBazelWrittenFilesFrom(
|
readBazelWrittenFilesFrom(
|
||||||
path.join(sources, 'angular/packages/compiler-cli/test/ngtsc/fake_core/npm_package'),
|
resolveNpmTreeArtifact(
|
||||||
|
'angular/packages/compiler-cli/test/ngtsc/fake_core/npm_package'),
|
||||||
'core', angularFiles, skipDirs);
|
'core', angularFiles, skipDirs);
|
||||||
}
|
}
|
||||||
if (options.compileAnimations) {
|
if (options.compileAnimations) {
|
||||||
// If this fails please add //packages/animations:npm_package as a test data dependency.
|
// If this fails please add //packages/animations:npm_package as a test data dependency.
|
||||||
readBazelWrittenFilesFrom(
|
readBazelWrittenFilesFrom(
|
||||||
path.join(sources, 'angular/packages/animations/npm_package'), 'animations',
|
resolveNpmTreeArtifact('angular/packages/animations/npm_package'), 'animations',
|
||||||
angularFiles, skipDirs);
|
angularFiles, skipDirs);
|
||||||
}
|
}
|
||||||
if (options.compileCommon) {
|
if (options.compileCommon) {
|
||||||
// If this fails please add //packages/common:npm_package as a test data dependency.
|
// If this fails please add //packages/common:npm_package as a test data dependency.
|
||||||
readBazelWrittenFilesFrom(
|
readBazelWrittenFilesFrom(
|
||||||
path.join(sources, 'angular/packages/common/npm_package'), 'common', angularFiles,
|
resolveNpmTreeArtifact('angular/packages/common/npm_package'), 'common', angularFiles,
|
||||||
skipDirs);
|
skipDirs);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -750,6 +751,10 @@ function isSourceOrDts(fileName: string): boolean {
|
|||||||
return /\.ts$/.test(fileName);
|
return /\.ts$/.test(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolveNpmTreeArtifact(manifestPath: string, resolveFile = 'package.json') {
|
||||||
|
return path.dirname(require.resolve(path.posix.join(manifestPath, resolveFile)));
|
||||||
|
}
|
||||||
|
|
||||||
export function compile(
|
export function compile(
|
||||||
rootDirs: MockData, options: {
|
rootDirs: MockData, options: {
|
||||||
emit?: boolean,
|
emit?: boolean,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user