[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Handle archiving directly in package.vcxproj
The patch creates a custom 'Archive' target in package.vcxproj that runs after 'TestSign'. This target handles archiving of the package so there is no longer any need for the equivalent functionality in build.py and build.ps1. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- build.py | 25 ------------------------- msbuild.ps1 | 24 ------------------------ vs2015/package/package.vcxproj | 19 +++++++++++++++++-- vs2017/package/package.vcxproj | 19 +++++++++++++++++-- 4 files changed, 34 insertions(+), 53 deletions(-) diff --git a/build.py b/build.py index 16bb5e3..8111ad0 100755 --- a/build.py +++ b/build.py @@ -144,29 +144,6 @@ def build_sln(name, release, arch, debug, vs): msbuild(platform, configuration, 'Build', name + '.sln', '', vs) -def copy_package(name, release, arch, debug, vs): - configuration = get_configuration(release, debug) - - if arch == 'x86': - platform = 'Win32' - elif arch == 'x64': - platform = 'x64' - - pattern = '/'.join([vs, ''.join(configuration.split(' ')), platform, 'package', '*']) - print('Copying package from %s' % pattern) - - files = glob.glob(pattern) - - dst = os.path.join(name, arch) - - os.makedirs(dst, exist_ok=True) - - for file in files: - new = shutil.copy(file, dst) - print(new) - - print('') - def remove_timestamps(path): try: os.unlink(path + '.orig') @@ -350,10 +327,8 @@ def main(): shutil.rmtree(driver, ignore_errors=True) build_sln(driver, release[vs], 'x86', debug[sys.argv[1]], vs) - copy_package(driver, release[vs], 'x86', debug[sys.argv[1]], vs) build_sln(driver, release[vs], 'x64', debug[sys.argv[1]], vs) - copy_package(driver, release[vs], 'x64', debug[sys.argv[1]], vs) symstore_add(driver, release[vs], 'x86', debug[sys.argv[1]], vs) symstore_add(driver, release[vs], 'x64', debug[sys.argv[1]], vs) diff --git a/msbuild.ps1 b/msbuild.ps1 index 3361ea1..0302a85 100644 --- a/msbuild.ps1 +++ b/msbuild.ps1 @@ -60,24 +60,6 @@ Function Run-MSBuildSDV { Set-Location $basepath } -Function Copy-To-Archive { - param( - [string]$ArtifactPath, - [string]$ArchivePath - ) - - if (-Not (Test-Path -Path $ArtifactPath)) { - return - } - - if (-Not (Test-Path -Path $ArchivePath)) { - New-Item -Name $ArchivePath -ItemType Directory | Out-Null - } - - $src = Join-Path -Path $ArtifactPath -ChildPath "package" - Get-ChildItem -Path $src -File | Copy-Item -Destination $ArchivePath -} - # # Script Body # @@ -85,21 +67,15 @@ Function Copy-To-Archive { $configuration = @{ "free" = "$ConfigurationBase Release"; "checked" = "$ConfigurationBase Debug"; "sdv" = "$ConfigurationBase Release"; } $platform = @{ "x86" = "Win32"; "x64" = "x64" } $solutionpath = Resolve-Path $SolutionDir -$artifactpath = Join-Path -Path $solutionpath -ChildPath (Join-Path -Path $configuration[$Type].Replace(' ', '') -Childpath $platform[$Arch]) -$archivepath = Join-Path -Path (Resolve-Path "xenbus") -ChildPath $Arch if ($Type -eq "free") { Run-MSBuild $solutionpath "xenbus.sln" $configuration["free"] $platform[$Arch] - Copy-To-Archive $artifactpath $archivepath } elseif ($Type -eq "checked") { Run-MSBuild $solutionpath "xenbus.sln" $configuration["checked"] $platform[$Arch] - Copy-To-Archive $artifactpath $archivepath } elseif ($Type -eq "sdv") { Run-MSBuildSDV $solutionpath "xen" $configuration["sdv"] $platform[$Arch] Run-MSBuildSDV $solutionpath "xenfilt" $configuration["sdv"] $platform[$Arch] Run-MSBuildSDV $solutionpath "xenbus" $configuration["sdv"] $platform[$Arch] - - Get-ChildItem -Path $artifactpath -Include "*.DVL.XML" -File -Recurse | Copy-Item -Destination $archivepath } diff --git a/vs2015/package/package.vcxproj b/vs2015/package/package.vcxproj index af2304d..68b0774 100644 --- a/vs2015/package/package.vcxproj +++ b/vs2015/package/package.vcxproj @@ -32,6 +32,12 @@ <IntDir>..\$(ProjectName)\$(ConfigurationName)\$(Platform)\</IntDir> <OutDir>..\$(ConfigurationName)\$(Platform)\</OutDir> </PropertyGroup> + <PropertyGroup Condition="'$(Platform)'=='Win32'"> + <ArchiveDir>..\..\$(SolutionName)\x86</ArchiveDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Platform)'=='x64'"> + <ArchiveDir>..\..\$(SolutionName)\x64</ArchiveDir> + </PropertyGroup> <ItemGroup> <ProjectReference Include="..\xenfilt\xenfilt.vcxproj"> <Project>{d7411b2c-2c43-434d-9f56-e10a3d2f5bad}</Project> @@ -55,6 +61,15 @@ <FilesToPackage Include="$(DPINST_REDIST)\x64\dpinst.exe" Condition="'$(Platform)'=='x64'" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> + <ImportGroup Label="ExtensionTargets"></ImportGroup> + <ItemGroup> + <PackageFiles Include="$(OutDir)\$(ProjectName)\*" /> + </ItemGroup> + <Target Name="Archive" AfterTargets="TestSign"> + <Exec Command="del /f /q $(ArchiveDir)" /> + <Copy + SourceFiles="@(PackageFiles)" + DestinationFiles="@(PackageFiles->'$(ArchiveDir)\%(FileName)%(Extension)')" + /> + </Target> </Project> diff --git a/vs2017/package/package.vcxproj b/vs2017/package/package.vcxproj index af2304d..f5094b5 100644 --- a/vs2017/package/package.vcxproj +++ b/vs2017/package/package.vcxproj @@ -32,6 +32,12 @@ <IntDir>..\$(ProjectName)\$(ConfigurationName)\$(Platform)\</IntDir> <OutDir>..\$(ConfigurationName)\$(Platform)\</OutDir> </PropertyGroup> + <PropertyGroup Condition="'$(Platform)'=='Win32'"> + <ArchiveDir>..\..\$(SolutionName)\x86</ArchiveDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Platform)'=='x64'"> + <ArchiveDir>..\..\$(SolutionName)\x64</ArchiveDir> + </PropertyGroup> <ItemGroup> <ProjectReference Include="..\xenfilt\xenfilt.vcxproj"> <Project>{d7411b2c-2c43-434d-9f56-e10a3d2f5bad}</Project> @@ -55,6 +61,15 @@ <FilesToPackage Include="$(DPINST_REDIST)\x64\dpinst.exe" Condition="'$(Platform)'=='x64'" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> + <ImportGroup Label="ExtensionTargets"></ImportGroup> + <ItemGroup> + <PackageFiles Include="$(OutDir)\$(ProjectName)\*" /> + </ItemGroup> + <Target Name="Archive" AfterTargets="TestSign"> + <Exec Command="del /f /q $(ArchiveDir)" /> + <Copy + SourceFiles="@(PackageFiles)" + DestinationFiles="@(PackageFiles->'$(ArchiveDir)\%(FileName)%(Extension)')" + /> + </Target> </Project> -- 2.5.3 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |