IDE: auto create application bundle for IDE on darwin for all widgetsets

git-svn-id: trunk@47920 -
This commit is contained in:
mattias 2015-02-20 17:31:26 +00:00
parent 3a3f45bd46
commit ddf953cb24

View File

@ -174,8 +174,9 @@ type
// Methods used by MakeLazarus : // Methods used by MakeLazarus :
procedure ApplyCleanOnce; procedure ApplyCleanOnce;
function CheckDirectoryWritable(Dir: string): boolean; function CheckDirectoryWritable(Dir: string): boolean;
procedure CleanLazarusSrcDir(Dir: string; Recursive: boolean = true); procedure CleanDir(Dir: string; Recursive: boolean = true);
procedure CleanAll; procedure CleanLazarusSrcDir;
procedure CleanLazarusFallbackOutDir;
procedure CheckRevisionInc; procedure CheckRevisionInc;
procedure RestoreBackup; procedure RestoreBackup;
// Methods used by SaveIDEMakeOptions : // Methods used by SaveIDEMakeOptions :
@ -268,7 +269,7 @@ begin
mtError,[mbCancel]); mtError,[mbCancel]);
end; end;
procedure TLazarusBuilder.CleanLazarusSrcDir(Dir: string; Recursive: boolean = true); procedure TLazarusBuilder.CleanDir(Dir: string; Recursive: boolean = true);
var var
FileInfo: TSearchRec; FileInfo: TSearchRec;
Ext: String; Ext: String;
@ -278,14 +279,14 @@ begin
if FindFirstUTF8(Dir+AllFilesMask,faAnyFile,FileInfo)=0 then begin if FindFirstUTF8(Dir+AllFilesMask,faAnyFile,FileInfo)=0 then begin
repeat repeat
if (FileInfo.Name='') or (FileInfo.Name='.') or (FileInfo.Name='..') if (FileInfo.Name='') or (FileInfo.Name='.') or (FileInfo.Name='..')
or (FileInfo.Name='.svn') or (FileInfo.Name='.git') or (FileInfo.Name[1]='.')
then then
continue; continue;
Filename:=Dir+FileInfo.Name; Filename:=Dir+FileInfo.Name;
if faDirectory and FileInfo.Attr>0 then if faDirectory and FileInfo.Attr>0 then
begin begin
if Recursive then if Recursive then
CleanLazarusSrcDir(Filename) CleanDir(Filename)
end end
else begin else begin
Ext:=LowerCase(ExtractFileExt(FileInfo.Name)); Ext:=LowerCase(ExtractFileExt(FileInfo.Name));
@ -299,35 +300,40 @@ begin
FindCloseUTF8(FileInfo); FindCloseUTF8(FileInfo);
end; end;
procedure TLazarusBuilder.CleanAll; procedure TLazarusBuilder.CleanLazarusSrcDir;
var var
s: String; s: String;
begin begin
// clean all lazarus source directories // clean all lazarus source directories
// Note: Some installations put the fpc units into the lazarus directory // Note: Some installations put the fpc units into the lazarus directory
// => clean only the known directories // => clean only the known directories
CleanLazarusSrcDir(fWorkingDir,false); CleanDir(fWorkingDir,false);
CleanLazarusSrcDir(fWorkingDir+PathDelim+'examples'); CleanDir(fWorkingDir+PathDelim+'examples');
CleanLazarusSrcDir(fWorkingDir+PathDelim+'components'); CleanDir(fWorkingDir+PathDelim+'components');
CleanLazarusSrcDir(fWorkingDir+PathDelim+'units'); CleanDir(fWorkingDir+PathDelim+'units');
CleanLazarusSrcDir(fWorkingDir+PathDelim+'ide'); CleanDir(fWorkingDir+PathDelim+'ide');
CleanLazarusSrcDir(fWorkingDir+PathDelim+'packager'); CleanDir(fWorkingDir+PathDelim+'packager');
CleanLazarusSrcDir(fWorkingDir+PathDelim+'lcl'); CleanDir(fWorkingDir+PathDelim+'lcl');
CleanLazarusSrcDir(fWorkingDir+PathDelim+'ideintf'); CleanDir(fWorkingDir+PathDelim+'ideintf');
CleanLazarusSrcDir(fWorkingDir+PathDelim+'tools'); CleanDir(fWorkingDir+PathDelim+'tools');
CleanLazarusSrcDir(fWorkingDir+PathDelim+'test'); CleanDir(fWorkingDir+PathDelim+'test');
// clean config directory // clean config directory
CleanLazarusSrcDir(GetPrimaryConfigPath+PathDelim+'units'); CleanDir(GetPrimaryConfigPath+PathDelim+'units');
// clean custom target directory // clean custom target directory
if fProfile.TargetDirectory<>'' then begin if fProfile.TargetDirectory<>'' then begin
s:=fProfile.GetParsedTargetDirectory(fMacros); s:=fProfile.GetParsedTargetDirectory(fMacros);
if (s<>'') and DirPathExists(s) then if (s<>'') and DirPathExists(s) then
CleanLazarusSrcDir(s); CleanDir(s);
end; end;
end; end;
procedure TLazarusBuilder.CleanLazarusFallbackOutDir;
begin
end;
procedure TLazarusBuilder.CheckRevisionInc; procedure TLazarusBuilder.CheckRevisionInc;
var var
RevisionIncFile: String; RevisionIncFile: String;
@ -458,7 +464,7 @@ begin
if not CheckDirectoryWritable(fWorkingDir) then exit(mrCancel); if not CheckDirectoryWritable(fWorkingDir) then exit(mrCancel);
if (IdeBuildMode=bmCleanAllBuild) and (not (blfOnlyIDE in Flags)) then if (IdeBuildMode=bmCleanAllBuild) and (not (blfOnlyIDE in Flags)) then
CleanAll; CleanLazarusSrcDir;
// call make to clean up // call make to clean up
if (IdeBuildMode=bmCleanBuild) or (blfOnlyIDE in Flags) then if (IdeBuildMode=bmCleanBuild) or (blfOnlyIDE in Flags) then
@ -763,7 +769,7 @@ begin
// create apple bundle if needed // create apple bundle if needed
//debugln(['CreateIDEMakeOptions NewTargetDirectory=',fTargetDir]); //debugln(['CreateIDEMakeOptions NewTargetDirectory=',fTargetDir]);
if (fProfile.TargetPlatform in [lpCarbon,lpCocoa]) if (compareText(fProfile.TargetOS,'darwin')=0)
and fOutputDirRedirected and DirectoryIsWritableCached(fTargetDir) then and fOutputDirRedirected and DirectoryIsWritableCached(fTargetDir) then
begin begin
Result:=CreateAppleBundle; Result:=CreateAppleBundle;