Skip to content

Commit 7a6ce47

Browse files
committed
Fix Rakefile.
1 parent b66d642 commit 7a6ce47

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

Rakefile

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ require 'rake/clean'
2222
# configuration
2323
# --------------------------------------------------------------------------- #
2424
PROJECT = 'Cube.FileSystem.SevenZip'
25-
LIBRARY = '../packages'
25+
LIB = '../packages'
2626
NATIVE = '../resources/native'
2727
BRANCHES = ['stable', 'net35']
2828
FRAMEWORKS = ['net45', 'net35']
2929
PLATFORMS = ['Any CPU', 'x86', 'x64']
3030
CONFIGS = ['Release', 'Debug']
31-
COPIES = ['Libraries/Tests', 'Applications/Ice/Tests', 'Applications/Ice/Main']
31+
LIB_DEST = ['Libraries/Tests', 'Applications/Ice/Tests', 'Applications/Ice/Main']
3232
PACKAGES = ["Libraries/Core/#{PROJECT}.nuspec"]
3333
TESTCASES = {"#{PROJECT}.Tests" => 'Libraries/Tests',
3434
"#{PROJECT}.Ice.Tests" => 'Applications/Ice/Tests'}
@@ -70,7 +70,7 @@ desc "Clean objects and build the solution in pre-defined branches and platforms
7070
task :clean_build => [:clean] do
7171
BRANCHES.product(['Any CPU']) { |e|
7272
sh("git checkout #{e[0]}")
73-
RakeFileUtils::rm_rf(FileList.new("#{LIBRARY}/cube.*"))
73+
RakeFileUtils::rm_rf(FileList.new("#{LIB}/cube.*"))
7474
Rake::Task[:build].reenable
7575
Rake::Task[:build].invoke(e[1])
7676
}
@@ -91,30 +91,29 @@ end
9191
# --------------------------------------------------------------------------- #
9292
desc "Build and test projects in the current branch."
9393
task :test => [:build] do
94+
pf = PLATFORMS[0]
9495
fw = %x(git symbolic-ref --short HEAD).chomp
9596
fw = 'net45' if (fw != 'net35')
96-
bin = ['bin', PLATFORMS[0], CONFIGS[0], fw].join('/')
97-
97+
bin = ['bin', pf, CONFIGS[0], fw].join('/')
9898
Rake::Task[:copy].reenable
99-
Rake::Task[:copy].invoke(fw)
100-
101-
TESTCASES.each { |proj, root|
102-
dir = "#{root}/#{bin}"
103-
sh("#{TEST} \"#{dir}/#{proj}.dll\" --work=\"#{dir}\"")
104-
}
99+
Rake::Task[:copy].invoke(pf, fw)
100+
TESTCASES.each { |p, d| sh(%(#{TEST} "#{d}/#{bin}/#{p}.dll" --work="#{d}/#{bin}")) }
105101
end
106102

107103
# --------------------------------------------------------------------------- #
108104
# copy
109105
# --------------------------------------------------------------------------- #
110106
desc "Copy resources to the bin directories."
111-
task :copy, [:framework] do |_, e|
112-
fw = (e.framework != nil) ? [e.framework] : FRAMEWORKS
113-
fw.product(PLATFORMS, CONFIGS) { |set|
114-
pf = (set[1] == 'Any CPU') ? 'x64' : set[1]
115-
bin = ['bin', set[1], set[2], set[0]].join('/')
116-
COPIES.each { |root|
117-
src = Dir::glob("#{NATIVE}/#{pf}/7z/7z.*")
107+
task :copy, [:platform, :framework] do |_, e|
108+
v0 = (e.platform != nil) ? [e.platform ] : PLATFORMS
109+
v1 = (e.framework != nil) ? [e.framework] : FRAMEWORKS
110+
111+
v0.product(CONFIGS, v1) { |set|
112+
pf = (set[0] == 'Any CPU') ? 'x64' : set[0]
113+
bin = ['bin', set[0], set[1], set[2]].join('/')
114+
115+
LIB_DEST.each { |root|
116+
src = FileList.new("#{NATIVE}/#{pf}/7z/7z.*")
118117
dest = "#{root}/#{bin}"
119118
RakeFileUtils::mkdir_p(dest)
120119
RakeFileUtils::cp_r(src, dest)

0 commit comments

Comments
 (0)