forked from meebey/smuxi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
msbuild-preprocess.ps1
49 lines (34 loc) · 1.7 KB
/
msbuild-preprocess.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$branch = ""
$revision = ""
$hasGit = $false
if ($env:path.ToLower().Contains("git") -and (Test-Path .git))
{
$hasGit = $true
$branch = git symbolic-ref --short HEAD # @git_branch
$revision = git rev-parse HEAD # @git_commit_hash
}
# Task count
$tCount = 3
# Defines.cs
Write-Output "[1/$tCount] Generating Defines.cs file..."
$prefix = "." # @prefix@
$dist_version = "git" # @dist_version@
$twitter_key_content1 = Switch -regex (Get-Content -Path configure.ac) { "with_twitter_api_key=" { echo $switch.current } }
$twitter_key_content2 = $twitter_key_content1 -replace "^[^=]*=", ""
$twitter_api_key = $twitter_key_content2 -replace "[""]", "" # @twitter_api_key
$defines_in = Get-Content "src\Common\Defines.cs.in"
$defines = $defines_in -replace "@git_branch@", $branch -replace "@git_commit_hash@", $revision -replace "@prefix@", "." -replace "@dist_version@", "git" -replace "@twitter_api_key@", $twitter_api_key
Set-Content src\Common\Defines.cs $defines
Write-Output " -> Defines.cs file generated."
# Adapted configs for Win32 smuxi-frontend-gnome.exe Dev and Deploy
$fGnome = "src\Frontend-GNOME\smuxi-frontend-gnome.exe.config"
Write-Output "[2/$tCount] Fixing '$fGnome' for Win32"
Copy-Item -Force "lib\win32\smuxi-frontend-gnome.exe.config" $fGnome
Write-Warning "If you plan to do some hacking please don't commit '$fGnome'"
Write-Output " -> $fGnome fixed."
# Adapted configs for Win32 smuxi-server.exe Dev and Deploy
$fServer = "src\Server\smuxi-server.exe.config"
Write-Output "[3/$tCount] Fixing '$fServer' for Win32"
Copy-Item -Force "lib\win32\smuxi-server.exe.config" $fServer
Write-Warning "If you plan to do some hacking please don't commit '$fServer'"
Write-Output " -> $fServer fixed."