瀏覽代碼

Migrated target '_GenerateSource'

ArnoldZokas 15 年之前
父節點
當前提交
1fcb719003
共有 3 個文件被更改,包括 33 次插入9 次删除
  1. 2 3
      .gitignore
  2. 13 2
      build/Common.targets
  3. 18 4
      build/build.csproj

+ 2 - 3
.gitignore

@@ -21,9 +21,8 @@ src/ProtoMunge/obj/
 mono/bin
 mono/tmp
 mono/protoc
-_tmp
-_dist
-_benchmark
+build_output
+build_temp
 
 #
 # 	Untracked files

+ 13 - 2
build/Common.targets

@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
+
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
 	<Target Name="_Clean">
@@ -7,10 +8,20 @@
 	</Target>
 
 	<Target Name="_Compile" DependsOnTargets="_Clean">
-		<MSBuild Projects="@(Solution)" Properties="Configuration=$(BuildConfiguration)" BuildInParallel="true" />
+		<MSBuild Projects="$(SolutionFile)" Properties="Configuration=$(BuildConfiguration)" BuildInParallel="true" />
+	</Target>
+
+	<Target Name="_GenerateSource">
+		<PropertyGroup>
+			<ProtosList>@(Protos)</ProtosList>
+			<Args>$(ProtosList.Replace(`;`,` `))</Args>
+		</PropertyGroup>
+
+		<Exec Command="$(ProtocExePath) --proto_path=$(ProtosDirectory) --descriptor_set_out=compiled.pb $(Args)" WorkingDirectory="$(BuildTempDirectory)" />
+		<Exec Command="$(ProtogenExePath) compiled.pb" WorkingDirectory="$(BuildTempDirectory)" />
 	</Target>
 
-	<Target Name="_Test">
+	<Target Name="_Test" DependsOnTargets="_GenerateSource">
 		<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>
 

+ 18 - 4
build/build.csproj

@@ -3,25 +3,39 @@
 
 	<PropertyGroup>
 		<ProjectName>Protocol Buffers</ProjectName>
-		<BuildConfiguration>Debug</BuildConfiguration>
+		<BuildConfiguration></BuildConfiguration>
 
 		<!--Directory Paths-->
 		<ProjectDirectory>$(MSBuildProjectDirectory)\..</ProjectDirectory>
+		<ProtosDirectory>$(ProjectDirectory)\protos</ProtosDirectory>
+		<BuildTempDirectory>$(ProjectDirectory)\build_temp\$(BuildConfiguration)</BuildTempDirectory>
 		<BuildOutputDirectory>$(ProjectDirectory)\build_output</BuildOutputDirectory>
 		
 		<!--File Paths-->
 		<SolutionFile>$(ProjectDirectory)\src\ProtocolBuffers.sln</SolutionFile>
 		
 		<!--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>
 	</PropertyGroup>
 
 	<Import Project="Common.targets"/>
 
 	<ItemGroup>
+		<WorkingDirectories Include="$(BuildTempDirectory)" />
 		<WorkingDirectories Include="$(BuildOutputDirectory)" />
-		
-		<Solution Include="$(SolutionFile)" />
+
+		<Protos Include="$(ProtosDirectory)\google\protobuf\descriptor.proto" />
+		<Protos Include="$(ProtosDirectory)\google\protobuf\csharp_options.proto" />
+		<Protos Include="$(ProjectDirectory)\protos\google\protobuf\unittest.proto" />
+		<Protos Include="$(ProjectDirectory)\protos\google\protobuf\unittest_csharp_options.proto" />
+		<Protos Include="$(ProjectDirectory)\protos\google\protobuf\unittest_custom_options.proto" />
+		<Protos Include="$(ProjectDirectory)\protos\google\protobuf\unittest_embed_optimize_for.proto" />
+		<Protos Include="$(ProjectDirectory)\protos\google\protobuf\unittest_import.proto" />
+		<Protos Include="$(ProjectDirectory)\protos\google\protobuf\unittest_mset.proto" />
+		<Protos Include="$(ProjectDirectory)\protos\google\protobuf\unittest_optimize_for.proto" />
+		<Protos Include="$(ProjectDirectory)\protos\tutorial\addressbook.proto" />
 		
 		<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" />
@@ -30,6 +44,6 @@
 	<!-- targets -->
 	<Target Name="Build" DependsOnTargets="_Compile;_Test" />
 	<Target Name="RunBenchmarks" DependsOnTargets="_Compile" />
-	<Target Name="GeneratePackage" DependsOnTargets="_Compile" />
+	<Target Name="GeneratePackage" />
 
 </Project>