11import { determineCdsCommand } from './command' ;
22import { compileCdsToJson } from './compile' ;
3- import {
4- AlternativeCdsCommand ,
5- CompilationAttempt ,
6- CompilationTask ,
7- CompilationConfig ,
8- } from './types' ;
3+ import { CompilationAttempt , CompilationTask , CompilationConfig } from './types' ;
94import { addCompilationDiagnostic } from '../../diagnostics' ;
105import { cdsExtractorLog } from '../../logging' ;
116import { CdsDependencyGraph , CdsProject } from '../parser/types' ;
@@ -113,20 +108,15 @@ function createCompilationTask(
113108 } ;
114109}
115110
116- /**
117- * Create compilation configuration with retry alternatives
118- */
119111function createCompilationConfig (
120- primaryCommand : string ,
121- primaryCacheDir : string | undefined ,
112+ cdsCommand : string ,
113+ cacheDir : string | undefined ,
122114 useProjectLevel : boolean ,
123- alternatives : AlternativeCdsCommand [ ] = [ ] ,
124115) : CompilationConfig {
125116 return {
126- primaryCdsCommand : primaryCommand ,
127- primaryCacheDir ,
117+ cdsCommand : cdsCommand ,
118+ cacheDir : cacheDir ,
128119 useProjectLevelCompilation : useProjectLevel ,
129- alternativeCommands : alternatives ,
130120 versionCompatibility : {
131121 isCompatible : true , // Will be validated during planning
132122 } ,
@@ -135,7 +125,7 @@ function createCompilationConfig(
135125}
136126
137127/**
138- * Execute a single compilation task with retry logic
128+ * Execute a single compilation task
139129 */
140130function executeCompilationTask (
141131 task : CompilationTask ,
@@ -150,58 +140,26 @@ function executeCompilationTask(
150140 throw new Error ( `No compilation configuration found for project ${ project . projectDir } ` ) ;
151141 }
152142
153- let lastError : Error | undefined ;
154-
155- // Try primary command first
156- const primaryAttempt = attemptCompilation (
143+ const compilationAttempt = attemptCompilation (
157144 task ,
158- config . primaryCdsCommand ,
159- config . primaryCacheDir ,
145+ config . cdsCommand ,
146+ config . cacheDir ,
160147 dependencyGraph ,
161148 ) ;
162149
163- if ( primaryAttempt . result . success ) {
150+ if ( compilationAttempt . result . success ) {
164151 task . status = 'success' ;
165152 dependencyGraph . statusSummary . successfulCompilations ++ ;
166153 return ;
167154 }
168155
169- lastError = primaryAttempt . error
170- ? new Error ( primaryAttempt . error . message )
171- : new Error ( 'Primary compilation failed' ) ;
172- task . status = 'retry' ;
173-
174- // Try alternative commands if primary failed
175- for ( const alternative of config . alternativeCommands ) {
176- if ( task . attempts . length >= config . maxRetryAttempts ) {
177- break ;
178- }
179-
180- cdsExtractorLog (
181- 'info' ,
182- `Retrying compilation for ${ task . sourceFiles [ 0 ] } with alternative command: ${ alternative . strategy } ` ,
183- ) ;
184-
185- const retryAttempt = attemptCompilation (
186- task ,
187- alternative . command ,
188- alternative . cacheDir ,
189- dependencyGraph ,
190- ) ;
191-
192- if ( retryAttempt . result . success ) {
193- task . status = 'success' ;
194- dependencyGraph . statusSummary . successfulCompilations ++ ;
195- dependencyGraph . statusSummary . retriedCompilations ++ ;
196- return ;
197- }
198-
199- lastError = retryAttempt . error ? new Error ( retryAttempt . error . message ) : lastError ;
200- }
156+ // Compilation failed - mark task as failed
157+ const lastError = compilationAttempt . error
158+ ? new Error ( compilationAttempt . error . message )
159+ : new Error ( 'Compilation failed' ) ;
201160
202- // All attempts failed
203161 task . status = 'failed' ;
204- task . errorSummary = lastError ?. message || 'All compilation attempts failed' ;
162+ task . errorSummary = lastError ?. message || 'Compilation failed' ;
205163 dependencyGraph . statusSummary . failedCompilations ++ ;
206164
207165 // Add diagnostic for failed compilation
@@ -308,7 +266,6 @@ export function generateStatusReport(dependencyGraph: CdsDependencyGraph): strin
308266 lines . push ( ` Successful: ${ summary . successfulCompilations } ` ) ;
309267 lines . push ( ` Failed: ${ summary . failedCompilations } ` ) ;
310268 lines . push ( ` Skipped: ${ summary . skippedCompilations } ` ) ;
311- lines . push ( ` Retried: ${ summary . retriedCompilations } ` ) ;
312269 lines . push ( '' ) ;
313270
314271 // Performance metrics
@@ -401,7 +358,7 @@ export function planCompilationTasks(
401358 try {
402359 const cacheDir = projectCacheDirMap . get ( projectDir ) ;
403360
404- // Determine primary CDS command
361+ // Determine CDS command
405362 const cdsCommand = determineCdsCommand ( cacheDir , dependencyGraph . sourceRootDir ) ;
406363
407364 // Create compilation configuration
0 commit comments