maven deps, unpacking, jar generation
This commit is contained in:
parent
bf23410bab
commit
bf6df2d68f
84
Rakefile
84
Rakefile
|
@ -1,40 +1,37 @@
|
|||
require 'ant'
|
||||
|
||||
$:.unshift './lib'
|
||||
|
||||
require 'red_storm'
|
||||
|
||||
# EDIT JRUBY_JAR to fit your installation
|
||||
JRUBY_JAR = "$HOME/.rvm/rubies/jruby-1.6.5/lib/jruby-complete-1.6.5.jar"
|
||||
begin
|
||||
# will work from gem, since lib dir is in gem require_paths
|
||||
require 'red_storm'
|
||||
rescue LoadError
|
||||
# will work within RedStorm dev project
|
||||
$:.unshift './lib'
|
||||
require 'red_storm'
|
||||
end
|
||||
|
||||
CWD = Dir.pwd
|
||||
TARGET_DIR = "#{CWD}/target"
|
||||
TARGET_SRC_DIR = "#{TARGET_DIR}/src"
|
||||
TARGET_CLASSES_DIR = "#{TARGET_DIR}/classes"
|
||||
TARGET_DEPENDENCY_DIR = "#{TARGET_DIR}/dependency"
|
||||
TARGET_DEPENDENCY_UNPACKED_DIR = "#{TARGET_DIR}/dependency-unpacked"
|
||||
|
||||
JAVA_SRC_DIR = "#{RedStorm::REDSTORM_HOME}/src/main"
|
||||
JRUBY_SRC_DIR = "#{RedStorm::REDSTORM_HOME}/lib/red_storm"
|
||||
JRUBY_SRC_DIR = "#{RedStorm::REDSTORM_HOME}/lib/red_storm"
|
||||
|
||||
SRC_EXAMPLES = "#{RedStorm::REDSTORM_HOME}/examples"
|
||||
DST_EXAMPLES = "#{CWD}/examples"
|
||||
|
||||
task :default => [:clean, :build]
|
||||
|
||||
task :launch, :class_file do |t, args|
|
||||
# TARGET_DIR="./target"
|
||||
# DEPENDENCY_DIR="${TARGET_DIR}/dependency"
|
||||
# CLASSES_DIR="${TARGET_DIR}/classes"
|
||||
#
|
||||
system("java -cp \"#{TARGET_CLASSES_DIR}:#{TARGET_DEPENDENCY_DIR}/*\" redstorm.TopologyLauncher #{args[:class_file]}")
|
||||
end
|
||||
|
||||
task :clean_deps => :clean do
|
||||
ant.delete :dir => TARGET_DEPENDENCY_DIR
|
||||
end
|
||||
|
||||
task :clean do
|
||||
ant.delete :dir => TARGET_CLASSES_DIR
|
||||
ant.delete :dir => TARGET_SRC_DIR
|
||||
ant.delete :dir => TARGET_DIR
|
||||
end
|
||||
|
||||
|
||||
task :setup do
|
||||
ant.mkdir :dir => TARGET_DIR
|
||||
ant.mkdir :dir => TARGET_CLASSES_DIR
|
||||
|
@ -43,21 +40,54 @@ task :setup do
|
|||
fileset :dir => TARGET_DEPENDENCY_DIR
|
||||
fileset :dir => TARGET_CLASSES_DIR
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
task :install => [:deps, :build]
|
||||
|
||||
task :unpack do
|
||||
system("rmvn dependency:unpack -f pom.xml")
|
||||
end
|
||||
|
||||
task :jar => :unpack do
|
||||
ant.jar :destfile => "#{TARGET_DIR}/cluster-topology.jar" do
|
||||
fileset :dir => TARGET_CLASSES_DIR
|
||||
fileset :dir => TARGET_DEPENDENCY_UNPACKED_DIR
|
||||
fileset :dir => CWD do
|
||||
exclude :name => "target/**/*"
|
||||
end
|
||||
manifest do
|
||||
attribute :name => "Main-Class", :value => "redstorm.TopologyLauncher"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :examples do
|
||||
if File.identical?(SRC_EXAMPLES, DST_EXAMPLES)
|
||||
STDERR.puts("error: cannot copy examples into itself")
|
||||
exit(1)
|
||||
end
|
||||
if File.exist?(DST_EXAMPLES)
|
||||
STDERR.puts("error: directory #{DST_EXAMPLES} already exists")
|
||||
exit(1)
|
||||
end
|
||||
|
||||
puts("copying examples into #{DST_EXAMPLES}")
|
||||
system("mkdir #{DST_EXAMPLES}")
|
||||
system("cp -r #{SRC_EXAMPLES}/* #{DST_EXAMPLES}")
|
||||
end
|
||||
|
||||
task :deps do
|
||||
system("rmvn dependency:copy-dependencies")
|
||||
system("cp #{JRUBY_JAR} #{TARGET_DEPENDENCY_DIR}")
|
||||
system("rmvn dependency:copy-dependencies -f pom.xml")
|
||||
end
|
||||
|
||||
task :build => :setup do
|
||||
# generate the JRuby proxy classes in java, required by the Java bindings
|
||||
# compile the JRuby proxy classes to Java
|
||||
build_jruby("#{JRUBY_SRC_DIR}/proxy")
|
||||
|
||||
# compile the JRuby proxy classes
|
||||
# compile the generated Java proxy classes
|
||||
build_java_dir("#{TARGET_SRC_DIR}")
|
||||
|
||||
# generate the JRuby proxy classes in java, required by the Java bindings
|
||||
# generate the JRuby topology launcher
|
||||
build_jruby("#{JRUBY_SRC_DIR}/topology_launcher.rb")
|
||||
|
||||
# compile the JRuby proxy classes
|
||||
|
@ -82,7 +112,7 @@ def build_java_dir(source_folder)
|
|||
)
|
||||
end
|
||||
|
||||
def build_jruby(source_folder)
|
||||
def build_jruby(source_path)
|
||||
puts("\n--> Compiling JRuby")
|
||||
system("cd #{RedStorm::REDSTORM_HOME}; jrubyc -t #{TARGET_SRC_DIR} --verbose --java -c \"#{TARGET_DEPENDENCY_DIR}/storm-0.5.3.jar\" -c \"#{TARGET_CLASSES_DIR}\" #{source_folder}")
|
||||
system("cd #{RedStorm::REDSTORM_HOME}; jrubyc -t #{TARGET_SRC_DIR} --verbose --java -c \"#{TARGET_DEPENDENCY_DIR}/storm-0.5.3.jar\" -c \"#{TARGET_CLASSES_DIR}\" #{source_path}")
|
||||
end
|
||||
|
|
13
bin/redstorm
13
bin/redstorm
|
@ -1,5 +1,14 @@
|
|||
#!/usr/bin/env ruby
|
||||
# $:.unshift './lib'
|
||||
|
||||
require 'rubygems'
|
||||
require 'red_storm'
|
||||
|
||||
begin
|
||||
# will work from gem, since lib dir is in gem require_paths
|
||||
require 'red_storm'
|
||||
rescue LoadError
|
||||
# will work within RedStorm dev project
|
||||
$:.unshift './lib'
|
||||
require 'red_storm'
|
||||
end
|
||||
|
||||
RedStorm::Application.new.run(ARGV.dup)
|
||||
|
|
61
pom.xml
61
pom.xml
|
@ -5,7 +5,7 @@
|
|||
<groupId>redstorm</groupId>
|
||||
<artifactId>redstorm</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<name>Redstorm Storm/JRuby integration project</name>
|
||||
<name>RedStorm Storm JRuby bindings</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -16,6 +16,11 @@
|
|||
<id>clojars</id>
|
||||
<url>http://clojars.org/repo/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<url>http://repo1.maven.org/maven2</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
@ -23,41 +28,43 @@
|
|||
<groupId>storm</groupId>
|
||||
<artifactId>storm</artifactId>
|
||||
<version>0.5.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jruby</groupId>
|
||||
<artifactId>jruby-complete</artifactId>
|
||||
<version>1.6.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- <build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>copy</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/java/jars</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
-->
|
||||
<!-- <build>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.jruby</groupId>
|
||||
<artifactId>jruby-complete</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<type>jar</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${basedir}/target/dependency-unpacked</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack</id>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
-->
|
||||
|
||||
</project>
|
|
@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|||
s.email = ["colin.surprenant@gmail.com"]
|
||||
s.homepage = "http://github.com/praized/storm-jruby"
|
||||
s.summary = "Storm JRuby Bindings"
|
||||
s.description = "Storm JRuby Bindings Gem"
|
||||
s.description = "Storm 0.5.4 with JRuby 1.6.5 Bindings Gem"
|
||||
|
||||
s.required_rubygems_version = ">= 1.3.0"
|
||||
s.rubyforge_project = "redstorm"
|
||||
|
@ -22,10 +22,9 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.add_development_dependency "rubyforge"
|
||||
|
||||
# Test dependencies
|
||||
s.add_development_dependency "rspec", ["~> 2.6.0"]
|
||||
s.add_development_dependency "rake", ["~> 0.9.2"]
|
||||
|
||||
# s.add_development_dependency "rspec", ["~> 2.6.0"]
|
||||
s.add_runtime_dependency "rake", ["~> 0.9.2"]
|
||||
s.add_runtime_dependency "ruby-maven", ["~> 3.0.3.0.28.5"]
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue