mirror of https://github.com/icsharpcode/ILSpy.git
12 changed files with 134 additions and 747 deletions
@ -1,125 +0,0 @@ |
|||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="go"> |
|
||||||
<!-- This file is called by the build server. --> |
|
||||||
<!-- Expected properties: |
|
||||||
ArtefactsOutputDir : full path of directory to write the build artefacts to. |
|
||||||
TestReportsDir : full path of directory to write CC.net report files to |
|
||||||
--> |
|
||||||
|
|
||||||
<PropertyGroup> |
|
||||||
<ProjectDir Condition=" '$(ProjectDir)' == '' ">$(MSBuildProjectDirectory)\..</ProjectDir> |
|
||||||
|
|
||||||
<ILSpyBin>$(ProjectDir)\ILSpy\bin\Release</ILSpyBin> |
|
||||||
<VsixBin>$(ProjectDir)\ILSpy.AddIn\bin\Release</VsixBin> |
|
||||||
<MSBuildCommunityTasksPath>$(ProjectDir)\BuildTools\MSBuildCommunityTasks</MSBuildCommunityTasksPath> |
|
||||||
<ArtefactPrefix>ILSpy_</ArtefactPrefix> |
|
||||||
|
|
||||||
<!-- we cannot use <MSBuild> to build a solution because --> |
|
||||||
<!-- A) passing properties to a solution called with <MSBuild> doesn't make the |
|
||||||
properties available for the projects inside the solution |
|
||||||
(but this works using the command line) --> |
|
||||||
<!-- C) We need to use MSBuild 4.0, but the build server uses MSBuild 2.0 --> |
|
||||||
<MSBuildExecutable>"$(MSBuildBinPath)\msbuild.exe"</MSBuildExecutable> |
|
||||||
<BuildProperties>/p:Configuration=Release "/p:Platform=Any CPU"</BuildProperties> |
|
||||||
<BuildProperties>$(BuildProperties) "/p:BranchName=$(BranchName)"</BuildProperties> |
|
||||||
<BuildProperties>$(BuildProperties) $(AdditionalBuildProperties)</BuildProperties> |
|
||||||
</PropertyGroup> |
|
||||||
|
|
||||||
<Import Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.Targets"/> |
|
||||||
|
|
||||||
<Target Name="go"> |
|
||||||
<Error Text="ArtefactsOutputDir not set" Condition="'$(ArtefactsOutputDir)' == ''"/> |
|
||||||
<Error Text="TestReportsDir not set" Condition="'$(TestReportsDir)' == ''"/> |
|
||||||
|
|
||||||
<Message Text="ArtefactPrefix=$(ArtefactPrefix)" Importance="high"/> |
|
||||||
<Message Text="ArtefactsOutputDir=$(ArtefactsOutputDir)" Importance="high"/> |
|
||||||
<Message Text="BuildProperties=$(BuildProperties)" Importance="high"/> |
|
||||||
|
|
||||||
<CallTarget Targets="clean1"/> |
|
||||||
|
|
||||||
<CallTarget Targets="build"/> |
|
||||||
|
|
||||||
<CallTarget Targets="createsetup"/> |
|
||||||
|
|
||||||
<!-- |
|
||||||
<CallTarget Targets="buildunittests"/> |
|
||||||
<CallTarget Targets="rununittests"/> |
|
||||||
--> |
|
||||||
|
|
||||||
<CallTarget Targets="clean2"/> |
|
||||||
<CallTarget Targets="zipsource"/> |
|
||||||
<CallTarget Targets="addnote" Condition=" '$(IsOfficialBuildServer)' == 'True' "/> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="build"> |
|
||||||
<MSBuild Projects="$(ProjectDir)\BuildTools\UpdateAssemblyInfo\UpdateAssemblyInfo.csproj" Targets="Build" Properties="Configuration=Debug" /> |
|
||||||
<Exec WorkingDirectory="$(ProjectDir)\BuildTools\UpdateAssemblyInfo\bin\Debug" Command="UpdateAssemblyInfo.exe --REVISION --branchname $(BranchName)" Timeout="60000" Condition=" '$(BranchName)' != '' " /> |
|
||||||
<Exec WorkingDirectory="$(ProjectDir)\BuildTools\UpdateAssemblyInfo\bin\Debug" Command="UpdateAssemblyInfo.exe --REVISION" Timeout="60000" Condition=" '$(BranchName)' == '' " /> |
|
||||||
|
|
||||||
<!-- read content of REVISION into $(BuildNumber) --> |
|
||||||
<XmlRead XPath="/versionInfo/version" |
|
||||||
XmlFileName="$(ProjectDir)\REVISION"> |
|
||||||
<Output TaskParameter="Value" PropertyName="BuildNumber" /> |
|
||||||
</XmlRead> |
|
||||||
<Message Importance="high" Text="BuildNumber=$(BuildNumber)"/> |
|
||||||
|
|
||||||
<Copy SourceFiles="$(ProjectDir)\REVISION" |
|
||||||
DestinationFolder="$(ArtefactsOutputDir)"/> |
|
||||||
|
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" |
|
||||||
Command="$(MSBuildExecutable) ILSpy.sln $(BuildProperties)"/> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<!-- Yes, apparently we really need two identical clean tasks. MSBuild won't run the same task twice. --> |
|
||||||
<Target Name="clean1"> |
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" |
|
||||||
Command="$(MSBuildExecutable) ILSpy.sln /t:Clean /p:Configuration=Debug"/> |
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" |
|
||||||
Command="$(MSBuildExecutable) ILSpy.sln /t:Clean /p:Configuration=Release"/> |
|
||||||
</Target> |
|
||||||
<Target Name="clean2"> |
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" |
|
||||||
Command="$(MSBuildExecutable) ILSpy.sln /t:Clean /p:Configuration=Debug"/> |
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" |
|
||||||
Command="$(MSBuildExecutable) ILSpy.sln /t:Clean /p:Configuration=Release"/> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="createsetup"> |
|
||||||
<CreateItem Include="$(ILSpyBin)\*.dll;$(ILSpyBin)\*.exe;$(ILSpyBin)\*.config" |
|
||||||
Exclude="$(ILSpyBin)\*Debugger.*"> |
|
||||||
<Output TaskParameter="Include" ItemName="BinFileToZip"/> |
|
||||||
</CreateItem> |
|
||||||
<Message Importance="high" Text="Creating ZIP file $(ArtefactPrefix)$(BuildNumber)_Binaries.zip"/> |
|
||||||
<Zip Files="@(BinFileToZip)" |
|
||||||
ZipLevel="9" |
|
||||||
WorkingDirectory="$(ILSpyBin)" |
|
||||||
ZipFileName="$(ArtefactsOutputDir)\$(ArtefactPrefix)$(BuildNumber)_Binaries.zip"/> |
|
||||||
<Copy SourceFiles="$(VsixBin)\ILSpy.AddIn.vsix" |
|
||||||
DestinationFiles="$(ArtefactsOutputDir)\$(ArtefactPrefix)$(BuildNumber)_Addin.vsix"/> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="zipsource"> |
|
||||||
<CreateItem Include="$(ProjectDir)\**" |
|
||||||
Exclude="$(ProjectDir)\**\.svn\**;$(ProjectDir)\**\obj\**;$(ProjectDir)\**\bin\**;$(ProjectDir)\.git\**;$(ProjectDir)\.git*;$(ProjectDir)\BuildTools\build\**"> |
|
||||||
<Output TaskParameter="Include" ItemName="FileToZip"/> |
|
||||||
</CreateItem> |
|
||||||
<Message Importance="high" Text="Creating ZIP file $(ArtefactPrefix)$(BuildNumber)_Source.zip"/> |
|
||||||
<Zip Files="@(FileToZip)" |
|
||||||
ZipLevel="6" |
|
||||||
WorkingDirectory="$(ProjectDir)" |
|
||||||
ZipFileName="$(ArtefactsOutputDir)\$(ArtefactPrefix)$(BuildNumber)_Source.zip"/> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="addnote"> |
|
||||||
<XmlRead XPath="/versionInfo/version" |
|
||||||
XmlFileName="$(ProjectDir)\REVISION"> |
|
||||||
<Output TaskParameter="Value" PropertyName="BuildNumber" /> |
|
||||||
</XmlRead> |
|
||||||
<XmlRead XPath="/versionInfo/branchName" |
|
||||||
XmlFileName="$(ProjectDir)\REVISION"> |
|
||||||
<Output TaskParameter="Value" PropertyName="BranchName" /> |
|
||||||
</XmlRead> |
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" Command='git fetch origin refs/notes/build:refs/notes/build -f' /> |
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" Command='git notes --ref build add -m "Build $(BuildNumber) on $(BranchName) successful"' IgnoreExitCode="True" /> |
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" Command='git push git@github.com:icsharpcode/ILSpy.git refs/notes/build:refs/notes/build' /> |
|
||||||
</Target> |
|
||||||
</Project> |
|
Binary file not shown.
@ -1,73 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8" ?> |
|
||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
||||||
<!-- $Id: MSBuild.Community.Tasks.Targets 139 2006-03-26 13:34:13Z cmumford $ --> |
|
||||||
|
|
||||||
<PropertyGroup> |
|
||||||
<MSBuildCommunityTasksPath Condition="'$(MSBuildCommunityTasksPath)' == ''">$(MSBuildExtensionsPath)\MSBuildCommunityTasks</MSBuildCommunityTasksPath> |
|
||||||
<MSBuildCommunityTasksLib>$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib> |
|
||||||
</PropertyGroup> |
|
||||||
|
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.AssemblyInfo" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Attrib" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.ExecuteSQL" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.FileUpdate" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.FtpUpload" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.FxCop" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.ILMerge" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Mail" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Move" /> |
|
||||||
|
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Math.Add" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Math.Divide" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Math.Multiple" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Math.Subtract" /> |
|
||||||
|
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.NDoc" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.NUnit" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.RegistryRead" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.RegistryWrite" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Script" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.ServiceController" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.ServiceQuery" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Sleep" /> |
|
||||||
|
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Schema.TaskSchema" /> |
|
||||||
|
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssAdd" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssCheckin" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssCheckout" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssClean" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssDiff" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssGet" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssHistory" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssLabel" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.SourceSafe.VssUndoCheckout" /> |
|
||||||
|
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnCheckout" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnClient" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnCommit" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnExport" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnInfo" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnUpdate" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Subversion.SvnVersion" /> |
|
||||||
|
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Time" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Unzip" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Version" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.WebDownload" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.XmlRead" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.XmlUpdate" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Xslt" /> |
|
||||||
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Zip" /> |
|
||||||
|
|
||||||
<ItemGroup> |
|
||||||
<FxCopRuleAssemblies Include="UsageRules.dll"/> |
|
||||||
<FxCopRuleAssemblies Include="SecurityRules.dll"/> |
|
||||||
<FxCopRuleAssemblies Include="PortabilityRules.dll"/> |
|
||||||
<FxCopRuleAssemblies Include="PerformanceRules.dll"/> |
|
||||||
<FxCopRuleAssemblies Include="MobilityRules.dll"/> |
|
||||||
<FxCopRuleAssemblies Include="InteroperabilityRules.dll"/> |
|
||||||
<FxCopRuleAssemblies Include="GlobalizationRules.dll"/> |
|
||||||
<FxCopRuleAssemblies Include="DesignRules.dll"/> |
|
||||||
</ItemGroup> |
|
||||||
</Project> |
|
Binary file not shown.
@ -1,153 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<Project DefaultTargets="All" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
||||||
<!-- Required Import to use MSBuild Community Tasks --> |
|
||||||
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/> |
|
||||||
|
|
||||||
<!-- These are sample targets the demonstrate the use of MSBuild Community Tasks --> |
|
||||||
<Target Name="AssemblyInfo"> |
|
||||||
<AssemblyInfo CodeLanguage="CS" |
|
||||||
OutputFile="AssemblyInfo.cs" |
|
||||||
AssemblyTitle="AssemblyInfoTask" |
|
||||||
AssemblyDescription="AssemblyInfo Description" |
|
||||||
AssemblyConfiguration="" |
|
||||||
AssemblyCompany="Company Name, LLC" |
|
||||||
AssemblyProduct="AssemblyInfoTask" |
|
||||||
AssemblyCopyright="Copyright (c) Company Name, LLC 2005" |
|
||||||
AssemblyTrademark="" |
|
||||||
ComVisible="false" |
|
||||||
CLSCompliant="true" |
|
||||||
Guid="d038566a-1937-478a-b5c5-b79c4afb253d" |
|
||||||
AssemblyVersion="1.0.0.0" |
|
||||||
AssemblyFileVersion="1.0.0.0" /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="Math"> |
|
||||||
<Add Numbers="4;3"> |
|
||||||
<Output TaskParameter="Result" PropertyName="Result" /> |
|
||||||
</Add> |
|
||||||
<Message Text="Add 4+3= $(Result)"/> |
|
||||||
|
|
||||||
<Add Numbers="4;3;7"> |
|
||||||
<Output TaskParameter="Result" PropertyName="Result" /> |
|
||||||
</Add> |
|
||||||
<Message Text="Add 4+3+7= $(Result)"/> |
|
||||||
|
|
||||||
<Subtract Numbers="10;3"> |
|
||||||
<Output TaskParameter="Result" PropertyName="Result" /> |
|
||||||
</Subtract> |
|
||||||
<Message Text="Subtract 10-3= $(Result)"/> |
|
||||||
|
|
||||||
<Multiple Numbers="10;3"> |
|
||||||
<Output TaskParameter="Result" PropertyName="Result" /> |
|
||||||
</Multiple> |
|
||||||
<Message Text="Multiple 10*3= $(Result)"/> |
|
||||||
|
|
||||||
<Divide Numbers="1;2"> |
|
||||||
<Output TaskParameter="Result" PropertyName="Result" /> |
|
||||||
</Divide> |
|
||||||
<Message Text="Divide 1/2= $(Result)"/> |
|
||||||
|
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="Version"> |
|
||||||
<Version VersionFile="version.txt" RevisionType="Increment"> |
|
||||||
<Output TaskParameter="Major" PropertyName="Major" /> |
|
||||||
<Output TaskParameter="Minor" PropertyName="Minor" /> |
|
||||||
<Output TaskParameter="Build" PropertyName="Build" /> |
|
||||||
<Output TaskParameter="Revision" PropertyName="Revision" /> |
|
||||||
</Version> |
|
||||||
|
|
||||||
<Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)"/> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="Registry"> |
|
||||||
<RegistryRead |
|
||||||
KeyName="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" |
|
||||||
ValueName="InstallRoot"> |
|
||||||
<Output TaskParameter="Value" PropertyName="InstallRoot" /> |
|
||||||
</RegistryRead> |
|
||||||
<Message Text="InstallRoot: $(InstallRoot)"/> |
|
||||||
|
|
||||||
<RegistryWrite |
|
||||||
KeyName="HKEY_CURRENT_USER\SOFTWARE\MSBuildTasks" |
|
||||||
ValueName="RegistryWrite" |
|
||||||
Value="Test Write" /> |
|
||||||
|
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="Service"> |
|
||||||
<ServiceQuery ServiceName="w3svc"> |
|
||||||
<Output TaskParameter="Status" PropertyName="Status" /> |
|
||||||
</ServiceQuery> |
|
||||||
<Message Text="Web Server: $(Status)"/> |
|
||||||
|
|
||||||
<ServiceController ServiceName="w3svc" Action="Restart" /> |
|
||||||
|
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="WebDownload"> |
|
||||||
<WebDownload FileUri="http://www.microsoft.com/default.aspx" |
|
||||||
FileName="microsoft.html" /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="Attrib" DependsOnTargets="Version"> |
|
||||||
<Attrib Files="version.txt" |
|
||||||
ReadOnly="true" Hidden="true" System="true"/> |
|
||||||
|
|
||||||
<Attrib Files="version.txt" |
|
||||||
Hidden="false" System="false"/> |
|
||||||
|
|
||||||
<Attrib Files="version.txt" |
|
||||||
Normal="true"/> |
|
||||||
|
|
||||||
</Target> |
|
||||||
|
|
||||||
<PropertyGroup> |
|
||||||
<Code> |
|
||||||
<![CDATA[ |
|
||||||
public static void ScriptMain() { |
|
||||||
List<string> list = new List<string>(); |
|
||||||
list.Add("Happy"); |
|
||||||
list.Add("New"); |
|
||||||
list.Add("Year"); |
|
||||||
Console.WriteLine("Hello MSBuild Community Scripting World."); |
|
||||||
foreach(string s in list) |
|
||||||
{ |
|
||||||
Console.WriteLine(s); |
|
||||||
} |
|
||||||
} |
|
||||||
]]> |
|
||||||
</Code> |
|
||||||
</PropertyGroup> |
|
||||||
|
|
||||||
<Target Name="Script"> |
|
||||||
<Script Language="C#" Code="$(Code)" /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="Sleep"> |
|
||||||
<Message Text="Sleep: 200"/> |
|
||||||
<Sleep Milliseconds="200" /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<ItemGroup> |
|
||||||
<ZipFiles Include="**\*.*" Exclude="" /> |
|
||||||
</ItemGroup> |
|
||||||
|
|
||||||
<Target Name="Zip"> |
|
||||||
<Zip Files="@(ZipFiles)" |
|
||||||
ZipFileName="Sample.zip" /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="All"> |
|
||||||
<CallTarget Targets="AssemblyInfo" /> |
|
||||||
<CallTarget Targets="Math" /> |
|
||||||
<CallTarget Targets="Version" /> |
|
||||||
<CallTarget Targets="Registry" /> |
|
||||||
<CallTarget Targets="Service" /> |
|
||||||
<CallTarget Targets="WebDownload" /> |
|
||||||
<CallTarget Targets="Attrib" /> |
|
||||||
<CallTarget Targets="Script" /> |
|
||||||
<CallTarget Targets="Sleep" /> |
|
||||||
<CallTarget Targets="Zip" /> |
|
||||||
</Target> |
|
||||||
</Project> |
|
@ -1,294 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Specialized; |
|
||||||
using System.Diagnostics; |
|
||||||
using System.Globalization; |
|
||||||
using System.IO; |
|
||||||
using System.Linq; |
|
||||||
using System.Reflection; |
|
||||||
using System.Runtime.CompilerServices; |
|
||||||
using System.Text; |
|
||||||
using System.Text.RegularExpressions; |
|
||||||
using System.Threading; |
|
||||||
using System.Xml.Linq; |
|
||||||
|
|
||||||
namespace UpdateAssemblyInfo |
|
||||||
{ |
|
||||||
// Updates the version numbers in the assembly information.
|
|
||||||
class MainClass |
|
||||||
{ |
|
||||||
const string BaseCommit = "d779383cb85003d6dabeb976f0845631e07bf463"; |
|
||||||
const int BaseCommitRev = 1; |
|
||||||
|
|
||||||
const string globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs"; |
|
||||||
static readonly TemplateFile[] templateFiles = { |
|
||||||
new TemplateFile { |
|
||||||
Input = globalAssemblyInfoTemplateFile, |
|
||||||
Output = "ILSpy/Properties/AssemblyInfo.cs" |
|
||||||
}, |
|
||||||
new TemplateFile { |
|
||||||
Input = "ICSharpCode.Decompiler/Properties/AssemblyInfo.template.cs", |
|
||||||
Output = "ICSharpCode.Decompiler/Properties/AssemblyInfo.cs" |
|
||||||
}, |
|
||||||
new TemplateFile { |
|
||||||
Input = "ILSpy/Properties/app.config.template", |
|
||||||
Output = "ILSpy/app.config" |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
class TemplateFile |
|
||||||
{ |
|
||||||
public string Input, Output; |
|
||||||
} |
|
||||||
|
|
||||||
public static int Main(string[] args) |
|
||||||
{ |
|
||||||
try { |
|
||||||
string exeDir = Path.GetDirectoryName(typeof(MainClass).Assembly.Location); |
|
||||||
bool createdNew; |
|
||||||
using (Mutex mutex = new Mutex(true, "SharpDevelopUpdateAssemblyInfo" + exeDir.GetHashCode(), out createdNew)) { |
|
||||||
if (!createdNew) { |
|
||||||
// multiple calls in parallel?
|
|
||||||
// it's sufficient to let one call run, so just wait for the other call to finish
|
|
||||||
try { |
|
||||||
mutex.WaitOne(10000); |
|
||||||
} catch (AbandonedMutexException) { |
|
||||||
} |
|
||||||
return 0; |
|
||||||
} |
|
||||||
if (!File.Exists("ILSpy.sln")) { |
|
||||||
string mainDir = Path.GetFullPath(Path.Combine(exeDir, "../../../..")); |
|
||||||
if (File.Exists(Path.Combine(mainDir, "ILSpy.sln"))) { |
|
||||||
Directory.SetCurrentDirectory(mainDir); |
|
||||||
} |
|
||||||
} |
|
||||||
if (!File.Exists("ILSpy.sln")) { |
|
||||||
Console.WriteLine("Working directory must be the ILSpy repo root!"); |
|
||||||
return 2; |
|
||||||
} |
|
||||||
RetrieveRevisionNumber(); |
|
||||||
for (int i = 0; i < args.Length; i++) { |
|
||||||
if (args[i] == "--branchname" && i + 1 < args.Length && !string.IsNullOrEmpty(args[i+1])) |
|
||||||
gitBranchName = args[i + 1]; |
|
||||||
} |
|
||||||
UpdateFiles(); |
|
||||||
if (args.Contains("--REVISION")) { |
|
||||||
var doc = new XDocument(new XElement( |
|
||||||
"versionInfo", |
|
||||||
new XElement("version", fullVersionNumber), |
|
||||||
new XElement("revision", revisionNumber), |
|
||||||
new XElement("commitHash", gitCommitHash), |
|
||||||
new XElement("branchName", gitBranchName), |
|
||||||
new XElement("versionName", versionName) |
|
||||||
)); |
|
||||||
doc.Save("REVISION"); |
|
||||||
} |
|
||||||
return 0; |
|
||||||
} |
|
||||||
} catch (Exception ex) { |
|
||||||
Console.WriteLine(ex); |
|
||||||
return 3; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static void UpdateFiles() |
|
||||||
{ |
|
||||||
foreach (var file in templateFiles) { |
|
||||||
string content; |
|
||||||
using (StreamReader r = new StreamReader(file.Input)) { |
|
||||||
content = r.ReadToEnd(); |
|
||||||
} |
|
||||||
content = content.Replace("$INSERTVERSION$", fullVersionNumber); |
|
||||||
content = content.Replace("$INSERTMAJORVERSION$", majorVersionNumber); |
|
||||||
content = content.Replace("$INSERTREVISION$", revisionNumber); |
|
||||||
content = content.Replace("$INSERTCOMMITHASH$", gitCommitHash); |
|
||||||
content = content.Replace("$INSERTSHORTCOMMITHASH$", gitCommitHash.Substring(0, 8)); |
|
||||||
content = content.Replace("$INSERTDATE$", DateTime.Now.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture)); |
|
||||||
content = content.Replace("$INSERTYEAR$", DateTime.Now.Year.ToString()); |
|
||||||
content = content.Replace("$INSERTBRANCHNAME$", gitBranchName); |
|
||||||
bool isDefaultBranch = string.IsNullOrEmpty(gitBranchName) || gitBranchName == "master" || char.IsDigit(gitBranchName, 0); |
|
||||||
content = content.Replace("$INSERTBRANCHPOSTFIX$", isDefaultBranch ? "" : ("-" + gitBranchName)); |
|
||||||
|
|
||||||
content = content.Replace("$INSERTVERSIONNAME$", versionName ?? ""); |
|
||||||
content = content.Replace("$INSERTVERSIONNAMEPOSTFIX$", string.IsNullOrEmpty(versionName) ? "" : "-" + versionName); |
|
||||||
|
|
||||||
if (File.Exists(file.Output)) { |
|
||||||
using (StreamReader r = new StreamReader(file.Output)) { |
|
||||||
if (r.ReadToEnd() == content) { |
|
||||||
// nothing changed, do not overwrite file to prevent recompilation
|
|
||||||
// every time.
|
|
||||||
continue; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
using (StreamWriter w = new StreamWriter(file.Output, false, Encoding.UTF8)) { |
|
||||||
w.Write(content); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static void GetMajorVersion() |
|
||||||
{ |
|
||||||
majorVersionNumber = "?"; |
|
||||||
fullVersionNumber = "?"; |
|
||||||
versionName = null; |
|
||||||
// Get main version from startup
|
|
||||||
using (StreamReader r = new StreamReader(globalAssemblyInfoTemplateFile)) { |
|
||||||
string line; |
|
||||||
while ((line = r.ReadLine()) != null) { |
|
||||||
string search = "string Major = \""; |
|
||||||
int pos = line.IndexOf(search); |
|
||||||
if (pos >= 0) { |
|
||||||
int e = line.IndexOf('"', pos + search.Length + 1); |
|
||||||
majorVersionNumber = line.Substring(pos + search.Length, e - pos - search.Length); |
|
||||||
} |
|
||||||
search = "string Minor = \""; |
|
||||||
pos = line.IndexOf(search); |
|
||||||
if (pos >= 0) { |
|
||||||
int e = line.IndexOf('"', pos + search.Length + 1); |
|
||||||
majorVersionNumber = majorVersionNumber + "." + line.Substring(pos + search.Length, e - pos - search.Length); |
|
||||||
} |
|
||||||
search = "string Build = \""; |
|
||||||
pos = line.IndexOf(search); |
|
||||||
if (pos >= 0) { |
|
||||||
int e = line.IndexOf('"', pos + search.Length + 1); |
|
||||||
fullVersionNumber = majorVersionNumber + "." + line.Substring(pos + search.Length, e - pos - search.Length) + "." + revisionNumber; |
|
||||||
} |
|
||||||
search = "string VersionName = \""; |
|
||||||
pos = line.IndexOf(search); |
|
||||||
if (pos >= 0) { |
|
||||||
int e = line.IndexOf('"', pos + search.Length + 1); |
|
||||||
versionName = line.Substring(pos + search.Length, e - pos - search.Length); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static void SetVersionInfo(string fileName, Regex regex, string replacement) |
|
||||||
{ |
|
||||||
string content; |
|
||||||
using (StreamReader inFile = new StreamReader(fileName)) { |
|
||||||
content = inFile.ReadToEnd(); |
|
||||||
} |
|
||||||
string newContent = regex.Replace(content, replacement); |
|
||||||
if (newContent == content) |
|
||||||
return; |
|
||||||
using (StreamWriter outFile = new StreamWriter(fileName, false, Encoding.UTF8)) { |
|
||||||
outFile.Write(newContent); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
#region Retrieve Revision Number
|
|
||||||
static string revisionNumber; |
|
||||||
static string majorVersionNumber; |
|
||||||
static string fullVersionNumber; |
|
||||||
/// <summary>
|
|
||||||
/// Descriptive version name, e.g. 'Beta 3'
|
|
||||||
/// </summary>
|
|
||||||
static string versionName; |
|
||||||
static string gitCommitHash; |
|
||||||
static string gitBranchName; |
|
||||||
|
|
||||||
static void RetrieveRevisionNumber() |
|
||||||
{ |
|
||||||
if (revisionNumber == null) { |
|
||||||
if (Directory.Exists(".git")) { |
|
||||||
try { |
|
||||||
ReadRevisionNumberFromGit(); |
|
||||||
string appVeyorBranch = Environment.GetEnvironmentVariable("APPVEYOR_REPO_BRANCH"); |
|
||||||
// AppVeyor uses a repository with detached head.
|
|
||||||
if (string.IsNullOrWhiteSpace(appVeyorBranch)) |
|
||||||
ReadBranchNameFromGit(); |
|
||||||
else |
|
||||||
gitBranchName = appVeyorBranch; |
|
||||||
} catch (Exception ex) { |
|
||||||
Console.WriteLine(ex.ToString()); |
|
||||||
} |
|
||||||
} else { |
|
||||||
Console.WriteLine("There's no git working copy in " + Path.GetFullPath(".")); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (revisionNumber == null) { |
|
||||||
ReadRevisionFromFile(); |
|
||||||
} |
|
||||||
GetMajorVersion(); |
|
||||||
} |
|
||||||
|
|
||||||
static void ReadRevisionNumberFromGit() |
|
||||||
{ |
|
||||||
ProcessStartInfo info = new ProcessStartInfo("cmd", "/c git rev-list " + BaseCommit + "..HEAD"); |
|
||||||
string path = Environment.GetEnvironmentVariable("PATH"); |
|
||||||
path += ";" + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "git\\bin"); |
|
||||||
info.EnvironmentVariables["PATH"] = path; |
|
||||||
info.RedirectStandardOutput = true; |
|
||||||
info.UseShellExecute = false; |
|
||||||
using (Process p = Process.Start(info)) { |
|
||||||
string line; |
|
||||||
int revNum = BaseCommitRev; |
|
||||||
while ((line = p.StandardOutput.ReadLine()) != null) { |
|
||||||
//keep only line that contains git hash
|
|
||||||
if (gitCommitHash == null && line != null && line.Length == BaseCommit.Length) { |
|
||||||
// first entry is HEAD
|
|
||||||
gitCommitHash = line; |
|
||||||
} |
|
||||||
revNum++; |
|
||||||
} |
|
||||||
p.WaitForExit(); |
|
||||||
if (p.ExitCode != 0) |
|
||||||
throw new Exception("git-rev-list exit code was " + p.ExitCode); |
|
||||||
// Only set revisionNuber once we ensured the operation was successful,
|
|
||||||
// so that we retrieve the number from the REVISION file in case of errors
|
|
||||||
revisionNumber = revNum.ToString(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static void ReadBranchNameFromGit() |
|
||||||
{ |
|
||||||
ProcessStartInfo info = new ProcessStartInfo("cmd", "/c git branch --no-color"); |
|
||||||
string path = Environment.GetEnvironmentVariable("PATH"); |
|
||||||
path += ";" + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "git\\bin"); |
|
||||||
info.EnvironmentVariables["PATH"] = path; |
|
||||||
info.RedirectStandardOutput = true; |
|
||||||
info.UseShellExecute = false; |
|
||||||
using (Process p = Process.Start(info)) { |
|
||||||
string line; |
|
||||||
gitBranchName = "(no branch)"; |
|
||||||
while ((line = p.StandardOutput.ReadLine()) != null) { |
|
||||||
if (line.StartsWith("* ", StringComparison.Ordinal)) { |
|
||||||
gitBranchName = line.Substring(2); |
|
||||||
} |
|
||||||
} |
|
||||||
p.WaitForExit(); |
|
||||||
if (p.ExitCode != 0) |
|
||||||
throw new Exception("git-branch exit code was " + p.ExitCode); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static void ReadRevisionFromFile() |
|
||||||
{ |
|
||||||
try { |
|
||||||
XDocument doc = XDocument.Load("REVISION"); |
|
||||||
revisionNumber = (string)doc.Root.Element("revision"); |
|
||||||
gitCommitHash = (string)doc.Root.Element("commitHash"); |
|
||||||
gitBranchName = (string)doc.Root.Element("branchName"); |
|
||||||
} catch (Exception e) { |
|
||||||
Console.WriteLine(e.Message); |
|
||||||
Console.WriteLine(); |
|
||||||
Console.WriteLine("The revision number of the SharpDevelop version being compiled could not be retrieved."); |
|
||||||
Console.WriteLine(); |
|
||||||
Console.WriteLine("Build continues with revision number '0'..."); |
|
||||||
|
|
||||||
revisionNumber = null; |
|
||||||
} |
|
||||||
if (revisionNumber == null || revisionNumber.Length == 0) { |
|
||||||
revisionNumber = "0"; |
|
||||||
gitCommitHash = "0000000000000000000000000000000000000000"; |
|
||||||
//throw new ApplicationException("Error reading revision number");
|
|
||||||
} |
|
||||||
} |
|
||||||
#endregion
|
|
||||||
} |
|
||||||
} |
|
@ -1,63 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
|
||||||
<PropertyGroup> |
|
||||||
<OutputType>Exe</OutputType> |
|
||||||
<RootNamespace>UpdateAssemblyInfo</RootNamespace> |
|
||||||
<AssemblyName>UpdateAssemblyInfo</AssemblyName> |
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
||||||
<ProjectGuid>{605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}</ProjectGuid> |
|
||||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
|
||||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
|
||||||
<NoStdLib>False</NoStdLib> |
|
||||||
<RegisterForComInterop>False</RegisterForComInterop> |
|
||||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
|
||||||
<BaseAddress>4194304</BaseAddress> |
|
||||||
<PlatformTarget>x86</PlatformTarget> |
|
||||||
<FileAlignment>4096</FileAlignment> |
|
||||||
<WarningLevel>4</WarningLevel> |
|
||||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
|
||||||
<NoWarn>1607</NoWarn> |
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
|
||||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
|
||||||
<StartArguments>--REVISION</StartArguments> |
|
||||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
||||||
<OutputPath>bin\Debug\</OutputPath> |
|
||||||
<Optimize>false</Optimize> |
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
||||||
<OutputPath>bin\Release\</OutputPath> |
|
||||||
<Optimize>true</Optimize> |
|
||||||
<DefineConstants>TRACE</DefineConstants> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
|
||||||
<DebugType>Full</DebugType> |
|
||||||
<DebugSymbols>true</DebugSymbols> |
|
||||||
<StartAction>Project</StartAction> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
|
||||||
<DebugType>None</DebugType> |
|
||||||
<DebugSymbols>false</DebugSymbols> |
|
||||||
</PropertyGroup> |
|
||||||
<ItemGroup> |
|
||||||
<Reference Include="System" /> |
|
||||||
<Reference Include="System.Core"> |
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|
||||||
</Reference> |
|
||||||
<Reference Include="System.Data" /> |
|
||||||
<Reference Include="System.Data.DataSetExtensions"> |
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|
||||||
</Reference> |
|
||||||
<Reference Include="System.Xml" /> |
|
||||||
<Reference Include="System.Xml.Linq"> |
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|
||||||
</Reference> |
|
||||||
</ItemGroup> |
|
||||||
<ItemGroup> |
|
||||||
<Compile Include="Main.cs" /> |
|
||||||
</ItemGroup> |
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> |
|
||||||
</Project> |
|
@ -1,18 +0,0 @@ |
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 11.00 |
|
||||||
# Visual Studio 2010 |
|
||||||
# SharpDevelop 4.0.1.7088 |
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateAssemblyInfo", "UpdateAssemblyInfo.csproj", "{605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}" |
|
||||||
EndProject |
|
||||||
Global |
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|
||||||
Debug|Any CPU = Debug|Any CPU |
|
||||||
Release|Any CPU = Release|Any CPU |
|
||||||
EndGlobalSection |
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|
||||||
{605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
EndGlobalSection |
|
||||||
EndGlobal |
|
@ -1,17 +1,29 @@ |
|||||||
$majorVersion = 3; |
$ErrorActionPreference = "Stop" |
||||||
$minorVersion = 0; |
|
||||||
$revision = 0; |
|
||||||
$baseCommitHash = "d779383cb85003d6dabeb976f0845631e07bf463"; |
|
||||||
|
|
||||||
|
$baseCommit = "d779383cb85003d6dabeb976f0845631e07bf463"; |
||||||
|
$baseCommitRev = 1; |
||||||
|
|
||||||
|
$globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs"; |
||||||
|
|
||||||
|
$versionParts = @{}; |
||||||
|
Get-Content $globalAssemblyInfoTemplateFile | where { $_ -match 'string (\w+) = "?(\w+)"?;' } | foreach { $versionParts.Add($Matches[1], $Matches[2]) } |
||||||
|
|
||||||
|
$major = $versionParts.Major; |
||||||
|
$minor = $versionParts.Minor; |
||||||
|
$build = $versionParts.Build; |
||||||
|
$versionName = $versionParts.VersionName; |
||||||
|
|
||||||
|
if ($versionName -ne "null") { |
||||||
|
$versionName = "-$versionName"; |
||||||
|
} |
||||||
if ($env:APPVEYOR_REPO_BRANCH -ne 'master') { |
if ($env:APPVEYOR_REPO_BRANCH -ne 'master') { |
||||||
$branch = "-$env:APPVEYOR_REPO_BRANCH"; |
$branch = "-$env:APPVEYOR_REPO_BRANCH"; |
||||||
} else { |
} else { |
||||||
$branch = ""; |
$branch = ""; |
||||||
} |
} |
||||||
|
|
||||||
$build = [Int32]::Parse((git rev-list --count "$baseCommitHash..HEAD")) + 1; |
$revision = [Int32]::Parse((git rev-list --count "$baseCommit..HEAD")) + 1; |
||||||
|
|
||||||
$newVersion="$majorVersion.$minorVersion.$revision.$build"; |
$newVersion="$majorVersion.$minorVersion.$build.$revision"; |
||||||
$env:ilspy_version_number=$newVersion; |
$env:appveyor_build_version="$newVersion$branch$versionName"; |
||||||
$env:appveyor_build_version="$newVersion$branch"; |
appveyor UpdateBuild -Version "$newVersion$branch$versionName"; |
||||||
appveyor UpdateBuild -Version "$newVersion$branch"; |
|
@ -1,8 +0,0 @@ |
|||||||
@echo This script simulates what the build server is doing |
|
||||||
@rem /p:AdditionalBuildProperties="/v:d /p:MSBuildTargetsVerbose=true" |
|
||||||
"%ProgramFiles(x86)%\MSBuild\14.0\Bin\msbuild.exe" Automated.proj /p:ArtefactsOutputDir="%CD%\build" /p:TestReportsDir="%CD%\build" |
|
||||||
@IF %ERRORLEVEL% NEQ 0 GOTO err |
|
||||||
@exit /B 0 |
|
||||||
:err |
|
||||||
@PAUSE |
|
||||||
@exit /B 1 |
|
@ -0,0 +1,111 @@ |
|||||||
|
$ErrorActionPreference = "Stop" |
||||||
|
|
||||||
|
$baseCommit = "d779383cb85003d6dabeb976f0845631e07bf463"; |
||||||
|
$baseCommitRev = 1; |
||||||
|
|
||||||
|
$globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs"; |
||||||
|
|
||||||
|
function Test-File([string]$filename) { |
||||||
|
return [System.IO.File]::Exists( (Join-Path (Get-Location) $filename) ); |
||||||
|
} |
||||||
|
|
||||||
|
function Test-Dir([string]$name) { |
||||||
|
return [System.IO.Directory]::Exists( (Join-Path (Get-Location) $name) ); |
||||||
|
} |
||||||
|
|
||||||
|
function gitVersion() { |
||||||
|
if (-not (Test-Dir ".git")) { |
||||||
|
return 1; |
||||||
|
} |
||||||
|
return [Int32]::Parse((git rev-list --count "$baseCommit..HEAD")) + $baseCommitRev; |
||||||
|
} |
||||||
|
|
||||||
|
function gitCommitHash() { |
||||||
|
if (-not (Test-Dir ".git")) { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
return (git rev-list "$baseCommit..HEAD") | Select -First 1; |
||||||
|
} |
||||||
|
|
||||||
|
function gitBranch() { |
||||||
|
if (-not (Test-Dir ".git")) { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
|
||||||
|
if ($env:APPVEYOR_REPO_BRANCH -ne $null) { |
||||||
|
return $env:APPVEYOR_REPO_BRANCH; |
||||||
|
} else { |
||||||
|
return ((git branch --no-color).Split([System.Environment]::NewLine) | where { $_ -match "^\* " } | select -First 1).Substring(2); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
$templateFiles = ( |
||||||
|
@{Input=$globalAssemblyInfoTemplateFile; Output="ILSpy/Properties/AssemblyInfo.cs"}, |
||||||
|
@{Input="ICSharpCode.Decompiler/Properties/AssemblyInfo.template.cs"; Output="ICSharpCode.Decompiler/Properties/AssemblyInfo.cs"}, |
||||||
|
@{Input="ILSpy/Properties/app.config.template"; Output = "ILSpy/app.config"} |
||||||
|
); |
||||||
|
[string]$mutexId = "ILSpyUpdateAssemblyInfo" + $PSScriptRoot.GetHashCode(); |
||||||
|
[bool]$createdNew = $false; |
||||||
|
$mutex = New-Object System.Threading.Mutex($true, $mutexId, [ref]$createdNew); |
||||||
|
try { |
||||||
|
if (-not $createdNew) { |
||||||
|
try { |
||||||
|
$mutex.WaitOne(10000); |
||||||
|
} catch [System.Threading.AbandonedMutexException] { |
||||||
|
} |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
if (-not (Test-File "ILSpy.sln")) { |
||||||
|
Write-Host "Working directory must be the ILSpy repo root!"; |
||||||
|
return 2; |
||||||
|
} |
||||||
|
|
||||||
|
$versionParts = @{}; |
||||||
|
Get-Content $globalAssemblyInfoTemplateFile | where { $_ -match 'string (\w+) = "?(\w+)"?;' } | foreach { $versionParts.Add($Matches[1], $Matches[2]) } |
||||||
|
|
||||||
|
$major = $versionParts.Major; |
||||||
|
$minor = $versionParts.Minor; |
||||||
|
$build = $versionParts.Build; |
||||||
|
$versionName = $versionParts.VersionName; |
||||||
|
$revision = gitVersion; |
||||||
|
$branchName = gitBranch; |
||||||
|
$gitCommitHash = gitCommitHash; |
||||||
|
|
||||||
|
$postfixBranchName = ""; |
||||||
|
if ($branchName -ne "master") { |
||||||
|
$postfixBranchName = "-$branchName"; |
||||||
|
} |
||||||
|
|
||||||
|
if ($versionName -eq "null") { |
||||||
|
$versionName = ""; |
||||||
|
$postfixVersionName = ""; |
||||||
|
} else { |
||||||
|
$postfixVersionName = "-$versionName"; |
||||||
|
} |
||||||
|
|
||||||
|
$fullVersionNumber = "$major.$minor.$build.$revision"; |
||||||
|
|
||||||
|
foreach ($file in $templateFiles) { |
||||||
|
[string]$in = (Get-Content $file.Input) -Join [System.Environment]::NewLine; |
||||||
|
|
||||||
|
$out = $in.Replace('$INSERTVERSION$', $fullVersionNumber); |
||||||
|
$out = $out.Replace('$INSERTMAJORVERSION$', $major); |
||||||
|
$out = $out.Replace('$INSERTREVISION$', $minor); |
||||||
|
$out = $out.Replace('$INSERTCOMMITHASH$', $gitCommitHash); |
||||||
|
$out = $out.Replace('$INSERTSHORTCOMMITHASH$', $gitCommitHash.Substring(0, 8)); |
||||||
|
$out = $out.Replace('$INSERTDATE$', [System.DateTime]::Now.ToString("MM/dd/yyyy")); |
||||||
|
$out = $out.Replace('$INSERTYEAR$', [System.DateTime]::Now.Year.ToString()); |
||||||
|
$out = $out.Replace('$INSERTBRANCHNAME$', $branchName); |
||||||
|
$out = $out.Replace('$INSERTBRANCHPOSTFIX$', $postfixBranchName); |
||||||
|
$out = $out.Replace('$INSERTVERSIONNAME$', $versionName); |
||||||
|
$out = $out.Replace('$INSERTVERSIONNAMEPOSTFIX$', $postfixVersionName); |
||||||
|
|
||||||
|
if (((Get-Content $file.Input) -Join [System.Environment]::NewLine) -ne $out) { |
||||||
|
$out | Out-File $file.Output; |
||||||
|
} |
||||||
|
} |
||||||
|
} finally { |
||||||
|
$mutex.ReleaseMutex(); |
||||||
|
$mutex.Dispose(); |
||||||
|
} |
Loading…
Reference in new issue