-
Notifications
You must be signed in to change notification settings - Fork 422
Expand file tree
/
Copy pathcsharp.rb
More file actions
92 lines (76 loc) · 3.05 KB
/
csharp.rb
File metadata and controls
92 lines (76 loc) · 3.05 KB
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
# Maintained by:
# Joshua Anderson @joshua-anderson j@joshua-anderson.com
# Alexander Köplinger @akoeplinger alex.koeplinger@outlook.com
# Nicholas Terry @nterry nick.i.terry@gmail.com
module Travis
module Build
class Script
class Csharp < Script
DEFAULTS = {
csharp: 'latest',
}
MONO_VERSION_REGEXP = /^(\d{1}\.)(\d{1,2}\.)(\d{1,2})$/
def configure
super
sh.echo ''
sh.echo 'BETA Warning: Travis-CI C# support is in beta and may be changed or removed at any time.', ansi: :red
sh.echo 'Please open any issues at https://github.com/travis-ci/travis-ci/issues/new and cc @joshua-anderson @akoeplinger @nterry', ansi: :red
sh.fold('mono-install') do
if mono_version_valid?
sh.echo 'Installing Mono', ansi: :yellow
sh.cmd 'sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF', echo: false
sh.cmd "sudo sh -c \"echo 'deb http://download.mono-project.com/repo/debian #{mono_repo} main' >> /etc/apt/sources.list.d/mono-xamarin.list\"", echo: false
sh.cmd "sudo sh -c \"echo 'deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main' >> /etc/apt/sources.list.d/mono-xamarin.list\"", echo: false
sh.cmd 'sudo apt-get update -qq', timing: true
sh.cmd 'sudo apt-get install -qq mono-complete referenceassemblies-pcl nuget mono-vbnc fsharp', timing: true
sh.cmd 'mozroots --import --sync --quiet', timing: true
end
end
end
def setup
unless mono_version_valid?
sh.echo "#{config[:csharp]} is not a valid version of mono.", ansi: :red
sh.cmd 'false', echo: false, timing: false
end
end
def announce
super
sh.cmd 'mono --version', timing: true
sh.cmd 'xbuild /version', timing: true
sh.echo ''
end
def export
super
sh.export 'TRAVIS_SOLUTION', config[:solution].to_s.shellescape if config[:solution]
end
def install
sh.cmd "nuget restore #{config[:solution]}", retry: true if config[:solution]
end
def script
if config[:solution]
sh.cmd "xbuild /p:Configuration=Release #{config[:solution]}", timing: true if config[:solution]
else
sh.echo 'No solution or script defined, exiting', ansi: :red
sh.cmd 'false', echo: false, timing: false
end
end
def mono_repo
if config[:csharp] == 'latest'
'wheezy'
else
if MONO_VERSION_REGEXP === config[:csharp]
'wheezy/snapshots/' << config[:csharp]
else
'wheezy'
end
end
end
def mono_version_valid?
if MONO_VERSION_REGEXP === config[:csharp] || config[:csharp] == 'latest'
true
end
end
end
end
end
end