mirror of
https://github.com/moparisthebest/hexchat
synced 2024-12-21 23:28:51 -05:00
Replaced use of T4 templates with PS-based templates.
TextTransform.exe is not available with Express versions of Visual Studio.
This commit is contained in:
parent
61ceaef57e
commit
c7bf4b0474
@ -1,4 +1,4 @@
|
||||
<#@ include file="version.include.tt" #>#define LOCALEDIR ".\\share\\locale"
|
||||
#define LOCALEDIR ".\\share\\locale"
|
||||
#define ENABLE_NLS
|
||||
#define USE_GMODULE
|
||||
#define USE_PLUGIN
|
||||
@ -8,12 +8,12 @@
|
||||
#define ISO_CODES_PREFIX ".\\"
|
||||
#define ISO_CODES_LOCALEDIR LOCALEDIR
|
||||
#define PACKAGE_NAME "hexchat"
|
||||
#define PACKAGE_VERSION "<#= string.Join(".", versionParts) #>"
|
||||
#define PACKAGE_VERSION "<#= [string]::Join('.', $versionParts) #>"
|
||||
#define HEXCHATLIBDIR ".\\plugins"
|
||||
#define HEXCHATSHAREDIR "."
|
||||
#define OLD_PERL
|
||||
#define GETTEXT_PACKAGE "hexchat"
|
||||
#define PACKAGE_TARNAME "hexchat-<#= string.Join(".", versionParts) #>"
|
||||
#define PACKAGE_TARNAME "hexchat-<#= [string]::Join('.', $versionParts) #>"
|
||||
#ifndef USE_IPV6
|
||||
#define socklen_t int
|
||||
#endif
|
||||
|
@ -159,8 +159,10 @@
|
||||
<Command>
|
||||
<![CDATA[
|
||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
||||
$(TextTransformPath) -out "%SOLUTIONDIR%config-win32.h" "%SOLUTIONDIR%config-win32.h.tt"
|
||||
$(TextTransformPath) -out "%SOLUTIONDIR%win32\version.txt" "%SOLUTIONDIR%win32\version.txt.tt"
|
||||
powershell "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\config-win32.h.tt" "$(SolutionDir)..\config-win32.h"
|
||||
powershell "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\win32\version.txt.tt" "$(SolutionDir)..\win32\version.txt.tmp"
|
||||
REM version.txt must be in UTF-8 without trailing newline
|
||||
powershell "[string] $content = Get-Content '$(SolutionDir)..\win32\version.txt.tmp' -Encoding UTF8; [System.IO.File]::WriteAllText('$(SolutionDir)..\win32\version.txt', $content); Remove-Item '$(SolutionDir)..\win32\version.txt.tmp';"
|
||||
]]>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
|
@ -100,7 +100,9 @@
|
||||
<Command>
|
||||
<![CDATA[
|
||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
||||
$(TextTransformPath) -out hexchat.rc hexchat.rc.tt
|
||||
powershell "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.tt" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8"
|
||||
REM hexchat.rc needs to be in UCS-2 or Resource Compiler will complain
|
||||
powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8' | Out-File '$(SolutionDir)..\src\fe-gtk\hexchat.rc'; Remove-Item '$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8'"
|
||||
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --sourcedir $(DataDir) --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml"
|
||||
]]>
|
||||
</Command>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<#@ include file="..\..\version.include.tt" #>#include <winver.h>
|
||||
#include <winver.h>
|
||||
#include "../../config-win32.h"
|
||||
|
||||
#define COMMA_VERSION <#= string.Join(",", versionParts) #>,0
|
||||
#define COMMA_VERSION <#= [string]::Join(',', $versionParts) #>,0
|
||||
|
||||
XC_ICON ICON "../../data/icons/hexchat.ico"
|
||||
|
||||
|
12
version-template.ps1
Normal file
12
version-template.ps1
Normal file
@ -0,0 +1,12 @@
|
||||
param ([string] $templateFilename, [string] $outputFilename)
|
||||
|
||||
$versionParts = Select-String -Path "${env:SOLUTIONDIR}configure.ac" -Pattern '^AC_INIT\(\[HexChat\],\[([^]]+)\]\)$' | Select-Object -First 1 | %{ $_.Matches[0].Groups[1].Value.Split('.') }
|
||||
|
||||
[string[]] $contents = Get-Content $templateFilename -Encoding UTF8 | %{
|
||||
while ($_ -match '^(.*?)<#=(.*?)#>(.*?)$') {
|
||||
$_ = $Matches[1] + $(Invoke-Expression $Matches[2]) + $Matches[3]
|
||||
}
|
||||
$_
|
||||
}
|
||||
|
||||
[System.IO.File]::WriteAllLines($outputFilename, $contents)
|
@ -1,12 +0,0 @@
|
||||
<#@
|
||||
template debug="false" hostspecific="false" language="C#" #><#@
|
||||
assembly name="System.Core" #><#@
|
||||
import namespace="System.IO" #><#@
|
||||
import namespace="System.Linq" #><#@
|
||||
import namespace="System.Text.RegularExpressions" #><#
|
||||
var versionParts = File.ReadLines(Path.Combine(System.Environment.GetEnvironmentVariable("SOLUTIONDIR"), "configure.ac"))
|
||||
.Select(line => Regex.Match(line, @"^AC_INIT\(\[HexChat\],\[([^]]+)\]\)$"))
|
||||
.First(match => match.Success)
|
||||
.Groups[1].Value
|
||||
.Split('.');
|
||||
#>
|
@ -94,8 +94,6 @@ copy "$(HexChatBin)hcsysinfo.dll" "$(HexChatRel)\plugins"
|
||||
xcopy /q /s /i "$(HexChatBin)locale" "$(HexChatRel)\share\locale"
|
||||
xcopy /q /s /i "$(DepsRoot)\share\locale" "$(HexChatRel)\share\locale"
|
||||
</HexChatCopy>
|
||||
<TextTransformPath Condition="'$(Platform)'=='Win32'">"%PROGRAMFILES%\Common Files\microsoft shared\TextTemplating\12.0\TextTransform.exe"</TextTransformPath>
|
||||
<TextTransformPath Condition="'$(Platform)'=='x64'">"%PROGRAMFILES(x86)%\Common Files\microsoft shared\TextTemplating\12.0\TextTransform.exe"</TextTransformPath>
|
||||
<IsccPath Condition="'$(Platform)'=='Win32'">"%PROGRAMFILES%\Inno Setup 5\iscc.exe"</IsccPath>
|
||||
<IsccPath Condition="'$(Platform)'=='x64'">"%PROGRAMFILES(x86)%\Inno Setup 5\iscc.exe"</IsccPath>
|
||||
</PropertyGroup>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<#@ include file="..\..\version.include.tt" #>#define APPNAM "HexChat"
|
||||
#define APPVER "<#= string.Join(".", versionParts) #>"
|
||||
#define APPNAM "HexChat"
|
||||
#define APPVER "<#= [string]::Join('.', $versionParts) #>"
|
||||
; These are defined by our installer project at build time
|
||||
;#define APPARCH "x64"
|
||||
;#define PROJECTDIR "C:\...\hexchat\win32\installer\"
|
||||
|
@ -64,7 +64,7 @@
|
||||
<Command>
|
||||
<![CDATA[
|
||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
||||
$(TextTransformPath) -out "%SOLUTIONDIR%win32\installer\hexchat.iss" "%SOLUTIONDIR%win32\installer\hexchat.iss.tt"
|
||||
powershell "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\win32\installer\hexchat.iss.tt" "$(SolutionDir)..\win32\installer\hexchat.iss"
|
||||
del "$(OutDir)hexchat.iss"
|
||||
type hexchat.iss >> "$(OutDir)hexchat.iss"
|
||||
$(IsccPath) /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(OutDir)hexchat.iss"
|
||||
|
@ -1 +1 @@
|
||||
<#@ include file="..\version.include.tt" #><#= string.Join(".", versionParts) #>
|
||||
<#= [string]::Join('.', $versionParts) #>
|
Loading…
Reference in New Issue
Block a user