-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.proj
197 lines (166 loc) · 7.07 KB
/
build.proj
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
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0"
DefaultTargets="All"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="SetEnvironmentVariable"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll">
<ParameterGroup>
<Name ParameterType="System.String" Required="true" />
<Value ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Environment.SetEnvironmentVariable(Name, Value);
]]>
</Code>
</Task>
</UsingTask>
<PropertyGroup>
<Version>0.1.0.0</Version>
<ProductVersion>0.1.0-SNAPSHOT</ProductVersion>
<OutDir>bin\</OutDir>
<Configuration>Debug</Configuration>
<SourceDir>src\</SourceDir>
<ToolsDir>tools\</ToolsDir>
<ClojureCompiler>$(ToolsDir)Clojure.Compile.exe</ClojureCompiler>
<PackagesDir>packages\</PackagesDir>
<ClojurePackageDir>$(PackagesDir)Clojure.1.6.0.1\</ClojurePackageDir>
<TargetsDir>targets\</TargetsDir>
<TestProjectName>test-project</TestProjectName>
<ChocoExe>$(PackagesDir)chocolatey.0.9.8.28\tools\chocolateyInstall\chocolatey.cmd</ChocoExe>
<ClojureCompilePath>$([System.IO.Path]::GetFullPath($(TargetsDir)))</ClojureCompilePath>
</PropertyGroup>
<ItemGroup>
<Tools Include="$(ClojurePackageDir)tools\net40\*" />
</ItemGroup>
<ItemGroup>
<Libs Include="$(ClojurePackageDir)lib\net40\*.dll" />
<Libs Include="$(PackagesDir)Nuget.Core.2.8.3\lib\net40-Client\NuGet.Core.dll" />
<Libs Include="$(PackagesDir)Westwind.RazorHosting.3.00\lib\net40\Westwind.RazorHosting.dll" />
<Libs Include="$(PackagesDir)Microsoft.AspNet.Razor.3.2.3\lib\net45\*.dll" />
</ItemGroup>
<ItemGroup>
<Sources Include="$(SourceDir)**/*.clj" Exclude="*#*" />
</ItemGroup>
<ItemGroup>
<Resources Include="resources\templates\gitignore.razor">
<LogicalName>templates.gitignore</LogicalName>
</Resources>
<Resources Include="resources\templates\project.razor">
<LogicalName>templates.project.clj</LogicalName>
</Resources>
<Resources Include="resources\templates\core.clj.razor">
<LogicalName>templates.core.clj</LogicalName>
</Resources>
<Resources Include="resources\templates\webapp\project.razor">
<LogicalName>templates.webapp.project.clj</LogicalName>
</Resources>
<Resources Include="resources\templates\webapp\core.clj.razor">
<LogicalName>templates.webapp.core.clj</LogicalName>
</Resources>
</ItemGroup>
<Target Name="RestorePackages">
<Exec Command=""$(ToolsDir)NuGet.exe" restore -PackagesDirectory "$(PackagesDir.TrimEnd('\'))"" />
</Target>
<Target Name="All" DependsOnTargets="Compile;Package" />
<Target Name="Compile"
DependsOnTargets="InitToolsDir;
InitTargetsDir;
CompileResources;
CompileClojure;
PostCompile"
Outputs="$(TargetsDir)camp.exe">
<Copy SourceFiles="$(TargetsDir)camp.main.exe"
DestinationFiles="$(TargetsDir)camp.exe" />
</Target>
<Target Name="InitToolsDir">
<Copy SourceFiles="@(Tools)"
DestinationFolder="$(ToolsDir)"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(Libs)"
DestinationFolder="$(ToolsDir)"
SkipUnchangedFiles="true" />
</Target>
<Target Name="InitTargetsDir">
<!-- copy libs to targets directory for final executable -->
<Copy SourceFiles="@(Libs)"
DestinationFolder="$(TargetsDir)"
SkipUnchangedFiles="true" />
</Target>
<Target Name="CompileResources"
Inputs="@(Resources)"
Outputs="$(ToolsDir)camp.resources.dll">
<AL EmbedResources="@(Resources)"
Description="Resources used by camp"
Title="camp resources"
ProductName="camp"
ProductVersion="$(Version)"
Version="$(Version)"
OutputAssembly="$(TargetsDir)camp.resources.dll" />
<Copy SourceFiles="$(TargetsDir)camp.resources.dll"
DestinationFolder="$(ToolsDir)" />
</Target>
<Target Name="CompileClojure"
Inputs="@(Sources)"
Outputs="@(Sources->'$(TargetsDir)%(Identity).dll'->Replace('src\', '')->Replace('camp\', 'camp.')->Replace('tasks\', 'tasks.'))">
<!-- have compiler output go straight into targets path -->
<Message Text="CLOJURE_COMPILE_PATH = $(ClojureCompilePath)" />
<SetEnvironmentVariable Name="CLOJURE_COMPILE_PATH" Value="$(ClojureCompilePath)" />
<Exec Command="..\$(ClojureCompiler) @(Sources->Replace('src\', '')->Replace('.clj', '')->Replace('\', '.')->Replace('_', '-'), ' ')"
WorkingDirectory="$(SourceDir)" />
</Target>
<Target Name="PostCompile"
Inputs="$(TargetsDir)camp.main.exe"
Outputs="$(TargetsDir)camp.exe">
<Copy SourceFiles="$(TargetsDir)camp.main.exe"
DestinationFiles="$(TargetsDir)camp.exe"
SkipUnchangedFiles="true" />
</Target>
<Target Name="TestNew" DependsOnTargets="Compile">
<RemoveDir Directories="$(TestProjectName)" />
<Exec Command="$(TargetsDir)camp.exe new $(TestProjectName)"
WorkingDirectory="$(MSBuildThisFileDirectory)" />
</Target>
<Target Name="TestNewWebApp" DependsOnTargets="Compile">
<RemoveDir Directories="$(TestProjectName)" />
<Exec Command="$(TargetsDir)camp.exe new webapp $(TestProjectName)"
WorkingDirectory="$(MSBuildThisFileDirectory)" />
</Target>
<Target Name="TestDeps" DependsOnTargets="Compile">
<Exec Command="$(TargetsDir)camp.exe deps"
WorkingDirectory="$(MSBuildThisFileDirectory)$(TestProjectName)" />
</Target>
<Target Name="TestCompile" DependsOnTargets="Compile">
<Exec Command="..\$(TargetsDir)camp.exe compile --verbose"
WorkingDirectory="$(MSBuildThisFileDirectory)$(TestProjectName)" />
</Target>
<Target Name="TestRunTarget" DependsOnTargets="Compile">
<Message Text="Target output:" Importance="high" />
<Message Text="----------------------------------------" Importance="high" />
<Exec Command="$(TestProjectName).core.exe"
WorkingDirectory="$(TestProjectName)\targets" />
<Message Text="----------------------------------------" Importance="high" />
</Target>
<Target Name="Package" DependsOnTargets="ChocolateyPackage" />
<Target Name="ChocolateyPackage" DependsOnTargets="Compile">
<Exec Command="$(ChocoExe) pack chocolatey\camp.nuspec" />
</Target>
<Target Name="Install" DependsOnTargets="Package">
<Exec Command="$(ChocoExe) install --force --pre --source chocolatey camp.portable" />
</Target>
<Target Name="UnInstall">
<Exec Command="$(ChocoExe) uninstall --allversions camp.portable" />
</Target>
<Target Name="Clean">
<ItemGroup>
<Garbage Include="chocolatey\*.nupkg" />
<Garbage Include="$(ToolsDir)*" Exclude="$(ToolsDir)nuget.exe" />
</ItemGroup>
<Delete Files="@(Garbage)" />
<RemoveDir Directories="$(TargetsDir)" />
<RemoveDir Directories="$(TestProjectName)" />
</Target>
</Project>