File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import type { IPhase } from './CommandLineConfiguration';
1212import { OverlappingPathAnalyzer } from '../utilities/OverlappingPathAnalyzer' ;
1313import schemaJson from '../schemas/rush-project.schema.json' ;
1414import anythingSchemaJson from '../schemas/rush-project.schema.json' ;
15+ import { RushConnect } from '../utilities/RushConnect' ;
1516
1617/**
1718 * Describes the file structure for the `<project root>/config/rush-project.json` config file.
@@ -345,6 +346,12 @@ export class RushProjectConfiguration {
345346 phaseName : string ,
346347 isNoOp : boolean
347348 ) : string | undefined {
349+ const rushConnect : RushConnect = RushConnect . loadFromLinkStateFile ( this . project . rushConfiguration ) ;
350+ const subspaceNameList : string [ ] = Object . keys ( rushConnect . rushLinkState ?? { } ) ;
351+ if ( subspaceNameList . includes ( this . project . subspace . subspaceName ) ) {
352+ return 'Caching has been disabled for this project because it is a linked package.' ;
353+ }
354+
348355 // Skip no-op operations as they won't have any output/cacheable things.
349356 if ( isNoOp ) {
350357 return undefined ;
Original file line number Diff line number Diff line change @@ -61,15 +61,16 @@ interface IRushLinkOptions {
6161}
6262
6363export class RushConnect {
64+ public readonly rushLinkState : IRushLinkFileState | undefined ;
65+
6466 private readonly _terminal : ITerminal ;
6567 private readonly _rushLinkStateFilePath : string ;
66- private readonly _rushLinkState : IRushLinkFileState | undefined ;
6768
6869 public constructor ( options : IRushLinkOptions ) {
6970 this . _terminal = new Terminal ( new ConsoleTerminalProvider ( ) ) ;
7071
7172 this . _rushLinkStateFilePath = options . rushLinkStateFilePath ;
72- this . _rushLinkState = options . rushLinkState ;
73+ this . rushLinkState = options . rushLinkState ;
7374 }
7475
7576 private async _hardLinkToLinkedPackageAsync (
@@ -103,13 +104,13 @@ export class RushConnect {
103104 private async _modifyAndSaveLinkStateAsync (
104105 cb : ( linkState : IRushLinkFileState ) => Promise < void > | void
105106 ) : Promise < void > {
106- const linkState : IRushLinkFileState = this . _rushLinkState ?? { } ;
107+ const linkState : IRushLinkFileState = this . rushLinkState ?? { } ;
107108 await Promise . resolve ( cb ( linkState ) ) ;
108109 await JsonFile . saveAsync ( linkState , this . _rushLinkStateFilePath ) ;
109110 }
110111
111112 public async isSubspaceDependencyLinkedAsync ( subspaceName : string ) : Promise < boolean > {
112- if ( ! this . _rushLinkState || ! this . _rushLinkState [ subspaceName ] ?. length ) {
113+ if ( ! this . rushLinkState || ! this . rushLinkState [ subspaceName ] ?. length ) {
113114 return false ;
114115 }
115116
You can’t perform that action at this time.
0 commit comments