Эх сурвалжийг харах

Implemented distribution package generation

ArnoldZokas 15 жил өмнө
parent
commit
1999a990be

+ 18 - 0
build/Common.targets

@@ -33,4 +33,22 @@
 		<Exec Command="&quot;E:\dotnet-protobufs\lib\NUnit 2.2.8.0\nunit-console.exe&quot; %(TestContainer.Identity) /xml:$(BuildOutputDirectory)\%(TestContainer.Filename).$(BuildConfiguration).xml" />
 		<Exec Command="&quot;E:\dotnet-protobufs\lib\NUnit 2.2.8.0\nunit-console.exe&quot; %(TestContainer.Identity) /xml:$(BuildOutputDirectory)\%(TestContainer.Filename).$(BuildConfiguration).xml" />
 	</Target>
 	</Target>
 
 
+	<Target Name="_PreparePackageComponent">
+		<Copy SourceFiles="@(DynamicPackageItem)" DestinationFolder="$(BuildOutputDirectory)\%(DynamicPackageItem.TargetDirectory)\%(DynamicPackageItem.RecursiveDir)" />
+	</Target>
+
+	<Target Name="_GeneratePackage">
+		<ItemGroup><ExistingArchives Include="$(BuildOutputDirectory)\*.zip" /></ItemGroup>
+		<Delete Files="@(ExistingArchives)" />
+
+		<Copy SourceFiles="@(StaticPackageItem)" DestinationFolder="$(BuildOutputDirectory)\%(StaticPackageItem.TargetDirectory)\%(StaticPackageItem.RecursiveDir)" />
+		<Exec Command="&quot;E:\dotnet-protobufs\lib\7-Zip 9.20\7za.exe&quot; a -tzip $(PackageName) * -r" WorkingDirectory="$(BuildOutputDirectory)" />
+
+		<ItemGroup><DirectoriesToDelete Include="$([System.IO.Directory]::GetDirectories('$(BuildOutputDirectory)'))" /></ItemGroup>
+		<ItemGroup><FilesToDelete Include="$(BuildOutputDirectory)\**\*.*" Exclude="$(BuildOutputDirectory)\$(PackageName)" /></ItemGroup>
+		
+		<Delete Files="@(FilesToDelete)" />
+		<RemoveDir Directories="@(DirectoriesToDelete)" ContinueOnError="true" />
+	</Target>
+
 </Project>
 </Project>

+ 5 - 5
build/GenerateCompletePackage.bat

@@ -1,17 +1,17 @@
 @ECHO OFF
 @ECHO OFF
-%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Debug
+%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build;PreparePackageComponent /p:BuildConfiguration=Debug
 IF ERRORLEVEL 1 GOTO END
 IF ERRORLEVEL 1 GOTO END
 
 
-%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Debug_Silverlight2
+%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build;PreparePackageComponent /p:BuildConfiguration=Debug_Silverlight2
 IF ERRORLEVEL 1 GOTO END
 IF ERRORLEVEL 1 GOTO END
 
 
-%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Release
+%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build;PreparePackageComponent /p:BuildConfiguration=Release
 IF ERRORLEVEL 1 GOTO END
 IF ERRORLEVEL 1 GOTO END
 
 
-%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Release_Silverlight2
+%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build;PreparePackageComponent /p:BuildConfiguration=Release_Silverlight2
 IF ERRORLEVEL 1 GOTO END
 IF ERRORLEVEL 1 GOTO END
 
 
-%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageScope=AllBinariesAndSource
+%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageName=AllBinariesAndSource.zip
 
 
 :END
 :END
 PAUSE
 PAUSE

+ 3 - 3
build/GenerateReleasePackage.bat

@@ -1,11 +1,11 @@
 @ECHO OFF
 @ECHO OFF
-%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Release
+%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build;PreparePackageComponent /p:BuildConfiguration=Release
 IF ERRORLEVEL 1 GOTO END
 IF ERRORLEVEL 1 GOTO END
 
 
-%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Release_Silverlight2
+%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build;PreparePackageComponent /p:BuildConfiguration=Release_Silverlight2
 IF ERRORLEVEL 1 GOTO END
 IF ERRORLEVEL 1 GOTO END
 
 
-%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageScope=ReleaseBinaries
+%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageName=ReleaseBinaries.zip
 
 
 :END
 :END
 PAUSE
 PAUSE

+ 28 - 9
build/build.csproj

@@ -7,17 +7,19 @@
 
 
 		<!--Directory Paths-->
 		<!--Directory Paths-->
 		<ProjectDirectory>$(MSBuildProjectDirectory)\..</ProjectDirectory>
 		<ProjectDirectory>$(MSBuildProjectDirectory)\..</ProjectDirectory>
+		<SourceDirectory>$(ProjectDirectory)\src</SourceDirectory>
+		<LibDirectory>$(ProjectDirectory)\lib</LibDirectory>
 		<ProtosDirectory>$(ProjectDirectory)\protos</ProtosDirectory>
 		<ProtosDirectory>$(ProjectDirectory)\protos</ProtosDirectory>
 		<BuildTempDirectory>$(ProjectDirectory)\build_temp\$(BuildConfiguration)</BuildTempDirectory>
 		<BuildTempDirectory>$(ProjectDirectory)\build_temp\$(BuildConfiguration)</BuildTempDirectory>
-		<BuildOutputDirectory>$(ProjectDirectory)\build_output</BuildOutputDirectory>
+		<BuildOutputDirectory>$(ProjectDirectory)\build_output\$(BuildConfiguration)</BuildOutputDirectory>
 		
 		
 		<!--File Paths-->
 		<!--File Paths-->
-		<SolutionFile>$(ProjectDirectory)\src\ProtocolBuffers.sln</SolutionFile>
+		<SolutionFile>$(SourceDirectory)\ProtocolBuffers.sln</SolutionFile>
 		
 		
 		<!--Tool Paths-->
 		<!--Tool Paths-->
-		<ProtocExePath>$(ProjectDirectory)\lib\protoc.exe</ProtocExePath>
-		<ProtogenExePath>$(ProjectDirectory)\src\ProtoGen\bin\$(BuildConfiguration)\protogen.exe</ProtogenExePath>
-		<NUnitExePath>$(ProjectDirectory)\lib\NUnit 2.2.8.0\nunit-console.exe</NUnitExePath>
+		<ProtocExePath>$(LibDirectory)\protoc.exe</ProtocExePath>
+		<ProtogenExePath>$(SourceDirectory)\ProtoGen\bin\$(BuildConfiguration)\protogen.exe</ProtogenExePath>
+		<NUnitExePath>$(LibDirectory)\NUnit 2.2.8.0\nunit-console.exe</NUnitExePath>
 	</PropertyGroup>
 	</PropertyGroup>
 
 
 	<Import Project="Common.targets"/>
 	<Import Project="Common.targets"/>
@@ -68,13 +70,30 @@
 			<TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
 			<TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
 		</GeneratedSource>
 		</GeneratedSource>
 		
 		
-		<TestContainer Include="$(ProjectDirectory)\src\ProtocolBuffers.Test\bin\$(BuildConfiguration)\Google.ProtocolBuffers.Test.dll" />
-		<TestContainer Include="$(ProjectDirectory)\src\ProtoGen.Test\bin\$(BuildConfiguration)\Google.ProtocolBuffers.ProtoGen.Test.dll" />
+		<TestContainer Include="$(SourceDirectory)\ProtocolBuffers.Test\bin\$(BuildConfiguration)\Google.ProtocolBuffers.Test.dll" />
+		<TestContainer Include="$(SourceDirectory)\ProtoGen.Test\bin\$(BuildConfiguration)\Google.ProtocolBuffers.ProtoGen.Test.dll" />
+
+		<DynamicPackageItem Include="$(SourceDirectory)\ProtocolBuffers\bin\$(BuildConfiguration)\Google.ProtocolBuffers.*" />
+		<DynamicPackageItem Include="$(SourceDirectory)\ProtoGen\bin\$(BuildConfiguration)\ProtoGen.*" />
+		<DynamicPackageItem Include="$(SourceDirectory)\ProtoMunge\bin\$(BuildConfiguration)\ProtoMunge.*" />
+		<DynamicPackageItem Include="$(SourceDirectory)\ProtoDump\bin\$(BuildConfiguration)\ProtoDump.*" />
+		<DynamicPackageItem Include="$(SourceDirectory)\ProtoBench\bin\$(BuildConfiguration)\ProtoBench.*" />
+
+		<StaticPackageItem Include="$(ProjectDirectory)\readme.txt" />
+		<StaticPackageItem Include="$(ProjectDirectory)\license.txt" />
+		<StaticPackageItem Include="$(ProjectDirectory)\protos\**\*.*">
+			<TargetDirectory>\protos</TargetDirectory>
+		</StaticPackageItem>
+		<StaticPackageItem Include="$(LibDirectory)\Protoc*">
+			<TargetDirectory>\Protoc</TargetDirectory>
+		</StaticPackageItem>
+		
 	</ItemGroup>
 	</ItemGroup>
 
 
 	<!-- targets -->
 	<!-- targets -->
 	<Target Name="Build" DependsOnTargets="_Compile;_Test" />
 	<Target Name="Build" DependsOnTargets="_Compile;_Test" />
-	<Target Name="RunBenchmarks" DependsOnTargets="_Compile" />
-	<Target Name="GeneratePackage" />
+	<Target Name="PreparePackageComponent" DependsOnTargets="_PreparePackageComponent" />
+	<Target Name="GeneratePackage" DependsOnTargets="_GeneratePackage" />
+	<Target Name="RunBenchmarks" />
 
 
 </Project>
 </Project>