Skip to content

Commit

Permalink
Apply patches before configure call
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmorato committed Jun 26, 2024
1 parent 17bc385 commit 9d64fbc
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions Build/OpenDDSharp.Build/Tasks/SetupThirdPartyTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,33 @@ public override void Run(BuildContext context)
Git(context, "fetch --tags");
Git(context, $"checkout tags/{_versionTag}");

context.Log.Information("Apply required OpenDDSharp patches to OpenDDS...");
if (!Directory.Exists(BuildContext.PATCHES_FOLDER))
{
return;
}
var patches = Directory.EnumerateFiles(BuildContext.PATCHES_FOLDER, "*.patch");
var patchPaths = patches as string[] ?? patches.ToArray();
if (!patchPaths.Any())
{
return;
}
foreach (var patchPath in patchPaths)
{
var patchDirectory = new DirectoryPath(patchPath);
if (BuildContext.IsLinux)
{
var linuxPath = System.IO.Path.GetFullPath(patchDirectory.FullPath);

context.Log.Information($"Apply {linuxPath} in {context.DdsRoot}...");
Git(context, "apply --whitespace=fix --ignore-space-change --ignore-whitespace " + linuxPath);
}
else
{
Git(context, "apply " + patchDirectory.FullPath);
}
}

context.Log.Information("Call OpenDDS configure script");

if (BuildContext.IsLinux || BuildContext.IsOSX)
Expand Down Expand Up @@ -143,33 +170,6 @@ public override void Run(BuildContext context)
throw new BuildException($"Error calling the OpenDDS configure script. Exit code: {exit}");
}
}

context.Log.Information("Apply required OpenDDSharp patches to OpenDDS...");
if (!Directory.Exists(BuildContext.PATCHES_FOLDER))
{
return;
}
var patches = Directory.EnumerateFiles(BuildContext.PATCHES_FOLDER, "*.patch");
var patchPaths = patches as string[] ?? patches.ToArray();
if (!patchPaths.Any())
{
return;
}
foreach (var patchPath in patchPaths)
{
var patchDirectory = new DirectoryPath(patchPath);
if (BuildContext.IsLinux)
{
var linuxPath = System.IO.Path.GetFullPath(patchDirectory.FullPath);

context.Log.Information($"Apply {linuxPath} in {context.DdsRoot}...");
Git(context, "apply --whitespace=fix --ignore-space-change --ignore-whitespace " + linuxPath);
}
else
{
Git(context, "apply " + patchDirectory.FullPath);
}
}
}

private static void DeleteDirectory(string directoryPath)
Expand Down

0 comments on commit 9d64fbc

Please sign in to comment.