diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/DotNetOpenAuth.Common.Settings.targets | 2 | ||||
-rw-r--r-- | tools/DotNetOpenAuth.Versioning.targets | 18 | ||||
-rw-r--r-- | tools/Translation.targets | 39 |
3 files changed, 55 insertions, 4 deletions
diff --git a/tools/DotNetOpenAuth.Common.Settings.targets b/tools/DotNetOpenAuth.Common.Settings.targets index 34e14f5..7a8276c 100644 --- a/tools/DotNetOpenAuth.Common.Settings.targets +++ b/tools/DotNetOpenAuth.Common.Settings.targets @@ -19,6 +19,6 @@ <CheckAdminRights> <Output TaskParameter="IsElevated" PropertyName="IsElevated" /> </CheckAdminRights> - <Message Importance="High" Text="IsElevated = $(IsElevated)" /> + <Message Importance="High" Text="IsElevated = $(IsElevated)" /> </Target> </Project> diff --git a/tools/DotNetOpenAuth.Versioning.targets b/tools/DotNetOpenAuth.Versioning.targets index 6a4b95a..5047f3a 100644 --- a/tools/DotNetOpenAuth.Versioning.targets +++ b/tools/DotNetOpenAuth.Versioning.targets @@ -5,6 +5,7 @@ <PropertyGroup> <ProjectRoot Condition="'$(ProjectRoot)' == ''">$(MSBuildProjectDirectory)\..\..\</ProjectRoot> <VersionCsFile>$(ProjectRoot)obj\$(Configuration)\$(AssemblyName).Version.cs</VersionCsFile> + <NoWarn>$(NoWarn);1607</NoWarn> </PropertyGroup> <PropertyGroup Condition="'$(SignAssembly)' == 'true'"> @@ -18,10 +19,19 @@ <UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="AssemblyInfo"/> <Target Name="GetBuildVersion"> - <GetBuildVersion VersionFile="$(ProjectRoot)src\version.txt" Condition=" '$(BuildVersion)' == '' "> + <GetBuildVersion Condition=" '$(BuildVersion)' == '' " + VersionFile="$(ProjectRoot)src\version.txt" + GitRepoRoot="$(ProjectRoot)"> <Output TaskParameter="Version" PropertyName="BuildVersion" /> + <Output TaskParameter="GitCommitId" PropertyName="AssemblyInformationalVersion" /> </GetBuildVersion> - <Message Text="Building version $(BuildVersion)"/> + <PropertyGroup> + <!-- In TeamCity, the build agent doesn't get the .git directory, but the commit id is available by other means. --> + <AssemblyInformationalVersion Condition=" '$(AssemblyInformationalVersion)' == '' ">$(BUILD_VCS_NUMBER)</AssemblyInformationalVersion> + </PropertyGroup> + <Warning Condition=" '$(AssemblyInformationalVersion)' == '' " Text="Unable to determine the git HEAD commit ID to use for informational version number." /> + <Message Condition=" '$(AssemblyInformationalVersion)' != '' " Text="Building version $(BuildVersion) from commit $(AssemblyInformationalVersion)"/> + <Message Condition=" '$(AssemblyInformationalVersion)' == '' " Text="Building version $(BuildVersion)"/> </Target> <Target Name="BeforeBuild" DependsOnTargets="GetBuildVersion"> @@ -29,7 +39,9 @@ <NewVersionCsFile>$(VersionCsFile).new</NewVersionCsFile> </PropertyGroup> <MakeDir Directories="$(ProjectRoot)obj\$(Configuration)"/> - <AssemblyInfo OutputFile="$(NewVersionCsFile)" CodeLanguage="C#" AssemblyVersion="$(BuildVersion)" /> + <AssemblyInfo OutputFile="$(NewVersionCsFile)" CodeLanguage="C#" + AssemblyVersion="$(BuildVersion)" + AssemblyInformationalVersion="$(AssemblyInformationalVersion)" /> <!-- Avoid applying the newly generated AssemblyInfo.cs file to the build unless it has changed in order to allow for incremental building. --> <CompareFiles OriginalItems="$(VersionCsFile)" NewItems="$(NewVersionCsFile)"> diff --git a/tools/Translation.targets b/tools/Translation.targets new file mode 100644 index 0000000..21b27be --- /dev/null +++ b/tools/Translation.targets @@ -0,0 +1,39 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <ExportedTxtResourcesIntermediateDir>$(IntermediatePath)ExportedTxtResources</ExportedTxtResourcesIntermediateDir> + <ExportedTxtResourcesIntermediateDir Condition=" '$(Culture)' != '' ">$(ExportedTxtResourcesIntermediateDir).$(Culture)</ExportedTxtResourcesIntermediateDir> + <ExportedTxtResourcesIntermediateDir>$(ExportedTxtResourcesIntermediateDir)\</ExportedTxtResourcesIntermediateDir> + + <ExportedTxtResourcesZip>$(IntermediatePath)$(ProductName) resources</ExportedTxtResourcesZip> + <ExportedTxtResourcesZip Condition=" '$(Culture)' != '' ">$(ExportedTxtResourcesZip).$(Culture)</ExportedTxtResourcesZip> + <ExportedTxtResourcesZip>$(ExportedTxtResourcesZip).zip</ExportedTxtResourcesZip> + </PropertyGroup> + <Target Name="ExportResX"> + <ItemGroup Condition=" '$(Culture)' != '' " > + <ResXFilesToExport Include="$(ProjectRoot)src\$(ProductName)\**\*.$(Culture).resx" /> + </ItemGroup> + <PropertyGroup> + <ResXNewCulture Condition=" '@(ResXFilesToExport)' == '' ">.$(Culture)</ResXNewCulture> + </PropertyGroup> + <ItemGroup Condition=" '$(Culture)' == '' or '$(ResXNewCulture)' != '' "> + <ResXFilesToExport Include="$(ProjectRoot)src\$(ProductName)\**\*.resx" /> + <ResXFilesToExport Remove="$(ProjectRoot)src\$(ProductName)\**\*.*.resx" /> + </ItemGroup> + <ItemGroup> + <ResXFilesToExport> + <ExportedFullPath>$(ExportedTxtResourcesIntermediateDir)%(RecursiveDir)%(FileName)$(ResXNewCulture).txt</ExportedFullPath> + <ExportedDirectory>$(ExportedTxtResourcesIntermediateDir)%(RecursiveDir)</ExportedDirectory> + </ResXFilesToExport> + <ExportedTxtDirectories Include="@(ResXFilesToExport->'%(ExportedDirectory)')" /> + <ExportedTxtFiles Include="@(ResXFilesToExport->'%(ExportedFullPath)')" /> + </ItemGroup> + <Warning Condition=" '$(ResXNewCulture)' != '' " Text="No culture '$(Culture)' exists in the source project. Synthesizing new one from default culture." /> + <MakeDir Directories="%(ResXFilesToExport.ExportedDirectory)" Condition="!Exists('%(ResXFilesToExport.ExportedDirectory)')" /> + <Exec Command="resgen.exe %(ResXFilesToExport.Identity) %(ResXFilesToExport.ExportedFullPath)" /> + <Purge Directories="@(ExportedTxtDirectories)" IntendedFiles="@(ExportedTxtFiles)" /> + <Delete Files="$(ExportedTxtResourcesZip)" /> + <Zip ZipFileName="$(ExportedTxtResourcesZip)" + WorkingDirectory="$(ExportedTxtResourcesIntermediateDir)" + Files="@(ExportedTxtFiles)" /> + </Target> +</Project>
\ No newline at end of file |