class Rake::Delphi::Android::SDK

Constants

PROPERTIES

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/rake/delphi/android/sdk.rb, line 26
def initialize
  super(false)
  read_properties
end

Public Instance Methods

aapt() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 121
def aapt
  @aapt = ENV['DELPHI_ANDROID_SDK_BUILD_TOOLS_PATH'] || @aapt
  warn 'Please, set DELPHI_ANDROID_SDK_BUILD_TOOLS_PATH to path where aapt.exe is located' unless @aapt
  @aapt
end
keystore() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 133
def keystore
  @keystore = ENV['DELPHI_ANDROID_KEYSTORE'] || @keystore
  warn 'Please, set DELPHI_ANDROID_KEYSTORE to the path where a keystore (to sign an application) is located' unless @keystore
  @keystore
end
lib() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 103
def lib
  @lib = ENV['DELPHI_ANDROID_SDK_LIBPATH'] || @lib
  warn 'Please, define DELPHI_ANDROID_SDK_LIBPATH environment variable' unless @lib
  @lib
end
lib=(value) click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 88
def lib=(value)
  @lib, null  = value.split(';', 2)
end
linker() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 97
def linker
  @linker = ENV['DELPHI_ANDROID_SDK_LINKER'] || @linker
  warn "Please, define DELPHI_ANDROID_SDK_LINKER environment variable.\n Otherwise you may get 'File not found: ldandroid.exe' error" unless @linker
  @linker
end
linker_option() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 109
def linker_option
  @linker_option = ENV['DELPHI_ANDROID_SDK_LINKER_OPTION'] || @linker_option
  warn 'Please, define DELPHI_ANDROID_SDK_LINKER_OPTION environment variable' unless @linker_option
  @linker_option
end
linker_option=(value) click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 92
def linker_option=(value)
  null, @linker_option = value.split(';', 2)
  @linker_option = ' -L \"' + @linker_option + '\"'
end
platform() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 127
def platform
  @platform = ENV['DELPHI_ANDROID_SDK_PLATFORM_PATH'] || @platform
  warn 'Please, set DELPHI_ANDROID_SDK_PLATFORM_PATH to the path where android.jar is located' unless @platform
  @platform
end
read_default_config() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 31
def read_default_config
  begin
    require 'win32/registry'
    @reg_keys = {::Win32::Registry::HKEY_CURRENT_USER => 'HKCU',
      ::Win32::Registry::HKEY_LOCAL_MACHINE => 'HKLM'}

    [::Win32::Registry::HKEY_CURRENT_USER, \
        ::Win32::Registry::HKEY_LOCAL_MACHINE].each do |regRoot|
      begin
        key = 'Default_Android'
        Logger.trace(Logger::DEBUG, "Finding #{@reg_keys[regRoot]}\\#{@platform_SDKs}\\#{key}")
        regRoot.open(@platform_SDKs) do |reg|
            reg_typ, reg_val = reg.read(key)
          Logger.trace(Logger::DEBUG, "Found '#{reg_val}'")
          return reg_val
        end
      rescue ::Win32::Registry::Error
        Logger.trace(Logger::DEBUG, "No reg key '#{regRoot}'?!")
      end
    end
    return nil
  rescue LoadError
    Logger.trace(Logger::DEBUG, 'No `win32/registry` gem?!')
    return nil
  end
end
read_properties() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 58
def read_properties
  @platform_SDKs = @@regroot + '\\PlatformSDKs'
  default_android = read_default_config
  return unless default_android
  reg_default = @platform_SDKs + '\\' + default_android
  begin
    PROPERTIES.each do |prop, reg_key|
      next unless reg_key
      # current user values have precedence over local machine
      [::Win32::Registry::HKEY_CURRENT_USER, \
         ::Win32::Registry::HKEY_LOCAL_MACHINE].each do |regRoot|
        begin
          Logger.trace(Logger::DEBUG, "Finding '#{reg_key}' for '#{prop}' in '#{@reg_keys[regRoot]}\\#{reg_default}'")
          regRoot.open(reg_default) do |reg|
            reg_typ, reg_val = reg.read(reg_key)
            Logger.trace(Logger::DEBUG, "Value=#{reg_val}")
            send "#{prop}=", reg_val
          end
          # if value found (in CU) there is no reason to search in LM
          break
        rescue ::Win32::Registry::Error
          Logger.trace(Logger::DEBUG, "No reg key '#{regRoot}'?!")
        end
      end
    end
  rescue LoadError
    Logger.trace(Logger::DEBUG, 'No `win32/registry` gem?!')
  end
end
stripdebug() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 115
def stripdebug
  @stripdebug = ENV['DELPHI_ANDROID_SDK_STRIPDEBUG'] || @stripdebug
  warn 'Please, set DELPHI_ANDROID_SDK_STRIPDEBUG to path where arm-linux-androideabi-strip.exe is located' unless @stripdebug
  @stripdebug
end
zipalign() click to toggle source
# File lib/rake/delphi/android/sdk.rb, line 139
def zipalign
  @zipalign = ENV['DELPHI_ANDROID_SDK_PLATFORM_TOOLS'] || @zipalign
  warn 'Please, set DELPHI_ANDROID_SDK_PLATFORM_TOOLS to the path where zipalign.exe is located' unless @zipalign
  @zipalign
end