issue #73 - refactored dependencies control to now use ivy xml files
This commit is contained in:
parent
ad2dd0f201
commit
bad6f324e7
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="redstorm" module="storm-deps"/>
|
||||
<dependencies>
|
||||
<dependency org="storm" name="storm" rev="0.8.2" conf="default" transitive="true" />
|
||||
</dependencies>
|
||||
</ivy-module>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="redstorm" module="topology-deps"/>
|
||||
<dependencies>
|
||||
<dependency org="org.jruby" name="jruby-core" rev="1.7.3" conf="default" transitive="true"/>
|
||||
<override org="org.yaml" module="snakeyaml" rev="1.9"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue