@@ -34,13 +34,9 @@ TBuilder = class(TObject)
3434 constructor Create(AConfigFile: String);
3535 destructor Destroy; override;
3636
37- { $IFDEF UNIX}
3837 procedure BuildCompileScriptBash ;
3938 procedure BuildTestScriptBash ;
4039 procedure BuildRunScriptBash ;
41- { $ELSE}
42- procedure BuildCompileScriptPowerShell ;
43- { $ENDIF}
4440 published
4541 end ;
4642
@@ -50,7 +46,9 @@ implementation
5046 { $IFDEF FPC}
5147 fpjson
5248, jsonparser
49+ { $IFDEF UNIX}
5350, BaseUnix
51+ { $ENDIF}
5452 { $ELSE}
5553 { $ENDIF}
5654;
@@ -72,9 +70,8 @@ implementation
7270
7371 cBaselineBinary = ' baseline' ;
7472 cCompilerFPC = ' fpc' ;
75- // cCompilerDelphi = 'delphi';
73+ cCompilerDelphi = ' delphi' ;
7674 cSSD = ' SSD' ;
77- // cHDD = 'HDD';
7875
7976resourcestring
8077 rsEPatternsLengthDOntMatch = ' Patterns length does not match' ;
@@ -86,7 +83,6 @@ constructor TBuilder.Create(AConfigFile: String);
8683 configStream: TFileStream;
8784 configJSONData: TJSONData;
8885begin
89- { #todo 99 -ogcarreno : Config file must be used here }
9086 configStream:= TFileStream.Create(AConfigFile, fmOpenRead);
9187 try
9288 configJSONData:= GetJSON(configStream);
@@ -154,10 +150,15 @@ procedure TBuilder.BuildCompileScriptBash;
154150 begin
155151 Write(GenerateProgressBar(index+1 , FConfig.Entries.Count, 50 ), lineBreak);
156152 if not FConfig.Entries[index].Active then continue;
153+ { $IFDEF UNIX}
157154 if FConfig.Entries[index].Compiler <> cCompilerFPC then continue;
155+ { $ELSE}
156+ if FConfig.Entries[index].Compiler <> cCompilerDelphi then continue;
157+ { $ENDIF}
158158 // if FConfig.Entries[index].EntryBinary = cBaselineBinary then continue;
159159 line:= line + ' function ' + FConfig.Entries[index].EntryBinary + ' () {' + LineEnding + LineEnding;
160160 line:= line + ' echo "===== ' + FConfig.Entries[index].Name +' ======"' + LineEnding;
161+ { $IFDEF UNIX}
161162 if FConfig.Entries[index].HasRelease then
162163 begin
163164 line:= line +
@@ -188,22 +189,33 @@ procedure TBuilder.BuildCompileScriptBash;
188189 ] ) +
189190 LineEnding;
190191 end ;
192+ { $ELSE}
193+ line:= line + ' # Needs the Delphi command line stuff' + LineEnding;
194+ { $ENDIF}
191195 line:= line + ' echo "==========="' + LineEnding;
192196 line:= line + ' echo' + LineEnding + LineEnding + ' }' + LineEnding + LineEnding;
193197 end ;
194198 line:= line + ' if [ $1 == "" ];then' + LineEnding;
195199 for index:= 0 to Pred(FConfig.Entries.Count) do
196200 begin
197201 if not FConfig.Entries[index].Active then continue;
202+ { $IFDEF UNIX}
198203 if FConfig.Entries[index].Compiler <> cCompilerFPC then continue;
204+ { $ELSE}
205+ if FConfig.Entries[index].Compiler <> cCompilerDelphi then continue;
206+ { $ENDIF}
199207 line:= line + ' ' + FConfig.Entries[index].EntryBinary + LineEnding;
200208 end ;
201209 line:= line + ' else' + LineEnding;
202210 line:= line + ' case $1 in' + LineEnding;
203211 for index:= 0 to Pred(FConfig.Entries.Count) do
204212 begin
205213 if not FConfig.Entries[index].Active then continue;
214+ { $IFDEF UNIX}
206215 if FConfig.Entries[index].Compiler <> cCompilerFPC then continue;
216+ { $ELSE}
217+ if FConfig.Entries[index].Compiler <> cCompilerDelphi then continue;
218+ { $ENDIF}
207219 line:= line + ' ' + FConfig.Entries[index].EntryBinary + ' )' + LineEnding;
208220 line:= line + ' ' + FConfig.Entries[index].EntryBinary + LineEnding;
209221 line:= line + ' ;;' + LineEnding;
@@ -217,17 +229,11 @@ procedure TBuilder.BuildCompileScriptBash;
217229 finally
218230 FScriptStream.Free;
219231 end ;
232+ { $IFDEF UNIX}
220233 FpChmod(PChar(FScriptFile), &775 );
234+ { $ENDIF}
221235end ;
222236
223- { $IFNDEF UNIX}
224- procedure TBuilder.BuildCompileScriptPowerShell ;
225- begin
226- { #todo 99 -ogcarreno : Using the command line compiler, compile the binary for Linux 64b }
227- { #todo 99 -ogcarreno : Using scp copy the resulting binary to Linux }
228- end ;
229- { $ENDIF}
230-
231237procedure TBuilder.BuildTestScriptBash ;
232238var
233239 index: Integer;
@@ -308,7 +314,9 @@ procedure TBuilder.BuildTestScriptBash;
308314 finally
309315 FScriptStream.Free;
310316 end ;
317+ { $IFDEF UNIX}
311318 FpChmod(PChar(FScriptFile), &775 );
319+ { $ENDIF}
312320end ;
313321
314322procedure TBuilder.BuildRunScriptBash ;
@@ -341,7 +349,7 @@ procedure TBuilder.BuildRunScriptBash;
341349 FConfig.Entries[index].EntryBinary,
342350 Format(' %s%s' , [
343351 IncludeTrailingPathDelimiter(FConfig.ResultsFolder),
344- FConfig.Entries[index].EntryBinary + ' -1_000_000_000-SSD .json'
352+ FConfig.Entries[index].EntryBinary + ' -1_000_000_000-' + cSSD + ' .json'
345353 ]),
346354 Format(' %s%s %s' , [
347355 IncludeTrailingPathDelimiter(FConfig.BinFolder),
@@ -363,7 +371,7 @@ procedure TBuilder.BuildRunScriptBash;
363371 ],
364372 [rfReplaceAll]
365373 );
366- line:= line + ' echo "-- SSD --"' + LineEnding + ' ' + tmpStr + LineEnding;
374+ line:= line + ' echo "-- ' + cSSD + ' --"' + LineEnding + ' ' + tmpStr + LineEnding;
367375 line:= line + ' echo "==========="' + LineEnding;
368376 line:= line + ' echo' + LineEnding + LineEnding + ' }' + LineEnding + LineEnding;
369377 end ;
@@ -393,7 +401,9 @@ procedure TBuilder.BuildRunScriptBash;
393401 finally
394402 FScriptStream.Free;
395403 end ;
404+ { $IFDEF UNIX}
396405 FpChmod(PChar(FScriptFile), &775 );
406+ { $ENDIF}
397407end ;
398408
399409end .
0 commit comments