view Rakefile @ 15:8ed3a7b4f6e9 default tip

Changed homepage URL.
author Mikhail Kryshen <mikhail@kryshen.net>
date Sun, 26 Jan 2014 16:12:22 +0400
parents 9726d78eb848
children
line wrap: on
line source

require 'mirah'
require 'ant'
require 'rake/clean'

SRC = FileList['src/**/*.mirah']

CLEAN.include 'build/**/*.class'
CLEAN.include 'build/**/version.properties'
CLEAN.include 'dist/*.jar'

task :default => [:compile]

task :compile => SRC do
  Mirah::compile '--jvm', '1.6', '-d', 'build', *SRC

  begin
    hga = Hash[*File.read('.hg_archival.txt').split(/: |\n+/)]
    version = "#{hga['latesttag']}.#{hga['latesttagdistance']}"
  rescue Errno::ENOENT
    version = `hg log -r tip --template "{latesttag}.{latesttagdistance}"`
  end

  File.open('build/net/kryshen/charamega/version.properties', 'w') do |f|
    f.write "version = #{version}\n"
  end
end

task :run => [:compile] do
  sh 'java -cp build:res net/kryshen/charamega/Ui'
end

task :jar => [:compile] do
  ant.jar :jarfile => 'dist/charamega.jar' do
    fileset :dir => 'build'
    fileset :dir => 'res'
    manifest do
      attribute :name => 'Main-Class', :value => 'net.kryshen.charamega.Ui'
      attribute :name => 'Application-Name', :value => 'Charamega'
      attribute :name => 'Permissions', :value => 'sandbox'
      attribute :name => 'Codebase', :value => '*'
      attribute :name => 'Application-Library-Allowable-Codebase', :value => '*'
    end
  end
end