Skip to content

Commit f83c6ad

Browse files
Copiloticlanton
andauthored
Rename filterAppleDoubleFiles to excludeAppleDoubleFiles (#5626)
* Initial plan * Rename filterAppleDoubleFiles to excludeAppleDoubleFiles across the codebase Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
1 parent 11b6300 commit f83c6ad

8 files changed

Lines changed: 46 additions & 35 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "",
5+
"type": "none",
6+
"packageName": "@microsoft/rush"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "iclanton@users.noreply.github.com"
11+
}

common/changes/@microsoft/rush/omit-apple-doubles-from-cache_2026-02-16-05-38.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"changes": [
33
{
44
"packageName": "@microsoft/rush",
5-
"comment": "Add a new \"omitAppleDoubleFilesFromBuildCache\" experiment. When enabled, the Rush build cache will omit macOS AppleDouble metadata files (._*) from cache archives when a companion file exists in the same directory. This prevents platform-specific metadata files from polluting the shared build cache. The filtering only applies when running on macOS.",
5+
"comment": "Add a new \"omitAppleDoubleFilesFromBuildCache\" experiment. When enabled, the Rush build cache will omit macOS AppleDouble metadata files (._*) from cache archives when a companion file exists in the same directory. This prevents platform-specific metadata files from polluting the shared build cache. The exclusion only applies when running on macOS.",
66
"type": "none"
77
}
88
],

common/reviews/api/rush-lib.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ export interface _INpmOptionsJson extends IPackageManagerOptionsJsonBase {
584584
// @internal (undocumented)
585585
export interface _IOperationBuildCacheOptions {
586586
buildCacheConfiguration: BuildCacheConfiguration;
587-
filterAppleDoubleFiles: boolean;
587+
excludeAppleDoubleFiles: boolean;
588588
terminal: ITerminal;
589589
}
590590

libraries/rush-lib/src/cli/scriptActions/PhasedScriptAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ export class PhasedScriptAction extends BaseScriptAction<IPhasedCommandConfig> i
509509
buildCacheConfiguration,
510510
cobuildConfiguration,
511511
terminal,
512-
filterAppleDoubleFiles:
512+
excludeAppleDoubleFiles:
513513
!!this.rushConfiguration.experimentsConfiguration.configuration
514514
.omitAppleDoubleFilesFromBuildCache
515515
}).apply(this.hooks);

libraries/rush-lib/src/logic/buildCache/OperationBuildCache.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface IOperationBuildCacheOptions {
3131
* If true, omit AppleDouble (`._*`) files from cache archives when running on macOS
3232
* and a companion file exists in the same directory.
3333
*/
34-
filterAppleDoubleFiles: boolean;
34+
excludeAppleDoubleFiles: boolean;
3535
}
3636

3737
/**
@@ -74,7 +74,7 @@ export class OperationBuildCache {
7474
private readonly _cacheWriteEnabled: boolean;
7575
private readonly _projectOutputFolderNames: ReadonlyArray<string>;
7676
private readonly _cacheId: string | undefined;
77-
private readonly _filterAppleDoubleFiles: boolean;
77+
private readonly _excludeAppleDoubleFiles: boolean;
7878

7979
private constructor(cacheId: string | undefined, options: IProjectBuildCacheOptions) {
8080
const {
@@ -86,7 +86,7 @@ export class OperationBuildCache {
8686
},
8787
project,
8888
projectOutputFolderNames,
89-
filterAppleDoubleFiles
89+
excludeAppleDoubleFiles
9090
} = options;
9191
this._project = project;
9292
this._localBuildCacheProvider = localCacheProvider;
@@ -95,7 +95,7 @@ export class OperationBuildCache {
9595
this._cacheWriteEnabled = cacheWriteEnabled;
9696
this._projectOutputFolderNames = projectOutputFolderNames || [];
9797
this._cacheId = cacheId;
98-
this._filterAppleDoubleFiles = filterAppleDoubleFiles && process.platform === 'darwin';
98+
this._excludeAppleDoubleFiles = excludeAppleDoubleFiles && process.platform === 'darwin';
9999
}
100100

101101
private static _tryGetTarUtility(terminal: ITerminal): Promise<TarExecutable | undefined> {
@@ -119,7 +119,7 @@ export class OperationBuildCache {
119119
executionResult: IOperationExecutionResult,
120120
options: IOperationBuildCacheOptions
121121
): OperationBuildCache {
122-
const { buildCacheConfiguration, terminal, filterAppleDoubleFiles } = options;
122+
const { buildCacheConfiguration, terminal, excludeAppleDoubleFiles } = options;
123123
const outputFolders: string[] = [...(executionResult.operation.settings?.outputFolderNames ?? [])];
124124
if (executionResult.metadataFolderPath) {
125125
outputFolders.push(executionResult.metadataFolderPath);
@@ -132,7 +132,7 @@ export class OperationBuildCache {
132132
phaseName: executionResult.operation.associatedPhase.name,
133133
projectOutputFolderNames: outputFolders,
134134
operationStateHash: executionResult.getStateHash(),
135-
filterAppleDoubleFiles
135+
excludeAppleDoubleFiles
136136
};
137137
const cacheId: string | undefined = OperationBuildCache._getCacheId(buildCacheOptions);
138138
return new OperationBuildCache(cacheId, buildCacheOptions);
@@ -352,14 +352,14 @@ export class OperationBuildCache {
352352
const filteredOutputFolderNames: string[] = [];
353353

354354
let hasSymbolicLinks: boolean = false;
355-
const filterAppleDoubleFiles: boolean = this._filterAppleDoubleFiles;
355+
const excludeAppleDoubleFiles: boolean = this._excludeAppleDoubleFiles;
356356

357357
// Adds child directories to the queue, files to the path list, and bails on symlinks
358358
function processChildren(relativePath: string, diskPath: string, children: FolderItem[]): void {
359-
// When filtering AppleDouble files, build a set of sibling names so we can check
359+
// When excluding AppleDouble files, build a set of sibling names so we can check
360360
// whether a companion file exists for each ._X file.
361361
let childNameSet: Set<string> | undefined;
362-
if (filterAppleDoubleFiles) {
362+
if (excludeAppleDoubleFiles) {
363363
childNameSet = new Set<string>(children.map(({ name }) => name));
364364
}
365365

libraries/rush-lib/src/logic/buildCache/test/OperationBuildCache.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface ITestOptions {
1515
enabled: boolean;
1616
writeAllowed: boolean;
1717
trackedProjectFiles: string[] | undefined;
18-
filterAppleDoubleFiles: boolean;
18+
excludeAppleDoubleFiles: boolean;
1919
}
2020

2121
function createFolderItem(name: string, type: 'file' | 'directory' | 'symlink'): FolderItem {
@@ -59,7 +59,7 @@ describe(OperationBuildCache.name, () => {
5959
operationStateHash: '1926f30e8ed24cb47be89aea39e7efd70fcda075',
6060
terminal,
6161
phaseName: 'build',
62-
filterAppleDoubleFiles: !!options.filterAppleDoubleFiles
62+
excludeAppleDoubleFiles: !!options.excludeAppleDoubleFiles
6363
});
6464

6565
return subject;
@@ -74,7 +74,7 @@ describe(OperationBuildCache.name, () => {
7474
});
7575
});
7676

77-
describe('AppleDouble file filtering', () => {
77+
describe('AppleDouble file exclusion', () => {
7878
const originalPlatform: NodeJS.Platform = process.platform;
7979

8080
afterEach(() => {
@@ -85,7 +85,7 @@ describe(OperationBuildCache.name, () => {
8585
it('omits AppleDouble files with companions when enabled on macOS', async () => {
8686
Object.defineProperty(process, 'platform', { value: 'darwin' });
8787

88-
const subject: OperationBuildCache = prepareSubject({ filterAppleDoubleFiles: true });
88+
const subject: OperationBuildCache = prepareSubject({ excludeAppleDoubleFiles: true });
8989

9090
jest
9191
.spyOn(FileSystem, 'readFolderItemsAsync')
@@ -111,7 +111,7 @@ describe(OperationBuildCache.name, () => {
111111
it('keeps AppleDouble files without companion files', async () => {
112112
Object.defineProperty(process, 'platform', { value: 'darwin' });
113113

114-
const subject: OperationBuildCache = prepareSubject({ filterAppleDoubleFiles: true });
114+
const subject: OperationBuildCache = prepareSubject({ excludeAppleDoubleFiles: true });
115115

116116
jest
117117
.spyOn(FileSystem, 'readFolderItemsAsync')
@@ -127,10 +127,10 @@ describe(OperationBuildCache.name, () => {
127127
expect(result!.outputFilePaths).toEqual(['dist/._orphan.txt', 'dist/other.js']);
128128
});
129129

130-
it('does not filter AppleDouble files when the experiment is disabled', async () => {
130+
it('does not exclude AppleDouble files when the experiment is disabled', async () => {
131131
Object.defineProperty(process, 'platform', { value: 'darwin' });
132132

133-
const subject: OperationBuildCache = prepareSubject({ filterAppleDoubleFiles: false });
133+
const subject: OperationBuildCache = prepareSubject({ excludeAppleDoubleFiles: false });
134134

135135
jest
136136
.spyOn(FileSystem, 'readFolderItemsAsync')
@@ -146,10 +146,10 @@ describe(OperationBuildCache.name, () => {
146146
expect(result!.outputFilePaths).toEqual(['dist/._foo.txt', 'dist/foo.txt']);
147147
});
148148

149-
it('does not filter AppleDouble files on non-macOS platforms', async () => {
149+
it('does not exclude AppleDouble files on non-macOS platforms', async () => {
150150
Object.defineProperty(process, 'platform', { value: 'win32' });
151151

152-
const subject: OperationBuildCache = prepareSubject({ filterAppleDoubleFiles: true });
152+
const subject: OperationBuildCache = prepareSubject({ excludeAppleDoubleFiles: true });
153153

154154
jest
155155
.spyOn(FileSystem, 'readFolderItemsAsync')
@@ -165,10 +165,10 @@ describe(OperationBuildCache.name, () => {
165165
expect(result!.outputFilePaths).toEqual(['dist/._foo.txt', 'dist/foo.txt']);
166166
});
167167

168-
it('does not filter files named exactly "._"', async () => {
168+
it('does not exclude files named exactly "._"', async () => {
169169
Object.defineProperty(process, 'platform', { value: 'darwin' });
170170

171-
const subject: OperationBuildCache = prepareSubject({ filterAppleDoubleFiles: true });
171+
const subject: OperationBuildCache = prepareSubject({ excludeAppleDoubleFiles: true });
172172

173173
jest
174174
.spyOn(FileSystem, 'readFolderItemsAsync')
@@ -184,10 +184,10 @@ describe(OperationBuildCache.name, () => {
184184
expect(result!.outputFilePaths).toEqual(['dist/._', 'dist/other.txt']);
185185
});
186186

187-
it('filters AppleDouble files in nested directories', async () => {
187+
it('excludes AppleDouble files in nested directories', async () => {
188188
Object.defineProperty(process, 'platform', { value: 'darwin' });
189189

190-
const subject: OperationBuildCache = prepareSubject({ filterAppleDoubleFiles: true });
190+
const subject: OperationBuildCache = prepareSubject({ excludeAppleDoubleFiles: true });
191191

192192
// First call returns the top-level dist/ contents with a subdirectory
193193
// Second call returns the subdirectory contents

libraries/rush-lib/src/logic/operations/CacheableOperationPlugin.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ export interface ICacheableOperationPluginOptions {
7676
buildCacheConfiguration: BuildCacheConfiguration;
7777
cobuildConfiguration: CobuildConfiguration | undefined;
7878
terminal: ITerminal;
79-
filterAppleDoubleFiles: boolean;
79+
excludeAppleDoubleFiles: boolean;
8080
}
8181

8282
interface ITryGetOperationBuildCacheOptionsBase<TRecord> {
8383
buildCacheContext: IOperationBuildCacheContext;
8484
buildCacheConfiguration: BuildCacheConfiguration | undefined;
8585
terminal: ITerminal;
86-
filterAppleDoubleFiles: boolean;
86+
excludeAppleDoubleFiles: boolean;
8787
record: TRecord;
8888
}
8989

@@ -108,7 +108,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
108108
allowWarningsInSuccessfulBuild,
109109
buildCacheConfiguration,
110110
cobuildConfiguration,
111-
filterAppleDoubleFiles
111+
excludeAppleDoubleFiles
112112
} = this._options;
113113

114114
hooks.beforeExecuteOperations.tap(
@@ -272,7 +272,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
272272
buildCacheConfiguration,
273273
terminal: buildCacheTerminal,
274274
record,
275-
filterAppleDoubleFiles
275+
excludeAppleDoubleFiles
276276
});
277277

278278
// Try to acquire the cobuild lock
@@ -291,7 +291,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
291291
buildCacheContext,
292292
record,
293293
terminal: buildCacheTerminal,
294-
filterAppleDoubleFiles
294+
excludeAppleDoubleFiles
295295
});
296296
if (operationBuildCache) {
297297
buildCacheTerminal.writeVerboseLine(
@@ -585,7 +585,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
585585
private _tryGetOperationBuildCache(
586586
options: ITryGetOperationBuildCacheOptions
587587
): OperationBuildCache | undefined {
588-
const { buildCacheConfiguration, buildCacheContext, terminal, record, filterAppleDoubleFiles } = options;
588+
const { buildCacheConfiguration, buildCacheContext, terminal, record, excludeAppleDoubleFiles } = options;
589589
if (!buildCacheContext.operationBuildCache) {
590590
const { cacheDisabledReason } = buildCacheContext;
591591
if (cacheDisabledReason && !record.operation.settings?.allowCobuildWithoutCache) {
@@ -601,7 +601,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
601601
buildCacheContext.operationBuildCache = OperationBuildCache.forOperation(record, {
602602
buildCacheConfiguration,
603603
terminal,
604-
filterAppleDoubleFiles
604+
excludeAppleDoubleFiles
605605
});
606606
}
607607

@@ -618,7 +618,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
618618
cobuildConfiguration,
619619
record,
620620
terminal,
621-
filterAppleDoubleFiles
621+
excludeAppleDoubleFiles
622622
} = options;
623623

624624
if (!buildCacheConfiguration?.buildCacheEnabled) {
@@ -649,7 +649,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin {
649649
terminal,
650650
operationStateHash,
651651
phaseName: associatedPhase.name,
652-
filterAppleDoubleFiles
652+
excludeAppleDoubleFiles
653653
});
654654

655655
buildCacheContext.operationBuildCache = operationBuildCache;

rush-plugins/rush-bridge-cache-plugin/src/BridgeCachePlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class BridgeCachePlugin implements IRushPlugin {
119119
{
120120
buildCacheConfiguration,
121121
terminal,
122-
filterAppleDoubleFiles: !!omitAppleDoubleFilesFromBuildCache
122+
excludeAppleDoubleFiles: !!omitAppleDoubleFilesFromBuildCache
123123
}
124124
);
125125

0 commit comments

Comments
 (0)