dev 2.1.153 → 2.1.154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/apps/git.rb +207 -208
- data/lib/apps/msbuild.rb +90 -90
- data/lib/apps/nbench.rb +2 -1
- data/lib/apps/nuget.rb +57 -59
- data/lib/apps/svn.rb +137 -143
- data/lib/apps/wix.rb +47 -50
- data/lib/apps/xcodebuild.rb +13 -11
- data/lib/apps/zip.rb +25 -25
- data/lib/apps.rb +3 -1
- data/lib/base/array.rb +66 -64
- data/lib/base/command.rb +237 -238
- data/lib/base/dir.rb +73 -76
- data/lib/base/environment.rb +94 -99
- data/lib/base/file.rb +35 -33
- data/lib/base/gemspec.rb +47 -45
- data/lib/base/giturl.rb +88 -90
- data/lib/base/hash.rb +20 -15
- data/lib/base/history.rb +36 -33
- data/lib/base/internet.rb +22 -20
- data/lib/base/project.rb +410 -423
- data/lib/base/projects.rb +231 -246
- data/lib/base/source.rb +22 -20
- data/lib/base/string.rb +6 -4
- data/lib/base/text.rb +16 -14
- data/lib/base/timeout.rb +29 -28
- data/lib/base/timer.rb +23 -19
- data/lib/base/version.rb +68 -72
- data/lib/base.rb +5 -3
- data/lib/commands.rb +47 -43
- data/lib/dev.config.rb +3 -2
- data/lib/dev.rb +65 -66
- data/lib/tasks/add.rb +34 -40
- data/lib/tasks/analyze.rb +17 -15
- data/lib/tasks/build.rb +101 -103
- data/lib/tasks/clean.rb +6 -4
- data/lib/tasks/clobber.rb +20 -18
- data/lib/tasks/commit.rb +42 -44
- data/lib/tasks/default.rb +41 -39
- data/lib/tasks/doc.rb +10 -8
- data/lib/tasks/info.rb +8 -7
- data/lib/tasks/package.rb +23 -20
- data/lib/tasks/publish.rb +20 -25
- data/lib/tasks/pull.rb +9 -9
- data/lib/tasks/push.rb +11 -13
- data/lib/tasks/setup.rb +180 -183
- data/lib/tasks/test.rb +121 -107
- data/lib/tasks/update.rb +13 -11
- data/lib/tasks.rb +38 -42
- metadata +7 -9
- data/bin/dev +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e19e6acb617e668310c66b684c48f8fd5a7a6b101071db20fa7dc6a322ad2ed8
|
4
|
+
data.tar.gz: b171cf51d74c88493f9b0bb80b03b3b6e94703284643bcb6d5ef5b723c7a291d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2493f738a5b16231dbf2f48cdcb207987685f835a83a029650775057ece7e5527a72ebd9c3ba23d1b68ae8275f76bf57c246c384e4147d8c35ee5331f8e986d
|
7
|
+
data.tar.gz: b9058483a84a0bf7177e8127e28e671a4ffa05b187e4003e75f780f22d6f0245bcdc12ac6fc686dbf9c8d8c92b25ec1ba640b22ed555056fe732e7aee8d0e132
|
data/lib/apps/git.rb
CHANGED
@@ -1,216 +1,215 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
if defined?(DEBUG)
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
puts DELIMITER
|
5
|
+
puts __FILE__
|
6
|
+
puts
|
7
|
+
puts "git not found" unless Command.executes?("git --version")
|
8
|
+
puts
|
7
9
|
end
|
8
10
|
|
9
|
-
require
|
10
|
-
require
|
11
|
+
require "tmpdir"
|
12
|
+
require "rake"
|
11
13
|
|
12
14
|
class Git
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def self.branch(directory = "")
|
16
|
+
directory = Dir.pwd if directory.length.zero?
|
17
|
+
Dir.chdir(directory) do
|
18
|
+
`git branch`.scan(/\* ([.\w-]+)/)[0][0] if File.exist?(".git")
|
19
|
+
rescue StandardError
|
20
|
+
""
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.url
|
25
|
+
url = ""
|
26
|
+
url = `git config --get remote.origin.url` if File.exist?(".git")
|
27
|
+
end
|
28
|
+
|
29
|
+
@@master_url = ""
|
30
|
+
def self.master_url
|
31
|
+
@@master_url
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.master_url=(url)
|
35
|
+
@@master_url = url
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.is_fork?
|
39
|
+
master_url != url
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.user_email
|
43
|
+
email = ""
|
44
|
+
begin
|
45
|
+
email = `git config --list`.scan(/user.email=([\d\w.@\-+]+)/)[0][0]
|
46
|
+
rescue StandardError
|
47
|
+
email = ""
|
48
|
+
end
|
49
|
+
email
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.user_name
|
53
|
+
name = ""
|
54
|
+
begin
|
55
|
+
name = `git config --list`.scan(/user.name=([\d\w.@\-+]+)/)[0][0]
|
56
|
+
rescue StandardError
|
57
|
+
name = ""
|
58
|
+
end
|
59
|
+
name
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.remote_origin(directory = "")
|
63
|
+
url = ""
|
64
|
+
directory = Dir.pwd if directory.length.zero?
|
65
|
+
Dir.chdir(directory) do
|
66
|
+
url = `git remote show origin`.scan(%r{Fetch URL: ([.\-:/\w\d]+)})[0][0] if File.exist?(".git")
|
67
|
+
rescue StandardError
|
68
|
+
url = ""
|
69
|
+
end
|
70
|
+
url
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.has_changes?(directory = "")
|
74
|
+
directory = Dir.pwd if directory.length.zero?
|
75
|
+
Dir.chdir(directory) do
|
76
|
+
if File.exist?(".git")
|
77
|
+
return true if `git status`.include?("modified:")
|
78
|
+
return true if `git status`.include?("new file:")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
false
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.init(directory = "")
|
85
|
+
directory = Dir.pwd if directory.length.zero?
|
86
|
+
parent = File.dirname(directory)
|
87
|
+
FileUtils.mkdir_p parent if !File.exist?(parent) && parent.length.positive?
|
88
|
+
Dir.chdir(parent) do
|
89
|
+
`git init --bare`
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.tag(directory, version)
|
94
|
+
directory = Dir.pwd if directory.length.zero?
|
95
|
+
Dir.chdir(directory) do
|
96
|
+
# `git pull`
|
97
|
+
tags = `git tag`
|
98
|
+
unless tags.include?(version)
|
99
|
+
puts "tagging branch"
|
100
|
+
puts `git tag #{version} -m'#{version}'`
|
101
|
+
puts "committing"
|
102
|
+
puts `git commit -m'#{version}'`
|
103
|
+
# puts 'pushing'
|
104
|
+
# puts `git push --tags`
|
105
|
+
# puts `git push`
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.publish(destination, source_dir, source_filelist, tag)
|
111
|
+
puts "publish to #{destination}"
|
112
|
+
tmp_dir = Dir.mktmpdir
|
113
|
+
FileUtils.mkdir_p(File.dirname(tmp_dir)) unless File.exist?(File.dirname(tmp_dir))
|
114
|
+
FileUtils.rm_r(tmp_dir) if File.exist?(tmp_dir)
|
115
|
+
puts `git clone #{destination} #{tmp_dir}`
|
116
|
+
|
117
|
+
puts "checking if tag #{tag} exists..."
|
118
|
+
Dir.chdir(tmp_dir) do
|
119
|
+
tags = `git tag`
|
120
|
+
if tags.include?(tag)
|
121
|
+
puts "tag #{tag} already exists."
|
122
|
+
else
|
123
|
+
puts "tag #{tag} does not exist."
|
124
|
+
Dir.chdir(source_dir) do
|
125
|
+
source_filelist.each do |f|
|
126
|
+
dest = "#{tmp_dir}/#{f}"
|
127
|
+
FileUtils.mkdir_p(File.dirname(dest)) unless File.exist?(File.dirname(dest))
|
128
|
+
FileUtils.cp(f, dest)
|
129
|
+
puts "copying file #{f} for publishing"
|
130
|
+
end
|
21
131
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
132
|
+
puts "git add -A"
|
133
|
+
puts `git add -A`
|
134
|
+
puts 'git commit -m"add"'
|
135
|
+
puts `git commit -m"add"`
|
136
|
+
Git.tag tmp_dir, tag
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
FileUtils.rm_r tmp_dir
|
141
|
+
end
|
142
|
+
|
143
|
+
def self.clone_and_reset(uri, directory, tagname)
|
144
|
+
unless File.exist?(directory)
|
145
|
+
`git clone #{uri} #{directory}`
|
146
|
+
Dir.chdir(directory) do
|
147
|
+
`git reset --hard #{tagname}`
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def self.latest_tag(directory = "")
|
153
|
+
if directory.length.zero?
|
154
|
+
Command.output("git describe --abbrev=0 --tags").strip
|
155
|
+
# `git describe --abbrev=0 --tags`.strip
|
156
|
+
else
|
157
|
+
result = ""
|
158
|
+
Dir.chdir(directory) do
|
159
|
+
result = Command.output("git describe --abbrev=0 --tags").strip
|
160
|
+
# result=`git describe --abbrev=0 --tags`.strip
|
161
|
+
end
|
162
|
+
result
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.copy(src_url, src_directory, branch, target_directory, filelist)
|
167
|
+
if !File.exist?(src_directory)
|
168
|
+
puts "git clone #{src_url} #{src_directory}"
|
169
|
+
# puts `git clone #{src_url} #{src_directory}`
|
170
|
+
else
|
171
|
+
puts "chdir #{src_directory}"
|
172
|
+
Dir.chdir(src_directory) do
|
173
|
+
puts "git pull"
|
174
|
+
git_pull = Command.new("git pull")
|
175
|
+
git_pull[:directory] = src_directory
|
176
|
+
git_pull[:timeout] = 30
|
177
|
+
git_pull[:ignore_failure] = true
|
178
|
+
git_pull.execute
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
puts "chdir #{src_directory}"
|
183
|
+
Dir.chdir(src_directory) do
|
184
|
+
puts "git checkout #{branch}"
|
185
|
+
# puts `git checkout #{branch}`
|
186
|
+
filelist.each do |f|
|
187
|
+
dest = "#{target_directory}/#{f}"
|
188
|
+
FileUtils.mkdir_p File.dirname(dest) unless File.exist? File.dirname(dest)
|
189
|
+
puts "copying #{f} to #{dest}"
|
190
|
+
FileUtils.cp(f, dest)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def self.copy_gsub(url, branch, glob, glob_search, glob_replace, destination_directory)
|
196
|
+
temp_dir = Dir.mktmpdir
|
197
|
+
begin
|
198
|
+
puts `git clone #{url} #{temp_dir}`
|
199
|
+
puts "cd #{temp_dir}"
|
200
|
+
Dir.chdir(temp_dir) do
|
201
|
+
puts `git checkout #{branch}`
|
202
|
+
puts "glob #{glob}"
|
203
|
+
Dir.glob(glob).each do |f|
|
204
|
+
relative_filename = f.gsub(glob_search, glob_replace)
|
205
|
+
dest = "#{destination_directory}/#{relative_filename}"
|
206
|
+
FileUtils.mkdir_p File.dirname(dest) unless Dir.exist?(File.dirname(dest))
|
207
|
+
puts "copying #{f} to #{dest}"
|
208
|
+
FileUtils.copy(f, dest)
|
45
209
|
end
|
46
|
-
|
210
|
+
end
|
211
|
+
ensure
|
212
|
+
FileUtils.remove_entry_secure temp_dir
|
47
213
|
end
|
48
|
-
|
49
|
-
|
50
|
-
name=''
|
51
|
-
begin
|
52
|
-
name=`git config --list`.scan(/user.name=([\d\w.@\-\+]+)/)[0][0]
|
53
|
-
rescue
|
54
|
-
name=''
|
55
|
-
end
|
56
|
-
name
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.remote_origin directory=''
|
60
|
-
url=''
|
61
|
-
directory=Dir.pwd if directory.length == 0
|
62
|
-
Dir.chdir(directory) do
|
63
|
-
begin
|
64
|
-
url=`git remote show origin`.scan(/Fetch URL: ([\.\-:\/\w\d]+)/)[0][0] if(File.exists?('.git'))
|
65
|
-
rescue
|
66
|
-
url=''
|
67
|
-
end
|
68
|
-
end
|
69
|
-
url
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.has_changes? directory=''
|
73
|
-
directory=Dir.pwd if directory.length==0
|
74
|
-
Dir.chdir(directory) do
|
75
|
-
if(File.exists?('.git'))
|
76
|
-
return true if `git status`.include?('modified:')
|
77
|
-
return true if `git status`.include?('new file:')
|
78
|
-
end
|
79
|
-
end
|
80
|
-
false
|
81
|
-
end
|
82
|
-
|
83
|
-
def self.init directory=''
|
84
|
-
directory=Dir.pwd if directory.length==0
|
85
|
-
parent=File.dirname(directory)
|
86
|
-
FileUtils.mkdir_p parent if !File.exists?(parent) && parent.length > 0
|
87
|
-
Dir.chdir(parent) do
|
88
|
-
`git init --bare`
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def self.tag directory,version
|
94
|
-
directory=Dir.pwd if directory.length == 0
|
95
|
-
Dir.chdir(directory) do
|
96
|
-
#`git pull`
|
97
|
-
tags=`git tag`
|
98
|
-
if(!tags.include?(version))
|
99
|
-
puts 'tagging branch'
|
100
|
-
puts `git tag #{version} -m'#{version}'`
|
101
|
-
puts 'committing'
|
102
|
-
puts `git commit -m'#{version}'`
|
103
|
-
#puts 'pushing'
|
104
|
-
#puts `git push --tags`
|
105
|
-
#puts `git push`
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def self.publish destination, source_dir, source_filelist, tag
|
111
|
-
puts "publish to #{destination}"
|
112
|
-
tmp_dir=Dir.mktmpdir
|
113
|
-
FileUtils.mkdir_p(File.dirname(tmp_dir)) if(!File.exists?(File.dirname(tmp_dir)))
|
114
|
-
FileUtils.rm_r(tmp_dir) if File.exists?(tmp_dir)
|
115
|
-
puts `git clone #{destination} #{tmp_dir}`
|
116
|
-
|
117
|
-
puts "checking if tag #{tag} exists..."
|
118
|
-
Dir.chdir(tmp_dir) do
|
119
|
-
tags=`git tag`
|
120
|
-
if(tags.include?(tag))
|
121
|
-
puts "tag #{tag} already exists."
|
122
|
-
else
|
123
|
-
puts "tag #{tag} does not exist."
|
124
|
-
Dir.chdir(source_dir) do
|
125
|
-
source_filelist.each{|f|
|
126
|
-
dest = tmp_dir + "/" + f
|
127
|
-
FileUtils.mkdir_p(File.dirname(dest)) if(!File.exists?(File.dirname(dest)))
|
128
|
-
FileUtils.cp(f,dest);
|
129
|
-
puts "copying file #{f} for publishing"
|
130
|
-
}
|
131
|
-
end
|
132
|
-
puts 'git add -A'
|
133
|
-
puts `git add -A`
|
134
|
-
puts 'git commit -m"add"'
|
135
|
-
puts `git commit -m"add"`
|
136
|
-
Git.tag tmp_dir,tag
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
FileUtils.rm_r tmp_dir
|
141
|
-
end
|
142
|
-
|
143
|
-
def self.clone_and_reset uri, directory, tagname
|
144
|
-
if(!File.exists?(directory))
|
145
|
-
`git clone #{uri} #{directory}`
|
146
|
-
Dir.chdir(directory) do
|
147
|
-
`git reset --hard #{tagname}`
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def self.latest_tag directory=''
|
153
|
-
if directory.length==0
|
154
|
-
Command.output('git describe --abbrev=0 --tags').strip
|
155
|
-
#`git describe --abbrev=0 --tags`.strip
|
156
|
-
else
|
157
|
-
result=''
|
158
|
-
Dir.chdir(directory) do
|
159
|
-
result=Command.output('git describe --abbrev=0 --tags').strip
|
160
|
-
#result=`git describe --abbrev=0 --tags`.strip
|
161
|
-
end
|
162
|
-
result
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
def self.copy(src_url,src_directory,branch,target_directory,filelist)
|
167
|
-
if(!File.exists?(src_directory))
|
168
|
-
puts "git clone #{src_url} #{src_directory}"
|
169
|
-
#puts `git clone #{src_url} #{src_directory}`
|
170
|
-
else
|
171
|
-
puts "chdir #{src_directory}"
|
172
|
-
Dir.chdir(src_directory) do
|
173
|
-
puts "git pull"
|
174
|
-
git_pull=Command.new('git pull')
|
175
|
-
git_pull[:directory]=src_directory
|
176
|
-
git_pull[:timeout] = 30
|
177
|
-
git_pull[:ignore_failure] =true
|
178
|
-
git_pull.execute
|
179
|
-
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
puts "chdir #{src_directory}"
|
184
|
-
Dir.chdir(src_directory) do
|
185
|
-
puts "git checkout #{branch}"
|
186
|
-
#puts `git checkout #{branch}`
|
187
|
-
filelist.each{|f|
|
188
|
-
dest="#{target_directory}/#{f}"
|
189
|
-
FileUtils.mkdir_p File.dirname(dest) if !File.exists? File.dirname(dest)
|
190
|
-
puts "copying #{f} to #{dest}"
|
191
|
-
FileUtils.cp(f,dest)
|
192
|
-
}
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
def self.copy_gsub(url,branch,glob,glob_search,glob_replace,destination_directory)
|
197
|
-
temp_dir = Dir.mktmpdir
|
198
|
-
begin
|
199
|
-
puts `git clone #{url} #{temp_dir}`
|
200
|
-
puts "cd #{temp_dir}"
|
201
|
-
Dir.chdir(temp_dir) do
|
202
|
-
puts `git checkout #{branch}`
|
203
|
-
puts "glob #{glob}"
|
204
|
-
Dir.glob(glob).each{|f|
|
205
|
-
relative_filename=f.gsub(glob_search,glob_replace)
|
206
|
-
dest="#{destination_directory}/#{relative_filename}"
|
207
|
-
FileUtils.mkdir_p File.dirname(dest) if(!Dir.exists?(File.dirname(dest)))
|
208
|
-
puts "copying #{f} to #{dest}"
|
209
|
-
FileUtils.copy(f,dest)
|
210
|
-
}
|
211
|
-
end
|
212
|
-
ensure
|
213
|
-
FileUtils.remove_entry_secure temp_dir
|
214
|
-
end
|
215
|
-
end
|
216
|
-
end
|
214
|
+
end
|
215
|
+
end
|
data/lib/apps/msbuild.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
puts DELIMITER if defined?(DEBUG)
|
2
4
|
puts __FILE__ if defined?(DEBUG)
|
3
5
|
# Visual Studio 2008 version 9.0, solution format version 10.00
|
@@ -7,134 +9,132 @@ puts __FILE__ if defined?(DEBUG)
|
|
7
9
|
# Visual Studio 2015 version 14.0, solution format version 12.00
|
8
10
|
# Visual Studio 2017 version 15.0
|
9
11
|
# Visual Studio 2019 version 16.0
|
10
|
-
require
|
11
|
-
class MSBuild < Hash
|
12
|
+
require "pp"
|
12
13
|
|
13
|
-
|
14
|
+
class MSBuild < Hash
|
15
|
+
# @@ignore_configurations=Array.new
|
14
16
|
def initialize
|
15
|
-
add(:vs9,"C:/Windows/Microsoft.NET/Framework/v3.5/msbuild.exe")
|
16
|
-
add(:vs10,"C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe")
|
17
|
-
add(:vs12,"C:/Program Files (x86)/MSBuild/12.0/bin/msbuild.exe")
|
18
|
-
add(:vs14,"C:/Program Files (x86)/MSBuild/14.0/bin/msbuild.exe")
|
19
|
-
add(:vs15,"C:/Program Files (x86)/MSBuild/15.0/bin/msbuild.exe")
|
20
|
-
add(:vs15,"C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe")
|
21
|
-
if
|
22
|
-
add(:vs15,"C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe")
|
17
|
+
add(:vs9, "C:/Windows/Microsoft.NET/Framework/v3.5/msbuild.exe")
|
18
|
+
add(:vs10, "C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe")
|
19
|
+
add(:vs12, "C:/Program Files (x86)/MSBuild/12.0/bin/msbuild.exe")
|
20
|
+
add(:vs14, "C:/Program Files (x86)/MSBuild/14.0/bin/msbuild.exe")
|
21
|
+
add(:vs15, "C:/Program Files (x86)/MSBuild/15.0/bin/msbuild.exe")
|
22
|
+
add(:vs15, "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe")
|
23
|
+
if File.exist?("C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe")
|
24
|
+
add(:vs15, "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe")
|
23
25
|
end
|
24
|
-
if
|
25
|
-
add(:vs16,"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe")
|
26
|
+
if File.exist?("C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe")
|
27
|
+
add(:vs16, "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe")
|
26
28
|
end
|
27
|
-
if
|
28
|
-
add(:vs16,"C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/MSBuild/Current/Bin/MSBuild.exe")
|
29
|
+
if File.exist?("C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/MSBuild/Current/Bin/MSBuild.exe")
|
30
|
+
add(:vs16, "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/MSBuild/Current/Bin/MSBuild.exe")
|
29
31
|
end
|
30
|
-
if
|
31
|
-
add(:vs16,"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe")
|
32
|
+
if File.exist?("C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe")
|
33
|
+
add(:vs16, "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe")
|
32
34
|
end
|
33
|
-
if
|
34
|
-
add(:vs16,"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe")
|
35
|
+
if File.exist?("C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe")
|
36
|
+
add(:vs16, "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe")
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
38
|
-
def add(key,name)
|
39
|
-
if
|
40
|
-
self[key] = name
|
41
|
-
end
|
40
|
+
def add(key, name)
|
41
|
+
self[key] = name if File.exist?(name)
|
42
42
|
end
|
43
43
|
|
44
|
-
def self.has_version?
|
45
|
-
if
|
46
|
-
MSBUILD.
|
44
|
+
def self.has_version?(version)
|
45
|
+
if defined?(MSBUILD)
|
46
|
+
MSBUILD.key?(version)
|
47
47
|
else
|
48
|
-
msb=MSBuild.new
|
49
|
-
|
48
|
+
msb = MSBuild.new
|
49
|
+
msb.key? version
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
def self.in_path?
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
command = Command.new("msbuild /version")
|
55
|
+
command[:quiet] = true
|
56
|
+
command[:ignore_failure] = true
|
57
|
+
command.execute
|
58
|
+
return true if (command[:exit_code]).zero?
|
59
|
+
|
60
|
+
false
|
60
61
|
end
|
61
62
|
|
62
|
-
def self.get_version
|
63
|
+
def self.get_version(version)
|
63
64
|
return "msbuild" if MSBuild.in_path?
|
64
|
-
|
65
|
+
|
66
|
+
if defined?(MSBUILD)
|
65
67
|
MSBUILD[version]
|
66
68
|
else
|
67
|
-
msb=MSBuild.new
|
68
|
-
|
69
|
+
msb = MSBuild.new
|
70
|
+
msb[version]
|
69
71
|
end
|
70
72
|
end
|
71
73
|
|
72
|
-
|
73
|
-
if
|
74
|
+
def self.get_vs_version(sln_filename)
|
75
|
+
if sln_filename.nil?
|
74
76
|
return :vs16 if has_version? :vs16
|
75
77
|
return :vs15 if has_version? :vs15
|
78
|
+
|
76
79
|
return :vs14
|
77
80
|
end
|
78
|
-
sln_text=File.read(sln_filename
|
79
|
-
return :vs16 if sln_text.include?(
|
80
|
-
return :vs15 if sln_text.include?(
|
81
|
-
return :vs9 if sln_text.include?(
|
82
|
-
return :vs12 if sln_text.include?(
|
83
|
-
return :vs12 if sln_text.include?(
|
84
|
-
return :vs12 if sln_text.include?(
|
85
|
-
return :vs14 if sln_text.include?(
|
81
|
+
sln_text = File.read(sln_filename, encoding: "UTF-8")
|
82
|
+
return :vs16 if sln_text.include?("Visual Studio Version 16")
|
83
|
+
return :vs15 if sln_text.include?("VisualStudioVersion = 15.")
|
84
|
+
return :vs9 if sln_text.include?("Format Version 10.00")
|
85
|
+
return :vs12 if sln_text.include?("12.0.30723.0")
|
86
|
+
return :vs12 if sln_text.include?("Visual Studio 2013")
|
87
|
+
return :vs12 if sln_text.include?("12.0.31101.0")
|
88
|
+
return :vs14 if sln_text.include?("VisualStudioVersion = 14.0.")
|
86
89
|
return :vs16 if has_version? :vs16
|
87
90
|
return :vs15 if has_version? :vs15
|
88
|
-
|
91
|
+
|
92
|
+
:vs14
|
89
93
|
end
|
90
94
|
|
91
95
|
def self.get_configurations(sln_filename)
|
92
|
-
configs=
|
93
|
-
|
94
|
-
sln_text.scan(
|
95
|
-
|
96
|
+
configs = []
|
97
|
+
sln_text = File.read(sln_filename, encoding: "UTF-8")
|
98
|
+
sln_text.scan(/= (\w+)\|/).each do |m|
|
99
|
+
c = m.first.to_s
|
96
100
|
ignore = false
|
97
|
-
if
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
configs << c if !configs.include?(c)
|
102
|
-
end
|
103
|
-
}
|
104
|
-
return configs
|
101
|
+
ignore = true if defined?(IGNORE_CONFIGURATIONS) && IGNORE_CONFIGURATIONS.include?(c)
|
102
|
+
configs << c if !ignore && !configs.include?(c)
|
103
|
+
end
|
104
|
+
configs
|
105
105
|
end
|
106
106
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
107
|
+
def self.get_platforms(sln_filename)
|
108
|
+
platforms = []
|
109
|
+
sln_text = File.read(sln_filename, encoding: "UTF-8")
|
110
|
+
# sln_text.scan( /= [\w]+\|([\w ]+)/ ).each{|m|
|
111
|
+
sln_text.scan(/\|([\w\d\s]+)\s*=/).each do |m|
|
112
|
+
p = m.first.to_s.strip
|
113
|
+
platforms << p unless platforms.include?(p)
|
114
|
+
end
|
115
|
+
platforms
|
116
|
+
end
|
117
117
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
}
|
118
|
+
def self.get_build_commands(sln_filename)
|
119
|
+
build_commands = nil
|
120
|
+
vs_version = MSBuild.get_vs_version(sln_filename)
|
121
|
+
puts "vs version for '#{sln_filename}' : #{vs_version}"
|
122
|
+
if MSBuild.has_version?(vs_version)
|
123
|
+
MSBuild.get_configurations(sln_filename).each do |configuration|
|
124
|
+
MSBuild.get_platforms(sln_filename).each do |platform|
|
125
|
+
build_commands = [] if build_commands.nil?
|
126
|
+
msbuild_arg = MSBuild.get_version(vs_version)
|
127
|
+
msbuild_arg = "\"#{MSBuild.get_version(vs_version)}\"" if msbuild_arg.include?(" ")
|
128
|
+
sln_arg = sln_filename
|
129
|
+
sln_arg = "\"#{sln_filename}\"" if sln_filename.include?(" ")
|
130
|
+
platform_arg = "/p:Platform=#{platform}"
|
131
|
+
platform_arg = "/p:Platform=\"#{platform}\"" if platform.include?(" ")
|
132
|
+
build_commands << "#{msbuild_arg} #{sln_arg} /p:Configuration=#{configuration} #{platform_arg}"
|
133
|
+
end
|
135
134
|
end
|
136
|
-
build_commands
|
137
135
|
end
|
136
|
+
build_commands
|
137
|
+
end
|
138
138
|
end
|
139
139
|
|
140
140
|
if defined?(DEBUG)
|
@@ -143,4 +143,4 @@ if defined?(DEBUG)
|
|
143
143
|
msb = MSBuild.new
|
144
144
|
pp msb
|
145
145
|
puts
|
146
|
-
end
|
146
|
+
end
|