-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-project.build
156 lines (148 loc) · 6.22 KB
/
setup-project.build
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
<?xml version="1.0"?>
<project name="project setup" default="setup">
<target name="setup">
<call target="setup-workspace" unless="${directory::exists('bin')}"/>
<call target="additional-bin"/>
<call target="packages"/>
<call target="prebuild"/>
</target>
<target name="setup-workspace" description="Generates sym linked binaries storage">
<mkdir dir="../bin"/>
<exec program="windows/junction.exe" if="${platform::is-windows()}">
<arg path="bin"/>
<arg path="../bin"/>
</exec>
<exec program="ln" unless="${platform::is-windows()}">
<arg value="-sf"/>
<arg path="../bin"/>
<arg path="bin"/>
</exec>
</target>
<target name="additional-bin" description="Copy local binaries">
<copy todir="bin" if="${directory::exists('additional-bin')}" overwrite="true">
<fileset basedir="additional-bin">
<include name="**/*.dll"/>
<include name="**/*.so"/>
<include name="**/*.dylib"/>
<include name="**/*.config"/>
<include name="**/*.xml"/>
</fileset>
</copy>
</target>
<target name="packages" description="Copy package definitions">
<copy todir="bin/installed-packages" if="${directory::exists('packages')}" overwrite="true">
<fileset basedir="packages">
<include name="**/*.spkg"/>
</fileset>
</copy>
</target>
<target name="prebuild" description="Runs prebuild.exe">
<foreach item="Folder" in="SilverSim" property="modulefolder">
<delete>
<fileset basedir="${modulefolder}/obj">
<include name="**/*.cs"/>
</fileset>
</delete>
</foreach>
<if test="${platform::is-windows()}">
<exec program="Prebuild/Prebuild.exe">
<arg value="/target"/>
<arg value="vs2015"/>
</exec>
</if>
<if test="${not platform::is-windows()}">
<exec program="mono">
<arg path="Prebuild/Prebuild.exe"/>
<arg value="/target"/>
<arg value="vs2015"/>
</exec>
</if>
</target>
<target name="sonar-project" description="Creates sonar-project">
<property name="version" value="alpha" overwrite="false"/>
<property name="versionextra" value="" overwrite="false"/>
<property name="sonar.modules" value=""/>
<property name="sonar.moduledeclarations" value=""/>
<foreach item="Folder" in="SilverSim" property="modulefolder">
<property name="module" value="SilverSim/${path::get-file-name(modulefolder)}"/>
<property name="modulenamespace" value="${string::replace(module, '/', '.')}"/>
<property name="moduleid" value="${module}"/>
<echo message="Sonar.module ${moduleid}"/>
<property name="sonar.modules" value="${sonar.modules}," if="${property::get-value('sonar.modules')!=''}" overwrite="true"/>
<property name="sonar.modules" value="${sonar.modules}${moduleid}" overwrite="true"/>
<property name="sonar.moduledeclarations" value="${sonar.moduledeclarations}
${moduleid}.sonar.projectName=${modulenamespace}
${moduleid}.sonar.projectKey=${modulenamespace}
${moduleid}.sonar.sources=.
" overwrite="true"/>
</foreach>
<echo file="sonar-project.properties" message="
sonar.projectKey=SilverSim
sonar.projectName=SilverSim
sonar.projectVersion=${version}${versionextra}
sonar.sourceEncoding=UTF-8
sonar.modules=${sonar.modules}
${sonar.moduledeclarations}
"/>
</target>
<target name="build" description="Runs msbuild/xbuild">
<call target="setup"/>
<call target="nls"/>
<if test="${platform::is-windows()}">
<readregistry property="msbuildpath" key="SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0\MSBuildToolsPath" hive="LocalMachine"/>
<echo message="Found msbuild at ${msbuildpath}"/>
<exec program="msbuild.exe" basedir="${msbuildpath}" workingdir=".">
<arg value="/p:Configuration=Debug" if="${property::exists('debug-build')}"/>
<arg value="/p:Configuration=DebugRel" if="${property::exists('debugrel-build')}"/>
<arg value="/p:Configuration=Release" if="${property::exists('release-build')}"/>
<arg value="/p:Platform="Any CPU""/>
</exec>
</if>
<if test="${platform::is-unix()}">
<property name="builder" value="xbuild"/>
<foreach item="String" in="${environment::get-variable('PATH')}" delim=";:" property="path">
<property name="builder" value="msbuild" if="${file::exists(path::combine(path,'msbuild'))}"/>
</foreach>
<exec program="${builder}" workingdir=".">
<arg value="/p:Configuration=Debug" if="${property::exists('debug-build')}"/>
<arg value="/p:Configuration=DebugRel" if="${property::exists('debugrel-build')}"/>
<arg value="/p:Configuration=Release" if="${property::exists('release-build')}"/>
</exec>
</if>
</target>
<target name="nls" description="Process language files">
<mkdir dir="bin/languages"/>
<property name="resgen" value="resgen"/>
<if test="${platform::is-windows()}">
<property name="sdkpath" value=""/>
<foreach item="String" in="4.7.2,4.7.1,4.7,4.6.1" delim="," property="sdkversion">
<property name="key" value="SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\NETFXSDK\${sdkversion}\WinSDK-NetFx40Tools\InstallationFolder"/>
<readregistry key="${key}" property="sdkpath" failonerror="false" if="${sdkpath==''}"/>
</foreach>
<foreach item="String" in="4.7.2,4.7.1,4.7,4.6.1" delim="," property="sdkversion">
<property name="key" value="SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\${sdkversion}\WinSDK-NetFx40Tools\InstallationFolder"/>
<readregistry key="${key}" property="sdkpath" failonerror="false" if="${sdkpath==''}"/>
</foreach>
<property name="resgen" value="${sdkpath}resgen.exe"/>
</if>
<foreach item="Folder" property="longfoldername">
<in>
<items basedir="nls">
<include name="*.src"/>
</items>
</in>
<do>
<property name="foldername" value="${path::get-file-name-without-extension(longfoldername)}"/>
<echo message="Processing language data for ${foldername}"/>
<mkdir dir="bin/languages/${foldername}" failonerror="false"/>
<foreach item="File" property="longfilename" in="nls/${foldername}.src">
<property name="filename" value="${path::get-file-name-without-extension(longfilename)}"/>
<exec program="${resgen}">
<arg path="nls/${foldername}.src/${filename}.txt"/>
<arg path="bin/languages/${foldername}/${filename}.resources"/>
</exec>
</foreach>
</do>
</foreach>
</target>
</project>