diff --git a/ivy/storm_dependencies.xml b/ivy/storm_dependencies.xml new file mode 100644 index 0000000..983845c --- /dev/null +++ b/ivy/storm_dependencies.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/ivy/topology_dependencies.xml b/ivy/topology_dependencies.xml new file mode 100644 index 0000000..7c1004a --- /dev/null +++ b/ivy/topology_dependencies.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/lib/red_storm/application.rb b/lib/red_storm/application.rb index 370ac04..aa4dcb8 100644 --- a/lib/red_storm/application.rb +++ b/lib/red_storm/application.rb @@ -20,10 +20,12 @@ DST_EXAMPLES = "#{CWD}/examples" SRC_IVY_DIR = "#{RedStorm::REDSTORM_HOME}/ivy" DST_IVY_DIR = "#{CWD}/ivy" -CUSTOM_DEPENDENCIES = "#{CWD}/Dependencies" DEFAULT_IVY_SETTINGS = "#{SRC_IVY_DIR}/settings.xml" CUSTOM_IVY_SETTINGS = "#{DST_IVY_DIR}/settings.xml" - +DEFAULT_IVY_STORM_DEPENDENCIES = "#{SRC_IVY_DIR}/storm_dependencies.xml" +CUSTOM_IVY_STORM_DEPENDENCIES = "#{DST_IVY_DIR}/storm_dependencies.xml" +DEFAULT_IVY_TOPOLOGY_DEPENDENCIES = "#{SRC_IVY_DIR}/topology_dependencies.xml" +CUSTOM_IVY_TOPOLOGY_DEPENDENCIES = "#{DST_IVY_DIR}/topology_dependencies.xml" module RedStorm diff --git a/lib/tasks/red_storm.rake b/lib/tasks/red_storm.rake index 2eb765a..0672a53 100644 --- a/lib/tasks/red_storm.rake +++ b/lib/tasks/red_storm.rake @@ -158,19 +158,14 @@ end task :deps => "ivy:install" do puts("\n--> Installing dependencies") - dependencies = File.exists?(CUSTOM_DEPENDENCIES) ? eval(File.read(CUSTOM_DEPENDENCIES)) : DEFAULT_DEPENDENCIES ant.configure 'file' => File.exists?(CUSTOM_IVY_SETTINGS) ? CUSTOM_IVY_SETTINGS : DEFAULT_IVY_SETTINGS - dependencies[:storm_artifacts].each do |dependency| - artifact, transitive = dependency.split(/\s*,\s*/) - ivy_retrieve(*artifact.split(':').concat([transitive.split(/\s*=\s*/).last, "#{TARGET_DEPENDENCY_DIR}/storm", "default"])) - end + ant.resolve 'file' => File.exists?(CUSTOM_IVY_STORM_DEPENDENCIES) ? CUSTOM_IVY_STORM_DEPENDENCIES : DEFAULT_IVY_STORM_DEPENDENCIES + ant.retrieve 'pattern' => "#{TARGET_DEPENDENCY_DIR}/storm/[conf]/[artifact]-[revision].[ext]", 'sync' => "true" - dependencies[:topology_artifacts].each do |dependency| - artifact, transitive = dependency.split(/\s*,\s*/) - ivy_retrieve(*artifact.split(':').concat([transitive.split(/\s*=\s*/).last, "#{TARGET_DEPENDENCY_DIR}/topology", "default"])) - end -end + ant.resolve 'file' => File.exists?(CUSTOM_IVY_TOPOLOGY_DEPENDENCIES) ? CUSTOM_IVY_TOPOLOGY_DEPENDENCIES : DEFAULT_IVY_TOPOLOGY_DEPENDENCIES + ant.retrieve 'pattern' => "#{TARGET_DEPENDENCY_DIR}/topology/[conf]/[artifact]-[revision].[ext]", 'sync' => "true" +end task :jar, [:include_dir] => [:clean_jar] do |t, args| puts("\n--> Generating JAR file #{TARGET_CLUSTER_JAR}") @@ -248,30 +243,3 @@ def build_jruby(source_path) status = JRuby::Compiler::compile_argv(argv) end end - -def truefalse(s) - return true if s.to_s.downcase =~ /1|yes|true/ - return false if s.to_s.downcase =~ /0|no|false/ - nil -end - -def ivy_retrieve(org, mod, rev, transitive, dir, conf) - ant.resolve({ - 'organisation' => org, - 'module' => mod, - 'revision' => rev, - 'inline' => true, - 'transitive' => truefalse(transitive), - 'conf' => conf, - }) - - ant.retrieve({ - 'organisation' => org, - 'module' => mod, - 'revision' => rev, - 'pattern' => "#{dir}/[conf]/[artifact]-[revision].[ext]", - 'inline' => true, - 'transitive' => truefalse(transitive), - 'conf' => conf, - }) -end