@@ -23,6 +23,7 @@ import { BaseScriptAction, IBaseScriptActionOptions } from './BaseScriptAction';
2323import { FileSystem } from '@microsoft/node-core-library' ;
2424import { TaskRunner } from '../../logic/taskRunner/TaskRunner' ;
2525import { TaskCollection } from '../../logic/taskRunner/TaskCollection' ;
26+ import { Utilities } from '../../utilities/Utilities' ;
2627
2728/**
2829 * Constructor parameters for BulkScriptAction.
@@ -31,6 +32,7 @@ export interface IBulkScriptActionOptions extends IBaseScriptActionOptions {
3132 enableParallelism : boolean ;
3233 ignoreMissingScript : boolean ;
3334 ignoreDependencyOrder : boolean ;
35+ incremental : boolean ;
3436 allowWarningsInSuccessfulBuild : boolean ;
3537
3638 /**
@@ -51,6 +53,7 @@ export interface IBulkScriptActionOptions extends IBaseScriptActionOptions {
5153export class BulkScriptAction extends BaseScriptAction {
5254 private _enableParallelism : boolean ;
5355 private _ignoreMissingScript : boolean ;
56+ private _isIncrementalBuildAllowed : boolean ;
5457 private _commandToRun : string ;
5558
5659 private _changedProjectsOnly : CommandLineFlagParameter ;
@@ -67,6 +70,7 @@ export class BulkScriptAction extends BaseScriptAction {
6770 super ( options ) ;
6871 this . _enableParallelism = options . enableParallelism ;
6972 this . _ignoreMissingScript = options . ignoreMissingScript ;
73+ this . _isIncrementalBuildAllowed = options . incremental ;
7074 this . _commandToRun = options . commandToRun || options . actionName ;
7175 this . _ignoreDependencyOrder = options . ignoreDependencyOrder ;
7276 this . _allowWarningsInSuccessfulBuild = options . allowWarningsInSuccessfulBuild ;
@@ -95,7 +99,7 @@ export class BulkScriptAction extends BaseScriptAction {
9599 customParameter . appendToArgList ( customParameterValues ) ;
96100 }
97101
98- const changedProjectsOnly : boolean = this . actionName === 'build' && this . _changedProjectsOnly . value ;
102+ const changedProjectsOnly : boolean = this . _isIncrementalBuildAllowed && this . _changedProjectsOnly . value ;
99103
100104 const taskSelector : TaskSelector = new TaskSelector ( {
101105 rushConfiguration : this . rushConfiguration ,
@@ -104,20 +108,24 @@ export class BulkScriptAction extends BaseScriptAction {
104108 commandToRun : this . _commandToRun ,
105109 customParameterValues,
106110 isQuietMode : isQuietMode ,
107- isIncrementalBuildAllowed : this . actionName === 'build' ,
111+ isIncrementalBuildAllowed : this . _isIncrementalBuildAllowed ,
108112 ignoreMissingScript : this . _ignoreMissingScript ,
109- ignoreDependencyOrder : this . _ignoreDependencyOrder
113+ ignoreDependencyOrder : this . _ignoreDependencyOrder ,
114+ packageDepsFilename : Utilities . getPackageDepsFilenameForCommand ( this . _commandToRun )
110115 } ) ;
111116
112117 // Register all tasks with the task collection
113118 const taskCollection : TaskCollection = taskSelector . registerTasks ( ) ;
114119
115- const taskRunner : TaskRunner = new TaskRunner ( taskCollection . getOrderedTasks ( ) , {
116- quietMode : isQuietMode ,
117- parallelism : parallelism ,
118- changedProjectsOnly : changedProjectsOnly ,
119- allowWarningsInSuccessfulBuild : this . _allowWarningsInSuccessfulBuild
120- } ) ;
120+ const taskRunner : TaskRunner = new TaskRunner (
121+ taskCollection . getOrderedTasks ( ) ,
122+ {
123+ quietMode : isQuietMode ,
124+ parallelism : parallelism ,
125+ changedProjectsOnly : changedProjectsOnly ,
126+ allowWarningsInSuccessfulBuild : this . _allowWarningsInSuccessfulBuild
127+ }
128+ ) ;
121129
122130 return taskRunner . execute ( ) . then ( ( ) => {
123131 stopwatch . stop ( ) ;
@@ -179,7 +187,7 @@ export class BulkScriptAction extends BaseScriptAction {
179187 parameterShortName : '-v' ,
180188 description : 'Display the logs during the build, rather than just displaying the build status summary'
181189 } ) ;
182- if ( this . actionName === 'build' ) {
190+ if ( this . _isIncrementalBuildAllowed ) {
183191 this . _changedProjectsOnly = this . defineFlagParameter ( {
184192 parameterLongName : '--changed-projects-only' ,
185193 parameterShortName : '-o' ,
0 commit comments