Skip to content

Commit 146fd80

Browse files
committed
Revert unwinding directories to file tasks
Adding file tasks within a rake tasks doesn't work. Dependencies must be defined prior to running the rake resolver. It also had the downside of priting too many log messages. Implementing own cp_r which invokes tasks definitions is the better solution.
1 parent f3366b7 commit 146fd80

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

recipes/installer-inno/50-generate-filelist.rake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ file filelist_iss => [__FILE__, ovl_expand_file(sandbox_task.sandboxfile_listfil
1313
else
1414
components = "ruby"
1515
end
16-
unless File.directory?(path)
16+
args = if File.directory?(path)
17+
flags = "recursesubdirs createallsubdirs #{flags}"
18+
source = "../../#{path}/*"
19+
dest = "{app}/#{reltosandbox_path}"
20+
else
1721
source = "../../#{path}"
1822
dest = "{app}/#{File.dirname(reltosandbox_path)}"
19-
"Source: #{source}; DestDir: #{dest}; Flags: #{flags}; Components: #{components}"
2023
end
2124

25+
"Source: #{source}; DestDir: #{dest}; Flags: #{flags}; Components: #{components}"
2226
end.join("\n")
2327
File.write(filelist_iss, out)
2428
end

recipes/sandbox/50-gather-sandbox-files.rake

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,3 @@ sandboxfiles_rel = File.readlines(ovl_expand_file(sandboxfile_listfile)) + File.
44
sandboxfiles_rel = sandboxfiles_rel.map{|path| path.chomp }
55
sandboxfiles_rel += import_files.values
66
self.sandboxfiles += sandboxfiles_rel.map{|path| File.join(sandboxdir, path)}
7-
# go through directories and gather all files recursively
8-
self.sandboxfiles = sandboxfiles.flat_map do |path|
9-
unpack_path = path.sub(sandboxdir, unpackdirmgw)
10-
if File.directory?(unpack_path)
11-
Dir.glob(File.join(unpack_path, "**/*")).map do |pa|
12-
pa.sub(unpackdirmgw, sandboxdir)
13-
end
14-
else
15-
path
16-
end
17-
end

recipes/sandbox/60-side-by-side-assembly.rake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ core_dll_defs = [
2525
/^libgcc_s_.*.dll$/,
2626
]
2727

28+
# create rake tasks to trigger additional processing of so files
29+
ext_dll_defs.keys.each do |so_file|
30+
self.sandboxfiles << File.join(sandboxdir, so_file)
31+
end
32+
2833
core_dlls, dlls = dlls.partition do |destpath|
2934
core_dll_defs.any? { |re| re =~ File.basename(destpath) }
3035
end

recipes/sandbox/80-copy-msys-files.rake

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,26 @@ self.sandboxfiles.each do |destpath|
22
directory File.dirname(destpath)
33
unless Rake::Task.task_defined?(destpath)
44
file destpath => [destpath.sub(sandboxdir, unpackdirmgw), File.dirname(destpath)] do |t|
5-
if File.file?(t.prerequisites.first)
5+
# Copy file like cp_r, but excluding files with task definition
6+
# cp_r(t.prerequisites.first, t.name)
7+
8+
if FileTest.directory?(t.prerequisites.first)
9+
Dir.glob("**/*", base: t.prerequisites.first, flags: File::FNM_DOTMATCH) do |rel|
10+
dst = File.join(t.name, rel)
11+
if Rake::Task.task_defined?(dst)
12+
# invoke task definition and skip cp
13+
Rake::Task[dst].invoke
14+
next
15+
end
16+
src = File.join(t.prerequisites.first, rel)
17+
if FileTest.directory?(src)
18+
mkdir(dst, verbose: false) unless FileTest.directory?(dst)
19+
else
20+
cp(src, dst, verbose: false)
21+
end
22+
end
23+
else
624
cp(t.prerequisites.first, t.name)
7-
elsif File.directory?(t.prerequisites.first) && !File.exist?(t.name)
8-
mkdir t.name
925
end
1026
end
1127
end

0 commit comments

Comments
 (0)