3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 09:34:08 +00:00

Fix echo command for Windows.

This commit is contained in:
Mathias Soeken 2018-11-14 11:11:25 -08:00
parent 2fbaad15d7
commit d4567a1255

View file

@ -2396,27 +2396,35 @@ class DotNetExampleComponent(ExampleComponent):
for csfile in get_cs_files(self.ex_dir):
out.write(' ')
out.write(os.path.join(self.to_ex_dir, csfile))
def mk_echo(msg):
echo_ex_qu = '' if IS_WINDOWS else '"'
echo_in_qu = '"' if IS_WINDOWS else '\\"'
echo_esc = '^' if IS_WINDOWS else ''
msg = msg.replace('"', echo_in_qu).replace('<', echo_esc + '<').replace('>', echo_esc + '>')
out.write('\t@echo %s%s%s > %s\n' % (echo_ex_qu, msg, echo_ex_qu, proj_name))
out.write('\n')
out.write('\t@echo "<Project Sdk=\\"Microsoft.NET.Sdk\\">" > %s\n' % proj_name)
out.write('\t@echo " <PropertyGroup>" >> %s\n' % proj_name)
out.write('\t@echo " <OutputType>Exe</OutputType>" >> %s\n' % proj_name)
out.write('\t@echo " <TargetFramework>netcoreapp2.0</TargetFramework>" >> %s\n' % proj_name)
out.write('\t@echo " <PlatformTarget>')
mk_echo('<Project Sdk="Microsoft.NET.Sdk">')
mk_echo(' <PropertyGroup>')
mk_echo(' <OutputType>Exe</OutputType>')
mk_echo(' <TargetFramework>netcoreapp2.0</TargetFramework>')
if VS_X64:
out.write('x64')
platform = 'x64'
elif VS_ARM:
out.write('ARM')
platform = 'ARM'
else:
out.write('x86')
out.write('</PlatformTarget>" >> %s\n' % proj_name)
out.write('\t@echo " </PropertyGroup>" >> %s\n' % proj_name)
out.write('\t@echo " <ItemGroup>" >> %s\n' % proj_name)
out.write('\t@echo " <Compile Include=\\"%s/*.cs\\" />" >> %s\n' % (self.to_ex_dir, proj_name))
out.write('\t@echo " <Reference Include=\\"Microsoft.Z3\\">" >> %s\n' % proj_name)
out.write('\t@echo " <HintPath>Microsoft.Z3.dll</HintPath>" >> %s\n' % proj_name)
out.write('\t@echo " </Reference>" >> %s\n' % proj_name)
out.write('\t@echo " </ItemGroup>" >> %s\n' % proj_name)
out.write('\t@echo "</Project>" >> %s\n' % proj_name)
platform = 'x86'
mk_echo(' <PlatformTarget>%s</PlatformTarget>' % platform)
mk_echo(' </PropertyGroup>')
mk_echo(' <ItemGroup>')
mk_echo(' <Compile Include="%s/*.cs" />' % self.to_ex_dir)
mk_echo(' <Reference Include="Microsoft.Z3">')
mk_echo(' <HintPath>Microsoft.Z3.dll</HintPath')
mk_echo(' </Reference>')
mk_echo(' </ItemGroup>')
mk_echo('</Project>')
dotnetCmdLine = [DOTNET, "build", proj_name]
dotnetCmdLine.extend(['-c'])