forked from EvilBeaver/OneScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.csproj
199 lines (156 loc) · 9.84 KB
/
Build.csproj
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
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
<PropertyGroup>
<ReleaseNumber Condition="'$(ReleaseNumber)' == ''">1.1.0</ReleaseNumber>
<BuildNumber Condition="'$(BUILD_NUMBER)' != ''">$(BUILD_NUMBER)</BuildNumber>
<BuildNumber Condition="'$(BUILD_NUMBER)' == ''">0</BuildNumber>
<ArtifactsRoot>$(MSBuildProjectDirectory)/built</ArtifactsRoot>
<Solution>$(MSBuildProjectDirectory)/src/1Script.sln</Solution>
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</PropertyGroup>
<Target Name="CleanAll">
<ItemGroup>
<TestsResults Include="$(MSBuildProjectDirectory)/tests/*.os.xml" />
</ItemGroup>
<Delete Files="@(TestsResults)" />
<DeleteTree Directories="$(ArtifactsRoot)" Condition="Exists($(ArtifactsRoot))" />
<MSBuild Projects="$(Solution)" Targets="Clean" Properties="ReleaseNumber=$(ReleaseNumber);Configuration=$(Configuration);Platform=$(Platform)"/>
</Target>
<Target Name="Make">
<MSBuild Projects="$(Solution)" Targets="restore;Build" Properties="ReleaseNumber=$(ReleaseNumber);Configuration=$(Configuration);Platform=$(Platform)"/>
</Target>
<Target Name="CreateDistributions" DependsOnTargets="CreateInstaller;CreateNuget;CreateZip">
<ItemGroup>
<TempContent Include="$(ArtifactsRoot)/tmp"/>
<TempContent Include="$(MDDocFolder)"/>
</ItemGroup>
<DeleteTree Directories="@(TempContent)"/>
</Target>
<Target Name="PrepareArtifactsRoot">
<PropertyGroup>
<TempFolder>$(ArtifactsRoot)/tmp</TempFolder>
<BinFolder>$(TempFolder)/bin</BinFolder>
<LibFolder>$(TempFolder)/lib</LibFolder>
<ExamplesFolder>$(TempFolder)/examples</ExamplesFolder>
<DocFolder>$(TempFolder)/doc</DocFolder>
<DebugDest>$(ArtifactsRoot)\vscode\</DebugDest>
<MDDocFolder>$(ArtifactsRoot)/mddoc</MDDocFolder>
</PropertyGroup>
<MakeDir Directories="$(ArtifactsRoot)" />
<MakeDir Directories="$(TempFolder)" />
</Target>
<Target Name="PrepareDistributionContent">
<CallTarget Targets="GatherBinaries" />
<CallTarget Targets="GatherLibrary" />
<CallTarget Targets="GatherExamples" />
<CallTarget Targets="GatherDocuments" Condition=" '$(OneScriptDocumenter)' != '' "/>
</Target>
<!-- Собирает отовсюду содержимое папки bin -->
<Target Name="GatherBinaries" DependsOnTargets="Make;PrepareArtifactsRoot">
<MakeDir Directories="$(BinFolder)" />
<ItemGroup>
<BuiltProjects Include="oscript" />
<BuiltProjects Include="TestApp" />
<BinaryFiles Include="$(MSBuildProjectDirectory)/src/%(BuiltProjects.Identity)/bin/x86/$(Configuration)/net452/**"/>
<BinaryFiles Include="$(MSBuildProjectDirectory)/src/ASPNETHandler/bin/$(Configuration)/net452/ASPNETHandler.dll"/>
</ItemGroup>
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinFolder)" />
<!-- Копирование скрипта запуска для opm -->
<Copy SourceFiles="$(MSBuildProjectDirectory)\install\opm.bat" DestinationFolder="$(BinFolder)"/>
<PropertyGroup>
<DebugSrc>$(MSBuildProjectDirectory)/src/DebugServer/bin/$(Configuration)/net452</DebugSrc>
</PropertyGroup>
<ItemGroup>
<DbgBinFiles Include="$(DebugSrc)/*.dll"/>
<DbgBinFiles Include="$(DebugSrc)/*.exe"/>
<DbgBinFiles Include="$(DebugSrc)/*.config"/>
<DbgPackageFiles Include="$(DebugSrc)/README.md"/>
<DbgPackageFiles Include="$(DebugSrc)/package.json"/>
<DbgImageFiles Include="$(DebugSrc)/images/**"/>
</ItemGroup>
<Copy SourceFiles="@(DbgBinFiles)" DestinationFolder="$(DebugDest)/bin"/>
<Copy SourceFiles="@(DbgPackageFiles)" DestinationFolder="$(DebugDest)"/>
<Copy SourceFiles="@(DbgImageFiles)" DestinationFolder="$(DebugDest)/images"/>
</Target>
<!-- Собирает в целевой папке содержимое папки lib -->
<Target Name="GatherLibrary" DependsOnTargets="Make;PrepareArtifactsRoot">
<MakeDir Directories="$(LibFolder)" />
<Exec Command=""$(BinFolder)/oscript.exe" "$(MSBuildProjectDirectory)\install\unicode-zipper.os" unpack "$(MSBuildProjectDirectory)\install\opm-0.14.4.ospx" "$(LibFolder)\tmp""/>
<Exec Command=""$(BinFolder)/oscript.exe" "$(MSBuildProjectDirectory)\install\unicode-zipper.os" unpack "$(LibFolder)\tmp\content.zip" "$(LibFolder)/opm""/>
<Copy SourceFiles="$(MSBuildProjectDirectory)\install\package-loader.os" DestinationFolder="$(LibFolder)"/>
<DeleteTree Directories="$(LibFolder)\tmp"/>
<CallTarget Targets="InstallStdLib" Condition="'$(StandardLibraryPacks)' != ''"/>
</Target>
<!-- Копирует поставляемые файлы stdlib, если они есть на машине сборки -->
<Target Name="InstallStdLib">
<ItemGroup>
<LibraryFiles Include="$(StandardLibraryPacks)\**\*" />
</ItemGroup>
<Copy SourceFiles="@(LibraryFiles)" DestinationFolder="$(LibFolder)\%(RecursiveDir)"/>
</Target>
<!-- Собирает в целевой папке содержимое папки examples -->
<Target Name="GatherExamples" DependsOnTargets="PrepareArtifactsRoot">
<ItemGroup>
<ExampleFiles Include="$(MSBuildProjectDirectory)\install\examples\**\*"/>
</ItemGroup>
<MakeDir Directories="$(ExamplesFolder)" />
<Copy SourceFiles="@(ExampleFiles)" DestinationFolder="$(ExamplesFolder)\%(RecursiveDir)"/>
</Target>
<!-- Собирает в целевой папке содержимое папки doc -->
<Target Name="GatherDocuments" DependsOnTargets="PrepareArtifactsRoot;GenerateDocs">
<MakeDir Directories="$(DocFolder)"/>
<Exec Command="$(OneScriptDocumenter) html $(TMP)\tempdoc.xml "$(DocFolder)""/>
</Target>
<!-- Генерирует необходимую документацию -->
<Target Name="GenerateDocs">
<Exec Command="$(OneScriptDocumenter) $(TMP)\tempdoc.xml "$(BinFolder)\ScriptEngine.dll" "$(BinFolder)\ScriptEngine.HostedScript.dll" "$(BinFolder)\oscript.exe""/>
<MakeDir Directories="$(MDDocFolder)"/>
<Exec Command="$(OneScriptDocumenter) markdown $(TMP)\tempdoc.xml "$(MDDocFolder)" /syntax/page"/>
</Target>
<!-- Чистка промежуточных файлов -->
<Target Name="CleanIntermediates" AfterTargets="PrepareDistributionContent">
<ItemGroup>
<ExcludedArtifacts Include="$(BinFolder)/*.pdb" />
<ExcludedArtifacts Include="$(BinFolder)/*.xml" />
<!-- остается от документера. Надо починить его чтобы писал куда-то в другое место -->
<ExcludedArtifacts Include="$(MSBuildProjectDirectory)/map.json"/>
</ItemGroup>
<Delete Files="@(ExcludedArtifacts)"/>
</Target>
<!-- Инсталлятор -->
<Target Name="CreateInstaller" DependsOnTargets="PrepareArtifactsRoot">
<Error Text="No installer path is specified" Condition="'$(InnoSetupPath)' == ''"/>
<PropertyGroup>
<InstallerStandardPath>"$(InnoSetupPath)\iscc.exe"</InstallerStandardPath>
<DistPath>$(ArtifactsRoot)</DistPath>
</PropertyGroup>
<Exec Command="$(InstallerStandardPath) "$(MSBuildProjectDirectory)\install\install.iss" /o"$(DistPath)"" />
</Target>
<!-- Nuget -->
<Target Name="CreateNuget" DependsOnTargets="PrepareArtifactsRoot">
<ItemGroup>
<NugetAbleProject Include="ScriptEngine"/>
<NugetAbleProject Include="ScriptEngine.HostedScript"/>
<NugetAbleProject Include="OneScript.Language"/>
</ItemGroup>
<MSBuild Projects="src/%(NugetAbleProject.Identity)/%(NugetAbleProject.Identity).csproj" Targets="pack" Properties="PackageOutputPath=$(ArtifactsRoot);ReleaseNumber=$(ReleaseNumber)"/>
</Target>
<!-- ZIP -->
<Target Name="CreateZip" DependsOnTargets="PrepareArtifactsRoot">
<Exec Command=""$(BinFolder)\oscript.exe" "$(MSBuildProjectDirectory)\install\unicode-zipper.os" pack "$(TempFolder)/*" "$(ArtifactsRoot)/OneScript-$(ReleaseNumber).zip""/>
<Exec Command=""$(BinFolder)\oscript.exe" "$(MSBuildProjectDirectory)\install\unicode-zipper.os" pack "$(MDDocFolder)/*" "$(ArtifactsRoot)/mddoc-$(ReleaseNumber).zip""/>
</Target>
<!-- MSI -->
<Target Name="CreateMSI">
<MSBuild Projects="$(MSBuildProjectDirectory)\src\Installer\Installer.wixproj"
Properties="Configuration=$(Configuration);OutputPath=$(ArtifactsRoot);OutputPathForBuild=$(ArtifactsRoot);Version=$(ReleaseNumber).$(BuildNumber)" />
</Target>
<Target Name="xUnitTest" DependsOnTargets="PrepareArtifactsRoot">
<CreateItem Include="$(MSBuildProjectDirectory)\tests\*.os.xml">
<Output TaskParameter="Include" ItemName="RemoveXMLTestResult" />
</CreateItem>
<Delete Files="@(RemoveXMLTestResult)" />
<Exec WorkingDirectory="$(MSBuildProjectDirectory)\tests" Command=""$(BinFolder)/oscript.exe" "$(MSBuildProjectDirectory)\tests\testrunner.os" -runall . xddReportPath ." IgnoreExitCode="true"/>
</Target>
</Project>