Jelajahi Sumber

* If a found package seems to contain the source of the package, check if the
package is compiled earlier and when that's the case include it's unit
output directory. Usefull if more packages are being compiled manually,
without installing each package.

git-svn-id: trunk@17213 -

joost 14 tahun lalu
induk
melakukan
103867412a
1 mengubah file dengan 19 tambahan dan 4 penghapusan
  1. 19 4
      packages/fpmkunit/src/fpmkunit.pp

+ 19 - 4
packages/fpmkunit/src/fpmkunit.pp

@@ -4462,6 +4462,7 @@ end;
 function TBuildEngine.CheckExternalPackage(Const APackageName : String):TPackage;
 function TBuildEngine.CheckExternalPackage(Const APackageName : String):TPackage;
 var
 var
   S : String;
   S : String;
+  F : String;
   I : Integer;
   I : Integer;
 begin
 begin
   // Already checked?
   // Already checked?
@@ -4481,11 +4482,25 @@ begin
       Log(vldebug, SDbgExternalDependency, [APackageName,S]);
       Log(vldebug, SDbgExternalDependency, [APackageName,S]);
       Result.FTargetState:=tsInstalled;
       Result.FTargetState:=tsInstalled;
       // Load unit config if it exists
       // Load unit config if it exists
-      S:=IncludeTrailingPathDelimiter(S)+UnitConfigFile;
-      if FileExists(S) then
+      F:=IncludeTrailingPathDelimiter(S)+UnitConfigFile;
+      if FileExists(F) then
         begin
         begin
-          Log(vlDebug, Format(SDbgLoading, [S]));
-          Result.LoadUnitConfigFromFile(S);
+          Log(vlDebug, Format(SDbgLoading, [F]));
+          Result.LoadUnitConfigFromFile(F);
+        end
+      else if FileExists(IncludeTrailingPathDelimiter(S)+FPMakePPFile) then
+        begin
+          // The package is not installed, but the source-path is given.
+          // It is an external package so it is impossible to compile it, so
+          // assume that it has been compiled earlier.
+          F := IncludeTrailingPathDelimiter(Result.UnitDir) + Result.GetUnitsOutputDir(Defaults.CPU,Defaults.OS);
+          // If the unit-directory does not exist, you know for sure that
+          // the package is not compiled
+          if DirectoryExists(F) then
+            begin
+              Result.UnitDir := F;
+              Result.FTargetState:=tsCompiled;
+            end;
         end;
         end;
       // Check recursive implicit dependencies
       // Check recursive implicit dependencies
       CompileDependencies(Result);
       CompileDependencies(Result);