mirror of https://github.com/microsoft/vcpkg.git
28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<UsingTask TaskName="RestoreEnvVars" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
|
|
<ParameterGroup>
|
|
<VcpkgEnvVars ParameterType="System.String" Required="true" />
|
|
</ParameterGroup>
|
|
<Task>
|
|
<Code Type="Fragment" Language="cs">
|
|
<![CDATA[
|
|
if (string.IsNullOrEmpty(VcpkgEnvVars)) return true;
|
|
|
|
var pairs = VcpkgEnvVars.Split( new[] { "____" }, StringSplitOptions.None);
|
|
foreach (var pair in pairs)
|
|
{
|
|
var parts = pair.Split(new[] { '=' }, 2);
|
|
if (parts.Length == 2)
|
|
{
|
|
// Unescape the %3B back to ;
|
|
string key = parts[0];
|
|
string val = parts[1].Replace("%3B", ";");
|
|
Environment.SetEnvironmentVariable(key, val);
|
|
Log.LogMessage(MessageImportance.Low, "Restored Env Var: {0}", key);
|
|
}
|
|
}
|
|
]]>
|
|
</Code>
|
|
</Task>
|
|
</UsingTask>
|
|
</Project> |