-
Notifications
You must be signed in to change notification settings - Fork 7
/
config.xml
218 lines (194 loc) · 10 KB
/
config.xml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?xml version='1.1' encoding='UTF-8'?>
<project>
<actions/>
<description>游戏build</description>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>projectPath</name>
<description>打包项目所在的目录</description>
<defaultValue>G:\program2019\unity\JenkinsUnityBuildTest</defaultValue>
<trim>true</trim>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>outputPath</name>
<description>打包的输出目录</description>
<defaultValue>G:\program2019\unity\testout</defaultValue>
<trim>true</trim>
</hudson.model.StringParameterDefinition>
<com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition plugin="extended-choice-parameter@0.78">
<name>buildPlatform</name>
<description>选择打包平台</description>
<quoteValue>false</quoteValue>
<saveJSONParameterToFile>false</saveJSONParameterToFile>
<visibleItemCount>3</visibleItemCount>
<type>PT_RADIO</type>
<value>0,1,2</value>
<defaultValue>0</defaultValue>
<multiSelectDelimiter>,</multiSelectDelimiter>
<descriptionPropertyValue>Windows64,Android,iOS</descriptionPropertyValue>
<projectName>game</projectName>
</com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition>
<com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition plugin="extended-choice-parameter@0.78">
<name>buildMode</name>
<description>选择打包模式,如果资源(lua代码也是资源,C#代码不是)没变动,可以选择之后的几项</description>
<quoteValue>false</quoteValue>
<saveJSONParameterToFile>false</saveJSONParameterToFile>
<visibleItemCount>3</visibleItemCount>
<type>PT_RADIO</type>
<value>0,1,2</value>
<defaultValue>0</defaultValue>
<multiSelectDelimiter>,</multiSelectDelimiter>
<descriptionPropertyValue>全量打包,不打包AssetBundle,直接Build,只重新编译C#代码(不包括lua),不打AssetBundle和场景</descriptionPropertyValue>
<projectName>game</projectName>
</com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>enableUnityDevelopment</name>
<description>开启unity的developmentbuild</description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>enableExportProject</name>
<description>导出额外的工程(Android),iOS默认开启不需要选</description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>enableGameDevelopment</name>
<description>Game的开发者模式,指代码的逻辑是开发者模式</description>
<defaultValue>true</defaultValue>
</hudson.model.BooleanParameterDefinition>
<com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition plugin="extended-choice-parameter@0.78">
<name>versionControl</name>
<description>版本控制软件</description>
<quoteValue>false</quoteValue>
<saveJSONParameterToFile>false</saveJSONParameterToFile>
<visibleItemCount>2</visibleItemCount>
<type>PT_SINGLE_SELECT</type>
<value>0,1</value>
<defaultValue>0</defaultValue>
<multiSelectDelimiter>,</multiSelectDelimiter>
<descriptionPropertyValue>Git(需要安装Git),SVN(需要安装SVN,并有SVN命令可用)</descriptionPropertyValue>
<projectName>game</projectName>
</com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>enableProjectUpdate</name>
<description>使用Git或者SVN更新项目</description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>#前置初始化,让终端输出颜色,兼容MacOS和Windows和Linux
sysname=$(uname)
echoarg="-e"
if [ ${sysname} == "Darwin" ];then
echoarg=""
fi
echo ${echoarg} "\033[1;34m Build Start...... \033[0m"
#清空上次环境变量的文件
:> ${WORKSPACE}/env.properties
echo ${echoarg} "\033[1;34m buildPlatform:${buildPlatform} \033[0m"
echo ${echoarg} "\033[1;34m projectPath:${projectPath} \033[0m"
echo ${echoarg} "\033[1;34m outputPath:${outputPath} \033[0m"
echo ${echoarg} "\033[1;34m buildVersionName:${buildVersionName} \033[0m"
echo ${echoarg} "\033[1;34m buildMode:${buildMode} \033[0m"
echo ${echoarg} "\033[1;34m enableUnityDevelopment:${enableUnityDevelopment} \033[0m"
echo ${echoarg} "\033[1;34m enableExportProject:${enableExportProject} \033[0m"
echo ${echoarg} "\033[1;34m enableGameDevelopment:${enableGameDevelopment} \033[0m"
#在Unity中执行的函数
buildMethod="AutoBuild.AutoBuildEntry."
#打包的输出路径
finalOutputPath="${outputPath}"
if [ ${buildPlatform} == 0 ];then
buildMethod="${buildMethod}BuildWindows"
finalOutputPath="${finalOutputPath}/Windows"
elif [ ${buildPlatform} == 1 ];then
buildMethod="${buildMethod}BuildAndroid"
finalOutputPath="${finalOutputPath}/Android"
elif [ ${buildPlatform} == 2 ];then
buildMethod="${buildMethod}BuildiOS"
finalOutputPath="${finalOutputPath}/iOS"
fi
echo "buildMethod=${buildMethod}" >> ${WORKSPACE}/env.properties
echo "finalOutputPath=${finalOutputPath}" >> ${WORKSPACE}/env.properties
unityLogPath="${WORKSPACE}/unitybuildlogs"
echo ${echoarg} "\033[1;34m unityLogPath:${unityLogPath} \033[0m"
echo "unityLogPath=${unityLogPath}" >> ${WORKSPACE}/env.properties
if [ ! -d "${unityLogPath}" ];then
mkdir "${unityLogPath}"
fi
#开始更新版本
if [ $enableProjectUpdate == true ];then
echo ${echoarg} "\033[1;34m Star Update Project... \033[0m"
if [ $versionControl == 0 ];then
git -C "${projectPath}" pull
elif [ $versionControl == 1 ];then
svn update "${projectPath}"
fi
fi
#开始调用Unity打包
echo ${echoarg} "\033[1;34m Star Build Unity... \033[0m"
</command>
</hudson.tasks.Shell>
<EnvInjectBuilder plugin="envinject@2.3.0">
<info>
<propertiesFilePath>${WORKSPACE}/env.properties</propertiesFilePath>
</info>
</EnvInjectBuilder>
<org.jenkinsci.plugins.unity3d.Unity3dBuilder plugin="unity3d-plugin@1.3">
<unity3dName>unity2018.4</unity3dName>
<argLine>-projectPath "${projectPath}" -quit -batchmode -executeMethod "${buildMethod}" "buildPlatform|${buildPlatform}" "outputPath|${finalOutputPath}" "buildVersionName|${buildVersionName}" "buildMode|${buildMode}" "enableUnityDevelopment|${enableUnityDevelopment}" "enableExportProject|${enableExportProject}" "enableGameDevelopment|${enableGameDevelopment}" -logFile "${unityLogPath}/${buildVersionName}.txt"</argLine>
<unstableReturnCodes></unstableReturnCodes>
</org.jenkinsci.plugins.unity3d.Unity3dBuilder>
<hudson.tasks.Shell>
<command>#前置初始化,让终端输出颜色,兼容MacOS和Windows和Linux
sysname=$(uname)
echoarg="-e"
if [ ${sysname} == "Darwin" ];then
echoarg=""
fi
#TODO,xcode 命令行构建
if [ ${buildPlatform} == 2 ];then
echo ${echoarg} "\033[1;34m Start Build XCode Project...... \033[0m"
fi
echo ${echoarg} "\033[1;34m Finish Build! \033[0m"</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers>
<hudson.plugins.ansicolor.AnsiColorBuildWrapper plugin="ansicolor@0.6.2">
<colorMapName>xterm</colorMapName>
</hudson.plugins.ansicolor.AnsiColorBuildWrapper>
<org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder plugin="versionnumber@1.9">
<versionNumberString>${JOB_NAME}_${BUILD_DATE_FORMATTED, "yyyyMMdd"}_${BUILDS_TODAY}</versionNumberString>
<projectStartDate>2019-11-20 16:00:00.0 UTC</projectStartDate>
<environmentVariableName>buildVersionName</environmentVariableName>
<environmentPrefixVariable></environmentPrefixVariable>
<oBuildsToday></oBuildsToday>
<oBuildsThisWeek></oBuildsThisWeek>
<oBuildsThisMonth></oBuildsThisMonth>
<oBuildsThisYear></oBuildsThisYear>
<oBuildsAllTime></oBuildsAllTime>
<worstResultForIncrement>SUCCESS</worstResultForIncrement>
<skipFailedBuilds>false</skipFailedBuilds>
<useAsBuildDisplayName>false</useAsBuildDisplayName>
</org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder>
<org.jenkinsci.plugins.buildnamesetter.BuildNameSetter plugin="build-name-setter@2.0.3">
<template>#${BUILD_NUMBER}_${buildVersionName}</template>
<descriptionTemplate></descriptionTemplate>
<runAtStart>true</runAtStart>
<runAtEnd>true</runAtEnd>
</org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
</buildWrappers>
</project>