Skip to content

Commit f87f0be

Browse files
committedNov 29, 2017
update xp build and version auto management in appveyor.yml
1 parent 245bb26 commit f87f0be

File tree

6 files changed

+190
-6
lines changed

6 files changed

+190
-6
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
[Dd]ebugPublic/
1616
[Rr]elease/
1717
[Rr]eleases/
18+
XP-Release/
1819
x64/
1920
x86/
2021
bld/

‎CommandTrayHost.sln

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27004.2009
4+
VisualStudioVersion = 15.0.27004.2010
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommandTrayHost", "CommandTrayHost\CommandTrayHost.vcxproj", "{18FC42B7-89B4-4972-9D65-C4322F6CC817}"
77
EndProject
@@ -11,6 +11,8 @@ Global
1111
Debug|x86 = Debug|x86
1212
Release|x64 = Release|x64
1313
Release|x86 = Release|x86
14+
XP-Release|x64 = XP-Release|x64
15+
XP-Release|x86 = XP-Release|x86
1416
EndGlobalSection
1517
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1618
{18FC42B7-89B4-4972-9D65-C4322F6CC817}.Debug|x64.ActiveCfg = Debug|x64
@@ -21,6 +23,10 @@ Global
2123
{18FC42B7-89B4-4972-9D65-C4322F6CC817}.Release|x64.Build.0 = Release|x64
2224
{18FC42B7-89B4-4972-9D65-C4322F6CC817}.Release|x86.ActiveCfg = Release|Win32
2325
{18FC42B7-89B4-4972-9D65-C4322F6CC817}.Release|x86.Build.0 = Release|Win32
26+
{18FC42B7-89B4-4972-9D65-C4322F6CC817}.XP-Release|x64.ActiveCfg = XP-Release|x64
27+
{18FC42B7-89B4-4972-9D65-C4322F6CC817}.XP-Release|x64.Build.0 = XP-Release|x64
28+
{18FC42B7-89B4-4972-9D65-C4322F6CC817}.XP-Release|x86.ActiveCfg = XP-Release|Win32
29+
{18FC42B7-89B4-4972-9D65-C4322F6CC817}.XP-Release|x86.Build.0 = XP-Release|Win32
2430
EndGlobalSection
2531
GlobalSection(SolutionProperties) = preSolution
2632
HideSolutionNode = FALSE

‎CommandTrayHost/CommandTrayHost.vcxproj

+75
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
<Configuration>Release</Configuration>
1818
<Platform>x64</Platform>
1919
</ProjectConfiguration>
20+
<ProjectConfiguration Include="XP-Release|Win32">
21+
<Configuration>XP-Release</Configuration>
22+
<Platform>Win32</Platform>
23+
</ProjectConfiguration>
24+
<ProjectConfiguration Include="XP-Release|x64">
25+
<Configuration>XP-Release</Configuration>
26+
<Platform>x64</Platform>
27+
</ProjectConfiguration>
2028
</ItemGroup>
2129
<PropertyGroup Label="Globals">
2230
<VCProjectVersion>15.0</VCProjectVersion>
@@ -25,6 +33,9 @@
2533
<RootNamespace>CommandTrayHost</RootNamespace>
2634
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
2735
</PropertyGroup>
36+
<PropertyGroup>
37+
<VcpkgConfiguration Condition="'$(Configuration)' == 'XP-Release'">Release</VcpkgConfiguration>
38+
</PropertyGroup>
2839
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2940
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
3041
<ConfigurationType>Application</ConfigurationType>
@@ -39,6 +50,13 @@
3950
<WholeProgramOptimization>true</WholeProgramOptimization>
4051
<CharacterSet>Unicode</CharacterSet>
4152
</PropertyGroup>
53+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='XP-Release|Win32'" Label="Configuration">
54+
<ConfigurationType>Application</ConfigurationType>
55+
<UseDebugLibraries>false</UseDebugLibraries>
56+
<PlatformToolset>v141_xp</PlatformToolset>
57+
<WholeProgramOptimization>true</WholeProgramOptimization>
58+
<CharacterSet>Unicode</CharacterSet>
59+
</PropertyGroup>
4260
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
4361
<ConfigurationType>Application</ConfigurationType>
4462
<UseDebugLibraries>true</UseDebugLibraries>
@@ -52,6 +70,13 @@
5270
<WholeProgramOptimization>true</WholeProgramOptimization>
5371
<CharacterSet>Unicode</CharacterSet>
5472
</PropertyGroup>
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='XP-Release|x64'" Label="Configuration">
74+
<ConfigurationType>Application</ConfigurationType>
75+
<UseDebugLibraries>false</UseDebugLibraries>
76+
<PlatformToolset>v141_xp</PlatformToolset>
77+
<WholeProgramOptimization>true</WholeProgramOptimization>
78+
<CharacterSet>Unicode</CharacterSet>
79+
</PropertyGroup>
5580
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
5681
<ImportGroup Label="ExtensionSettings">
5782
</ImportGroup>
@@ -63,12 +88,18 @@
6388
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
6489
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
6590
</ImportGroup>
91+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='XP-Release|Win32'" Label="PropertySheets">
92+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
93+
</ImportGroup>
6694
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
6795
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
6896
</ImportGroup>
6997
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
7098
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
7199
</ImportGroup>
100+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='XP-Release|x64'" Label="PropertySheets">
101+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
102+
</ImportGroup>
72103
<PropertyGroup Label="UserMacros" />
73104
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74105
<LinkIncremental>true</LinkIncremental>
@@ -79,9 +110,15 @@
79110
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
80111
<LinkIncremental>false</LinkIncremental>
81112
</PropertyGroup>
113+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='XP-Release|Win32'">
114+
<LinkIncremental>false</LinkIncremental>
115+
</PropertyGroup>
82116
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
83117
<LinkIncremental>false</LinkIncremental>
84118
</PropertyGroup>
119+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='XP-Release|x64'">
120+
<LinkIncremental>false</LinkIncremental>
121+
</PropertyGroup>
85122
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
86123
<ClCompile>
87124
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -127,6 +164,24 @@
127164
<GenerateDebugInformation>false</GenerateDebugInformation>
128165
</Link>
129166
</ItemDefinitionGroup>
167+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='XP-Release|Win32'">
168+
<ClCompile>
169+
<PrecompiledHeader>Use</PrecompiledHeader>
170+
<WarningLevel>Level3</WarningLevel>
171+
<Optimization>MaxSpeed</Optimization>
172+
<FunctionLevelLinking>true</FunctionLevelLinking>
173+
<IntrinsicFunctions>true</IntrinsicFunctions>
174+
<SDLCheck>true</SDLCheck>
175+
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
176+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
177+
</ClCompile>
178+
<Link>
179+
<SubSystem>Windows</SubSystem>
180+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
181+
<OptimizeReferences>true</OptimizeReferences>
182+
<GenerateDebugInformation>false</GenerateDebugInformation>
183+
</Link>
184+
</ItemDefinitionGroup>
130185
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
131186
<ClCompile>
132187
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -145,6 +200,24 @@
145200
<GenerateDebugInformation>false</GenerateDebugInformation>
146201
</Link>
147202
</ItemDefinitionGroup>
203+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='XP-Release|x64'">
204+
<ClCompile>
205+
<PrecompiledHeader>Use</PrecompiledHeader>
206+
<WarningLevel>Level3</WarningLevel>
207+
<Optimization>MaxSpeed</Optimization>
208+
<FunctionLevelLinking>true</FunctionLevelLinking>
209+
<IntrinsicFunctions>true</IntrinsicFunctions>
210+
<SDLCheck>true</SDLCheck>
211+
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
212+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
213+
</ClCompile>
214+
<Link>
215+
<SubSystem>Windows</SubSystem>
216+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
217+
<OptimizeReferences>true</OptimizeReferences>
218+
<GenerateDebugInformation>false</GenerateDebugInformation>
219+
</Link>
220+
</ItemDefinitionGroup>
148221
<ItemGroup>
149222
<ClInclude Include="CommandTrayHost.h" />
150223
<ClInclude Include="configure.h" />
@@ -159,7 +232,9 @@
159232
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
160233
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
161234
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
235+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='XP-Release|Win32'">Create</PrecompiledHeader>
162236
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
237+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='XP-Release|x64'">Create</PrecompiledHeader>
163238
</ClCompile>
164239
</ItemGroup>
165240
<ItemGroup>

‎CommandTrayHost/stdafx.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,5 @@ void LOGMESSAGE(wchar_t* pszFormat, ...);
6363

6464
#define CommandTrayHost (L"Command_Tray_Host")
6565

66-
#define VERSION_NUMS L"0.6.0"
66+
#define VERSION_NUMS L"0.6.0"
67+

‎appveyor.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,31 @@ clone_folder: c:\projects\CommandTrayHost
1111
install:
1212
- cmd: >-
1313
vcpkg install rapidjson rapidjson:x64-windows nlohmann-json nlohmann-json:x64-windows
14-
# before_build:
15-
# - cmd: cd c:\projects\CommandTrayHost
16-
# - cmd: dir /a CommandTrayHost
14+
before_build:
15+
- cmd: >-
16+
cd c:\projects\CommandTrayHost
17+
C:\Python36\python.exe version_set.py %APPVEYOR_BUILD_NUMBER%
1718
build:
1819
project: c:\projects\CommandTrayHost\CommandTrayHost.sln
1920
verbosity: minimal
2021
after_build:
2122
- cmd: msbuild "c:\projects\CommandTrayHost\CommandTrayHost.sln" /verbosity:minimal /p:Configuration=Release /p:Platform=x64 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
23+
- cmd: msbuild "c:\projects\CommandTrayHost\CommandTrayHost.sln" /verbosity:minimal /p:Configuration=XP-Release /p:Platform=x86 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
2224
- cmd: >-
2325
cd c:\projects\CommandTrayHost
2426
2527
mkdir CommandTrayHost-x64
2628
2729
mkdir CommandTrayHost-x86
2830
31+
mkdir CommandTrayHost-xp-x86
32+
2933
copy x64\Release\CommandTrayHost.exe CommandTrayHost-x64\
3034
3135
copy Release\CommandTrayHost.exe CommandTrayHost-x86\
3236
37+
copy XP-Release\CommandTrayHost.exe CommandTrayHost-xp-x86\
38+
3339
curl -L -o upx.zip https://github.com/upx/upx/releases/download/v3.94/upx394w.zip
3440
3541
7z e upx.zip *.exe -r
@@ -38,7 +44,9 @@ after_build:
3844
3945
upx CommandTrayHost-x86\CommandTrayHost.exe
4046
41-
7z a -tzip CommandTrayHost-%APPVEYOR_BUILD_VERSION%.zip .\CommandTrayHost-x64\ .\CommandTrayHost-x86\
47+
upx CommandTrayHost-xp-x86\CommandTrayHost.exe
48+
49+
7z a -tzip CommandTrayHost-%APPVEYOR_BUILD_VERSION%.zip .\CommandTrayHost-x64\ .\CommandTrayHost-x86\ .CommandTrayHost-xp-x86\
4250
artifacts:
4351
- path: CommandTrayHost-%APPVEYOR_BUILD_VERSION%.zip
4452
name: CommandTrayHost

‎version_set.py

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# /usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
import os
5+
import re
6+
import sys
7+
import codecs
8+
9+
MAJOR_VERSION = '0'
10+
MINOR_VERSION = '6'
11+
FIX_VERSION = '0'
12+
13+
'''
14+
git checkout HEAD -- CommandTrayHost/CommandTrayHost.rc CommandTrayHost/stdafx.h
15+
'''
16+
17+
18+
def main():
19+
global MAJOR_VERSION, MINOR_VERSION, FIX_VERSION
20+
print(sys.argv)
21+
if len(sys.argv) < 2:
22+
print("must input build version")
23+
return False
24+
argc = len(sys.argv)
25+
if(argc > 1):
26+
build_version_number = sys.argv[1]
27+
print("build_version_number: ", build_version_number)
28+
if(argc > 2):
29+
MAJOR_VERSION = sys.argv[2]
30+
if(argc > 3):
31+
MINOR_VERSION = sys.argv[3]
32+
if(argc > 4):
33+
FIX_VERSION = sys.argv[4]
34+
# \r\n will have trouble with $ to match end
35+
pattern_rc = re.compile(
36+
r'^VALUE "ProductVersion", "\d+, \d+, \d+, \d+[\\]0"', re.M)
37+
rc_string = r'VALUE "ProductVersion", "{}, {}, {}, {}\\0"'.format(
38+
MAJOR_VERSION, MINOR_VERSION, FIX_VERSION, build_version_number) # .encode('utf-8')
39+
40+
pattern_stdafx_h = re.compile(
41+
r'^#define VERSION_NUMS L"\d+[.]\d+[.][0-9b-]+"', re.M)
42+
stdafx_h_string = r'#define VERSION_NUMS L"{}.{}.{}-b{}"'.format(
43+
MAJOR_VERSION, MINOR_VERSION, FIX_VERSION, build_version_number) # .encode('utf-16le')
44+
45+
base_dir = os.path.dirname(os.path.abspath(__file__))
46+
rc_file = os.path.join(base_dir, "CommandTrayHost", "CommandTrayHost.rc")
47+
stdafx_h_file = os.path.join(base_dir, "CommandTrayHost", "stdafx.h")
48+
49+
print(stdafx_h_string, '\n', rc_string)
50+
51+
for file_name, pattern_re, replace_string, encoding in (
52+
(stdafx_h_file, pattern_stdafx_h, stdafx_h_string, 'utf-16le'),
53+
(rc_file, pattern_rc, rc_string, 'utf-8'),
54+
):
55+
# CommandTrayHost.rc # stdafx.h
56+
try:
57+
with open(file_name, "rb") as f:
58+
content = f.read()
59+
except:
60+
return False
61+
print(len(content), end=" ")
62+
if encoding == 'utf-16le':
63+
bom = codecs.BOM_UTF16_LE
64+
else:
65+
bom = codecs.BOM_UTF8
66+
if content.startswith(bom):
67+
content = content[len(bom):]
68+
content = content.decode(encoding)
69+
70+
if pattern_re.search(content) is None:
71+
return False
72+
print(len(content), end=" ")
73+
content = pattern_re.sub(replace_string, content)
74+
print(len(content), end=" ")
75+
if encoding == 'utf-16le':
76+
content = bom + content.encode(encoding)
77+
else:
78+
content = content.encode(encoding)
79+
print(len(content))
80+
with open(file_name, "wb") as f:
81+
f.write(content)
82+
print(file_name, "repalced!\n")
83+
84+
return True
85+
86+
87+
if __name__ == '__main__':
88+
print(f"""{__file__} <build_number> [MAJOR_VERSION] [MINOR_VERSION] [FIX_VERSION]
89+
[MAJOR_VERSION] [MINOR_VERSION] [FIX_VERSION] are optional.""")
90+
if (sys.version_info < (3, 0)):
91+
sys.exit(2)
92+
if not main():
93+
sys.exit(1)

0 commit comments

Comments
 (0)
Please sign in to comment.