Created
November 25, 2010 01:28
-
-
Save cfurrow/714764 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@project_directory = "org/carlfurrow/unhuman" | |
@project_jar = @project_directory.gsub(/\//,".") + ".jar" | |
desc "Build the app, output a jar, then run" | |
task :default, [:env] do |t, arg| | |
Rake::Task[:compile].execute | |
# copy the manifest file | |
sh "cp src/#{@project_directory}/Manifest.txt bin/" | |
Rake::Task[:jar].execute | |
Rake::Task[:run].execute(arg) | |
end | |
desc "Compile all java files, output .class to bin dir" | |
task :compile do | |
sh "javac -d bin/ src/#{@project_directory}/*.java" | |
end | |
desc "Jar-up the bin directory" | |
task :jar do | |
# get inside of the bin directory, so that the jar doesn't contain bin/ | |
cd "bin" | |
# jar options jarfile inputfiles | |
sh "jar cvfm ../jar/#{@project_jar} Manifest.txt ." | |
cd ".." | |
end | |
desc "Run the output jar" | |
task :run, [:env] do |t, args| | |
if args.env.nil? | |
args.env = 'macosx' | |
end | |
ref_string = get_references_string( get_references() ) | |
sh "java -cp .#{ref_string} -Djava.library.path=lib/native/#{args.env} org.carlfurrow.unhuman.Game" | |
end | |
def get_references | |
references = [] | |
references.push('lib/lwjgl/lwjgl.jar') | |
references.push('lib/lwjgl/lwjgl_util.jar') | |
references.push('lib/lwjgl/lwjgl_fmod3.jar') | |
references.push('lib/lwjgl/lwjgl_devil.jar') | |
references.push('lib/lwjgl/lwjgl_jinput.jar') | |
references.push("jar/#{@project_jar}") | |
reference | |
end | |
def get_references_string(references) | |
output = "" | |
references.each do |r| | |
output += ":#{r}" | |
end | |
output | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment