Commit 7691473a authored by csharptest's avatar csharptest

Completion of 3.5 build integration and Lite runtime build changes.

parent 30d3fa32
......@@ -25,6 +25,7 @@ mono/tmp
mono/protoc
build_output
build_temp
build/msbuild*.log
#
# Untracked files
......
@echo off
SET BUILD_TARGET=%1
SET BUILD_CONFIG=%2
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Debug /p:Platform="Any CPU"
IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild
IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug
CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj %3 %4 %5 %6 /t:%BUILD_TARGET% /p:BuildConfiguration=%BUILD_CONFIG% /p:Platform="Any CPU" /p:BuildTools=4.0 /toolsversion:4.0"
pause
\ No newline at end of file
@ECHO OFF
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Debug /p:Platform="Any CPU"
IF ERRORLEVEL 1 GOTO END
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU"
SET PREV_WORKING_DIR=%CD%
CD %~dp0
REM -- 3.5 Debug build, ensure this continues to work
%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.csproj /t:Rebuild /p:BuildConfiguration=Debug /p:Platform="Any CPU" /p:BuildTools=3.5 /toolsversion:3.5"
IF ERRORLEVEL 1 GOTO ERROR
REM -- 4.0 Debug build
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Debug /p:Platform="Any CPU"
IF ERRORLEVEL 1 GOTO ERROR
REM -- 4.0 Release build
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Release /p:Platform="Any CPU"
IF ERRORLEVEL 1 GOTO ERROR
IF EXIST "%ProgramFiles%\MSBuild\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" GOTO SILVERLIGHT
IF EXIST "%ProgramFiles(x86)%\MSBuild\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" GOTO SILVERLIGHT
ECHO Unable to locate %ProgramFiles(x86)%\MSBuild\Microsoft\Silverlight\v2.0
GOTO ERROR
:SILVERLIGHT
REM -- 4.0 Debug_Silverlight2 build
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU"
IF ERRORLEVEL 1 GOTO ERROR
REM -- 4.0 Release_Silverlight2 build
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU"
IF ERRORLEVEL 1 GOTO ERROR
GOTO END
:ERROR
CD %PREV_WORKING_DIR%
PAUSE
:END
PAUSE
\ No newline at end of file
CD %PREV_WORKING_DIR%
SET PREV_WORKING_DIR=
\ No newline at end of file
......@@ -2,19 +2,26 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="_Clean">
<Target Name="_BuildSolution">
<Message Text="Running $(SolutionTarget) $(BuildConfiguration) with $(BuildTools) on $(SolutionFile)" Importance="normal" />
<MSBuild Targets="$(SolutionTarget)" Projects="$(SolutionFile)" ToolsVersion="$(BuildTools)"
Properties="Configuration=$(BuildConfiguration);$(ForcedFrameworkVersion)TreatWarningsAsErrors=true;"
/>
</Target>
<Target Name="_Clean">
<RemoveDir Directories="@(WorkingDirectories)" Condition="Exists(%(WorkingDirectories.Identity))" />
<MakeDir Directories="@(WorkingDirectories)" />
</Target>
<Target Name="_Compile" DependsOnTargets="_Clean">
<MSBuild Projects="$(SolutionFile)" Properties="Configuration=$(BuildConfiguration)" BuildInParallel="true" Condition=" '$(BuildTools)' == '' " />
<MSBuild Projects="$(SolutionFile)" Properties="Configuration=$(BuildConfiguration);TargetFrameworkVersion=v2.0" Condition=" '$(BuildTools)' == 'v3.5' " />
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Clean;BuildConfiguration=$(BuildConfiguration)" Targets="_BuildSolution" ContinueOnError="true" />
</Target>
<Target Name="_CompileGeneratedSource" DependsOnTargets="_CopyGeneratedSource">
<MSBuild Projects="$(SolutionFile)" Properties="Configuration=$(BuildConfiguration)" BuildInParallel="true" Condition=" '$(BuildTools)' == '' " />
<MSBuild Projects="$(SolutionFile)" Properties="Configuration=$(BuildConfiguration);TargetFrameworkVersion=v2.0" Condition=" '$(BuildTools)' == 'v3.5' " />
<Target Name="_Compile">
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="SolutionTarget=Rebuild;BuildConfiguration=$(BuildConfiguration)" Targets="_BuildSolution" />
</Target>
<Target Name="_CompileGeneratedSource" DependsOnTargets="_CopyGeneratedSource">
<MSBuild Projects="$(MSBuildProjectFullPath)" Properties="Step=Two;SolutionTarget=Build;BuildConfiguration=$(BuildConfiguration)" Targets="_BuildSolution" />
</Target>
<Target Name="_GenerateSource">
......@@ -24,19 +31,20 @@
<Target Name="_CopyGeneratedSource" DependsOnTargets="_GenerateSource">
<Copy SourceFiles="%(GeneratedSource.Identity)" DestinationFiles="%(GeneratedSource.TargetDirectory)\%(GeneratedSource.Filename)%(GeneratedSource.Extension)" />
</Target>
</Target>
<Target Name="_Test" DependsOnTargets="_CompileGeneratedSource" Condition="$(BuildConfiguration)=='Debug' or $(BuildConfiguration)=='Release'">
<CallTarget Targets="_RunTests" />
</Target>
<Target Name="_Test" DependsOnTargets="_CompileGeneratedSource" Condition="$(BuildConfiguration)=='Debug' or $(BuildConfiguration)=='Release'">
<Exec Command="&quot;$(NUnitExePath)&quot; %(TestContainer.Identity) /xml:$(BuildTempDirectory)\..\%(TestContainer.Filename).$(BuildConfiguration).xml" />
<Target Name="_RunTests">
<Exec Command="&quot;$(NUnitExePath)&quot; /noshadow %(TestContainer.Identity) /xml:$(BuildTempDirectory)\..\%(TestContainer.Filename).$(BuildConfiguration).xml" />
</Target>
<!--## Package Generation ##-->
<Target Name="_CleanOutputDirectory">
<ItemGroup><DirectoriesToDelete Include="$([System.IO.Directory]::GetDirectories('$(BuildOutputDirectory)'))" /></ItemGroup>
<RemoveDir Directories="@(DirectoriesToDelete)" ContinueOnError="true" />
<ItemGroup><FilesToDelete Include="$(BuildOutputDirectory)\**\*.*" /></ItemGroup>
<Delete Files="@(FilesToDelete)" />
<RemoveDir Directories="$(BuildOutputDirectory)" ContinueOnError="true" />
<MakeDir Directories="$(BuildOutputDirectory)" ContinueOnError="true" />
</Target>
<Target Name="_PreparePackageComponent">
......@@ -47,11 +55,6 @@
<Copy SourceFiles="@(StaticPackageItem)" DestinationFolder="$(BuildOutputDirectory)\%(StaticPackageItem.TargetDirectory)\%(StaticPackageItem.RecursiveDir)" />
<Exec Command="&quot;$(ZipExePath)&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>
<!--## Benchmark ##-->
......@@ -67,7 +70,8 @@
<Target Name="_CompileBenchmarkAssembly" DependsOnTargets="_GenerateBenchmarkSource">
<ItemGroup>
<BenchmarkSources Include="$(BuildTempDirectory)\GoogleSizeProtoFile.cs" />
<BenchmarkSources Include="$(BuildTempDirectory)\GoogleSpeedProtoFile.cs" />
<BenchmarkSources Include="$(BuildTempDirectory)\GoogleSpeedProtoFile.cs" />
<BenchmarkSources Include="$(SourceDirectory)\ProtoBench\Properties\AssemblyInfo.cs" />
</ItemGroup>
<Csc TargetType="library" OutputAssembly="$(BuildTempDirectory)\BenchmarkTypes.dll" Optimize="true" Sources="@(BenchmarkSources)" References="$(SourceDirectory)\ProtocolBuffers\bin\$(BuildConfiguration)\Google.ProtocolBuffers.dll" />
......@@ -101,7 +105,7 @@
<Args>$(BenchmarkParameterList.Replace(`;`,` `))</Args>
</PropertyGroup>
<Exec Command="&quot;$(ProtoBenchExePath)&quot; $(Args) > &quot;$(BuildTempDirectory)\..\BenchmarkResults.txt&quot;" WorkingDirectory="$(BuildTempDirectory)" />
<Exec Command="&quot;$(ProtoBenchExePath)&quot; @(BenchmarkParameter->'%(Identity)', ' ') > &quot;$(BuildTempDirectory)\..\BenchmarkResults.txt&quot;" WorkingDirectory="$(BuildTempDirectory)" />
</Target>
</Project>
\ No newline at end of file
......@@ -3,9 +3,11 @@
<PropertyGroup>
<ProjectName>Protocol Buffers</ProjectName>
<BuildConfiguration></BuildConfiguration>
<BuildConfiguration Condition=" '$(BuildConfiguration)' == '' ">Error</BuildConfiguration>
<BuildTools Condition=" '$(BuildTools)' == '' ">4.0</BuildTools>
<ForcedFrameworkVersion Condition=" '$(BuildTools)' == '3.5' ">TargetFrameworkVersion=v2.0;</ForcedFrameworkVersion>
<!--Directory Paths-->
<!--Directory Paths-->
<ProjectDirectory>$(MSBuildProjectDirectory)\..</ProjectDirectory>
<SourceDirectory>$(ProjectDirectory)\src</SourceDirectory>
<LibDirectory>$(ProjectDirectory)\lib</LibDirectory>
......@@ -13,10 +15,12 @@
<BenchmarkProtosDirectory>$(ProjectDirectory)\benchmarks</BenchmarkProtosDirectory>
<BuildTempDirectory>$(ProjectDirectory)\build_temp\$(BuildConfiguration)</BuildTempDirectory>
<BuildOutputDirectory>$(ProjectDirectory)\build_output\$(BuildConfiguration)</BuildOutputDirectory>
<PackageName Condition=" '$(PackageName)' == '' ">$(BuildConfiguration)</PackageName>
<!--File Paths-->
<SolutionFile Condition=" '$(BuildTools)' == '' ">$(SourceDirectory)\ProtocolBuffers.sln</SolutionFile>
<SolutionFile Condition=" '$(BuildTools)' == 'v3.5' ">$(SourceDirectory)\ProtocolBuffers2008.sln</SolutionFile>
<SolutionFile Condition=" '$(BuildTools)' == '4.0' ">$(SourceDirectory)\ProtocolBuffers.sln</SolutionFile>
<SolutionFile Condition=" '$(BuildTools)' == '3.5' ">$(SourceDirectory)\ProtocolBuffers2008.sln</SolutionFile>
<!--Tool Paths-->
<ProtocExePath>$(LibDirectory)\protoc.exe</ProtocExePath>
......@@ -41,9 +45,10 @@
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_custom_options.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_embed_optimize_for.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_empty.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_import.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_import_lite.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_lite_imports_nonlite.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_import.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_import_lite.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_lite.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_lite_imports_nonlite.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_mset.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_no_generic_services.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\unittest_optimize_for.proto" />
......@@ -61,7 +66,7 @@
<GeneratedSource Include="$(BuildTempDirectory)\AddressBookProtos.cs">
<TargetDirectory>$(SourceDirectory)\AddressBook</TargetDirectory>
</GeneratedSource>
<!-- Unit test -->
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestCSharpOptionsProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
</GeneratedSource>
......@@ -92,6 +97,25 @@
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
</GeneratedSource>
<!-- Lite unit test -->
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestExtrasFullProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory>
</GeneratedSource>
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestImportLiteProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory>
</GeneratedSource>
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestImportProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory>
</GeneratedSource>
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestLiteImportNonLiteProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory>
</GeneratedSource>
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestLiteProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory>
</GeneratedSource>
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory>
</GeneratedSource>
<TestContainer Include="$(SourceDirectory)\ProtocolBuffers.Test\bin\$(BuildConfiguration)\Google.ProtocolBuffers.Test.dll" />
<TestContainer Include="$(SourceDirectory)\ProtocolBuffersLite.Test\bin\$(BuildConfiguration)\Google.ProtocolBuffersLite.Test.dll" />
......@@ -116,11 +140,15 @@
</ItemGroup>
<!-- targets -->
<Target Name="Build" DependsOnTargets="_Compile;_Test" />
<!-- targets -->
<Target Name="Clean" DependsOnTargets="_Clean" />
<Target Name="Build" DependsOnTargets="_Compile;_Test" />
<Target Name="Test" DependsOnTargets="_RunTests" />
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<Target Name="BuildPackage" DependsOnTargets="PrepareOutputDirectory;PreparePackageComponent;GeneratePackage" />
<Target Name="PrepareOutputDirectory" DependsOnTargets="_CleanOutputDirectory" />
<Target Name="PreparePackageComponent" DependsOnTargets="_PreparePackageComponent" />
<Target Name="GeneratePackage" DependsOnTargets="_GeneratePackage" />
<Target Name="RunBenchmarks" DependsOnTargets="_RunBenchmarks" />
</Project>
@echo off
SET START_DIR=%CD%
CD %~dp0
%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.csproj /t:Build /p:BuildConfiguration=Debug /p:Platform="Any CPU" /p:TargetFramework="v2.0" /p:BuildTools="v3.5" /toolsversion:3.5
CD %START_DIR%
SET START_DIR=
SET BUILD_TARGET=%1
SET BUILD_CONFIG=%2
IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild
IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug
CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.csproj %3 %4 %5 %6 /t:%BUILD_TARGET% /p:BuildConfiguration=%BUILD_CONFIG% /p:Platform="Any CPU" /p:BuildTools=3.5 /toolsversion:3.5"
using System.Reflection;
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
......@@ -19,6 +20,8 @@ using System.Runtime.InteropServices;
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0f515d09-9a6c-49ec-8500-14a5303ebadf")]
......
......@@ -93,9 +93,25 @@ namespace Google.ProtocolBuffers.ProtoGen {
/// </summary>
private void Generate(FileDescriptor descriptor) {
UmbrellaClassGenerator ucg = new UmbrellaClassGenerator(descriptor);
using (TextWriter textWriter = File.CreateText(GetOutputFile(descriptor))) {
TextGenerator writer = new TextGenerator(textWriter);
ucg.Generate(writer);
string tempFile = Path.GetTempFileName();
try {
using (Stream fstream = File.Open(GetOutputFile(descriptor), FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read)) {
using (TextWriter textWriter = File.CreateText(tempFile)) {
TextGenerator writer = new TextGenerator(textWriter);
ucg.Generate(writer);
}
fstream.SetLength(0);
using (TextReader input = new StreamReader(tempFile))
using (TextWriter output = new StreamWriter(fstream)) {
string line;
while (null != (line = input.ReadLine()))
output.WriteLine(line);
}
}
}
finally {
if (File.Exists(tempFile))
File.Delete(tempFile);
}
}
......
......@@ -61,8 +61,8 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug_Silverlight2|Any CPU
{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.Build.0 = Debug_Silverlight2|Any CPU
{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Release|Any CPU
{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.ActiveCfg = Release_Silverlight2|Any CPU
{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.Build.0 = Release_Silverlight2|Any CPU
{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment