From 65e5d19c551539e7219fa87f3d66388eb8919297 Mon Sep 17 00:00:00 2001 From: Mark and Ariel Date: Mon, 28 Jul 2014 15:05:09 -0400 Subject: [PATCH] adding arbitrary resources to target/classes instead of just the jar --- lib/tasks/red_storm.rake | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/tasks/red_storm.rake b/lib/tasks/red_storm.rake index e84e6bb..4c61320 100644 --- a/lib/tasks/red_storm.rake +++ b/lib/tasks/red_storm.rake @@ -177,8 +177,20 @@ desc "install storm and topology dependencies in #{RedStorm::TARGET_DEPENDENCY_D task :deps => ["ivy:install", :ivy_config, :storm_deps, :topology_deps] do end +desc "copies topology resource files into the #{RedStorm::TARGET_CLASSES_DIR} directory" +task :cp_resources, [:include_dir] do |t, args| + if args[:include_dir] + dirs = args[:include_dir].split(":") + #add any resources/ dir in the tree in the jar root - requirement for ShellBolt multilang resources + all_resource_dirs = dirs.map do |dir| + Dir.glob("#{dir}/**/resources") + end + FileUtils.cp_r(all_resource_dirs.flatten, RedStorm::TARGET_CLASSES_DIR, verbose: true) + end +end + desc "generate #{RedStorm::TARGET_CLUSTER_JAR}" -task :jar, [:include_dir] => [:clean_jar] do |t, args| +task :jar, [:include_dir] => [:clean_jar, :cp_resources] do |t, args| puts("\n--> Generating JAR file #{RedStorm::TARGET_CLUSTER_JAR}") ant.jar 'destfile' => RedStorm::TARGET_CLUSTER_JAR do @@ -199,17 +211,6 @@ task :jar, [:include_dir] => [:clean_jar] do |t, args| if args[:include_dir] dirs = args[:include_dir].split(":") - # first add any resources/ dir in the tree in the jar root - requirement for ShellBolt multilang resources - dirs.each do |dir| - resources_dirs = Dir.glob("#{dir}/**/resources") - resources_dirs.each do |resources_dir| - resources_parent = resources_dir.gsub("/resources", "") - fileset 'dir' => resources_parent do - include 'name' => "resources/**/*" - end - end - end - # include complete source dir tree (note we don't care about potential duplicated resources dir) fileset 'dir' => RedStorm::CWD do dirs.each{|dir| include 'name' => "#{dir}/**/*"}