-
-
Save jaydonnell/231345 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
# instant.rake | |
# Rake rules for compiling and running trivial Java programs | |
# | |
# Usage: rake com.example.MonkeyShines | |
# Source goes under ./src | |
# Classes end up under ./target | |
require 'rake/clean' | |
libs = FileList["lib/*"] | |
libs << "target" | |
JavaClassPaths = libs.join(":") | |
# regex should weed out anything containing "/", i.e. paths | |
rule(/^[^\/]+\.\w/ => lambda {|tn| "src/#{tn.gsub(".", "/")}.class"} ) do |t| | |
puts command = "java -classpath #{JavaClassPaths} #{t.name}" | |
system(command) | |
end | |
rule ".class" => [".java", "target"] do |t| | |
puts command = "javac -classpath #{JavaClassPaths} #{t.source} -d target" | |
system(command) | |
end | |
desc "make directories, or whatever" | |
task :setup => ["src", "lib"] | |
directory "target" | |
directory "src" | |
directory "lib" | |
CLEAN.include("target") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment