mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
"UpdateAssemblyDescription" renamed to "UpdateAssemblyInfo". Now also gets revision number (number of commits since last release)
This commit is contained in:
parent
7dad65ff88
commit
baa946265c
@ -31,4 +31,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("3.3.13.0")]
|
||||
[assembly: AssemblyVersion("3.3.13.[REVNO]")]
|
||||
|
@ -14,7 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{7BE5B8E8-9469-4C7C-89D7-E8C884DEFC0E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateAssemblyDescription", "UpdateAssemblyDescription\UpdateAssemblyDescription.csproj", "{DBD4656C-5F40-4067-A70B-C4460DE20F77}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateAssemblyInfo", "UpdateAssemblyInfo\UpdateAssemblyInfo.csproj", "{DBD4656C-5F40-4067-A70B-C4460DE20F77}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(TestCaseManagementSettings) = postSolution
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace UpdateAssemblyDescription
|
||||
namespace UpdateAssemblyInfo
|
||||
{
|
||||
public class CommandLineRunner
|
||||
{
|
||||
@ -16,7 +16,7 @@ namespace UpdateAssemblyDescription
|
||||
p.StartInfo.RedirectStandardInput = true;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.StartInfo.CreateNoWindow = true;
|
||||
p.OutputDataReceived += _mplayer_OutputDataReceived;
|
||||
p.OutputDataReceived += OutputDataReceived;
|
||||
|
||||
try
|
||||
{
|
||||
@ -34,7 +34,7 @@ namespace UpdateAssemblyDescription
|
||||
return false;
|
||||
}
|
||||
|
||||
void _mplayer_OutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
void OutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if (e != null && e.Data != null)
|
||||
Result = e.Data;
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace UpdateAssemblyDescription
|
||||
namespace UpdateAssemblyInfo
|
||||
{
|
||||
class Program
|
||||
{
|
||||
@ -31,10 +31,10 @@ namespace UpdateAssemblyDescription
|
||||
return "git";
|
||||
}
|
||||
|
||||
private static void DoUpdateAssemblyDescription(string gitHash, string template, string target)
|
||||
private static void DoUpdateAssembly(string source, string gitHash, string template, string target)
|
||||
{
|
||||
string templateData = File.ReadAllText(template);
|
||||
string fixedData = templateData.Replace("[GITHASH]", gitHash);
|
||||
string fixedData = templateData.Replace(source, gitHash);
|
||||
File.WriteAllText(target, fixedData);
|
||||
}
|
||||
|
||||
@ -54,13 +54,18 @@ namespace UpdateAssemblyDescription
|
||||
string template = args[0];
|
||||
string target = args[1];
|
||||
|
||||
var clr = new CommandLineRunner();
|
||||
var rc = clr.RunCommandAndGetOutput(GetGitPath(), "rev-parse --verify HEAD", workingFolder);
|
||||
if (rc)
|
||||
var clrHash = new CommandLineRunner();
|
||||
var rcGitHash = clrHash.RunCommandAndGetOutput(GetGitPath(), "rev-parse --verify HEAD", workingFolder);
|
||||
var clrTags = new CommandLineRunner();
|
||||
var rcGitTags = clrTags.RunCommandAndGetOutput(GetGitPath(), "describe --tags", workingFolder);
|
||||
if (rcGitHash && rcGitTags)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoUpdateAssemblyDescription(clr.Result, template, target);
|
||||
DoUpdateAssembly("[GITHASH]", clrHash.Result, template, target);
|
||||
File.WriteAllText(errorFileName, "GIT TAGS: " + clrTags.Result);
|
||||
|
||||
DoUpdateAssembly("[REVNO]", clrTags.Result.Split('-')[1] , target, target);
|
||||
return 0;
|
||||
}
|
||||
catch (Exception e)
|
@ -8,7 +8,7 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UpdateAssemblyDescription</RootNamespace>
|
||||
<AssemblyName>UpdateAssemblyDescription</AssemblyName>
|
||||
<AssemblyName>UpdateAssemblyInfo</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
@ -3,7 +3,7 @@ SETLOCAL
|
||||
|
||||
PUSHD %~dp0
|
||||
|
||||
"src\UpdateAssemblyDescription\bin\Release\UpdateAssemblyDescription.exe" "src\Properties\AssemblyInfo.cs.template" "src\Properties\AssemblyInfo.cs"
|
||||
"src\UpdateAssemblyInfo\bin\Release\UpdateAssemblyInfo.exe" "src\Properties\AssemblyInfo.cs.template" "src\Properties\AssemblyInfo.cs"
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO SubError
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user