Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

De-responsify system inputs #7

Open
ClxS opened this issue Sep 28, 2016 · 2 comments
Open

De-responsify system inputs #7

ClxS opened this issue Sep 28, 2016 · 2 comments

Comments

@ClxS
Copy link
Owner

ClxS commented Sep 28, 2016

I'm having a problem building certain Game only exes due to it failing to read the modified response file for some reason. An easy fix to this is to remove the response file completely and insert the system includes into the arguments. This will probably be even more stable than the current method if we endup with builds where no input files are defined in the response file.

@missmah
Copy link

missmah commented Apr 14, 2017

Where do you find the system includes? Or, do you mean the Windows SDK and such?

I'm having an issue where the response files are missing some of the important defines (like /DWITH_ENGINE and even what unreal build type it is) - though it's not quite the same issue, since the response file does parse properly.

@ClxS
Copy link
Owner Author

ClxS commented Apr 14, 2017

I awkwardly worded the issue, and now can't really remember what I meant by "system includes".
However, on our internal version what's worked for us is just expanding the response file. I'm not including it in this repository yet (because I'm planning a re-write). but these are the changes:

  • In FASTBuild.cs > ParseCompilerAction(), just before performing the Regex.Matches
action.CommandArguments = SubstituteResponseFiles(action.CommandArguments);
if (!action.CommandPath.EndsWith("rc.exe"))
{
    action.CommandArguments = ApplyIncludeAbsolutionPatch(action.CommandArguments);
}

Other methods to place in file

private static string ApplyIncludeAbsolutionPatch(string commandArguments)
{
    // 4.14 causes D8049: command line is too long to fit in debug record
    // on remote hosts due to a combination of FBuild and CL.exe limitations.
    // This is a hacky workaround.
    // https://github.com/fastbuild/fastbuild/issues/105
    var test = Regex.Replace(commandArguments, "(?<=\\/I\\s)(?!(.:|\".:|\\$|\"\\$))(.*?)(?=\\s)", "\"" + UnrealBuildTool.EngineSourceDirectory + "/$2\"");
    return test;
}

private static string SubstituteResponseFiles(string commandArguments)
{            
    var matches = Regex.Matches(commandArguments, "@\".*\"");

    foreach(Match match in matches)
    {
        var fileName = match.Value.Replace("\"", "").Replace("@", "");
        var fileText = File.ReadAllText(fileName);
        commandArguments = commandArguments.Replace(match.Value, fileText);
    }

    return commandArguments;
}

You may not need the path absolution fix. We've only included that because we haven't moved on to a newer version of FBuild yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants