diff options
author | fanquake <fanquake@gmail.com> | 2019-06-29 12:38:39 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2019-06-29 12:39:00 +0800 |
commit | 0f309541aa6dee91ac1cf6058c1ab5f51447b3c1 (patch) | |
tree | 540ef75d19972599c3d1da081acb3fb43a3e4685 | |
parent | 935cd6b1ec08676969cf601159317b53f631393a (diff) | |
parent | 819c5ddad3ca915f77adc94d8b0a5d73069fff99 (diff) |
Merge #16258: [MSVC]: Create the config.ini as part of bitcoind build
819c5ddad3ca915f77adc94d8b0a5d73069fff99 [MSVC] Enable Fuzz for functional tests (nicolas.dorier)
e47e79377f5d81b567881fcba851772bda0cefd8 [MSVC]: Create the config.ini as part of bitcoind build (nicolas.dorier)
Pull request description:
This remove the patchwork of powershell done in AppVeyor to the `AfterBuild` target of `bitcoind` so that windows developers do not have to figure out how to manually edit the config.ini before running the functional tests.
You can easily test with `msbuild /t:AfterBuild` in bitcoind folder.
ACKs for top commit:
sipsorcery:
tACK 819c5dd.
fanquake:
ACK 819c5ddad3ca915f77adc94d8b0a5d73069fff99
Tree-SHA512: 657a3019532c6a3729310e52bfc2183cc805a406aab84cd83b0219e3ef8a6f208a3b1760317b41978d9dabb90fae0350e8cb00cf7e219b3bab04010ef1267a4b
-rw-r--r-- | .appveyor.yml | 11 | ||||
-rw-r--r-- | build_msvc/bitcoind/bitcoind.vcxproj | 26 | ||||
-rw-r--r-- | build_msvc/msbuild/tasks/replaceinfile.targets | 35 |
3 files changed, 61 insertions, 11 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 0c43e61592..ea587b78d4 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -38,17 +38,6 @@ after_build: - ps: fsutil behavior set disablelastaccess 1 # Disable Access time feature on Windows (better performance) - ps: clcache -z before_test: -- ps: ${conf_ini} = (Get-Content([IO.Path]::Combine(${env:APPVEYOR_BUILD_FOLDER}, "test", "config.ini.in"))) -- ps: ${conf_ini} = ${conf_ini}.Replace("@PACKAGE_NAME@", "Bitcoin Core") -- ps: ${conf_ini} = ${conf_ini}.Replace("@abs_top_srcdir@", ${env:APPVEYOR_BUILD_FOLDER}) -- ps: ${conf_ini} = ${conf_ini}.Replace("@abs_top_builddir@", ${env:APPVEYOR_BUILD_FOLDER}) -- ps: ${conf_ini} = ${conf_ini}.Replace("@EXEEXT@", ".exe") -- ps: ${conf_ini} = ${conf_ini}.Replace("@ENABLE_WALLET_TRUE@", "") -- ps: ${conf_ini} = ${conf_ini}.Replace("@BUILD_BITCOIN_CLI_TRUE@", "") -- ps: ${conf_ini} = ${conf_ini}.Replace("@BUILD_BITCOIND_TRUE@", "") -- ps: ${conf_ini} = ${conf_ini}.Replace("@ENABLE_ZMQ_TRUE@", "") -- ps: ${utf8} = New-Object System.Text.UTF8Encoding ${false} -- ps: '[IO.File]::WriteAllLines([IO.Path]::Combine(${env:APPVEYOR_BUILD_FOLDER}, "test", "config.ini"), ${conf_ini}, ${utf8})' - ps: move "build_msvc\${env:PLATFORM}\${env:CONFIGURATION}\*.exe" src test_script: - cmd: src\test_bitcoin.exe -k stdout -e stdout 2> NUL diff --git a/build_msvc/bitcoind/bitcoind.vcxproj b/build_msvc/bitcoind/bitcoind.vcxproj index 2c5dde3015..c5cddfdbb2 100644 --- a/build_msvc/bitcoind/bitcoind.vcxproj +++ b/build_msvc/bitcoind/bitcoind.vcxproj @@ -45,4 +45,30 @@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <Import Label="ReplaceInFile" Project="..\msbuild\tasks\replaceinfile.targets" /> + <PropertyGroup> + <ConfigIniIn>..\..\test\config.ini.in</ConfigIniIn> + <ConfigIniOut>..\..\test\config.ini</ConfigIniOut> + </PropertyGroup> + <Target Name="AfterBuild"> + <Copy SourceFiles="$(ConfigIniIn)" DestinationFiles="$(ConfigIniOut)" ></Copy> + <ReplaceInFile FilePath="$(ConfigIniOut)" + Replace="@PACKAGE_NAME@" By="Bitcoin Core"></ReplaceInFile> + <ReplaceInFile FilePath="$(ConfigIniOut)" + Replace="@abs_top_srcdir@" By="..\.." ToFullPath="true"></ReplaceInFile> + <ReplaceInFile FilePath="$(ConfigIniOut)" + Replace="@abs_top_builddir@" By="..\.." ToFullPath="true"></ReplaceInFile> + <ReplaceInFile FilePath="$(ConfigIniOut)" + Replace="@EXEEXT@" By=".exe"></ReplaceInFile> + <ReplaceInFile FilePath="$(ConfigIniOut)" + Replace="@ENABLE_WALLET_TRUE@" By=""></ReplaceInFile> + <ReplaceInFile FilePath="$(ConfigIniOut)" + Replace="@BUILD_BITCOIN_CLI_TRUE@" By=""></ReplaceInFile> + <ReplaceInFile FilePath="$(ConfigIniOut)" + Replace="@BUILD_BITCOIND_TRUE@" By=""></ReplaceInFile> + <ReplaceInFile FilePath="$(ConfigIniOut)" + Replace="@ENABLE_FUZZ_TRUE@" By=""></ReplaceInFile> + <ReplaceInFile FilePath="$(ConfigIniOut)" + Replace="@ENABLE_ZMQ_TRUE@" By=""></ReplaceInFile> + </Target> </Project> diff --git a/build_msvc/msbuild/tasks/replaceinfile.targets b/build_msvc/msbuild/tasks/replaceinfile.targets new file mode 100644 index 0000000000..2ccb8b30e0 --- /dev/null +++ b/build_msvc/msbuild/tasks/replaceinfile.targets @@ -0,0 +1,35 @@ +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <UsingTask + TaskName="ReplaceInFile" + TaskFactory="CodeTaskFactory" + AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" > + <ParameterGroup> + <FilePath Required="true" /> + <Replace Required="true" /> + <By Required="false" /> + <ToFullPath Required="false" /> + </ParameterGroup> + <Task> + <Using Namespace="System"/> + <Using Namespace="System.IO"/> + <Code Type="Fragment" Language="cs"> +<![CDATA[ +if(File.Exists(FilePath) == false) { + Log.LogError("replaceinfile task could not locate " + FilePath + "."); +} +else { + var data = File.ReadAllText(FilePath); + var by = By; + if (ToFullPath == "true") + { + by = Path.GetFullPath(by); + } + data = data.Replace(Replace, by); + Log.LogMessage("Replace '" + Replace + "' by '" + by + "' in " + FilePath); + File.WriteAllText(FilePath, data, new System.Text.UTF8Encoding(false)); +} +]]> + </Code> + </Task> + </UsingTask> +</Project>
\ No newline at end of file |