Subversion Repositories Projects

Rev

Rev 219 | Blame | Last modification | View Log | RSS feed

#!/usr/bin/env ruby
# little ruby script to build DUBwise
#
# Author: Marcus -LiGi- Bueschleb
#
# see README for further Infos


resdir="res/"


if ARGV.length==2
  bindir=ARGV[1]
  puts `rm -rf #{bindir}`
else
  bindir="bin"
end


 ARGV<<"" if ARGV==[]
case ARGV[0]
 when "p910"
  screensizes=["200x300"]
  voice_modes=["en_speedy"]
  bluetooth_modes=["off"]
  devicecontrol_modes=["off"]
  fileapi_modes=["off"]
  cldc11_modes=["off"]

 when "test"
  screensizes=["240x320"]
  voice_modes=["en_speedy"]
  bluetooth_modes=["on"]
  devicecontrol_modes=["on"]
  fileapi_modes=["on"]
  cldc11_modes=["on"]
  #firmware_modes=["fc_mk3mag_firmwares"]
  #firmware_modes=["all_firmwares"]
  firmware_modes=["no_firmwares"]

 when "bltest"
  screensizes=["240x320"]
  voice_modes=["en_speedy"]
  bluetooth_modes=["on"]
  devicecontrol_modes=["on"]
  fileapi_modes=["on"]
  cldc11_modes=["on"]
  firmware_modes=["all_firmwares"]

 when "test2"
  screensizes=["176x220"]
  voice_modes=["en_speedy"]
  bluetooth_modes=["on"]
  devicecontrol_modes=["on"]
  fileapi_modes=["on"]
  cldc11_modes=["on"]
  firmware_modes=["all_firmwares"]

 when "off"
  screensizes=["240x320"]
  voice_modes=["en_speedy"]
  bluetooth_modes=["off"]
  devicecontrol_modes=["off"]
  fileapi_modes=["off"]
  cldc11_modes=["off"]

 when "alloff"
  screensizes=["128x128","176x220","200x300","240x320","340x400","480x640"]
  voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","wav"]
  bluetooth_modes=["off"]
  devicecontrol_modes=["off"]
  fileapi_modes=["off"]
  cldc11_modes=["off"]

 when "n80"
  bluetooth_modes=["on"]
  screensizes=["340x400"]
  voice_modes=["en_speedy"]
  fileapi_modes=["on"]
  devicecontrol_modes=["on"]
  cldc11_modes=["on"]
  firmware_modes=["all_firmwares"]
 when "common"
  screensizes=["128x128","176x220","200x300","240x320","340x400","480x640"]
  voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","wav"]
  bluetooth_modes=["on"]
  fileapi_modes=["on"]
  devicecontrol_modes=["on"]
  cldc11_modes=["on"]
  firmware_modes=["all_firmwares"]

 else
#  screensizes=["128x128","176x220","200x300","240x320","340x400","480x640"]
#  voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","wav"]
#  bluetooth_modes=["on","off"]
#  fileapi_modes=["on","off"]
# devicecontrol_modes=["on","off"]
#  cldc11_modes=["on","off"]
#  firmware_modes=["no_firmwares","fc_mk3mag_firmware","all_firmwares"]
  puts "no valid profile given"
  exit
end


puts `mv build.props build.props.bak`
puts `ant clean`
puts `mkdir #{bindir}`


propertys={}

firmware_modes.each {|firmware|
cldc11_modes.each { |cldc11|
devicecontrol_modes.each { |devicecontrol|
  fileapi_modes.each { |fileapi|
      bluetooth_modes.each { |bluetooth|
        screensizes.each { |screensize|
          voice_modes.each { |voice_mode|

            p "cleaning ressources"
            p `rm -rf tmp/res`
            p `mkdir tmp/res`

            p `cp -v res/images_by_screensize/#{screensize}/* tmp/res/`
              p `cp -v res/firmwares/#{firmware}/* tmp/res/`

            propertys["screensize"]=screensize
           
            p "voice_mode" + voice_mode
            p "Screensize " + screensize

            propertys["voice_mode"]=voice_mode
            propertys["bluetooth"]=bluetooth
            propertys["fileapi"]=fileapi
            propertys["devicecontrol"]=devicecontrol
            propertys["cldc11"]=cldc11


              propertys["basename"]="DUBwise-#{screensize}-#{cldc11=="on"?"cldc11":"cldc10"}-#{voice_mode}-#{firmware}-bluetooth_#{bluetooth}-fileapi_#{fileapi}-devicecontrol_#{devicecontrol}"
            p `cp -v res/voice_samples_by_name/#{voice_mode}/* tmp/res/`  
         

          prefs_file= File.new("build.props","w")
          propertys.each_pair {|name,value|
            p "writing props " + name+"="+value+"\n"
            prefs_file <<       name+"="+value+"\n"
          }
          prefs_file.close

          `ant build`.each_line {       |l| puts l }

          `mkdir -p #{bindir}/#{screensize}/#{cldc11=="on"?"cldc11":"cldc10"}/#{voice_mode}/bluetooth_#{bluetooth}/fileapi_#{fileapi}/devicecontrol_#{devicecontrol}`

#          `mv build/bin/#{propertys["basename"]}* #{bindir}/#{screensize}/#{cldc11=="on"?"cldc11":"cldc10"}/#{voice_mode}/bluetooth_#{bluetooth}/fileapi_#{fileapi}/devicecontrol_#{devicecontrol}`



          `mkdir -p #{bindir}/#{screensize}/#{cldc11=="on"?"cldc11":"cldc10"}/#{voice_mode}/bluetooth_#{bluetooth}/fileapi_#{fileapi}/devicecontrol_#{devicecontrol}`

          `mv build/bin/#{propertys["basename"]}* #{bindir}/#{screensize}/#{cldc11=="on"?"cldc11":"cldc10"}/#{voice_mode}/bluetooth_#{bluetooth}/fileapi_#{fileapi}/devicecontrol_#{devicecontrol}`
       
        }


      }
    }
  }
}
}
}
    puts `mv -v  build.props.bak build.props`