physique 0.3.10 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/FLUENT_MIGRATOR.md +300 -300
- data/Gemfile +3 -3
- data/Gemfile.lock +51 -11
- data/Guardfile +34 -0
- data/README.md +368 -368
- data/RUBY_SETUP.md +14 -14
- data/Rakefile +1 -1
- data/lib/physique.rb +22 -22
- data/lib/physique/config.rb +23 -23
- data/lib/physique/dsl.rb +46 -46
- data/lib/physique/project_path_resolver.rb +45 -45
- data/lib/physique/solution.rb +72 -72
- data/lib/physique/task_builders/build.rb +76 -69
- data/lib/physique/task_builders/default.rb +19 -19
- data/lib/physique/task_builders/fluent_migrator.rb +302 -299
- data/lib/physique/task_builders/nuget.rb +18 -6
- data/lib/physique/task_builders/octopus.rb +4 -2
- data/lib/physique/task_builders/publish_nugets.rb +5 -3
- data/lib/physique/task_builders/test.rb +4 -4
- data/lib/physique/tasks/fluent_migrator.rb +158 -158
- data/lib/physique/tasks/nugets_pack.rb +12 -12
- data/lib/physique/tasks/octopus_pack.rb +1 -1
- data/lib/physique/tasks/sqlcmd.rb +109 -109
- data/lib/physique/tasks/versionizer.rb +112 -112
- data/lib/physique/tasks_builder.rb +59 -59
- data/lib/physique/tool_locator.rb +50 -50
- data/lib/physique/version.rb +3 -3
- data/physique.gemspec +29 -28
- data/spec/fluent_migrator_config_spec.rb +39 -39
- data/spec/project_spec.rb +42 -42
- data/spec/publish_nugets_spec.rb +40 -40
- data/spec/solution_spec.rb +11 -11
- data/spec/sqlcmd_spec.rb +146 -146
- data/spec/support/shared_contexts/rake.rb +20 -21
- data/spec/task_builders/build_spec.rb +25 -25
- data/spec/task_builders/default_spec.rb +17 -17
- data/spec/task_builders/fluent_migrator_spec.rb +70 -68
- data/spec/task_builders/nspec_spec.rb +13 -13
- data/spec/task_builders/nuget_spec.rb +16 -16
- data/spec/test_data/solutions/.nuget/NuGet.Config +5 -5
- data/spec/test_data/solutions/.nuget/NuGet.exe +0 -0
- data/spec/test_data/solutions/.nuget/NuGet.targets +144 -144
- data/spec/test_data/solutions/.nuget/packages.config +3 -3
- data/spec/test_data/solutions/basic/.semver +6 -6
- data/spec/test_data/solutions/basic/Basic.Tests/Basic.Tests.csproj +58 -58
- data/spec/test_data/solutions/basic/Basic.Tests/Class1.cs +14 -14
- data/spec/test_data/solutions/basic/Basic.Tests/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/basic/Basic.Tests/packages.config +3 -3
- data/spec/test_data/solutions/basic/Basic.sln +28 -28
- data/spec/test_data/solutions/basic/Basic/Basic.csproj +52 -52
- data/spec/test_data/solutions/basic/Basic/Class1.cs +12 -12
- data/spec/test_data/solutions/basic/Basic/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/basic/Rakefile.rb +10 -10
- data/spec/test_data/solutions/basic/packages.config +3 -3
- data/spec/test_data/solutions/fluent-migrator/.semver +6 -6
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/Migrations/.gitkeep +0 -0
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/TestMigration.cs +19 -19
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/_Scripts/create.sql +1 -1
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/_Scripts/drop.sql +4 -4
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/_Scripts/seed.sql +1 -1
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/packages.config +3 -3
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/Basic.Specs.csproj +59 -59
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/Class1.cs +12 -12
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/DebuggerShim.cs +42 -42
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/packages.config +3 -3
- data/spec/test_data/solutions/fluent-migrator/Basic.sln +39 -39
- data/spec/test_data/solutions/fluent-migrator/Basic/Basic.csproj +55 -55
- data/spec/test_data/solutions/fluent-migrator/Basic/Class1.cs +12 -12
- data/spec/test_data/solutions/fluent-migrator/Basic/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/fluent-migrator/Basic/packages.config +2 -2
- data/spec/test_data/solutions/fluent-migrator/Rakefile.rb +20 -20
- data/spec/test_data/solutions/multiple-fluent-migrator/.semver +6 -6
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations1/Basic.Migrations1.csproj +52 -52
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations1/Class1.cs +12 -12
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations1/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations2/Basic.Migrations2.csproj +52 -52
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations2/Class1.cs +12 -12
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations2/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/Basic.Specs.csproj +59 -59
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/Class1.cs +12 -12
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/DebuggerShim.cs +42 -42
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/packages.config +3 -3
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.sln +45 -45
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic/Basic.csproj +55 -55
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic/Class1.cs +12 -12
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic/packages.config +2 -2
- data/spec/test_data/solutions/multiple-fluent-migrator/Rakefile.rb +28 -28
- data/spec/test_data/solutions/nspec/.semver +6 -6
- data/spec/test_data/solutions/nspec/Basic.Specs/Basic.Specs.csproj +59 -59
- data/spec/test_data/solutions/nspec/Basic.Specs/Class1.cs +12 -12
- data/spec/test_data/solutions/nspec/Basic.Specs/DebuggerShim.cs +42 -42
- data/spec/test_data/solutions/nspec/Basic.Specs/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/nspec/Basic.Specs/packages.config +3 -3
- data/spec/test_data/solutions/nspec/Basic.sln +28 -28
- data/spec/test_data/solutions/nspec/Basic/Basic.csproj +55 -55
- data/spec/test_data/solutions/nspec/Basic/Class1.cs +12 -12
- data/spec/test_data/solutions/nspec/Basic/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/nspec/Basic/packages.config +2 -2
- data/spec/test_data/solutions/nspec/Rakefile.rb +14 -14
- data/spec/test_data/tool_locator/Program Files/Microsoft SQL Server/110/Tools/Binn/SQLCMD.exe.txt b/data/spec/test_data/tool_locator/Program Files/Microsoft SQL → Server/110/Tools/Binn/SQLCMD.exe.txt +0 -0
- data/spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v3.5/MSBuild.exe.txt +0 -0
- data/spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe.txt +0 -0
- data/spec/tool_locator_spec.rb +27 -29
- metadata +33 -16
@@ -1,17 +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
|
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
|
@@ -1,68 +1,70 @@
|
|
1
|
-
require 'support/shared_contexts/rake'
|
2
|
-
|
3
|
-
describe 'fluent-migrator' do
|
4
|
-
include_context 'rake'
|
5
|
-
|
6
|
-
let(:db_build_tasks) { %w(create drop migrate new_migration rebuild rollback seed setup try) }
|
7
|
-
|
8
|
-
let(:db_specific_tasks) { db_build_tasks.map {|t| "db:mydatabase:#{t}" } }
|
9
|
-
|
10
|
-
let(:build_tasks) { db_build_tasks.map {|t| "db:#{t}" } }
|
11
|
-
|
12
|
-
it 'should create all of the db tasks' do
|
13
|
-
build_tasks.each do |name|
|
14
|
-
task_names.should include(name)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should create all of the db specific tasks' do
|
19
|
-
db_specific_tasks.each do |name|
|
20
|
-
task_names.should include(name)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
let
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
let(:
|
55
|
-
let(:
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
1
|
+
require 'support/shared_contexts/rake'
|
2
|
+
|
3
|
+
describe 'fluent-migrator' do
|
4
|
+
include_context 'rake'
|
5
|
+
|
6
|
+
let(:db_build_tasks) { %w(create drop migrate new_migration rebuild rollback seed setup try) }
|
7
|
+
|
8
|
+
let(:db_specific_tasks) { db_build_tasks.map {|t| "db:mydatabase:#{t}" } }
|
9
|
+
|
10
|
+
let(:build_tasks) { db_build_tasks.map {|t| "db:#{t}" } }
|
11
|
+
|
12
|
+
it 'should create all of the db tasks' do
|
13
|
+
build_tasks.each do |name|
|
14
|
+
task_names.should include(name)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should create all of the db specific tasks' do
|
19
|
+
db_specific_tasks.each do |name|
|
20
|
+
task_names.should include(name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
if ::Rake::Win32.windows?
|
25
|
+
it 'should rebuild the database' do
|
26
|
+
rake['db:rebuild'].invoke
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'when creating migrations' do
|
31
|
+
let(:project_folder) { "Basic.Migrations" }
|
32
|
+
let(:project_file) { "#{project_folder}/Basic.Migrations.csproj" }
|
33
|
+
let!(:project_file_contents) { File.read(project_file) }
|
34
|
+
|
35
|
+
it 'should create a new migration' do
|
36
|
+
rake['db:new_migration'].invoke 'TestMigration', 'Test migration description'
|
37
|
+
end
|
38
|
+
|
39
|
+
after do
|
40
|
+
# Delete the created migrations files
|
41
|
+
FileUtils.rm_rf Dir.glob("#{project_folder}/Migrations/*")
|
42
|
+
|
43
|
+
# Restore the project file to it's original state
|
44
|
+
open(project_file, 'w') do |f|
|
45
|
+
f.puts project_file_contents
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'multiple-fluent-migrator' do
|
52
|
+
include_context 'rake'
|
53
|
+
|
54
|
+
let(:db_aliases) { %w(client server) }
|
55
|
+
let(:build_tasks) { %w(create drop migrate new_migration rebuild rollback seed setup try) }
|
56
|
+
let(:db_specific_tasks) { db_aliases.product(build_tasks).map {|db_alias, task| "db:#{db_alias}:#{task}"} }
|
57
|
+
let(:global_tasks) { %w(db:create db:drop db:migrate db:rebuild db:seed db:setup) }
|
58
|
+
|
59
|
+
it 'should create the global build tasks' do
|
60
|
+
global_tasks.each do |name|
|
61
|
+
task_names.should include(name)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should create the db specific tasks' do
|
66
|
+
db_specific_tasks.each do |name|
|
67
|
+
task_names.should include(name)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require 'support/shared_contexts/rake'
|
2
|
-
|
3
|
-
describe 'nspec' do
|
4
|
-
include_context 'rake'
|
5
|
-
|
6
|
-
TASK = 'test'
|
7
|
-
|
8
|
-
let(:task) { rake[TASK] }
|
9
|
-
|
10
|
-
it 'should run the test task without error' do
|
11
|
-
task.invoke
|
12
|
-
end
|
13
|
-
end
|
1
|
+
require 'support/shared_contexts/rake'
|
2
|
+
|
3
|
+
describe 'nspec' do
|
4
|
+
include_context 'rake'
|
5
|
+
|
6
|
+
TASK = 'test'
|
7
|
+
|
8
|
+
let(:task) { rake[TASK] }
|
9
|
+
|
10
|
+
it 'should run the test task without error' do
|
11
|
+
task.invoke
|
12
|
+
end
|
13
|
+
end
|
@@ -1,16 +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
|
10
|
-
task_names.should include(RESTORE_TASK)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should run without error' do
|
14
|
-
task.invoke
|
15
|
-
end
|
16
|
-
end
|
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 test task' 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
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<configuration>
|
3
|
-
<solution>
|
4
|
-
<add key="disableSourceControlIntegration" value="true" />
|
5
|
-
</solution>
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<configuration>
|
3
|
+
<solution>
|
4
|
+
<add key="disableSourceControlIntegration" value="true" />
|
5
|
+
</solution>
|
6
6
|
</configuration>
|
File without changes
|
@@ -1,144 +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>
|
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>
|