Class: Rake::Delphi::Android::SDK
Constant Summary
collapse
- PROPERTIES =
{
:linker => 'NDKArmLinuxAndroidFile',
:lib => 'DelphiNDKLibraryPath',
:linker_option => 'DelphiNDKLibraryPath',
:stripdebug => 'NDKArmLinuxAndroidStripFile',
:aapt => 'SDKAaptPath',
:platform => 'SDKApiLevelPath',
:keystore => nil,
:zipalign => 'SDKZipAlignPath',
:jdk_path => 'JDKJarsignerPath'
}
- REG_KEYS =
{::Win32::Registry::HKEY_CURRENT_USER => 'HKCU',
::Win32::Registry::HKEY_LOCAL_MACHINE => 'HKLM'}
CustomDelphiTool::BDSRegRoot, CustomDelphiTool::DelphiRegRoot, CustomDelphiTool::EDSRegRoot, CustomDelphiTool::EmbarcaderoRegRoot
Instance Attribute Summary
Attributes inherited from Dcc32Tool
#env
Instance Method Summary
collapse
Methods inherited from Dcc32Tool
#delphidir, #delphilib, #init_env, #readLibraryPaths, toolName
checkToolFailure, #delphidir, find, #options, readDelphiDir, readUserOption, #regroot, reinit, rootForVersion, toolName, #toolpath, #version, version4version, #versionInfoClass
Methods inherited from CustomExec
#execute, #to_system_path
Methods inherited from BasicTask
#trace?
Constructor Details
#initialize ⇒ SDK
Returns a new instance of SDK.
29
30
31
32
|
# File 'lib/rake/delphi/android/sdk.rb', line 29
def initialize
super(false)
read_properties
end
|
Instance Method Details
#aapt ⇒ Object
122
123
124
125
126
|
# File 'lib/rake/delphi/android/sdk.rb', line 122
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 ⇒ Object
134
135
136
137
138
|
# File 'lib/rake/delphi/android/sdk.rb', line 134
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 ⇒ Object
104
105
106
107
108
|
# File 'lib/rake/delphi/android/sdk.rb', line 104
def lib
@lib = ENV['DELPHI_ANDROID_SDK_LIBPATH'] || @lib
warn 'Please, define DELPHI_ANDROID_SDK_LIBPATH environment variable' unless @lib
@lib
end
|
#lib=(value) ⇒ Object
89
90
91
|
# File 'lib/rake/delphi/android/sdk.rb', line 89
def lib=(value)
@lib, null = value.split(';', 2)
end
|
#linker ⇒ Object
98
99
100
101
102
|
# File 'lib/rake/delphi/android/sdk.rb', line 98
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 ⇒ Object
110
111
112
113
114
|
# File 'lib/rake/delphi/android/sdk.rb', line 110
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) ⇒ Object
93
94
95
96
|
# File 'lib/rake/delphi/android/sdk.rb', line 93
def linker_option=(value)
null, @linker_option = value.split(';', 2)
@linker_option = ' -L \"' + @linker_option + '\"'
end
|
128
129
130
131
132
|
# File 'lib/rake/delphi/android/sdk.rb', line 128
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 ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/rake/delphi/android/sdk.rb', line 34
def read_default_config
begin
require 'win32/registry'
[::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 ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# 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
require 'win32/registry'
PROPERTIES.each do |prop, reg_key|
next unless reg_key
[::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
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 ⇒ Object
116
117
118
119
120
|
# File 'lib/rake/delphi/android/sdk.rb', line 116
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 ⇒ Object
140
141
142
143
144
|
# File 'lib/rake/delphi/android/sdk.rb', line 140
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
|