physique 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +205 -1
- data/Gemfile.lock +1 -1
- data/lib/physique/task_builders/fluent_migrator.rb +3 -4
- data/lib/physique/task_builders/test.rb +48 -8
- data/lib/physique/tasks/sqlcmd.rb +1 -1
- data/lib/physique/version.rb +1 -1
- data/spec/sqlcmd_spec.rb +4 -4
- data/spec/support/shared_contexts/rake.rb +21 -0
- data/spec/task_builders/build_spec.rb +25 -0
- data/spec/task_builders/default_spec.rb +17 -0
- data/spec/task_builders/nspec_spec.rb +13 -0
- data/spec/task_builders/nuget_spec.rb +16 -0
- data/spec/test_data/solutions/.nuget/NuGet.Config +6 -0
- data/spec/test_data/solutions/.nuget/NuGet.exe +0 -0
- data/spec/test_data/solutions/.nuget/NuGet.targets +144 -0
- data/spec/test_data/solutions/.nuget/packages.config +4 -0
- data/spec/test_data/solutions/basic/.semver +6 -0
- data/spec/test_data/solutions/basic/Basic/Basic.csproj +53 -0
- data/spec/test_data/solutions/basic/Basic/Class1.cs +12 -0
- data/spec/test_data/solutions/basic/Basic/Properties/AssemblyInfo.cs +36 -0
- data/spec/test_data/solutions/basic/Basic.Tests/Basic.Tests.csproj +59 -0
- data/spec/test_data/solutions/basic/Basic.Tests/Class1.cs +14 -0
- data/spec/test_data/solutions/basic/Basic.Tests/Properties/AssemblyInfo.cs +36 -0
- data/spec/test_data/solutions/basic/Basic.Tests/packages.config +4 -0
- data/spec/test_data/solutions/basic/Basic.sln +28 -0
- data/spec/test_data/solutions/basic/Rakefile.rb +10 -0
- data/spec/test_data/solutions/basic/packages.config +4 -0
- data/spec/test_data/solutions/nspec/.semver +6 -0
- data/spec/test_data/solutions/nspec/Basic/Basic.csproj +56 -0
- data/spec/test_data/solutions/nspec/Basic/Class1.cs +12 -0
- data/spec/test_data/solutions/nspec/Basic/Properties/AssemblyInfo.cs +36 -0
- data/spec/test_data/solutions/nspec/Basic/packages.config +3 -0
- data/spec/test_data/solutions/nspec/Basic.Specs/Basic.Specs.csproj +60 -0
- data/spec/test_data/solutions/nspec/Basic.Specs/Class1.cs +12 -0
- data/spec/test_data/solutions/nspec/Basic.Specs/DebuggerShim.cs +42 -0
- data/spec/test_data/solutions/nspec/Basic.Specs/Properties/AssemblyInfo.cs +36 -0
- data/spec/test_data/solutions/nspec/Basic.Specs/packages.config +4 -0
- data/spec/test_data/solutions/nspec/Basic.sln +28 -0
- data/spec/test_data/solutions/nspec/Rakefile.rb +14 -0
- metadata +66 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWU4MGE4OWY1OGU2ODQyZTZlYmQ1ZjJlNzU0MzU2YTY5ZjllZGViMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzE1ZjQ5MmU1MjdhZmMxMDM4ODM1MWUxOWNmZDE5YzA3NWM2MzkzMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDZkMWQxZTMzNGFlNjQzODgyNzI0MmI4YWU5MjVkMzQ0NmU2NTc5ZTg1MDAz
|
10
|
+
NDIzZDVlNjhlZTZmOGE5YTYxNWRkMzk1YmM2ZTk5YjMxMTEzZjM1Mzk0NDg1
|
11
|
+
MTIyMjQ3ZjUxNDRiZmZjNDVlYjY5Y2Y2YjQwZTU4ZDJlYzQ1YjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzJiYTg2NzhhZGQxNWMyMDdiMjM3YTQ5YWZiNTFlYjcwNDRjZDMzMWJjNzQx
|
14
|
+
YzkxNTEwYjY0NWU4MjQxMjJkYWEzMWJjY2I4ZTAxMTExM2UyMDUwNzRmNDY3
|
15
|
+
OWNlZDVlNTMxYTc2NjYwYjkzYjY2MTA4NmY2NmVjZTYzZjU4N2M=
|
data/.gitignore
CHANGED
@@ -33,4 +33,208 @@ build/
|
|
33
33
|
# .ruby-gemset
|
34
34
|
|
35
35
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
-
.rvmrc
|
36
|
+
.rvmrc
|
37
|
+
|
38
|
+
## Ignore Visual Studio temporary files, build results, and
|
39
|
+
## files generated by popular Visual Studio add-ons.
|
40
|
+
|
41
|
+
# User-specific files
|
42
|
+
*.suo
|
43
|
+
*.user
|
44
|
+
*.sln.docstates
|
45
|
+
|
46
|
+
# Build results
|
47
|
+
[Dd]ebug/
|
48
|
+
[Dd]ebugPublic/
|
49
|
+
[Rr]elease/
|
50
|
+
x64/
|
51
|
+
bld/
|
52
|
+
[Bb]in/
|
53
|
+
[Oo]bj/
|
54
|
+
|
55
|
+
# MSTest test Results
|
56
|
+
[Tt]est[Rr]esult*/
|
57
|
+
[Bb]uild[Ll]og.*
|
58
|
+
|
59
|
+
#NUNIT
|
60
|
+
*.VisualState.xml
|
61
|
+
TestResult.xml
|
62
|
+
|
63
|
+
*_i.c
|
64
|
+
*_p.c
|
65
|
+
*_i.h
|
66
|
+
*.ilk
|
67
|
+
*.meta
|
68
|
+
*.obj
|
69
|
+
*.pch
|
70
|
+
*.pdb
|
71
|
+
*.pgc
|
72
|
+
*.pgd
|
73
|
+
*.rsp
|
74
|
+
*.sbr
|
75
|
+
*.tlb
|
76
|
+
*.tli
|
77
|
+
*.tlh
|
78
|
+
*.tmp
|
79
|
+
*.tmp_proj
|
80
|
+
*.log
|
81
|
+
*.vspscc
|
82
|
+
*.vssscc
|
83
|
+
.builds
|
84
|
+
*.pidb
|
85
|
+
*.svclog
|
86
|
+
*.scc
|
87
|
+
|
88
|
+
# Chutzpah Test files
|
89
|
+
_Chutzpah*
|
90
|
+
|
91
|
+
# Visual C++ cache files
|
92
|
+
ipch/
|
93
|
+
*.aps
|
94
|
+
*.ncb
|
95
|
+
*.opensdf
|
96
|
+
*.sdf
|
97
|
+
*.cachefile
|
98
|
+
|
99
|
+
# Visual Studio profiler
|
100
|
+
*.psess
|
101
|
+
*.vsp
|
102
|
+
*.vspx
|
103
|
+
|
104
|
+
# TFS 2012 Local Workspace
|
105
|
+
$tf/
|
106
|
+
|
107
|
+
# Guidance Automation Toolkit
|
108
|
+
*.gpState
|
109
|
+
|
110
|
+
# ReSharper is a .NET coding add-in
|
111
|
+
_ReSharper*/
|
112
|
+
*.[Rr]e[Ss]harper
|
113
|
+
*.DotSettings.user
|
114
|
+
|
115
|
+
# JustCode is a .NET coding addin-in
|
116
|
+
.JustCode
|
117
|
+
|
118
|
+
# TeamCity is a build add-in
|
119
|
+
_TeamCity*
|
120
|
+
|
121
|
+
# DotCover is a Code Coverage Tool
|
122
|
+
*.dotCover
|
123
|
+
|
124
|
+
# NCrunch
|
125
|
+
*.ncrunch*
|
126
|
+
_NCrunch_*
|
127
|
+
.*crunch*.local.xml
|
128
|
+
|
129
|
+
# MightyMoose
|
130
|
+
*.mm.*
|
131
|
+
AutoTest.Net/
|
132
|
+
|
133
|
+
# Web workbench (sass)
|
134
|
+
.sass-cache/
|
135
|
+
|
136
|
+
# Installshield output folder
|
137
|
+
[Ee]xpress/
|
138
|
+
|
139
|
+
# DocProject is a documentation generator add-in
|
140
|
+
DocProject/buildhelp/
|
141
|
+
DocProject/Help/*.HxT
|
142
|
+
DocProject/Help/*.HxC
|
143
|
+
DocProject/Help/*.hhc
|
144
|
+
DocProject/Help/*.hhk
|
145
|
+
DocProject/Help/*.hhp
|
146
|
+
DocProject/Help/Html2
|
147
|
+
DocProject/Help/html
|
148
|
+
|
149
|
+
# Click-Once directory
|
150
|
+
publish/
|
151
|
+
|
152
|
+
# Publish Web Output
|
153
|
+
*.[Pp]ublish.xml
|
154
|
+
*.azurePubxml
|
155
|
+
|
156
|
+
# NuGet Packages Directory
|
157
|
+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
158
|
+
packages/*
|
159
|
+
## TODO: If the tool you use requires repositories.config, also uncomment the next line
|
160
|
+
!packages/repositories.config
|
161
|
+
|
162
|
+
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
|
163
|
+
# This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented)
|
164
|
+
!packages/build/
|
165
|
+
|
166
|
+
# Windows Azure Build Output
|
167
|
+
csx/
|
168
|
+
*.build.csdef
|
169
|
+
|
170
|
+
# Windows Store app package directory
|
171
|
+
AppPackages/
|
172
|
+
|
173
|
+
# Others
|
174
|
+
sql/
|
175
|
+
*.Cache
|
176
|
+
ClientBin/
|
177
|
+
[Ss]tyle[Cc]op.*
|
178
|
+
~$*
|
179
|
+
*~
|
180
|
+
*.dbmdl
|
181
|
+
*.dbproj.schemaview
|
182
|
+
*.pfx
|
183
|
+
*.publishsettings
|
184
|
+
node_modules/
|
185
|
+
|
186
|
+
# RIA/Silverlight projects
|
187
|
+
Generated_Code/
|
188
|
+
|
189
|
+
# Backup & report files from converting an old project file to a newer
|
190
|
+
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
191
|
+
_UpgradeReport_Files/
|
192
|
+
Backup*/
|
193
|
+
UpgradeLog*.XML
|
194
|
+
UpgradeLog*.htm
|
195
|
+
|
196
|
+
# SQL Server files
|
197
|
+
App_Data/*.mdf
|
198
|
+
App_Data/*.ldf
|
199
|
+
|
200
|
+
# Business Intelligence projects
|
201
|
+
*.rdl.data
|
202
|
+
*.bim.layout
|
203
|
+
*.bim_*.settings
|
204
|
+
|
205
|
+
# Microsoft Fakes
|
206
|
+
FakesAssemblies/
|
207
|
+
|
208
|
+
# =========================
|
209
|
+
# Windows detritus
|
210
|
+
# =========================
|
211
|
+
|
212
|
+
# Windows image file caches
|
213
|
+
Thumbs.db
|
214
|
+
ehthumbs.db
|
215
|
+
|
216
|
+
# Folder config file
|
217
|
+
Desktop.ini
|
218
|
+
|
219
|
+
# Recycle Bin used on file shares
|
220
|
+
$RECYCLE.BIN/
|
221
|
+
|
222
|
+
# Ignore FluentMigrator change scripts
|
223
|
+
migrate-output.sql
|
224
|
+
|
225
|
+
#Nuget packages
|
226
|
+
packages/
|
227
|
+
src/packages
|
228
|
+
.bundle/
|
229
|
+
|
230
|
+
#created files
|
231
|
+
/src/SouthFloridaVision.Web/apps/userfiles
|
232
|
+
/src/SouthFloridaVision.Web/apps/userfiles_temp
|
233
|
+
|
234
|
+
working/*
|
235
|
+
working*
|
236
|
+
|
237
|
+
src/SouthFloridaVision.userprefs
|
238
|
+
|
239
|
+
# Ignore NancyFx keyStore
|
240
|
+
keyStore/
|
data/Gemfile.lock
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require 'active_support/core_ext/
|
2
|
-
require 'active_support/core_ext/array'
|
1
|
+
require 'active_support/core_ext/object/blank'
|
3
2
|
require 'physique/project'
|
4
3
|
|
5
4
|
module Physique
|
@@ -61,7 +60,7 @@ module Physique
|
|
61
60
|
namespace :db do
|
62
61
|
namespace task_namespace do
|
63
62
|
# First look at the scripts_dir and add a task for every sql file that you find
|
64
|
-
defaults = default_tasks(db)
|
63
|
+
defaults = default_tasks(db.name)
|
65
64
|
add_script_tasks db, defaults
|
66
65
|
|
67
66
|
# Then add the default minimum required tasks in case the scripts_dir didn't contain them
|
@@ -238,7 +237,7 @@ namespace #{project_name}.Migrations
|
|
238
237
|
{
|
239
238
|
// Add migration rollback code here
|
240
239
|
}
|
241
|
-
}
|
240
|
+
}
|
242
241
|
}
|
243
242
|
TEMPLATE
|
244
243
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_support/core_ext/object/blank'
|
2
|
+
|
1
3
|
module Physique
|
2
4
|
class TestConfig
|
3
5
|
self.extend Albacore::ConfigDSL
|
@@ -8,10 +10,20 @@ module Physique
|
|
8
10
|
# Path to test runner executable
|
9
11
|
attr_writer :files
|
10
12
|
|
13
|
+
# The test runner to use
|
14
|
+
attr_writer :runner
|
15
|
+
|
16
|
+
# Additional parameters to pass to the test runner
|
17
|
+
attr_writer :parameters
|
18
|
+
|
11
19
|
def opts
|
12
20
|
Map.new({
|
13
21
|
exe: @exe,
|
14
|
-
|
22
|
+
runner: @runner,
|
23
|
+
files: @files,
|
24
|
+
parameters: @parameters
|
25
|
+
}).apply({
|
26
|
+
runner: :nunit
|
15
27
|
})
|
16
28
|
end
|
17
29
|
end
|
@@ -22,16 +34,44 @@ module Physique
|
|
22
34
|
end
|
23
35
|
|
24
36
|
def add_test_tasks
|
25
|
-
|
26
|
-
|
37
|
+
options = solution.test
|
38
|
+
defaults = default_runner_config options
|
27
39
|
|
28
40
|
desc 'Run unit tests'
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
41
|
+
|
42
|
+
if defaults && !defaults[:files].blank?
|
43
|
+
test_runner :test => :compile do |tests|
|
44
|
+
tests.files = options.files || defaults[:files]
|
45
|
+
tests.exe = options.exe || locate_tool(defaults[:exe])
|
46
|
+
|
47
|
+
defaults[:parameters].each do |p|
|
48
|
+
tests.parameters.add(p)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
else
|
52
|
+
task :test => :compile do
|
53
|
+
puts 'No test assemblies were detected'
|
54
|
+
end
|
34
55
|
end
|
35
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def default_runner_config(options)
|
61
|
+
configuration = solution.compile.configuration
|
62
|
+
package_dir = solution.nuget.restore_location
|
63
|
+
|
64
|
+
defaults = {
|
65
|
+
nunit: {
|
66
|
+
files: FileList["**/*.Tests/bin/#{configuration}/*.Tests.dll"],
|
67
|
+
exe: "#{package_dir}/NUnit.Runners.*/tools/nunit-console.exe",
|
68
|
+
parameters: %w(/labels /trace=Verbose)},
|
69
|
+
nspec: {
|
70
|
+
files: FileList["**/*.Specs/bin/#{configuration}/*.Specs.dll"],
|
71
|
+
exe: "#{package_dir}/nspec.*/tools/NSpecRunner.exe",
|
72
|
+
parameters: []}}
|
73
|
+
|
74
|
+
defaults[options.runner]
|
75
|
+
end
|
36
76
|
end
|
37
77
|
end
|
@@ -26,7 +26,7 @@ module Physique
|
|
26
26
|
@parameters << "-S #{opts[:server_name]}"
|
27
27
|
@parameters << "-d #{opts[:database_name]}" unless opts.blank? :database_name
|
28
28
|
@parameters << "-i #{opts[:file]}" if opts[:source] == :file
|
29
|
-
@parameters <<
|
29
|
+
@parameters << %{-Q "#{opts[:command]}"} if opts[:source] == :command
|
30
30
|
@parameters << '-b' unless opts[:continue_on_error]
|
31
31
|
|
32
32
|
opts[:variables].each do |k, v|
|
data/lib/physique/version.rb
CHANGED
data/spec/sqlcmd_spec.rb
CHANGED
@@ -121,8 +121,8 @@ describe Physique::SqlCmd::Cmd do
|
|
121
121
|
expect(@cmd.parameters).to include('-S server')
|
122
122
|
end
|
123
123
|
|
124
|
-
it 'should include the command in
|
125
|
-
expect(@cmd.parameters).to include(
|
124
|
+
it 'should include the command in double quotes' do
|
125
|
+
expect(@cmd.parameters).to include('-Q "command"')
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
@@ -139,8 +139,8 @@ describe Physique::SqlCmd::Cmd do
|
|
139
139
|
end
|
140
140
|
|
141
141
|
it 'should add multiple variables to the command line' do
|
142
|
-
expect(@cmd.parameters).to include(
|
143
|
-
expect(@cmd.parameters).to include(
|
142
|
+
expect(@cmd.parameters).to include('-v test_variable1=test_value1')
|
143
|
+
expect(@cmd.parameters).to include('-v test_variable2=test_value2')
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
shared_context 'rake' do
|
4
|
+
let(:rake) { Rake::Application.new }
|
5
|
+
let(:solution_name) { self.class.top_level_description }
|
6
|
+
let(:solution_dir) { "spec/test_data/solutions/#{solution_name}" }
|
7
|
+
let(:task_names) { rake.tasks.map{|t| t.name } }
|
8
|
+
|
9
|
+
|
10
|
+
before do
|
11
|
+
@original_app = Rake.application
|
12
|
+
Dir.chdir(solution_dir)
|
13
|
+
Rake.application = rake
|
14
|
+
Rake.load_rakefile('Rakefile.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
after do
|
18
|
+
Rake.application = @original_app
|
19
|
+
Dir.chdir(@original_app.original_dir)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'support/shared_contexts/rake'
|
2
|
+
|
3
|
+
describe 'basic' do
|
4
|
+
include_context 'rake'
|
5
|
+
|
6
|
+
BUILD_TASKS = %w(versionizer compile compile:clean compile:build compile:rebuild)
|
7
|
+
|
8
|
+
it 'should create the build tasks' do
|
9
|
+
BUILD_TASKS.each do |name|
|
10
|
+
task_names.should include(name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'the compile task' do
|
15
|
+
let(:task) { rake['compile'] }
|
16
|
+
|
17
|
+
it 'should run without error' do
|
18
|
+
task.invoke
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should include restore as a prerequisite' do
|
22
|
+
task.prerequisites.should include('restore')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'support/shared_contexts/rake'
|
2
|
+
|
3
|
+
describe 'basic' do
|
4
|
+
include_context 'rake'
|
5
|
+
|
6
|
+
DEFAULT_TASK = 'default'
|
7
|
+
|
8
|
+
let(:task) { rake[DEFAULT_TASK] }
|
9
|
+
|
10
|
+
it 'should create the default task' do
|
11
|
+
task_names.should include(DEFAULT_TASK)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should run default task without error' do
|
15
|
+
task.invoke
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'support/shared_contexts/rake'
|
2
|
+
|
3
|
+
describe 'basic' do
|
4
|
+
include_context 'rake'
|
5
|
+
|
6
|
+
RESTORE_TASK = 'restore'
|
7
|
+
let(:task) { rake[RESTORE_TASK] }
|
8
|
+
|
9
|
+
it 'should create the build tasks' do
|
10
|
+
task_names.should include(RESTORE_TASK)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should run without error' do
|
14
|
+
task.invoke
|
15
|
+
end
|
16
|
+
end
|
Binary file
|
@@ -0,0 +1,144 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
3
|
+
<PropertyGroup>
|
4
|
+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
|
5
|
+
|
6
|
+
<!-- Enable the restore command to run before builds -->
|
7
|
+
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
|
8
|
+
|
9
|
+
<!-- Property that enables building a package from a project -->
|
10
|
+
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
|
11
|
+
|
12
|
+
<!-- Determines if package restore consent is required to restore packages -->
|
13
|
+
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
|
14
|
+
|
15
|
+
<!-- Download NuGet.exe if it does not already exist -->
|
16
|
+
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
|
17
|
+
</PropertyGroup>
|
18
|
+
|
19
|
+
<ItemGroup Condition=" '$(PackageSources)' == '' ">
|
20
|
+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
|
21
|
+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
|
22
|
+
<!--
|
23
|
+
<PackageSource Include="https://www.nuget.org/api/v2/" />
|
24
|
+
<PackageSource Include="https://my-nuget-source/nuget/" />
|
25
|
+
-->
|
26
|
+
</ItemGroup>
|
27
|
+
|
28
|
+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
|
29
|
+
<!-- Windows specific commands -->
|
30
|
+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
|
31
|
+
</PropertyGroup>
|
32
|
+
|
33
|
+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
|
34
|
+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
|
35
|
+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
|
36
|
+
</PropertyGroup>
|
37
|
+
|
38
|
+
<PropertyGroup>
|
39
|
+
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
|
40
|
+
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
|
41
|
+
</PropertyGroup>
|
42
|
+
|
43
|
+
<PropertyGroup>
|
44
|
+
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
|
45
|
+
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
|
46
|
+
</PropertyGroup>
|
47
|
+
|
48
|
+
<PropertyGroup>
|
49
|
+
<!-- NuGet command -->
|
50
|
+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
|
51
|
+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
|
52
|
+
|
53
|
+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
|
54
|
+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
|
55
|
+
|
56
|
+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
|
57
|
+
|
58
|
+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
|
59
|
+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
|
60
|
+
|
61
|
+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
|
62
|
+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
|
63
|
+
|
64
|
+
<!-- Commands -->
|
65
|
+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
|
66
|
+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
|
67
|
+
|
68
|
+
<!-- We need to ensure packages are restored prior to assembly resolve -->
|
69
|
+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
|
70
|
+
RestorePackages;
|
71
|
+
$(BuildDependsOn);
|
72
|
+
</BuildDependsOn>
|
73
|
+
|
74
|
+
<!-- Make the build depend on restore packages -->
|
75
|
+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
|
76
|
+
$(BuildDependsOn);
|
77
|
+
BuildPackage;
|
78
|
+
</BuildDependsOn>
|
79
|
+
</PropertyGroup>
|
80
|
+
|
81
|
+
<Target Name="CheckPrerequisites">
|
82
|
+
<!-- Raise an error if we're unable to locate nuget.exe -->
|
83
|
+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
|
84
|
+
<!--
|
85
|
+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
|
86
|
+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
|
87
|
+
parallel builds will have to wait for it to complete.
|
88
|
+
-->
|
89
|
+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
|
90
|
+
</Target>
|
91
|
+
|
92
|
+
<Target Name="_DownloadNuGet">
|
93
|
+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
|
94
|
+
</Target>
|
95
|
+
|
96
|
+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
|
97
|
+
<Exec Command="$(RestoreCommand)"
|
98
|
+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
99
|
+
|
100
|
+
<Exec Command="$(RestoreCommand)"
|
101
|
+
LogStandardErrorAsError="true"
|
102
|
+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
103
|
+
</Target>
|
104
|
+
|
105
|
+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
|
106
|
+
<Exec Command="$(BuildCommand)"
|
107
|
+
Condition=" '$(OS)' != 'Windows_NT' " />
|
108
|
+
|
109
|
+
<Exec Command="$(BuildCommand)"
|
110
|
+
LogStandardErrorAsError="true"
|
111
|
+
Condition=" '$(OS)' == 'Windows_NT' " />
|
112
|
+
</Target>
|
113
|
+
|
114
|
+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
115
|
+
<ParameterGroup>
|
116
|
+
<OutputFilename ParameterType="System.String" Required="true" />
|
117
|
+
</ParameterGroup>
|
118
|
+
<Task>
|
119
|
+
<Reference Include="System.Core" />
|
120
|
+
<Using Namespace="System" />
|
121
|
+
<Using Namespace="System.IO" />
|
122
|
+
<Using Namespace="System.Net" />
|
123
|
+
<Using Namespace="Microsoft.Build.Framework" />
|
124
|
+
<Using Namespace="Microsoft.Build.Utilities" />
|
125
|
+
<Code Type="Fragment" Language="cs">
|
126
|
+
<![CDATA[
|
127
|
+
try {
|
128
|
+
OutputFilename = Path.GetFullPath(OutputFilename);
|
129
|
+
|
130
|
+
Log.LogMessage("Downloading latest version of NuGet.exe...");
|
131
|
+
WebClient webClient = new WebClient();
|
132
|
+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
|
133
|
+
|
134
|
+
return true;
|
135
|
+
}
|
136
|
+
catch (Exception ex) {
|
137
|
+
Log.LogErrorFromException(ex);
|
138
|
+
return false;
|
139
|
+
}
|
140
|
+
]]>
|
141
|
+
</Code>
|
142
|
+
</Task>
|
143
|
+
</UsingTask>
|
144
|
+
</Project>
|