Skip to content

Commit

Permalink
Revert "TS Incremental build exclude test files (elastic#95610)" (ela…
Browse files Browse the repository at this point in the history
…stic#96223)

This reverts commit b6e582c.
  • Loading branch information
mshustov committed Apr 6, 2021
1 parent c62610b commit a26c99b
Show file tree
Hide file tree
Showing 171 changed files with 281 additions and 351 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"incremental": false,
"outDir": "target",
Expand Down
2 changes: 1 addition & 1 deletion src/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.project.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
37 changes: 5 additions & 32 deletions src/dev/typescript/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { basename, dirname, relative, resolve } from 'path';
import { memoize } from 'lodash';

import { IMinimatch, Minimatch } from 'minimatch';
import { REPO_ROOT } from '@kbn/utils';

Expand All @@ -26,10 +26,6 @@ function testMatchers(matchers: IMinimatch[], path: string) {
return matchers.some((matcher) => matcher.match(path));
}

const parentProjectFactory = memoize(function (parentConfigPath: string) {
return new Project(parentConfigPath);
});

export class Project {
public directory: string;
public name: string;
Expand All @@ -38,24 +34,22 @@ export class Project {

private readonly include: IMinimatch[];
private readonly exclude: IMinimatch[];
private readonly parent?: Project;

constructor(
public tsConfigPath: string,
options: { name?: string; disableTypeCheck?: boolean } = {}
) {
this.config = parseTsConfig(tsConfigPath);

const { files, include, exclude = [], extends: extendsPath } = this.config as {
const { files, include, exclude = [] } = this.config as {
files?: string[];
include?: string[];
exclude?: string[];
extends?: string;
};

if (files || !include) {
throw new Error(
`[${tsConfigPath}]: tsconfig.json files in the Kibana repo must use "include" keys and not "files"`
'tsconfig.json files in the Kibana repo must use "include" keys and not "files"'
);
}

Expand All @@ -64,30 +58,9 @@ export class Project {
this.name = options.name || relative(REPO_ROOT, this.directory) || basename(this.directory);
this.include = makeMatchers(this.directory, include);
this.exclude = makeMatchers(this.directory, exclude);

if (extendsPath !== undefined) {
const parentConfigPath = resolve(this.directory, extendsPath);
this.parent = parentProjectFactory(parentConfigPath);
}
}

public isAbsolutePathSelected(path: string): boolean {
return this.isExcluded(path) ? false : this.isIncluded(path);
}

public isExcluded(path: string): boolean {
if (testMatchers(this.exclude, path)) return true;
if (this.parent) {
return this.parent.isExcluded(path);
}
return false;
}

public isIncluded(path: string): boolean {
if (testMatchers(this.include, path)) return true;
if (this.parent) {
return this.parent.isIncluded(path);
}
return false;
public isAbsolutePathSelected(path: string) {
return testMatchers(this.exclude, path) ? false : testMatchers(this.include, path);
}
}
2 changes: 1 addition & 1 deletion src/plugins/advanced_settings/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/apm_oss/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/bfetch/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/charts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/console/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dashboard/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { createMockContext } from '../../../../expressions/common/mocks';
import { createMockContext } from '../../../../expressions/common';
import { functionWrapper } from './utils';
import { existsFilterFunction } from './exists_filter';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { createMockContext } from '../../../../expressions/common/mocks';
import { createMockContext } from '../../../../expressions/common';
import { functionWrapper } from './utils';
import { kibanaFilterFunction } from './kibana_filter';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { createMockContext } from '../../../../expressions/common/mocks';
import { createMockContext } from '../../../../expressions/common';
import { functionWrapper } from './utils';
import { phraseFilterFunction } from './phrase_filter';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { createMockContext } from '../../../../expressions/common/mocks';
import { createMockContext } from '../../../../expressions/common';
import { functionWrapper } from './utils';
import { rangeFilterFunction } from './range_filter';

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dev_tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/discover/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/embeddable/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/es_ui_shared/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/expressions/common/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ export const createMockExecutionContext = <ExtraContext extends object = object>
...extraContext,
};
};

export { createMockContext } from './util/test_utils';
1 change: 1 addition & 0 deletions src/plugins/expressions/common/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export * from './create_error';
export * from './get_by_alias';
export * from './tables_adapter';
export * from './expressions_inspector_adapter';
export * from './test_utils';
2 changes: 1 addition & 1 deletion src/plugins/expressions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/home/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/index_pattern_field_editor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/index_pattern_management/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/input_control_vis/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/inspector/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana_legacy/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana_overview/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana_react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana_usage_collection/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana_utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/legacy_export/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/management/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/maps_ems/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/maps_legacy/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/navigation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/newsfeed/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/presentation_util/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/region_map/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/saved_objects/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/saved_objects_management/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/saved_objects_tagging_oss/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/security_oss/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/share/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/spaces_oss/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/telemetry/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.project.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
Loading

0 comments on commit a26c99b

Please sign in to comment.