Merge branch 'cupcake'
This commit is contained in:
@@ -123,13 +123,15 @@
|
|||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<!--
|
||||||
<activity android:name="AppHwConfigList" android:label="Applications Hw Configuration">
|
<activity android:name="AppHwConfigList" android:label="Applications Hw Configuration">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.TEST" />
|
<category android:name="android.intent.category.TEST" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
-->
|
||||||
<activity android:name="AppHwPref" android:label="Applications Hardware Preferences">
|
<activity android:name="AppHwPref" android:label="Applications Hardware Preferences">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|||||||
7
apps/Fallback/res/values-cs/strings.xml
Normal file
7
apps/Fallback/res/values-cs/strings.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Záloha"</string>
|
||||||
|
<string name="title">"Akce není podporována"</string>
|
||||||
|
<string name="error">"Tato akce není momentálně podporována."</string>
|
||||||
|
</resources>
|
||||||
7
apps/Fallback/res/values-es/strings.xml
Normal file
7
apps/Fallback/res/values-es/strings.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"Acción no admitida"</string>
|
||||||
|
<string name="error">"Esa acción no se admite actualmente."</string>
|
||||||
|
</resources>
|
||||||
7
apps/Fallback/res/values-nl/strings.xml
Normal file
7
apps/Fallback/res/values-nl/strings.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Reserve"</string>
|
||||||
|
<string name="title">"Niet-ondersteunde actie"</string>
|
||||||
|
<string name="error">"Die actie wordt momenteel niet ondersteund."</string>
|
||||||
|
</resources>
|
||||||
7
apps/Fallback/res/values-pl/strings.xml
Normal file
7
apps/Fallback/res/values-pl/strings.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Wycofanie"</string>
|
||||||
|
<string name="title">"Nieobsługiwana czynność"</string>
|
||||||
|
<string name="error">"Ta czynność nie jest aktualnie obsługiwana."</string>
|
||||||
|
</resources>
|
||||||
7
apps/Fallback/res/values-ru/strings.xml
Normal file
7
apps/Fallback/res/values-ru/strings.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"Fallback"</string>
|
||||||
|
<string name="title">"Действие не поддерживается"</string>
|
||||||
|
<string name="error">"В настоящее время это действие не поддерживается."</string>
|
||||||
|
</resources>
|
||||||
7
apps/Fallback/res/values-zh-rTW/strings.xml
Normal file
7
apps/Fallback/res/values-zh-rTW/strings.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<string name="appTitle">"備用"</string>
|
||||||
|
<string name="title">"不支援的操作"</string>
|
||||||
|
<string name="error">"目前不支援此操作。"</string>
|
||||||
|
</resources>
|
||||||
@@ -17,7 +17,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.android.sdksetup">
|
package="com.android.sdksetup">
|
||||||
|
|
||||||
<!-- For miscellaneous secure settings -->
|
<!-- For miscellaneous settings -->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
|
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
|
||||||
|
|
||||||
<application>
|
<application>
|
||||||
|
|||||||
@@ -78,9 +78,11 @@ function package() {
|
|||||||
unzip "$SDK_ZIP" -d "$DIST_DIR"
|
unzip "$SDK_ZIP" -d "$DIST_DIR"
|
||||||
mv -v "$UNZIPPED" "$DEST"
|
mv -v "$UNZIPPED" "$DEST"
|
||||||
|
|
||||||
# USB Driver is not in tools
|
# USB Driver for ADB
|
||||||
mkdir -pv $DEST/usb_driver
|
mkdir -pv $DEST/usb_driver/x86
|
||||||
cp -rv development/host/windows/prebuilt/usb/driver/* $DEST/usb_driver
|
cp -rv development/host/windows/prebuilt/usb/driver/* $DEST/usb_driver/x86/
|
||||||
|
mkdir -pv $DEST/usb_driver/amd64
|
||||||
|
cp -rv development/host/windows/prebuilt/usb/driver_amd_64/* $DEST/usb_driver/amd64/
|
||||||
|
|
||||||
# Remove obsolete stuff from tools
|
# Remove obsolete stuff from tools
|
||||||
TOOLS="$DEST/tools"
|
TOOLS="$DEST/tools"
|
||||||
|
|||||||
@@ -1250,7 +1250,7 @@ static Multiplexer _multiplexer[1];
|
|||||||
|
|
||||||
static const struct { const char* name; ChannelType ctype; } default_channels[] = {
|
static const struct { const char* name; ChannelType ctype; } default_channels[] = {
|
||||||
{ "gsm", CHANNEL_DUPLEX }, /* GSM AT command channel, used by commands/rild/rild.c */
|
{ "gsm", CHANNEL_DUPLEX }, /* GSM AT command channel, used by commands/rild/rild.c */
|
||||||
{ "gps", CHANNEL_BROADCAST }, /* GPS NMEA commands, used by libs/hardware/qemu_gps.c */
|
{ "gps", CHANNEL_BROADCAST }, /* GPS NMEA commands, used by libs/hardware_legacy/qemu_gps.c */
|
||||||
{ "control", CHANNEL_DUPLEX }, /* Used for power/leds/vibrator/etc... */
|
{ "control", CHANNEL_DUPLEX }, /* Used for power/leds/vibrator/etc... */
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|||||||
Binary file not shown.
@@ -10,8 +10,9 @@ Signature="$WINDOWS NT$"
|
|||||||
Class=USB
|
Class=USB
|
||||||
ClassGuid={F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}
|
ClassGuid={F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}
|
||||||
Provider=%GOOG%
|
Provider=%GOOG%
|
||||||
DriverVer=date,1.0.0009.00000
|
DriverVer=12/11/2008,1.0.0009.00000
|
||||||
CatalogFile=androidusb.cat
|
CatalogFile.NTx86=androidusb86.cat
|
||||||
|
CatalogFile.NTamd64=androidusba64.cat
|
||||||
|
|
||||||
; ================= Class section =====================
|
; ================= Class section =====================
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ DefaultDestDir = 12
|
|||||||
; ================= Device section =====================
|
; ================= Device section =====================
|
||||||
|
|
||||||
[Manufacturer]
|
[Manufacturer]
|
||||||
%MfgName%=Google,NTx86
|
%MfgName%=Google,NTx86,NTamd64
|
||||||
|
|
||||||
; For Win2K
|
; For Win2K
|
||||||
[Google]
|
[Google]
|
||||||
@@ -46,6 +47,14 @@ DefaultDestDir = 12
|
|||||||
%USB\VID_0BB4&PID_0C01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C01
|
%USB\VID_0BB4&PID_0C01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C01
|
||||||
%USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C02&MI_01
|
%USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C02&MI_01
|
||||||
|
|
||||||
|
; For AMD64 and later
|
||||||
|
[Google.NTamd64]
|
||||||
|
; For loopback testing
|
||||||
|
%USB\VID_18D1&PID_DDDD.DeviceDescTest%=androidusb.Dev, USB\VID_18D1&PID_DDDD
|
||||||
|
; HTC Dream
|
||||||
|
%USB\VID_0BB4&PID_0C01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C01
|
||||||
|
%USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C02&MI_01
|
||||||
|
|
||||||
[androidusb.Dev.NT]
|
[androidusb.Dev.NT]
|
||||||
CopyFiles=androidusb.Files.Ext
|
CopyFiles=androidusb.Files.Ext
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
BIN
host/windows/prebuilt/usb/driver/androidusb86.cat
Normal file
BIN
host/windows/prebuilt/usb/driver/androidusb86.cat
Normal file
Binary file not shown.
BIN
host/windows/prebuilt/usb/driver_amd_64/WdfCoInstaller01005.dll
Normal file
BIN
host/windows/prebuilt/usb/driver_amd_64/WdfCoInstaller01005.dll
Normal file
Binary file not shown.
122
host/windows/prebuilt/usb/driver_amd_64/android_usb.inf
Normal file
122
host/windows/prebuilt/usb/driver_amd_64/android_usb.inf
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
;/*++
|
||||||
|
;
|
||||||
|
;Abstract:
|
||||||
|
; Installation inf for the Android USB Bulk device
|
||||||
|
;
|
||||||
|
;--*/
|
||||||
|
|
||||||
|
[Version]
|
||||||
|
Signature="$WINDOWS NT$"
|
||||||
|
Class=USB
|
||||||
|
ClassGuid={F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}
|
||||||
|
Provider=%GOOG%
|
||||||
|
DriverVer=12/11/2008,1.0.0009.00000
|
||||||
|
CatalogFile.NTx86=androidusb86.cat
|
||||||
|
CatalogFile.NTamd64=androidusba64.cat
|
||||||
|
|
||||||
|
; ================= Class section =====================
|
||||||
|
|
||||||
|
[ClassInstall32]
|
||||||
|
Addreg=AndroidUsbClassReg
|
||||||
|
|
||||||
|
[AndroidUsbClassReg]
|
||||||
|
HKR,,,0,%ClassName%
|
||||||
|
HKR,,Icon,,-5
|
||||||
|
|
||||||
|
[DestinationDirs]
|
||||||
|
DefaultDestDir = 12
|
||||||
|
|
||||||
|
; ================= Device section =====================
|
||||||
|
|
||||||
|
[Manufacturer]
|
||||||
|
%MfgName%=Google,NTx86,NTamd64
|
||||||
|
|
||||||
|
; For Win2K
|
||||||
|
[Google]
|
||||||
|
; For loopback testing
|
||||||
|
%USB\VID_18D1&PID_DDDD.DeviceDescTest%=androidusb.Dev, USB\VID_18D1&PID_DDDD
|
||||||
|
; HTC Dream
|
||||||
|
%USB\VID_0BB4&PID_0C01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C01
|
||||||
|
%USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C02&MI_01
|
||||||
|
|
||||||
|
; For XP and later
|
||||||
|
[Google.NTx86]
|
||||||
|
; For loopback testing
|
||||||
|
%USB\VID_18D1&PID_DDDD.DeviceDescTest%=androidusb.Dev, USB\VID_18D1&PID_DDDD
|
||||||
|
; HTC Dream
|
||||||
|
%USB\VID_0BB4&PID_0C01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C01
|
||||||
|
%USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C02&MI_01
|
||||||
|
|
||||||
|
; For AMD64 and later
|
||||||
|
[Google.NTamd64]
|
||||||
|
; For loopback testing
|
||||||
|
%USB\VID_18D1&PID_DDDD.DeviceDescTest%=androidusb.Dev, USB\VID_18D1&PID_DDDD
|
||||||
|
; HTC Dream
|
||||||
|
%USB\VID_0BB4&PID_0C01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C01
|
||||||
|
%USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C02&MI_01
|
||||||
|
|
||||||
|
[androidusb.Dev.NT]
|
||||||
|
CopyFiles=androidusb.Files.Ext
|
||||||
|
|
||||||
|
[androidusb.Dev.NT.Services]
|
||||||
|
Addservice = androidusb, 0x00000002, androidusb.AddService
|
||||||
|
|
||||||
|
[androidusb.AddService]
|
||||||
|
DisplayName = %androidusb.SvcDesc%
|
||||||
|
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
|
||||||
|
StartType = 3 ; SERVICE_DEMAND_START
|
||||||
|
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
|
||||||
|
ServiceBinary = %10%\System32\Drivers\androidusb.sys
|
||||||
|
AddReg = androidusb.AddReg
|
||||||
|
LoadOrderGroup = Base
|
||||||
|
|
||||||
|
[androidusb.AddReg]
|
||||||
|
HKR,"Parameters","MaximumTransferSize",0x10001,4096
|
||||||
|
HKR,"Parameters","DebugLevel",0x10001,2
|
||||||
|
HKR, Parameters\Wdf, VerboseOn, 0x00010001, 1
|
||||||
|
HKR, Parameters\Wdf, VerifierOn, 0x00010001, 1
|
||||||
|
HKR, Parameters\Wdf, DbgBreakOnError, 0x00010001, 1
|
||||||
|
|
||||||
|
[androidusb.Files.Ext]
|
||||||
|
androidusb.sys
|
||||||
|
|
||||||
|
[SourceDisksNames]
|
||||||
|
1=%Disk_Description%,,,
|
||||||
|
|
||||||
|
[SourceDisksFiles]
|
||||||
|
androidusb.sys = 1
|
||||||
|
|
||||||
|
;-------------- WDF Coinstaller installation
|
||||||
|
[DestinationDirs]
|
||||||
|
CoInstaller_CopyFiles = 11
|
||||||
|
|
||||||
|
[androidusb.Dev.NT.CoInstallers]
|
||||||
|
AddReg=CoInstaller_AddReg
|
||||||
|
CopyFiles=CoInstaller_CopyFiles
|
||||||
|
|
||||||
|
[CoInstaller_CopyFiles]
|
||||||
|
wdfcoinstaller01005.dll
|
||||||
|
|
||||||
|
[SourceDisksFiles]
|
||||||
|
wdfcoinstaller01005.dll=1 ; make sure the number matches with SourceDisksNames
|
||||||
|
|
||||||
|
[CoInstaller_AddReg]
|
||||||
|
HKR,,CoInstallers32,0x00010000, "wdfcoinstaller01005.dll,WdfCoInstaller"
|
||||||
|
|
||||||
|
[androidusb.Dev.NT.Wdf]
|
||||||
|
KmdfService = androidusb, androidusb_wdfsect
|
||||||
|
|
||||||
|
[androidusb_wdfsect]
|
||||||
|
KmdfLibraryVersion = 1.5
|
||||||
|
|
||||||
|
;---------------------------------------------------------------;
|
||||||
|
|
||||||
|
[Strings]
|
||||||
|
GOOG = "Google, Inc"
|
||||||
|
MfgName = "Google, Inc"
|
||||||
|
Disk_Description= "ADB Interface Installation Disk"
|
||||||
|
androidusb.SvcDesc = "ADB Interface Driver"
|
||||||
|
ClassName = "ADB Interface"
|
||||||
|
USB\VID_18D1&PID_DDDD.DeviceDescTest="ADB Testing Interface"
|
||||||
|
USB\VID_0BB4&PID_0C01.DeviceDescRelease="HTC Dream"
|
||||||
|
USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease="HTC Dream Composite ADB Interface"
|
||||||
BIN
host/windows/prebuilt/usb/driver_amd_64/androidusb.sys
Normal file
BIN
host/windows/prebuilt/usb/driver_amd_64/androidusb.sys
Normal file
Binary file not shown.
BIN
host/windows/prebuilt/usb/driver_amd_64/androidusba64.cat
Normal file
BIN
host/windows/prebuilt/usb/driver_amd_64/androidusba64.cat
Normal file
Binary file not shown.
@@ -67,19 +67,22 @@ typedef struct _AdbEndpointInformation {
|
|||||||
{0xf72fe0d4, 0xcbcb, 0x407d, {0x88, 0x14, 0x9e, 0xd6, 0x73, 0xd0, 0xdd, 0x6b}};
|
{0xf72fe0d4, 0xcbcb, 0x407d, {0x88, 0x14, 0x9e, 0xd6, 0x73, 0xd0, 0xdd, 0x6b}};
|
||||||
|
|
||||||
/// Defines vendor ID for the device
|
/// Defines vendor ID for the device
|
||||||
#define DEVICE_VENDOR_ID 0x18D1
|
#define DEVICE_VENDOR_ID 0x0BB4
|
||||||
|
|
||||||
/// Defines product ID for the device with single interface.
|
/// Defines product ID for the device with single interface.
|
||||||
#define DEVICE_SINGLE_PRODUCT_ID 0xD00D
|
#define DEVICE_SINGLE_PRODUCT_ID 0x0C01
|
||||||
|
|
||||||
/// Defines product ID for the composite device.
|
/// Defines product ID for the composite device.
|
||||||
#define DEVICE_COMPOSITE_PRODUCT_ID 0xDEED
|
#define DEVICE_COMPOSITE_PRODUCT_ID 0x0C02
|
||||||
|
|
||||||
|
/// Defines interface ID for the device.
|
||||||
|
#define DEVICE_INTERFACE_ID 0x01
|
||||||
|
|
||||||
|
/// Defines vendor ID for the device
|
||||||
|
#define DEVICE_EMULATOR_VENDOR_ID 0x18D1
|
||||||
|
|
||||||
/// Defines product ID for a SoftUSB device simulator that is used to test
|
/// Defines product ID for a SoftUSB device simulator that is used to test
|
||||||
/// the driver in isolation from hardware.
|
/// the driver in isolation from hardware.
|
||||||
#define DEVICE_EMULATOR_PROD_ID 0xDDDD
|
#define DEVICE_EMULATOR_PROD_ID 0xDDDD
|
||||||
|
|
||||||
/// Defines interface ID for the device.
|
|
||||||
#define DEVICE_INTERFACE_ID 0x01
|
|
||||||
|
|
||||||
#endif // ANDROID_USB_API_ADB_API_EXTRA_H__
|
#endif // ANDROID_USB_API_ADB_API_EXTRA_H__
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ ADBAPIHANDLE AdbIOObject::CommonAsyncReadWrite(bool is_read,
|
|||||||
AdbBulkTransfer transfer_param;
|
AdbBulkTransfer transfer_param;
|
||||||
transfer_param.time_out = time_out;
|
transfer_param.time_out = time_out;
|
||||||
transfer_param.transfer_size = is_read ? 0 : bytes_to_transfer;
|
transfer_param.transfer_size = is_read ? 0 : bytes_to_transfer;
|
||||||
transfer_param.write_buffer = is_read ? NULL : buffer;
|
transfer_param.SetWriteBuffer(is_read ? NULL : buffer);
|
||||||
|
|
||||||
res = DeviceIoControl(usb_handle(),
|
res = DeviceIoControl(usb_handle(),
|
||||||
is_read ? ADB_IOCTL_BULK_READ : ADB_IOCTL_BULK_WRITE,
|
is_read ? ADB_IOCTL_BULK_READ : ADB_IOCTL_BULK_WRITE,
|
||||||
@@ -254,7 +254,7 @@ bool AdbIOObject::CommonSyncReadWrite(bool is_read,
|
|||||||
AdbBulkTransfer transfer_param;
|
AdbBulkTransfer transfer_param;
|
||||||
transfer_param.time_out = time_out;
|
transfer_param.time_out = time_out;
|
||||||
transfer_param.transfer_size = is_read ? 0 : bytes_to_transfer;
|
transfer_param.transfer_size = is_read ? 0 : bytes_to_transfer;
|
||||||
transfer_param.write_buffer = is_read ? NULL : buffer;
|
transfer_param.SetWriteBuffer(is_read ? NULL : buffer);
|
||||||
|
|
||||||
ULONG tmp;
|
ULONG tmp;
|
||||||
ret = DeviceIoControl(usb_handle(),
|
ret = DeviceIoControl(usb_handle(),
|
||||||
|
|||||||
@@ -60,35 +60,35 @@
|
|||||||
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
||||||
ADB_CTL_GET_USB_DEVICE_DESCRIPTOR, \
|
ADB_CTL_GET_USB_DEVICE_DESCRIPTOR, \
|
||||||
METHOD_BUFFERED, \
|
METHOD_BUFFERED, \
|
||||||
FILE_ANY_ACCESS)
|
FILE_READ_ACCESS)
|
||||||
|
|
||||||
/// IOCTL that gets USB_CONFIGURATION_DESCRIPTOR
|
/// IOCTL that gets USB_CONFIGURATION_DESCRIPTOR
|
||||||
#define ADB_IOCTL_GET_USB_CONFIGURATION_DESCRIPTOR \
|
#define ADB_IOCTL_GET_USB_CONFIGURATION_DESCRIPTOR \
|
||||||
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
||||||
ADB_CTL_GET_USB_CONFIGURATION_DESCRIPTOR, \
|
ADB_CTL_GET_USB_CONFIGURATION_DESCRIPTOR, \
|
||||||
METHOD_BUFFERED, \
|
METHOD_BUFFERED, \
|
||||||
FILE_ANY_ACCESS)
|
FILE_READ_ACCESS)
|
||||||
|
|
||||||
/// IOCTL that gets USB_INTERFACE_DESCRIPTOR
|
/// IOCTL that gets USB_INTERFACE_DESCRIPTOR
|
||||||
#define ADB_IOCTL_GET_USB_INTERFACE_DESCRIPTOR \
|
#define ADB_IOCTL_GET_USB_INTERFACE_DESCRIPTOR \
|
||||||
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
||||||
ADB_CTL_GET_USB_INTERFACE_DESCRIPTOR, \
|
ADB_CTL_GET_USB_INTERFACE_DESCRIPTOR, \
|
||||||
METHOD_BUFFERED, \
|
METHOD_BUFFERED, \
|
||||||
FILE_ANY_ACCESS)
|
FILE_READ_ACCESS)
|
||||||
|
|
||||||
/// IOCTL that gets endpoint information
|
/// IOCTL that gets endpoint information
|
||||||
#define ADB_IOCTL_GET_ENDPOINT_INFORMATION \
|
#define ADB_IOCTL_GET_ENDPOINT_INFORMATION \
|
||||||
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
||||||
ADB_CTL_GET_ENDPOINT_INFORMATION, \
|
ADB_CTL_GET_ENDPOINT_INFORMATION, \
|
||||||
METHOD_BUFFERED, \
|
METHOD_BUFFERED, \
|
||||||
FILE_ANY_ACCESS)
|
FILE_READ_ACCESS)
|
||||||
|
|
||||||
/// Bulk read IOCTL
|
/// Bulk read IOCTL
|
||||||
#define ADB_IOCTL_BULK_READ \
|
#define ADB_IOCTL_BULK_READ \
|
||||||
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
||||||
ADB_CTL_BULK_READ, \
|
ADB_CTL_BULK_READ, \
|
||||||
METHOD_OUT_DIRECT, \
|
METHOD_OUT_DIRECT, \
|
||||||
FILE_ANY_ACCESS)
|
FILE_READ_ACCESS)
|
||||||
|
|
||||||
// For bulk write IOCTL we send request data in the form of AdbBulkTransfer
|
// For bulk write IOCTL we send request data in the form of AdbBulkTransfer
|
||||||
// structure and output buffer is just ULONG that receives number of bytes
|
// structure and output buffer is just ULONG that receives number of bytes
|
||||||
@@ -99,14 +99,14 @@
|
|||||||
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
||||||
ADB_CTL_BULK_WRITE, \
|
ADB_CTL_BULK_WRITE, \
|
||||||
METHOD_BUFFERED, \
|
METHOD_BUFFERED, \
|
||||||
FILE_ANY_ACCESS)
|
FILE_WRITE_ACCESS)
|
||||||
|
|
||||||
/// IOCTL that gets device serial number
|
/// IOCTL that gets device serial number
|
||||||
#define ADB_IOCTL_GET_SERIAL_NUMBER \
|
#define ADB_IOCTL_GET_SERIAL_NUMBER \
|
||||||
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
CTL_CODE(FILE_DEVICE_UNKNOWN, \
|
||||||
ADB_CTL_GET_SERIAL_NUMBER, \
|
ADB_CTL_GET_SERIAL_NUMBER, \
|
||||||
METHOD_BUFFERED, \
|
METHOD_BUFFERED, \
|
||||||
FILE_ANY_ACCESS)
|
FILE_READ_ACCESS)
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
@@ -131,9 +131,49 @@ struct AdbBulkTransfer {
|
|||||||
/// size is defined by the output buffer size.
|
/// size is defined by the output buffer size.
|
||||||
ULONG transfer_size;
|
ULONG transfer_size;
|
||||||
|
|
||||||
|
/// Initializes statically allocated structure
|
||||||
|
__forceinline AdbBulkTransfer() {
|
||||||
|
time_out = 0;
|
||||||
|
transfer_size = 0;
|
||||||
|
for_x64 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provides access to protected write_buffer field
|
||||||
|
void* GetWriteBuffer() {
|
||||||
|
return write_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provides access to protected write_buffer field
|
||||||
|
const void* GetWriteBuffer() const {
|
||||||
|
return write_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sets write_buffer field.
|
||||||
|
void SetWriteBuffer(void* buffer) {
|
||||||
|
// For 32-bit we must zero out high 32 bit of the address, so 64-bit
|
||||||
|
// driver will see valid address when accessing 64-bit write_buffer.
|
||||||
|
for_x64 = 0;
|
||||||
|
write_buffer = buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/// Pointer to the actual buffer for ADB_CTL_BULK_WRITE request. This field
|
/// Pointer to the actual buffer for ADB_CTL_BULK_WRITE request. This field
|
||||||
/// is not used in ADB_CTL_BULK_READ request.
|
/// is not used in ADB_CTL_BULK_READ request. Note that in order to support
|
||||||
void* write_buffer;
|
/// compatibility between 32-bit and 64-bit versions of both, driver and
|
||||||
|
/// application we must sizeof this field to the max pointer sizeof (which
|
||||||
|
/// is 64 bit in our case). The idea is that if IOCTL was issued by a 64-bit
|
||||||
|
/// process to a 64-bit driver, write_buffer will be valid 64-bit pointer to
|
||||||
|
/// the write buffer. Same is true for 32-bit app talking to 32-bit driver.
|
||||||
|
/// If, however, a 32-bit app is talking to 64-bit driver, then write_buffer
|
||||||
|
/// initialized by 32-bit app will contain 32-bit address, which will be
|
||||||
|
/// correctly picked up ("extended") by 64-bit driver. Since when setting
|
||||||
|
/// this field by a 32-bit app requires some extra work (see SetWriteBuffer)
|
||||||
|
/// we hide this field, making it accessible only throug the accessor
|
||||||
|
/// methods (Get/SetWriteBuffer).
|
||||||
|
union {
|
||||||
|
void* write_buffer;
|
||||||
|
__int64 for_x64;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ANDROID_USB_COMMON_DEFINES_H__
|
#endif // ANDROID_USB_COMMON_DEFINES_H__
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ Signature="$WINDOWS NT$"
|
|||||||
Class=USB
|
Class=USB
|
||||||
ClassGuid={F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}
|
ClassGuid={F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}
|
||||||
Provider=%GOOG%
|
Provider=%GOOG%
|
||||||
DriverVer=date,1.0.0009.00000
|
DriverVer=12/11/2008,1.0.0009.00000
|
||||||
CatalogFile=androidusb.cat
|
CatalogFile.NTx86=androidusb86.cat
|
||||||
|
CatalogFile.NTamd64=androidusba64.cat
|
||||||
|
|
||||||
; ================= Class section =====================
|
; ================= Class section =====================
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ DefaultDestDir = 12
|
|||||||
; ================= Device section =====================
|
; ================= Device section =====================
|
||||||
|
|
||||||
[Manufacturer]
|
[Manufacturer]
|
||||||
%MfgName%=Google,NTx86
|
%MfgName%=Google,NTx86,NTamd64
|
||||||
|
|
||||||
; For Win2K
|
; For Win2K
|
||||||
[Google]
|
[Google]
|
||||||
@@ -46,6 +47,14 @@ DefaultDestDir = 12
|
|||||||
%USB\VID_0BB4&PID_0C01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C01
|
%USB\VID_0BB4&PID_0C01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C01
|
||||||
%USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C02&MI_01
|
%USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C02&MI_01
|
||||||
|
|
||||||
|
; For AMD64 and later
|
||||||
|
[Google.NTamd64]
|
||||||
|
; For loopback testing
|
||||||
|
%USB\VID_18D1&PID_DDDD.DeviceDescTest%=androidusb.Dev, USB\VID_18D1&PID_DDDD
|
||||||
|
; HTC Dream
|
||||||
|
%USB\VID_0BB4&PID_0C01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C01
|
||||||
|
%USB\VID_0BB4&PID_0C02&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_0BB4&PID_0C02&MI_01
|
||||||
|
|
||||||
[androidusb.Dev.NT]
|
[androidusb.Dev.NT]
|
||||||
CopyFiles=androidusb.Files.Ext
|
CopyFiles=androidusb.Files.Ext
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,19 @@ EndProject
|
|||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
GlobalSection(SolutionConfiguration) = preSolution
|
||||||
Debug = Debug
|
Debug = Debug
|
||||||
|
Debug-64 = Debug-64
|
||||||
Release = Release
|
Release = Release
|
||||||
|
Release-64 = Release-64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfiguration) = postSolution
|
GlobalSection(ProjectConfiguration) = postSolution
|
||||||
{D980BE56-A7AB-4E05-919B-677FB7716307}.Debug.ActiveCfg = Debug|Win32
|
{D980BE56-A7AB-4E05-919B-677FB7716307}.Debug.ActiveCfg = Debug|Win32
|
||||||
{D980BE56-A7AB-4E05-919B-677FB7716307}.Debug.Build.0 = Debug|Win32
|
{D980BE56-A7AB-4E05-919B-677FB7716307}.Debug.Build.0 = Debug|Win32
|
||||||
|
{D980BE56-A7AB-4E05-919B-677FB7716307}.Debug-64.ActiveCfg = Debug-64|Win32
|
||||||
|
{D980BE56-A7AB-4E05-919B-677FB7716307}.Debug-64.Build.0 = Debug-64|Win32
|
||||||
{D980BE56-A7AB-4E05-919B-677FB7716307}.Release.ActiveCfg = Release|Win32
|
{D980BE56-A7AB-4E05-919B-677FB7716307}.Release.ActiveCfg = Release|Win32
|
||||||
{D980BE56-A7AB-4E05-919B-677FB7716307}.Release.Build.0 = Release|Win32
|
{D980BE56-A7AB-4E05-919B-677FB7716307}.Release.Build.0 = Release|Win32
|
||||||
|
{D980BE56-A7AB-4E05-919B-677FB7716307}.Release-64.ActiveCfg = Release-64|Win32
|
||||||
|
{D980BE56-A7AB-4E05-919B-677FB7716307}.Release-64.Build.0 = Release-64|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|||||||
@@ -18,33 +18,36 @@
|
|||||||
ConfigurationType="0">
|
ConfigurationType="0">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCNMakeTool"
|
Name="VCNMakeTool"
|
||||||
BuildCommandLine="call c:\winddk\6000\bin\setenv.bat c:\winddk\6000\ chk WXP
|
BuildCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ chk WXP
|
||||||
set PROJECTDIR=$(ProjectDir)
|
set PROJECTDIR=$(ProjectDir)
|
||||||
set DRIVE=%PROJECTDIR:~0,2%
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
%DRIVE%
|
%DRIVE%
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
build -beEIFZ
|
build -beEIFZ
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
copy android_usb.inf ..\build\debug\i386\android_usb.inf"
|
copy /Y android_usb.inf ..\build\debug\i386\android_usb.inf
|
||||||
ReBuildCommandLine="call c:\winddk\6000\bin\setenv.bat c:\winddk\6000\ chk WXP
|
copy /Y C:\WINDDK\6000\redist\wdf\x86\WdfCoInstaller01005.dll ..\build\debug\i386
|
||||||
|
set PATH=%PATH%;C:\WINDDK\6001.18001\bin\SelfSign
|
||||||
|
Inf2Cat /driver:..\build\debug\i386 /os:XP_X86,Server2003_X86,Vista_X86
|
||||||
|
"
|
||||||
|
ReBuildCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ chk WXP
|
||||||
set PROJECTDIR=$(ProjectDir)
|
set PROJECTDIR=$(ProjectDir)
|
||||||
set DRIVE=%PROJECTDIR:~0,2%
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
%DRIVE%
|
%DRIVE%
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
build -cbeEIFZ
|
build -cbeEIFZ
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
copy android_usb.inf ..\build\debug\i386\android_usb.inf
|
copy /Y android_usb.inf ..\build\debug\i386\android_usb.inf
|
||||||
cd ..\build\debug\i386
|
copy /Y C:\WINDDK\6000\redist\wdf\x86\WdfCoInstaller01005.dll ..\build\debug\i386
|
||||||
set Path=%Path%;$(VCInstallDir)bin;$(VSInstallDir)Common7\IDE
|
set PATH=%PATH%;C:\WINDDK\6001.18001\bin\SelfSign
|
||||||
dumpbin /ALL /OUT:androidusb.txt androidusb.sys
|
Inf2Cat /driver:..\build\debug\i386 /os:XP_X86,Server2003_X86,Vista_X86
|
||||||
"
|
"
|
||||||
CleanCommandLine="call c:\winddk\6000\bin\setenv.bat c:\winddk\6000\ chk WXP
|
CleanCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ chk WXP
|
||||||
set PROJECTDIR=$(ProjectDir)
|
set PROJECTDIR=$(ProjectDir)
|
||||||
set DRIVE=%PROJECTDIR:~0,2%
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
%DRIVE%
|
%DRIVE%
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
build -c0
|
build -c0"/>
|
||||||
"/>
|
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
@@ -53,29 +56,113 @@ build -c0
|
|||||||
ConfigurationType="0">
|
ConfigurationType="0">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCNMakeTool"
|
Name="VCNMakeTool"
|
||||||
BuildCommandLine="call c:\winddk\6000\bin\setenv.bat c:\winddk\6000\ free WXP
|
BuildCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ fre WXP
|
||||||
set PROJECTDIR=$(ProjectDir)
|
set PROJECTDIR=$(ProjectDir)
|
||||||
set DRIVE=%PROJECTDIR:~0,2%
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
%DRIVE%
|
%DRIVE%
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
build -beEIFZ
|
build -beEIFZ
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
copy android_usb.inf ..\build\release\i386\android_usb.inf"
|
copy /Y android_usb.inf ..\build\release\i386\android_usb.inf
|
||||||
ReBuildCommandLine="call c:\winddk\6000\bin\setenv.bat c:\winddk\6000\ free WXP
|
copy /Y C:\WINDDK\6000\redist\wdf\x86\WdfCoInstaller01005.dll ..\build\release\i386
|
||||||
|
set PATH=%PATH%;C:\WINDDK\6001.18001\bin\SelfSign
|
||||||
|
Inf2Cat /driver:..\build\release\i386 /os:XP_X86,Server2003_X86,Vista_X86
|
||||||
|
"
|
||||||
|
ReBuildCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ fre WXP
|
||||||
set PROJECTDIR=$(ProjectDir)
|
set PROJECTDIR=$(ProjectDir)
|
||||||
set DRIVE=%PROJECTDIR:~0,2%
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
%DRIVE%
|
%DRIVE%
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
build -cbeEIFZ
|
build -cbeEIFZ
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
copy android_usb.inf ..\build\release\i386\android_usb.inf"
|
copy /Y android_usb.inf ..\build\release\i386\android_usb.inf
|
||||||
CleanCommandLine="call c:\winddk\6000\bin\setenv.bat c:\winddk\6000\ free WXP
|
copy /Y C:\WINDDK\6000\redist\wdf\x86\WdfCoInstaller01005.dll ..\build\release\i386
|
||||||
|
set PATH=%PATH%;C:\WINDDK\6001.18001\bin\SelfSign
|
||||||
|
Inf2Cat /driver:..\build\release\i386 /os:XP_X86,Server2003_X86,Vista_X86
|
||||||
|
"
|
||||||
|
CleanCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ fre WXP
|
||||||
set PROJECTDIR=$(ProjectDir)
|
set PROJECTDIR=$(ProjectDir)
|
||||||
set DRIVE=%PROJECTDIR:~0,2%
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
%DRIVE%
|
%DRIVE%
|
||||||
cd %PROJECTDIR%
|
cd %PROJECTDIR%
|
||||||
build -c0
|
build -c0"/>
|
||||||
"/>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug-64|Win32"
|
||||||
|
OutputDirectory="$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="0">
|
||||||
|
<Tool
|
||||||
|
Name="VCNMakeTool"
|
||||||
|
BuildCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ chk AMD64 WNET
|
||||||
|
set PROJECTDIR=$(ProjectDir)
|
||||||
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
|
%DRIVE%
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
build -beEIFZ
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
copy android_usb.inf ..\build\debug\amd64\android_usb.inf
|
||||||
|
copy C:\WINDDK\6000\redist\wdf\amd64\WdfCoInstaller01005.dll ..\build\debug\amd64
|
||||||
|
set PATH=%PATH%;C:\WINDDK\6001.18001\bin\SelfSign
|
||||||
|
Inf2Cat /driver:..\build\debug\amd64 /os:XP_X64,Server2003_X64,Vista_X64
|
||||||
|
"
|
||||||
|
ReBuildCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ chk AMD64 WNET
|
||||||
|
set PROJECTDIR=$(ProjectDir)
|
||||||
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
|
%DRIVE%
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
build -cbeEIFZ
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
copy android_usb.inf ..\build\debug\amd64\android_usb.inf
|
||||||
|
copy C:\WINDDK\6000\redist\wdf\amd64\WdfCoInstaller01005.dll ..\build\debug\amd64
|
||||||
|
set PATH=%PATH%;C:\WINDDK\6001.18001\bin\SelfSign
|
||||||
|
SignTool sign /v /s AndroidTestCertStore /n Android /t http://timestamp.verisign.com/scripts/timestamp.dll ..\build\debug\amd64\androidusb.sys
|
||||||
|
Inf2Cat /driver:..\build\debug\amd64 /os:XP_X64,Server2003_X64,Vista_X64
|
||||||
|
SignTool sign /v /s AndroidTestCertStore /n Android /t http://timestamp.verisign.com/scripts/timestamp.dll ..\build\debug\amd64\androidusba64.cat"
|
||||||
|
CleanCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ chk AMD64 WNET
|
||||||
|
set PROJECTDIR=$(ProjectDir)
|
||||||
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
|
%DRIVE%
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
build -c0"/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release-64|Win32"
|
||||||
|
OutputDirectory="$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="0">
|
||||||
|
<Tool
|
||||||
|
Name="VCNMakeTool"
|
||||||
|
BuildCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ fre AMD64 WNET
|
||||||
|
set PROJECTDIR=$(ProjectDir)
|
||||||
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
|
%DRIVE%
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
build -beEIFZ
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
copy android_usb.inf ..\build\release\amd64\android_usb.inf
|
||||||
|
copy C:\WINDDK\6000\redist\wdf\amd64\WdfCoInstaller01005.dll ..\build\release\amd64
|
||||||
|
set PATH=%PATH%;C:\WINDDK\6001.18001\bin\SelfSign
|
||||||
|
Inf2Cat /driver:..\build\release\amd64 /os:XP_X64,Server2003_X64,Vista_X64
|
||||||
|
"
|
||||||
|
ReBuildCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ fre AMD64 WNET
|
||||||
|
set PROJECTDIR=$(ProjectDir)
|
||||||
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
|
%DRIVE%
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
build -cbeEIFZ
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
copy android_usb.inf ..\build\release\amd64\android_usb.inf
|
||||||
|
copy C:\WINDDK\6000\redist\wdf\amd64\WdfCoInstaller01005.dll ..\build\release\amd64
|
||||||
|
set PATH=%PATH%;C:\WINDDK\6001.18001\bin\SelfSign
|
||||||
|
Inf2Cat /driver:..\build\release\amd64 /os:XP_X64,Server2003_X64,Vista_X64
|
||||||
|
"
|
||||||
|
CleanCommandLine="call C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ fre AMD64 WNET
|
||||||
|
set PROJECTDIR=$(ProjectDir)
|
||||||
|
set DRIVE=%PROJECTDIR:~0,2%
|
||||||
|
%DRIVE%
|
||||||
|
cd %PROJECTDIR%
|
||||||
|
build -c0"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
@@ -749,10 +836,10 @@ build -c0
|
|||||||
RelativePath="..\..\..\..\Winddk\6000\inc\api\usb.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\api\usb.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\api\usb100.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\api\usb100.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\api\usb100.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\api\usb100.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\api\usb200.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\api\usb200.h">
|
||||||
@@ -794,10 +881,10 @@ build -c0
|
|||||||
RelativePath="..\..\..\..\Winddk\6000\inc\ddk\videoagp.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\ddk\videoagp.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf10.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf10.h">
|
||||||
@@ -805,252 +892,252 @@ build -c0
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf10.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf10.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf11.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf11.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf11.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfassert.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdf11.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfassert.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfassert.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfassert.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfbugcodes.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfbugcodes.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfbugcodes.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfbugcodes.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfchildlist.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfchildlist.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfchildlist.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcollection.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfchildlist.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcollection.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcollection.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcommonbuffer.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcollection.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcommonbuffer.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcommonbuffer.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcontrol.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcommonbuffer.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcontrol.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcontrol.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcontrol.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcore.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcore.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcore.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfcore.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdevice.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdevice.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdevice.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdmaenabler.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdevice.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdmaenabler.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdmaenabler.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdmatransaction.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdmaenabler.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdmatransaction.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdmatransaction.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdpc.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdmatransaction.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdpc.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdpc.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdpc.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdriver.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdriver.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdriver.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfdriver.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffdo.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffdo.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffdo.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffileobject.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffdo.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffileobject.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffileobject.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffileobject.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffuncenum.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffuncenum.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffuncenum.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdffuncenum.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfglobals.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfglobals.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfglobals.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfinstaller.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfglobals.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfinstaller.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfinstaller.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfinstaller.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfinterrupt.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfinterrupt.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfinterrupt.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfinterrupt.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfio.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfio.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfio.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfiotarget.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfio.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfiotarget.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfiotarget.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfmemory.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfiotarget.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfmemory.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfmemory.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfminiport.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfmemory.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfminiport.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfminiport.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfminiport.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfobject.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfobject.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfobject.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfobject.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfpdo.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfpdo.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfpdo.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfpool.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfpdo.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfpool.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfpool.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfqueryinterface.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfpool.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfqueryinterface.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfqueryinterface.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfregistry.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfqueryinterface.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfregistry.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfregistry.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfregistry.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfrequest.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfrequest.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfrequest.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfrequest.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfresource.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfresource.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfresource.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfstatus.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfresource.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfstatus.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfstatus.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfstring.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfstatus.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfstring.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfstring.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfsync.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfstring.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfsync.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfsync.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfsync.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftimer.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftimer.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftimer.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftimer.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftraceenums.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftraceenums.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftraceenums.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftypes.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftraceenums.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftypes.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftypes.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfusb.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdftypes.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfusb.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfusb.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfverifier.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfusb.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfverifier.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfverifier.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfverifier.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfwmi.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfwmi.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfwmi.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfwmi.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfworkitem.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfworkitem.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfworkitem.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\ddk\wdm.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\wdf\kmdf\10\wdfworkitem.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\ddk\wdm.h">
|
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\ddk\wdm.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\Winddk\6000\inc\ddk\wdm.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\Winddk\6000\inc\ddk\wdmguid.h">
|
RelativePath="..\..\..\..\Winddk\6000\inc\ddk\wdmguid.h">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@@ -47,26 +47,26 @@ void AndroidUsbDeviceFileObject::OnEvtIoDeviceControl(WDFREQUEST request,
|
|||||||
ULONG ioctl_code) {
|
ULONG ioctl_code) {
|
||||||
ASSERT_IRQL_LOW_OR_DISPATCH();
|
ASSERT_IRQL_LOW_OR_DISPATCH();
|
||||||
|
|
||||||
switch (GetCtlCode(ioctl_code)) {
|
switch (ioctl_code) {
|
||||||
case ADB_CTL_GET_USB_DEVICE_DESCRIPTOR:
|
case ADB_IOCTL_GET_USB_DEVICE_DESCRIPTOR:
|
||||||
device_object()->OnGetUsbDeviceDescriptorCtl(request, output_buf_len);
|
device_object()->OnGetUsbDeviceDescriptorCtl(request, output_buf_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ADB_CTL_GET_USB_CONFIGURATION_DESCRIPTOR:
|
case ADB_IOCTL_GET_USB_CONFIGURATION_DESCRIPTOR:
|
||||||
device_object()->OnGetUsbConfigDescriptorCtl(request, output_buf_len);
|
device_object()->OnGetUsbConfigDescriptorCtl(request, output_buf_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ADB_CTL_GET_USB_INTERFACE_DESCRIPTOR:
|
case ADB_IOCTL_GET_USB_INTERFACE_DESCRIPTOR:
|
||||||
device_object()->OnGetUsbInterfaceDescriptorCtl(request, output_buf_len);
|
device_object()->OnGetUsbInterfaceDescriptorCtl(request, output_buf_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ADB_CTL_GET_ENDPOINT_INFORMATION:
|
case ADB_IOCTL_GET_ENDPOINT_INFORMATION:
|
||||||
device_object()->OnGetEndpointInformationCtl(request,
|
device_object()->OnGetEndpointInformationCtl(request,
|
||||||
input_buf_len,
|
input_buf_len,
|
||||||
output_buf_len);
|
output_buf_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ADB_CTL_GET_SERIAL_NUMBER:
|
case ADB_IOCTL_GET_SERIAL_NUMBER:
|
||||||
device_object()->OnGetSerialNumberCtl(request, output_buf_len);
|
device_object()->OnGetSerialNumberCtl(request, output_buf_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -143,16 +143,16 @@ void AndroidUsbPipeFileObject::OnEvtIoDeviceControl(WDFREQUEST request,
|
|||||||
ULONG ioctl_code) {
|
ULONG ioctl_code) {
|
||||||
ASSERT_IRQL_LOW_OR_DISPATCH();
|
ASSERT_IRQL_LOW_OR_DISPATCH();
|
||||||
|
|
||||||
switch (GetCtlCode(ioctl_code)) {
|
switch (ioctl_code) {
|
||||||
case ADB_CTL_GET_ENDPOINT_INFORMATION:
|
case ADB_IOCTL_GET_ENDPOINT_INFORMATION:
|
||||||
OnCtlGetEndpointInformation(request, output_buf_len);
|
OnCtlGetEndpointInformation(request, output_buf_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ADB_CTL_BULK_READ:
|
case ADB_IOCTL_BULK_READ:
|
||||||
OnCtlBulkRead(request, output_buf_len, input_buf_len);
|
OnCtlBulkRead(request, output_buf_len, input_buf_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ADB_CTL_BULK_WRITE:
|
case ADB_IOCTL_BULK_WRITE:
|
||||||
OnCtlBulkWrite(request, output_buf_len, input_buf_len);
|
OnCtlBulkWrite(request, output_buf_len, input_buf_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ void AndroidUsbPipeFileObject::OnCtlBulkWrite(WDFREQUEST request,
|
|||||||
// 1. Never trust anything that comes from the User Mode.
|
// 1. Never trust anything that comes from the User Mode.
|
||||||
// 2. Never assume that anything that User Mode buffer has will remain
|
// 2. Never assume that anything that User Mode buffer has will remain
|
||||||
// unchanged.
|
// unchanged.
|
||||||
void* transfer_buffer = transfer_param->write_buffer;
|
void* transfer_buffer = transfer_param->GetWriteBuffer();
|
||||||
ULONG transfer_size = transfer_param->transfer_size;
|
ULONG transfer_size = transfer_param->transfer_size;
|
||||||
|
|
||||||
// Make sure zero length I/O doesn't go through
|
// Make sure zero length I/O doesn't go through
|
||||||
|
|||||||
@@ -75,7 +75,8 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="TitleEditor" android:label="@string/title_edit_title"
|
<activity android:name="TitleEditor" android:label="@string/title_edit_title"
|
||||||
android:theme="@android:style/Theme.Dialog">
|
android:theme="@android:style/Theme.Dialog"
|
||||||
|
android:windowSoftInputMode="stateVisible">
|
||||||
<!-- This activity implements an alternative action that can be
|
<!-- This activity implements an alternative action that can be
|
||||||
performed on notes: editing their title. It can be used as
|
performed on notes: editing their title. It can be used as
|
||||||
a default operation if the user invokes this action, and is
|
a default operation if the user invokes this action, and is
|
||||||
|
|||||||
40
samples/SimpleJNI/Android.mk
Normal file
40
samples/SimpleJNI/Android.mk
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2008 The Android Open Source Project
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
# This makefile shows how to build a shared library and an activity that
|
||||||
|
# bundles the shared library and calls it using JNI.
|
||||||
|
|
||||||
|
TOP_LOCAL_PATH:= $(call my-dir)
|
||||||
|
|
||||||
|
# Build activity
|
||||||
|
|
||||||
|
LOCAL_PATH:= $(TOP_LOCAL_PATH)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := samples
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||||
|
|
||||||
|
LOCAL_PACKAGE_NAME := SimpleJNI
|
||||||
|
|
||||||
|
LOCAL_JNI_SHARED_LIBRARIES := libsimplejni
|
||||||
|
|
||||||
|
include $(BUILD_PACKAGE)
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
|
||||||
|
# Also build all of the sub-targets under this one: the shared library.
|
||||||
|
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||||
29
samples/SimpleJNI/AndroidManifest.xml
Normal file
29
samples/SimpleJNI/AndroidManifest.xml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2008 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- This is an example of writing an application that bundles a
|
||||||
|
native code library. -->
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.example.android.simplejni">
|
||||||
|
<application android:label="Simple JNI">
|
||||||
|
<activity android:name="SimpleJNI">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
54
samples/SimpleJNI/jni/Android.mk
Normal file
54
samples/SimpleJNI/jni/Android.mk
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2008 The Android Open Source Project
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
# This makefile supplies the rules for building a library of JNI code for
|
||||||
|
# use by our example of how to bundle a shared library with an APK.
|
||||||
|
|
||||||
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := samples
|
||||||
|
|
||||||
|
# This is the target being built.
|
||||||
|
LOCAL_MODULE:= libsimplejni
|
||||||
|
|
||||||
|
|
||||||
|
# All of the source files that we will compile.
|
||||||
|
LOCAL_SRC_FILES:= \
|
||||||
|
native.cpp
|
||||||
|
|
||||||
|
# All of the shared libraries we link against.
|
||||||
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
|
libutils
|
||||||
|
|
||||||
|
# No static libraries.
|
||||||
|
LOCAL_STATIC_LIBRARIES :=
|
||||||
|
|
||||||
|
# Also need the JNI headers.
|
||||||
|
LOCAL_C_INCLUDES += \
|
||||||
|
$(JNI_H_INCLUDE)
|
||||||
|
|
||||||
|
# No special compiler flags.
|
||||||
|
LOCAL_CFLAGS +=
|
||||||
|
|
||||||
|
# Don't prelink this library. For more efficient code, you may want
|
||||||
|
# to add this library to the prelink map and set this to true. However,
|
||||||
|
# it's difficult to do this for applications that are not supplied as
|
||||||
|
# part of a system image.
|
||||||
|
|
||||||
|
LOCAL_PRELINK_MODULE := false
|
||||||
|
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
109
samples/SimpleJNI/jni/native.cpp
Normal file
109
samples/SimpleJNI/jni/native.cpp
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LOG_TAG "simplejni native.cpp"
|
||||||
|
#include <utils/Log.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
static jint
|
||||||
|
add(JNIEnv *env, jobject thiz, jint a, jint b) {
|
||||||
|
int result = a + b;
|
||||||
|
LOGI("%d + %d = %d", a, b, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *classPathName = "com/example/android/simplejni/Native";
|
||||||
|
|
||||||
|
static JNINativeMethod methods[] = {
|
||||||
|
{"add", "(II)I", (void*)add },
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register several native methods for one class.
|
||||||
|
*/
|
||||||
|
static int registerNativeMethods(JNIEnv* env, const char* className,
|
||||||
|
JNINativeMethod* gMethods, int numMethods)
|
||||||
|
{
|
||||||
|
jclass clazz;
|
||||||
|
|
||||||
|
clazz = env->FindClass(className);
|
||||||
|
if (clazz == NULL) {
|
||||||
|
LOGE("Native registration unable to find class '%s'", className);
|
||||||
|
return JNI_FALSE;
|
||||||
|
}
|
||||||
|
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
|
||||||
|
LOGE("RegisterNatives failed for '%s'", className);
|
||||||
|
return JNI_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JNI_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register native methods for all classes we know about.
|
||||||
|
*
|
||||||
|
* returns JNI_TRUE on success.
|
||||||
|
*/
|
||||||
|
static int registerNatives(JNIEnv* env)
|
||||||
|
{
|
||||||
|
if (!registerNativeMethods(env, classPathName,
|
||||||
|
methods, sizeof(methods) / sizeof(methods[0]))) {
|
||||||
|
return JNI_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JNI_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is called by the VM when the shared library is first loaded.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
JNIEnv* env;
|
||||||
|
void* venv;
|
||||||
|
} UnionJNIEnvToVoid;
|
||||||
|
|
||||||
|
jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||||
|
{
|
||||||
|
UnionJNIEnvToVoid uenv;
|
||||||
|
uenv.venv = NULL;
|
||||||
|
jint result = -1;
|
||||||
|
JNIEnv* env = NULL;
|
||||||
|
|
||||||
|
LOGI("JNI_OnLoad");
|
||||||
|
|
||||||
|
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
|
||||||
|
LOGE("ERROR: GetEnv failed");
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
env = uenv.env;
|
||||||
|
|
||||||
|
if (registerNatives(env) != JNI_TRUE) {
|
||||||
|
LOGE("ERROR: registerNatives failed");
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = JNI_VERSION_1_4;
|
||||||
|
|
||||||
|
bail:
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.example.android.simplejni;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class SimpleJNI extends Activity {
|
||||||
|
/** Called when the activity is first created. */
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
TextView tv = new TextView(this);
|
||||||
|
int sum = Native.add(2, 3);
|
||||||
|
tv.setText("2 + 3 = " + Integer.toString(sum));
|
||||||
|
setContentView(tv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Native {
|
||||||
|
static {
|
||||||
|
// The runtime will add "lib" on the front and ".o" on the end of
|
||||||
|
// the name supplied to loadLibrary.
|
||||||
|
System.loadLibrary("simplejni");
|
||||||
|
}
|
||||||
|
|
||||||
|
static native int add(int a, int b);
|
||||||
|
}
|
||||||
@@ -22,7 +22,9 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.snake">
|
package="com.example.android.snake">
|
||||||
<application android:label="Snake on a Phone">
|
<application android:label="Snake on a Phone">
|
||||||
<activity android:name="Snake">
|
<activity android:name="Snake"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:configChanges="keyboardHidden|orientation">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
android:id="@+id/snake"
|
android:id="@+id/snake"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
tileSize="12"
|
tileSize="24"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package com.example.android.snake;
|
package com.example.android.snake;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -551,5 +550,4 @@ public class SnakeView extends TileView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import android.graphics.drawable.Drawable;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TileView: a View-variant designed for handling arrays of "icons" or other
|
* TileView: a View-variant designed for handling arrays of "icons" or other
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ public class SoftKeyboard extends InputMethodService
|
|||||||
|
|
||||||
private void handleClose() {
|
private void handleClose() {
|
||||||
commitTyped(getCurrentInputConnection());
|
commitTyped(getCurrentInputConnection());
|
||||||
dismissSoftInput();
|
dismissSoftInput(0);
|
||||||
mInputView.closing();
|
mInputView.closing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,4 +506,8 @@ public class SoftKeyboard extends InputMethodService
|
|||||||
public void swipeUp() {
|
public void swipeUp() {
|
||||||
// ?
|
// ?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onPress(int primaryCode) { }
|
||||||
|
|
||||||
|
public void onRelease(int primaryCode) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,25 +19,30 @@ package com.android.ant;
|
|||||||
import com.android.sdklib.IAndroidTarget;
|
import com.android.sdklib.IAndroidTarget;
|
||||||
import com.android.sdklib.ISdkLog;
|
import com.android.sdklib.ISdkLog;
|
||||||
import com.android.sdklib.SdkManager;
|
import com.android.sdklib.SdkManager;
|
||||||
|
import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
|
||||||
import com.android.sdklib.project.ProjectProperties;
|
import com.android.sdklib.project.ProjectProperties;
|
||||||
|
|
||||||
import org.apache.tools.ant.BuildException;
|
import org.apache.tools.ant.BuildException;
|
||||||
import org.apache.tools.ant.Project;
|
import org.apache.tools.ant.Project;
|
||||||
import org.apache.tools.ant.taskdefs.ImportTask;
|
import org.apache.tools.ant.taskdefs.ImportTask;
|
||||||
|
import org.apache.tools.ant.types.Path;
|
||||||
|
import org.apache.tools.ant.types.Path.PathElement;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import Target Ant task. This task accomplishes:
|
* Import Target Ant task. This task accomplishes:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Gets the project target hash string from {@link ProjectProperties#PROPERTY_TARGET},
|
* <li>Gets the project target hash string from {@link ProjectProperties#PROPERTY_TARGET},
|
||||||
* and resolves it.</li>
|
* and resolves it to get the project's {@link IAndroidTarget}.</li>
|
||||||
* <li>Sets up ant properties so that the rest of the Ant scripts finds:
|
* <li>Sets up properties so that aapt can find the android.jar in the resolved target.</li>
|
||||||
* <ul>
|
* <li>Sets up the boot classpath ref so that the <code>javac</code> task knows where to find
|
||||||
* <li>Path to the underlying platform to access the build rules ('android-platform')<li>
|
* the libraries. This includes the default android.jar from the resolved target but also optional
|
||||||
* </ul>
|
* libraries provided by the target (if any, when the target is an add-on).</li>
|
||||||
* </li>
|
* <li>Imports the build rules located in the resolved target so that the build actually does
|
||||||
|
* something.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* This is used in build.xml/template.
|
* This is used in build.xml/template.
|
||||||
@@ -46,8 +51,12 @@ import java.util.ArrayList;
|
|||||||
public class AndroidInitTask extends ImportTask {
|
public class AndroidInitTask extends ImportTask {
|
||||||
private final static String ANDROID_RULES = "android_rules.xml";
|
private final static String ANDROID_RULES = "android_rules.xml";
|
||||||
|
|
||||||
|
// ant property with the path to the android.jar
|
||||||
private final static String PROPERTY_ANDROID_JAR = "android-jar";
|
private final static String PROPERTY_ANDROID_JAR = "android-jar";
|
||||||
|
// ant property with the path to the framework.jar
|
||||||
private final static String PROPERTY_ANDROID_AIDL = "android-aidl";
|
private final static String PROPERTY_ANDROID_AIDL = "android-aidl";
|
||||||
|
// ref id to the <path> object containing all the boot classpaths.
|
||||||
|
private final static String REF_CLASSPATH = "android.target.classpath";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws BuildException {
|
public void execute() throws BuildException {
|
||||||
@@ -117,13 +126,39 @@ public class AndroidInitTask extends ImportTask {
|
|||||||
System.out.println("Platform Version: " + androidTarget.getApiVersionName());
|
System.out.println("Platform Version: " + androidTarget.getApiVersionName());
|
||||||
System.out.println("API level: " + androidTarget.getApiVersionNumber());
|
System.out.println("API level: " + androidTarget.getApiVersionNumber());
|
||||||
|
|
||||||
// sets up the properties.
|
// sets up the properties to find android.jar/framework.aidl
|
||||||
String androidJar = androidTarget.getPath(IAndroidTarget.ANDROID_JAR);
|
String androidJar = androidTarget.getPath(IAndroidTarget.ANDROID_JAR);
|
||||||
String androidAidl = androidTarget.getPath(IAndroidTarget.ANDROID_AIDL);
|
String androidAidl = androidTarget.getPath(IAndroidTarget.ANDROID_AIDL);
|
||||||
|
|
||||||
antProject.setProperty(PROPERTY_ANDROID_JAR, androidJar);
|
antProject.setProperty(PROPERTY_ANDROID_JAR, androidJar);
|
||||||
antProject.setProperty(PROPERTY_ANDROID_AIDL, androidAidl);
|
antProject.setProperty(PROPERTY_ANDROID_AIDL, androidAidl);
|
||||||
|
|
||||||
|
// sets up the boot classpath
|
||||||
|
|
||||||
|
// create the Path object
|
||||||
|
Path bootclasspath = new Path(antProject);
|
||||||
|
|
||||||
|
// create a PathElement for the framework jar
|
||||||
|
PathElement element = bootclasspath.createPathElement();
|
||||||
|
element.setPath(androidJar);
|
||||||
|
|
||||||
|
// create PathElement for each optional library.
|
||||||
|
IOptionalLibrary[] libraries = androidTarget.getOptionalLibraries();
|
||||||
|
if (libraries != null) {
|
||||||
|
HashSet<String> visitedJars = new HashSet<String>();
|
||||||
|
for (IOptionalLibrary library : libraries) {
|
||||||
|
String jarPath = library.getJarPath();
|
||||||
|
if (visitedJars.contains(jarPath) == false) {
|
||||||
|
visitedJars.add(jarPath);
|
||||||
|
|
||||||
|
element = bootclasspath.createPathElement();
|
||||||
|
element.setPath(library.getJarPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// finally sets the path in the project with a reference
|
||||||
|
antProject.addReference(REF_CLASSPATH, bootclasspath);
|
||||||
|
|
||||||
// find the file to import, and import it.
|
// find the file to import, and import it.
|
||||||
String templateFolder = androidTarget.getPath(IAndroidTarget.TEMPLATES);
|
String templateFolder = androidTarget.getPath(IAndroidTarget.TEMPLATES);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<classpathentry kind="lib" path="layoutlib_api.jar"/>
|
<classpathentry kind="lib" path="layoutlib_api.jar"/>
|
||||||
<classpathentry kind="lib" path="layoutlib_utils.jar"/>
|
<classpathentry kind="lib" path="layoutlib_utils.jar"/>
|
||||||
<classpathentry kind="lib" path="ninepatch.jar"/>
|
<classpathentry kind="lib" path="ninepatch.jar"/>
|
||||||
<classpathentry kind="lib" path="sdklib.jar"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/SdkLib"/>
|
||||||
<classpathentry kind="lib" path="sdkuilib.jar"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/SdkUiLib"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -648,8 +648,11 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
String message = String.format(Messages.Dalvik_Error_s,
|
String message = ex.getMessage();
|
||||||
ex.getMessage());
|
if (message == null) {
|
||||||
|
message = ex.getClass().getCanonicalName();
|
||||||
|
}
|
||||||
|
message = String.format(Messages.Dalvik_Error_s, message);
|
||||||
AdtPlugin.printErrorToConsole(getProject(), message);
|
AdtPlugin.printErrorToConsole(getProject(), message);
|
||||||
markProject(AdtConstants.MARKER_ADT, message, IMarker.SEVERITY_ERROR);
|
markProject(AdtConstants.MARKER_ADT, message, IMarker.SEVERITY_ERROR);
|
||||||
if ((ex instanceof NoClassDefFoundError)
|
if ((ex instanceof NoClassDefFoundError)
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ class AndroidClasspathContainer implements IClasspathContainer {
|
|||||||
/**
|
/**
|
||||||
* Constructs the container with the {@link IClasspathEntry} representing the android
|
* Constructs the container with the {@link IClasspathEntry} representing the android
|
||||||
* framework jar file and the container id
|
* framework jar file and the container id
|
||||||
* @param entry the entry representing the android framework.
|
* @param entries the entries representing the android framework and optional libraries.
|
||||||
* @param path the path containing the classpath container id.
|
* @param path the path containing the classpath container id.
|
||||||
* @param name the name of the container to display.
|
* @param name the name of the container to display.
|
||||||
*/
|
*/
|
||||||
AndroidClasspathContainer(IClasspathEntry entry, IPath path, String name) {
|
AndroidClasspathContainer(IClasspathEntry[] entries, IPath path, String name) {
|
||||||
mClasspathEntry = new IClasspathEntry[] { entry };
|
mClasspathEntry = entries;
|
||||||
mContainerPath = path;
|
mContainerPath = path;
|
||||||
mName = name;
|
mName = name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.android.ide.eclipse.adt.sdk.LoadStatus;
|
|||||||
import com.android.ide.eclipse.adt.sdk.Sdk;
|
import com.android.ide.eclipse.adt.sdk.Sdk;
|
||||||
import com.android.ide.eclipse.common.project.BaseProjectHelper;
|
import com.android.ide.eclipse.common.project.BaseProjectHelper;
|
||||||
import com.android.sdklib.IAndroidTarget;
|
import com.android.sdklib.IAndroidTarget;
|
||||||
|
import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
@@ -43,6 +44,9 @@ import org.eclipse.jdt.core.IJavaProject;
|
|||||||
import org.eclipse.jdt.core.JavaCore;
|
import org.eclipse.jdt.core.JavaCore;
|
||||||
import org.eclipse.jdt.core.JavaModelException;
|
import org.eclipse.jdt.core.JavaModelException;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classpath container initializer responsible for binding {@link AndroidClasspathContainer} to
|
* Classpath container initializer responsible for binding {@link AndroidClasspathContainer} to
|
||||||
* {@link IProject}s. This removes the hard-coded path to the android.jar.
|
* {@link IProject}s. This removes the hard-coded path to the android.jar.
|
||||||
@@ -142,7 +146,6 @@ public class AndroidClasspathContainerInitializer extends ClasspathContainerInit
|
|||||||
AdtPlugin.log(ce, "Error removing target marker.");
|
AdtPlugin.log(ce, "Error removing target marker.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// First we check if the SDK has been loaded.
|
// First we check if the SDK has been loaded.
|
||||||
// By passing the javaProject to getSdkLoadStatus(), we ensure that, should the SDK
|
// By passing the javaProject to getSdkLoadStatus(), we ensure that, should the SDK
|
||||||
// not be loaded yet, the classpath container will be resolved again once the SDK is loaded.
|
// not be loaded yet, the classpath container will be resolved again once the SDK is loaded.
|
||||||
@@ -255,15 +258,19 @@ public class AndroidClasspathContainerInitializer extends ClasspathContainerInit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns a new {@link IClasspathEntry} object for the android
|
* Creates and returns an array of {@link IClasspathEntry} objects for the android
|
||||||
* framework. <p/>This references the OS path to the android.jar and the
|
* framework and optional libraries.
|
||||||
|
* <p/>This references the OS path to the android.jar and the
|
||||||
* java doc directory. This is dynamically created when a project is opened,
|
* java doc directory. This is dynamically created when a project is opened,
|
||||||
* and never saved in the project itself, so there's no risk of storing an
|
* and never saved in the project itself, so there's no risk of storing an
|
||||||
* obsolete path.
|
* obsolete path.
|
||||||
*
|
*
|
||||||
* @param target The target that contains the libraries.
|
* @param target The target that contains the libraries.
|
||||||
*/
|
*/
|
||||||
private static IClasspathEntry createFrameworkClasspath(IAndroidTarget target) {
|
private static IClasspathEntry[] createFrameworkClasspath(IAndroidTarget target) {
|
||||||
|
ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
|
||||||
|
|
||||||
|
// First, we create the IClasspathEntry for the framework.
|
||||||
// now add the android framework to the class path.
|
// now add the android framework to the class path.
|
||||||
// create the path object.
|
// create the path object.
|
||||||
IPath android_lib = new Path(target.getPath(IAndroidTarget.ANDROID_JAR));
|
IPath android_lib = new Path(target.getPath(IAndroidTarget.ANDROID_JAR));
|
||||||
@@ -278,7 +285,7 @@ public class AndroidClasspathContainerInitializer extends ClasspathContainerInit
|
|||||||
new Path("com/android/internal/**"), //$NON-NLS-1$
|
new Path("com/android/internal/**"), //$NON-NLS-1$
|
||||||
IAccessRule.K_NON_ACCESSIBLE);
|
IAccessRule.K_NON_ACCESSIBLE);
|
||||||
|
|
||||||
IClasspathEntry classpathEntry = JavaCore.newLibraryEntry(android_lib,
|
IClasspathEntry frameworkClasspathEntry = JavaCore.newLibraryEntry(android_lib,
|
||||||
android_src, // source attachment path
|
android_src, // source attachment path
|
||||||
null, // default source attachment root path.
|
null, // default source attachment root path.
|
||||||
new IAccessRule[] { accessRule },
|
new IAccessRule[] { accessRule },
|
||||||
@@ -286,6 +293,41 @@ public class AndroidClasspathContainerInitializer extends ClasspathContainerInit
|
|||||||
false // not exported.
|
false // not exported.
|
||||||
);
|
);
|
||||||
|
|
||||||
return classpathEntry;
|
list.add(frameworkClasspathEntry);
|
||||||
|
|
||||||
|
// now deal with optional libraries
|
||||||
|
IOptionalLibrary[] libraries = target.getOptionalLibraries();
|
||||||
|
if (libraries != null) {
|
||||||
|
HashSet<String> visitedJars = new HashSet<String>();
|
||||||
|
for (IOptionalLibrary library : libraries) {
|
||||||
|
String jarPath = library.getJarPath();
|
||||||
|
if (visitedJars.contains(jarPath) == false) {
|
||||||
|
visitedJars.add(jarPath);
|
||||||
|
|
||||||
|
// create the java doc link, if needed
|
||||||
|
String targetDocPath = target.getPath(IAndroidTarget.DOCS);
|
||||||
|
IClasspathAttribute[] attributes = null;
|
||||||
|
if (targetDocPath != null) {
|
||||||
|
attributes = new IClasspathAttribute[] {
|
||||||
|
JavaCore.newClasspathAttribute(
|
||||||
|
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
|
||||||
|
targetDocPath)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
IClasspathEntry entry = JavaCore.newLibraryEntry(
|
||||||
|
new Path(library.getJarPath()),
|
||||||
|
null, // source attachment path
|
||||||
|
null, // default source attachment root path.
|
||||||
|
null,
|
||||||
|
attributes,
|
||||||
|
false // not exported.
|
||||||
|
);
|
||||||
|
list.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list.toArray(new IClasspathEntry[list.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,9 @@ public class Sdk {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a target from a hash that was generated by {@link IAndroidTarget#hashString()}.
|
* Returns a target from a hash that was generated by {@link IAndroidTarget#hashString()}.
|
||||||
* @param hash the hash
|
*
|
||||||
|
* @param hash the {@link IAndroidTarget} hash string.
|
||||||
|
* @return The matching {@link IAndroidTarget} or null.
|
||||||
*/
|
*/
|
||||||
public IAndroidTarget getTargetFromHashString(String hash) {
|
public IAndroidTarget getTargetFromHashString(String hash) {
|
||||||
return mManager.getTargetFromHashString(hash);
|
return mManager.getTargetFromHashString(hash);
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import com.android.ide.eclipse.common.AndroidConstants;
|
|||||||
import com.android.ide.eclipse.common.project.AndroidManifestHelper;
|
import com.android.ide.eclipse.common.project.AndroidManifestHelper;
|
||||||
import com.android.sdklib.IAndroidTarget;
|
import com.android.sdklib.IAndroidTarget;
|
||||||
import com.android.sdklib.SdkConstants;
|
import com.android.sdklib.SdkConstants;
|
||||||
|
import com.android.sdklib.project.ProjectProperties;
|
||||||
|
import com.android.sdklib.project.ProjectProperties.PropertyType;
|
||||||
import com.android.sdkuilib.SdkTargetSelector;
|
import com.android.sdkuilib.SdkTargetSelector;
|
||||||
|
|
||||||
import org.eclipse.core.filesystem.URIUtil;
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
@@ -129,6 +131,7 @@ public class NewProjectCreationPage extends WizardPage {
|
|||||||
protected boolean mProjectNameModifiedByUser;
|
protected boolean mProjectNameModifiedByUser;
|
||||||
protected boolean mApplicationNameModifiedByUser;
|
protected boolean mApplicationNameModifiedByUser;
|
||||||
private boolean mInternalMinSdkVersionUpdate;
|
private boolean mInternalMinSdkVersionUpdate;
|
||||||
|
private boolean mMinSdkVersionModifiedByUser;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -402,6 +405,7 @@ public class NewProjectCreationPage extends WizardPage {
|
|||||||
mSdkTargetSelector.setSelectionListener(new SelectionAdapter() {
|
mSdkTargetSelector.setSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
onSdkTargetModified();
|
||||||
updateLocationPathField(null);
|
updateLocationPathField(null);
|
||||||
setPageComplete(validatePage());
|
setPageComplete(validatePage());
|
||||||
}
|
}
|
||||||
@@ -735,6 +739,14 @@ public class NewProjectCreationPage extends WizardPage {
|
|||||||
try {
|
try {
|
||||||
int version = Integer.parseInt(getMinSdkVersion());
|
int version = Integer.parseInt(getMinSdkVersion());
|
||||||
|
|
||||||
|
// Before changing, compare with the currently selected one, if any.
|
||||||
|
// There can be multiple targets with the same sdk api version, so don't change
|
||||||
|
// it if it's already at the right version.
|
||||||
|
IAndroidTarget curr_target = getSdkTarget();
|
||||||
|
if (curr_target != null && curr_target.getApiVersionNumber() == version) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (IAndroidTarget target : mSdkTargetSelector.getTargets()) {
|
for (IAndroidTarget target : mSdkTargetSelector.getTargets()) {
|
||||||
if (target.getApiVersionNumber() == version) {
|
if (target.getApiVersionNumber() == version) {
|
||||||
mSdkTargetSelector.setSelection(target);
|
mSdkTargetSelector.setSelection(target);
|
||||||
@@ -744,6 +756,24 @@ public class NewProjectCreationPage extends WizardPage {
|
|||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mMinSdkVersionModifiedByUser = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an SDK target is modified.
|
||||||
|
*
|
||||||
|
* If the minSdkVersion field hasn't been modified by the user yet, we change it
|
||||||
|
* to reflect the sdk api level that has just been selected.
|
||||||
|
*/
|
||||||
|
private void onSdkTargetModified() {
|
||||||
|
IAndroidTarget target = getSdkTarget();
|
||||||
|
|
||||||
|
if (target != null && !mMinSdkVersionModifiedByUser) {
|
||||||
|
mInternalMinSdkVersionUpdate = true;
|
||||||
|
mMinSdkVersionField.setText(Integer.toString(target.getApiVersionNumber()));
|
||||||
|
mInternalMinSdkVersionUpdate = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -872,9 +902,22 @@ public class NewProjectCreationPage extends WizardPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select the target matching the manifest's sdk, if any
|
// Select the target matching the manifest's sdk or build properties, if any
|
||||||
boolean foundTarget = false;
|
boolean foundTarget = false;
|
||||||
if (minSdkVersion != null) {
|
|
||||||
|
ProjectProperties p = ProjectProperties.create(projectLocation, null);
|
||||||
|
if (p != null) {
|
||||||
|
// Check the {build|default}.properties files if present
|
||||||
|
p.merge(PropertyType.BUILD).merge(PropertyType.DEFAULT);
|
||||||
|
String v = p.getProperty(ProjectProperties.PROPERTY_TARGET);
|
||||||
|
IAndroidTarget target = Sdk.getCurrent().getTargetFromHashString(v);
|
||||||
|
if (target != null) {
|
||||||
|
mSdkTargetSelector.setSelection(target);
|
||||||
|
foundTarget = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundTarget && minSdkVersion != null) {
|
||||||
try {
|
try {
|
||||||
int sdkVersion = Integer.parseInt(minSdkVersion);
|
int sdkVersion = Integer.parseInt(minSdkVersion);
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ knownTests=(
|
|||||||
"heap frameworks/base/tests/AndroidTests com.android.unit_tests HeapTest # #"
|
"heap frameworks/base/tests/AndroidTests com.android.unit_tests HeapTest # #"
|
||||||
"activity frameworks/base/tests/AndroidTests com.android.unit_tests activity.ActivityTests # #"
|
"activity frameworks/base/tests/AndroidTests com.android.unit_tests activity.ActivityTests # #"
|
||||||
"deadlock tests/Deadlock com.android.deadlock # com.android.deadlock.tests #"
|
"deadlock tests/Deadlock com.android.deadlock # com.android.deadlock.tests #"
|
||||||
|
"syncadapter vendor/google/tests/AbstractGDataSyncAdapterTest # # com.google.android.providers.abstractgdatasyncadaptertests #"
|
||||||
|
"tablemerger frameworks/base/tests/FrameworkTest # android.content.AbstractTableMergerTest com.android.frameworktest.tests #"
|
||||||
|
|
||||||
# selected app tests
|
# selected app tests
|
||||||
"browser packages/apps/Browser com.android.browser # # .BrowserTestRunner"
|
"browser packages/apps/Browser com.android.browser # # .BrowserTestRunner"
|
||||||
@@ -130,7 +132,7 @@ knownTests=(
|
|||||||
"calendar packages/apps/Calendar/tests com.android.calendar.tests # # #"
|
"calendar packages/apps/Calendar/tests com.android.calendar.tests # # #"
|
||||||
"calprov content/providers/calendar com.android.providers.calendar.tests # # #"
|
"calprov content/providers/calendar com.android.providers.calendar.tests # # #"
|
||||||
"camera tests/Camera com.android.cameratests # # CameraInstrumentationTestRunner"
|
"camera tests/Camera com.android.cameratests # # CameraInstrumentationTestRunner"
|
||||||
"contactsprov content/tests/providers/contacts com.android.providers.contacts # com.android.providers.contactstests .ContactsProviderInstrumentation"
|
"contactsprov packages/providers/GoogleContactsProvider/tests com.android.providers.contacts # com.android.providers.contactstests #"
|
||||||
"email packages/apps/Email com.android.email # com.android.email.tests #"
|
"email packages/apps/Email com.android.email # com.android.email.tests #"
|
||||||
"emailsmall packages/apps/Email com.android.email SmallTests com.android.email.tests #"
|
"emailsmall packages/apps/Email com.android.email SmallTests com.android.email.tests #"
|
||||||
"media tests/MediaFrameworkTest com.android.mediaframeworktest # # .MediaFrameworkTestRunner"
|
"media tests/MediaFrameworkTest com.android.mediaframeworktest # # .MediaFrameworkTestRunner"
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
|
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
|
||||||
srcdir="${source-folder}"
|
srcdir="${source-folder}"
|
||||||
destdir="${out-classes}"
|
destdir="${out-classes}"
|
||||||
bootclasspath="${android-jar}">
|
bootclasspathref="android.target.classpath">
|
||||||
<classpath>
|
<classpath>
|
||||||
<fileset dir="${external-libs}" includes="*.jar"/>
|
<fileset dir="${external-libs}" includes="*.jar"/>
|
||||||
<pathelement path="${main-out-classes}"/>
|
<pathelement path="${main-out-classes}"/>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
<taskdef name="androidinit" classname="com.android.ant.AndroidInitTask"
|
<taskdef name="androidinit" classname="com.android.ant.AndroidInitTask"
|
||||||
classpathref="android.antlibs"/>
|
classpathref="android.antlibs"/>
|
||||||
|
|
||||||
<!-- Class the Android Init task that will import the proper rule file containing
|
<!-- Execute the Android Init task that will import the proper rule file containing
|
||||||
all the Ant targets -->
|
all the Ant targets, as well as setup some properties specific to the target. -->
|
||||||
<androidinit />
|
<androidinit />
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ rem Set up prog to be the path of this script, including following symlinks,
|
|||||||
rem and set up progdir to be the fully-qualified pathname of its directory.
|
rem and set up progdir to be the fully-qualified pathname of its directory.
|
||||||
set prog=%~f0
|
set prog=%~f0
|
||||||
|
|
||||||
|
rem Grab current directory before we change it
|
||||||
|
set workdir=%cd%
|
||||||
|
|
||||||
rem Change current directory to where ddms is, to avoid issues with directories
|
rem Change current directory to where ddms is, to avoid issues with directories
|
||||||
rem containing whitespaces.
|
rem containing whitespaces.
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
@@ -45,4 +48,4 @@ if debug NEQ "%1" goto NoDebug
|
|||||||
|
|
||||||
set jarpath=%frameworkdir%%jarfile%
|
set jarpath=%frameworkdir%%jarfile%
|
||||||
|
|
||||||
call java %java_debug% -Djava.ext.dirs=%frameworkdir% -Djava.library.path=%libdir% -Dcom.android.sdkmanager.toolsdir= -jar %jarpath% %*
|
call java %java_debug% -Djava.ext.dirs=%frameworkdir% -Djava.library.path=%libdir% -Dcom.android.sdkmanager.toolsdir= -Dcom.android.sdkmanager.workdir="%workdir%" -jar %jarpath% %*
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.sdkmanager;
|
package com.android.sdkmanager;
|
||||||
|
|
||||||
|
import com.android.sdklib.ISdkLog;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
@@ -57,8 +59,10 @@ public class CommandLineProcessor {
|
|||||||
* The key is a string "action/longName".
|
* The key is a string "action/longName".
|
||||||
*/
|
*/
|
||||||
private final HashMap<String, Arg> mArguments = new HashMap<String, Arg>();
|
private final HashMap<String, Arg> mArguments = new HashMap<String, Arg>();
|
||||||
|
private final ISdkLog mLog;
|
||||||
|
|
||||||
public CommandLineProcessor(String[][] actions) {
|
public CommandLineProcessor(ISdkLog logger, String[][] actions) {
|
||||||
|
mLog = logger;
|
||||||
mActions = actions;
|
mActions = actions;
|
||||||
|
|
||||||
define(MODE.STRING, false, INTERNAL_FLAG, null, KEY_ACTION, "Selected Action", null);
|
define(MODE.STRING, false, INTERNAL_FLAG, null, KEY_ACTION, "Selected Action", null);
|
||||||
@@ -564,7 +568,7 @@ public class CommandLineProcessor {
|
|||||||
* @param args Format arguments.
|
* @param args Format arguments.
|
||||||
*/
|
*/
|
||||||
protected void stdout(String format, Object...args) {
|
protected void stdout(String format, Object...args) {
|
||||||
System.out.println(String.format(format, args));
|
mLog.printf(format + "\n", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -575,6 +579,6 @@ public class CommandLineProcessor {
|
|||||||
* @param args Format arguments.
|
* @param args Format arguments.
|
||||||
*/
|
*/
|
||||||
protected void stderr(String format, Object...args) {
|
protected void stderr(String format, Object...args) {
|
||||||
System.err.println(String.format(format, args));
|
mLog.error(null, format, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,16 +41,27 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
class Main {
|
class Main {
|
||||||
|
|
||||||
|
/** Java property that defines the location of the sdk/tools directory. */
|
||||||
private final static String TOOLSDIR = "com.android.sdkmanager.toolsdir";
|
private final static String TOOLSDIR = "com.android.sdkmanager.toolsdir";
|
||||||
|
/** Java property that defines the working directory. On Windows the current working directory
|
||||||
|
* is actually the tools dir, in which case this is used to get the original CWD. */
|
||||||
|
private final static String WORKDIR = "com.android.sdkmanager.workdir";
|
||||||
|
|
||||||
private final static String[] BOOLEAN_YES_REPLIES = new String[] { "yes", "y" };
|
private final static String[] BOOLEAN_YES_REPLIES = new String[] { "yes", "y" };
|
||||||
private final static String[] BOOLEAN_NO_REPLIES = new String[] { "no", "n" };
|
private final static String[] BOOLEAN_NO_REPLIES = new String[] { "no", "n" };
|
||||||
|
|
||||||
|
/** Path to the SDK folder. This is the parent of {@link #TOOLSDIR}. */
|
||||||
private String mSdkFolder;
|
private String mSdkFolder;
|
||||||
|
/** Logger object. Use this to print normal output, warnings or errors. */
|
||||||
private ISdkLog mSdkLog;
|
private ISdkLog mSdkLog;
|
||||||
|
/** The SDK manager parses the SDK folder and gives access to the content. */
|
||||||
private SdkManager mSdkManager;
|
private SdkManager mSdkManager;
|
||||||
|
/** Virtual Machine manager to access the list of VMs or create new ones. */
|
||||||
private VmManager mVmManager;
|
private VmManager mVmManager;
|
||||||
|
/** Command-line processor with options specific to SdkManager. */
|
||||||
private SdkCommandLine mSdkCommandLine;
|
private SdkCommandLine mSdkCommandLine;
|
||||||
|
/** The working directory, either null or set to an existing absolute canonical directory. */
|
||||||
|
private File mWorkDir;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new Main().run(args);
|
new Main().run(args);
|
||||||
@@ -58,23 +69,57 @@ class Main {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the sdk manager app
|
* Runs the sdk manager app
|
||||||
* @param args
|
|
||||||
*/
|
*/
|
||||||
private void run(String[] args) {
|
private void run(String[] args) {
|
||||||
|
createLogger();
|
||||||
init();
|
init();
|
||||||
mSdkCommandLine.parseArgs(args);
|
mSdkCommandLine.parseArgs(args);
|
||||||
parseSdk();
|
parseSdk();
|
||||||
doAction();
|
doAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the {@link #mSdkLog} object.
|
||||||
|
* <p/>
|
||||||
|
* This must be done before {@link #init()} as it will be used to report errors.
|
||||||
|
*/
|
||||||
|
private void createLogger() {
|
||||||
|
mSdkLog = new ISdkLog() {
|
||||||
|
public void error(Throwable t, String errorFormat, Object... args) {
|
||||||
|
if (errorFormat != null) {
|
||||||
|
System.err.printf("Error: " + errorFormat, args);
|
||||||
|
if (!errorFormat.endsWith("\n")) {
|
||||||
|
System.err.printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (t != null) {
|
||||||
|
System.err.printf("Error: %s\n", t.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warning(String warningFormat, Object... args) {
|
||||||
|
if (mSdkCommandLine.isVerbose()) {
|
||||||
|
System.out.printf("Warning: " + warningFormat, args);
|
||||||
|
if (!warningFormat.endsWith("\n")) {
|
||||||
|
System.out.printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void printf(String msgFormat, Object... args) {
|
||||||
|
System.out.printf(msgFormat, args);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init the application by making sure the SDK path is available and
|
* Init the application by making sure the SDK path is available and
|
||||||
* doing basic parsing of the SDK.
|
* doing basic parsing of the SDK.
|
||||||
*/
|
*/
|
||||||
private void init() {
|
private void init() {
|
||||||
mSdkCommandLine = new SdkCommandLine();
|
mSdkCommandLine = new SdkCommandLine(mSdkLog);
|
||||||
|
|
||||||
/* We get passed a property for the tools dir */
|
// We get passed a property for the tools dir
|
||||||
String toolsDirProp = System.getProperty(TOOLSDIR);
|
String toolsDirProp = System.getProperty(TOOLSDIR);
|
||||||
if (toolsDirProp == null) {
|
if (toolsDirProp == null) {
|
||||||
// for debugging, it's easier to override using the process environment
|
// for debugging, it's easier to override using the process environment
|
||||||
@@ -98,15 +143,28 @@ class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mSdkFolder == null) {
|
if (mSdkFolder == null) {
|
||||||
String os = System.getProperty("os.name");
|
errorAndExit("The tools directory property is not set, please make sure you are executing %1$s",
|
||||||
String cmd = "android";
|
SdkConstants.AndroidCmdName());
|
||||||
if (os.startsWith("Windows")) {
|
}
|
||||||
cmd += ".bat";
|
|
||||||
}
|
|
||||||
|
|
||||||
mSdkCommandLine.printHelpAndExit(
|
// We might get passed a property for the working directory
|
||||||
"ERROR: The tools directory property is not set, please make sure you are executing %1$s",
|
// Either it is a valid directory and mWorkDir is set to it's absolute canonical value
|
||||||
cmd);
|
// or mWorkDir remains null.
|
||||||
|
String workDirProp = System.getProperty(WORKDIR);
|
||||||
|
if (workDirProp == null) {
|
||||||
|
workDirProp = System.getenv(WORKDIR);
|
||||||
|
}
|
||||||
|
if (workDirProp != null) {
|
||||||
|
// This should be a valid directory
|
||||||
|
mWorkDir = new File(workDirProp);
|
||||||
|
try {
|
||||||
|
mWorkDir = mWorkDir.getCanonicalFile().getAbsoluteFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
mWorkDir = null;
|
||||||
|
}
|
||||||
|
if (mWorkDir == null || !mWorkDir.isDirectory()) {
|
||||||
|
errorAndExit("The working directory does not seem to be valid: '%1$s", workDirProp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,33 +172,10 @@ class Main {
|
|||||||
* Does the basic SDK parsing required for all actions
|
* Does the basic SDK parsing required for all actions
|
||||||
*/
|
*/
|
||||||
private void parseSdk() {
|
private void parseSdk() {
|
||||||
mSdkLog = new ISdkLog() {
|
|
||||||
public void error(Throwable t, String errorFormat, Object... args) {
|
|
||||||
if (errorFormat != null) {
|
|
||||||
System.err.printf("Error: " + errorFormat, args);
|
|
||||||
System.err.println("");
|
|
||||||
}
|
|
||||||
if (t != null) {
|
|
||||||
System.err.print("Error: " + t.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void warning(String warningFormat, Object... args) {
|
|
||||||
if (false) {
|
|
||||||
// TODO: on display warnings in verbose mode.
|
|
||||||
System.out.printf("Warning: " + warningFormat, args);
|
|
||||||
System.out.println("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void printf(String msgFormat, Object... args) {
|
|
||||||
System.out.printf(msgFormat, args);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mSdkManager = SdkManager.createManager(mSdkFolder, mSdkLog);
|
mSdkManager = SdkManager.createManager(mSdkFolder, mSdkLog);
|
||||||
|
|
||||||
if (mSdkManager == null) {
|
if (mSdkManager == null) {
|
||||||
mSdkCommandLine.printHelpAndExit("ERROR: Unable to parse SDK content.");
|
errorAndExit("Unable to parse SDK content.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,67 +202,108 @@ class Main {
|
|||||||
int targetId = mSdkCommandLine.getNewProjectTargetId();
|
int targetId = mSdkCommandLine.getNewProjectTargetId();
|
||||||
IAndroidTarget[] targets = mSdkManager.getTargets();
|
IAndroidTarget[] targets = mSdkManager.getTargets();
|
||||||
if (targetId < 1 || targetId > targets.length) {
|
if (targetId < 1 || targetId > targets.length) {
|
||||||
mSdkCommandLine.printHelpAndExit("ERROR: Wrong target id.");
|
errorAndExit("Target id is not valid. Use '%s list -f target' to get the target Ids.",
|
||||||
|
SdkConstants.AndroidCmdName());
|
||||||
}
|
}
|
||||||
IAndroidTarget target = targets[targetId - 1];
|
IAndroidTarget target = targets[targetId - 1];
|
||||||
|
|
||||||
ProjectCreator creator = new ProjectCreator(mSdkFolder,
|
ProjectCreator creator = new ProjectCreator(mSdkFolder,
|
||||||
OutputLevel.NORMAL, mSdkLog);
|
mSdkCommandLine.isVerbose() ? OutputLevel.VERBOSE : OutputLevel.NORMAL,
|
||||||
|
mSdkLog);
|
||||||
|
|
||||||
creator.createProject(mSdkCommandLine.getNewProjectLocation(),
|
String projectDir = getProjectLocation(mSdkCommandLine.getNewProjectLocation());
|
||||||
|
|
||||||
|
creator.createProject(projectDir,
|
||||||
mSdkCommandLine.getNewProjectName(), mSdkCommandLine.getNewProjectPackage(),
|
mSdkCommandLine.getNewProjectName(), mSdkCommandLine.getNewProjectPackage(),
|
||||||
mSdkCommandLine.getNewProjectActivity(), target, true);
|
mSdkCommandLine.getNewProjectActivity(), target, false /* isTestProject*/);
|
||||||
} else {
|
} else {
|
||||||
mSdkCommandLine.printHelpAndExit(null);
|
mSdkCommandLine.printHelpAndExit(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjusts the project location to make it absolute & canonical relative to the
|
||||||
|
* working directory, if any.
|
||||||
|
*
|
||||||
|
* @return The project absolute path relative to {@link #mWorkDir} or the original
|
||||||
|
* newProjectLocation otherwise.
|
||||||
|
*/
|
||||||
|
private String getProjectLocation(String newProjectLocation) {
|
||||||
|
|
||||||
|
// If the new project location is absolute, use it as-is
|
||||||
|
File projectDir = new File(newProjectLocation);
|
||||||
|
if (projectDir.isAbsolute()) {
|
||||||
|
return newProjectLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if there's no working directory, just use the project location as-is.
|
||||||
|
if (mWorkDir == null) {
|
||||||
|
return newProjectLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Combine then and get an absolute canonical directory
|
||||||
|
try {
|
||||||
|
projectDir = new File(mWorkDir, newProjectLocation).getCanonicalFile();
|
||||||
|
|
||||||
|
return projectDir.getPath();
|
||||||
|
} catch (IOException e) {
|
||||||
|
errorAndExit("Failed to combine working directory '%1$s' with project location '%2$s': %3$s",
|
||||||
|
mWorkDir.getPath(),
|
||||||
|
newProjectLocation,
|
||||||
|
e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the list of available Targets (Platforms and Add-ons)
|
* Displays the list of available Targets (Platforms and Add-ons)
|
||||||
*/
|
*/
|
||||||
private void displayTargetList() {
|
private void displayTargetList() {
|
||||||
System.out.println("Available Android targets:");
|
mSdkLog.printf("Available Android targets:\n");
|
||||||
|
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (IAndroidTarget target : mSdkManager.getTargets()) {
|
for (IAndroidTarget target : mSdkManager.getTargets()) {
|
||||||
if (target.isPlatform()) {
|
if (target.isPlatform()) {
|
||||||
System.out.printf("[%d] %s\n", index, target.getName());
|
mSdkLog.printf("[%d] %s\n", index, target.getName());
|
||||||
System.out.printf(" API level: %d\n", target.getApiVersionNumber());
|
mSdkLog.printf(" API level: %d\n", target.getApiVersionNumber());
|
||||||
} else {
|
} else {
|
||||||
System.out.printf("[%d] Add-on: %s\n", index, target.getName());
|
mSdkLog.printf("[%d] Add-on: %s\n", index, target.getName());
|
||||||
System.out.printf(" Vendor: %s\n", target.getVendor());
|
mSdkLog.printf(" Vendor: %s\n", target.getVendor());
|
||||||
if (target.getDescription() != null) {
|
if (target.getDescription() != null) {
|
||||||
System.out.printf(" Description: %s\n", target.getDescription());
|
mSdkLog.printf(" Description: %s\n", target.getDescription());
|
||||||
}
|
}
|
||||||
System.out.printf(" Based on Android %s (API level %d)\n",
|
mSdkLog.printf(" Based on Android %s (API level %d)\n",
|
||||||
target.getApiVersionName(), target.getApiVersionNumber());
|
target.getApiVersionName(), target.getApiVersionNumber());
|
||||||
|
|
||||||
// display the optional libraries.
|
// display the optional libraries.
|
||||||
IOptionalLibrary[] libraries = target.getOptionalLibraries();
|
IOptionalLibrary[] libraries = target.getOptionalLibraries();
|
||||||
if (libraries != null) {
|
if (libraries != null) {
|
||||||
|
mSdkLog.printf(" Libraries:\n");
|
||||||
for (IOptionalLibrary library : libraries) {
|
for (IOptionalLibrary library : libraries) {
|
||||||
System.out.printf(" Library: %s (%s)\n", library.getName(),
|
mSdkLog.printf(" * %1$s (%2$s)\n",
|
||||||
library.getJarName());
|
library.getName(), library.getJarName());
|
||||||
|
mSdkLog.printf(String.format(
|
||||||
|
" %1$s\n", library.getDescription()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the target skins
|
// get the target skins
|
||||||
String[] skins = target.getSkins();
|
String[] skins = target.getSkins();
|
||||||
System.out.print(" Skins: ");
|
mSdkLog.printf(" Skins: ");
|
||||||
if (skins != null) {
|
if (skins != null) {
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (String skin : skins) {
|
for (String skin : skins) {
|
||||||
if (first == false) {
|
if (first == false) {
|
||||||
System.out.print(", ");
|
mSdkLog.printf(", ");
|
||||||
} else {
|
} else {
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
System.out.print(skin);
|
mSdkLog.printf(skin);
|
||||||
}
|
}
|
||||||
System.out.println("");
|
mSdkLog.printf("\n");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("no skins.");
|
mSdkLog.printf("no skins.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
@@ -241,30 +317,29 @@ class Main {
|
|||||||
try {
|
try {
|
||||||
mVmManager = new VmManager(mSdkManager, null /* sdklog */);
|
mVmManager = new VmManager(mSdkManager, null /* sdklog */);
|
||||||
|
|
||||||
System.out.println("Available Android VMs:");
|
mSdkLog.printf("Available Android VMs:\n");
|
||||||
|
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (VmInfo info : mVmManager.getVms()) {
|
for (VmInfo info : mVmManager.getVms()) {
|
||||||
System.out.printf("[%d] %s\n", index, info.getName());
|
mSdkLog.printf("[%d] %s\n", index, info.getName());
|
||||||
System.out.printf(" Path: %s\n", info.getPath());
|
mSdkLog.printf(" Path: %s\n", info.getPath());
|
||||||
|
|
||||||
// get the target of the Vm
|
// get the target of the Vm
|
||||||
IAndroidTarget target = info.getTarget();
|
IAndroidTarget target = info.getTarget();
|
||||||
if (target.isPlatform()) {
|
if (target.isPlatform()) {
|
||||||
System.out.printf(" Target: %s (API level %d)\n", target.getName(),
|
mSdkLog.printf(" Target: %s (API level %d)\n", target.getName(),
|
||||||
target.getApiVersionNumber());
|
target.getApiVersionNumber());
|
||||||
} else {
|
} else {
|
||||||
System.out.printf(" Target: %s (%s)\n", target.getName(), target
|
mSdkLog.printf(" Target: %s (%s)\n", target.getName(), target
|
||||||
.getVendor());
|
.getVendor());
|
||||||
System.out.printf(" Based on Android %s (API level %d)\n", target
|
mSdkLog.printf(" Based on Android %s (API level %d)\n", target
|
||||||
.getApiVersionName(), target.getApiVersionNumber());
|
.getApiVersionName(), target.getApiVersionNumber());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
} catch (AndroidLocationException e) {
|
} catch (AndroidLocationException e) {
|
||||||
mSdkCommandLine.printHelpAndExit(e.getMessage());
|
errorAndExit(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,33 +354,43 @@ class Main {
|
|||||||
if (targetId >= 1 && targetId <= mSdkManager.getTargets().length) {
|
if (targetId >= 1 && targetId <= mSdkManager.getTargets().length) {
|
||||||
target = mSdkManager.getTargets()[targetId-1]; // target it is 1-based
|
target = mSdkManager.getTargets()[targetId-1]; // target it is 1-based
|
||||||
} else {
|
} else {
|
||||||
mSdkCommandLine.printHelpAndExit(
|
errorAndExit("Target id is not valid. Use '%s list -f target' to get the target Ids.",
|
||||||
"ERROR: Target Id is not a valid Id. Check 'android list target' for the list of targets.");
|
SdkConstants.AndroidCmdName());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// default to standard path now
|
mVmManager = new VmManager(mSdkManager, mSdkLog);
|
||||||
String vmRoot = AndroidLocation.getFolder() + AndroidLocation.FOLDER_VMS;
|
|
||||||
|
|
||||||
Map<String, String> hardwareConfig = null;
|
String vmName = mSdkCommandLine.getNewVmName();
|
||||||
if (target.isPlatform()) {
|
VmInfo info = mVmManager.getVm(vmName);
|
||||||
try {
|
if (info != null) {
|
||||||
hardwareConfig = promptForHardware(target);
|
errorAndExit("VM %s already exists.", vmName);
|
||||||
} catch (IOException e) {
|
} else {
|
||||||
mSdkCommandLine.printHelpAndExit(e.getMessage());
|
String vmParentFolder = mSdkCommandLine.getNewVmLocation();
|
||||||
|
if (vmParentFolder == null) {
|
||||||
|
vmParentFolder = AndroidLocation.getFolder() + AndroidLocation.FOLDER_VMS;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
VmManager.createVm(vmRoot,
|
Map<String, String> hardwareConfig = null;
|
||||||
mSdkCommandLine.getNewVmName(),
|
if (target.isPlatform()) {
|
||||||
target,
|
try {
|
||||||
null /*skinName*/,
|
hardwareConfig = promptForHardware(target);
|
||||||
null /*sdcardPath*/,
|
} catch (IOException e) {
|
||||||
0 /*sdcardSize*/,
|
errorAndExit(e.getMessage());
|
||||||
hardwareConfig,
|
}
|
||||||
null /* sdklog */);
|
}
|
||||||
|
|
||||||
|
mVmManager.createVm(vmParentFolder,
|
||||||
|
mSdkCommandLine.getNewVmName(),
|
||||||
|
target,
|
||||||
|
mSdkCommandLine.getNewVmSkin(),
|
||||||
|
null /*sdcardPath*/,
|
||||||
|
0 /*sdcardSize*/,
|
||||||
|
hardwareConfig,
|
||||||
|
mSdkLog);
|
||||||
|
}
|
||||||
} catch (AndroidLocationException e) {
|
} catch (AndroidLocationException e) {
|
||||||
mSdkCommandLine.printHelpAndExit(e.getMessage());
|
errorAndExit(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,10 +403,9 @@ class Main {
|
|||||||
String result;
|
String result;
|
||||||
String defaultAnswer = "no";
|
String defaultAnswer = "no";
|
||||||
|
|
||||||
System.out.print(String.format("%s is a basic Android platform.\n",
|
mSdkLog.printf("%s is a basic Android platform.\n", createTarget.getName());
|
||||||
createTarget.getName()));
|
mSdkLog.printf("Do you wish to create a custom hardware profile [%s]",
|
||||||
System.out.print(String.format("Do you which to create a custom hardware profile [%s]",
|
defaultAnswer);
|
||||||
defaultAnswer));
|
|
||||||
|
|
||||||
result = readLine(readLineBuffer).trim();
|
result = readLine(readLineBuffer).trim();
|
||||||
// handle default:
|
// handle default:
|
||||||
@@ -334,7 +418,7 @@ class Main {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(""); // empty line
|
mSdkLog.printf("\n"); // empty line
|
||||||
|
|
||||||
// get the list of possible hardware properties
|
// get the list of possible hardware properties
|
||||||
File hardwareDefs = new File (mSdkFolder + File.separator +
|
File hardwareDefs = new File (mSdkFolder + File.separator +
|
||||||
@@ -349,23 +433,23 @@ class Main {
|
|||||||
|
|
||||||
String description = property.getDescription();
|
String description = property.getDescription();
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
System.out.printf("%s: %s\n", property.getAbstract(), description);
|
mSdkLog.printf("%s: %s\n", property.getAbstract(), description);
|
||||||
} else {
|
} else {
|
||||||
System.out.println(property.getAbstract());
|
mSdkLog.printf("%s\n", property.getAbstract());
|
||||||
}
|
}
|
||||||
|
|
||||||
String defaultValue = property.getDefault();
|
String defaultValue = property.getDefault();
|
||||||
|
|
||||||
if (defaultValue != null) {
|
if (defaultValue != null) {
|
||||||
System.out.printf("%s [%s]:", property.getName(), defaultValue);
|
mSdkLog.printf("%s [%s]:", property.getName(), defaultValue);
|
||||||
} else {
|
} else {
|
||||||
System.out.printf("%s (%s):", property.getName(), property.getType());
|
mSdkLog.printf("%s (%s):", property.getName(), property.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
result = readLine(readLineBuffer);
|
result = readLine(readLineBuffer);
|
||||||
if (result.length() == 0) {
|
if (result.length() == 0) {
|
||||||
if (defaultValue != null) {
|
if (defaultValue != null) {
|
||||||
System.out.println(""); // empty line
|
mSdkLog.printf("\n"); // empty line
|
||||||
i++; // go to the next property if we have a valid default value.
|
i++; // go to the next property if we have a valid default value.
|
||||||
// if there's no default, we'll redo this property
|
// if there's no default, we'll redo this property
|
||||||
}
|
}
|
||||||
@@ -384,7 +468,7 @@ class Main {
|
|||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// display error, and do not increment i to redo this property
|
// display error, and do not increment i to redo this property
|
||||||
System.out.println("\n" + e.getMessage());
|
mSdkLog.printf("\n%s\n", e.getMessage());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
@@ -394,7 +478,7 @@ class Main {
|
|||||||
i++; // valid reply, move to next property
|
i++; // valid reply, move to next property
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
// display error, and do not increment i to redo this property
|
// display error, and do not increment i to redo this property
|
||||||
System.out.println("\n" + e.getMessage());
|
mSdkLog.printf("\n%s\n", e.getMessage());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DISKSIZE:
|
case DISKSIZE:
|
||||||
@@ -404,7 +488,7 @@ class Main {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(""); // empty line
|
mSdkLog.printf("\n"); // empty line
|
||||||
}
|
}
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
@@ -458,4 +542,9 @@ class Main {
|
|||||||
|
|
||||||
throw new IOException(String.format("%s is not a valid reply", reply));
|
throw new IOException(String.format("%s is not a valid reply", reply));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void errorAndExit(String format, Object...args) {
|
||||||
|
mSdkLog.error(null, format, args);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.sdkmanager;
|
package com.android.sdkmanager;
|
||||||
|
|
||||||
|
import com.android.sdklib.ISdkLog;
|
||||||
import com.android.sdklib.SdkManager;
|
import com.android.sdklib.SdkManager;
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +39,8 @@ public class SdkCommandLine extends CommandLineProcessor {
|
|||||||
public static final String KEY_NAME = "name";
|
public static final String KEY_NAME = "name";
|
||||||
public static final String KEY_OUT = "out";
|
public static final String KEY_OUT = "out";
|
||||||
public static final String KEY_FILTER = "filter";
|
public static final String KEY_FILTER = "filter";
|
||||||
|
public static final String KEY_SKIN = "skin";
|
||||||
|
public static final String KEY_SDCARD_PATH = "sdcard";
|
||||||
|
|
||||||
public final static String ACTION_LIST = "list";
|
public final static String ACTION_LIST = "list";
|
||||||
public final static String ACTION_NEW_VM = ARG_VM;
|
public final static String ACTION_NEW_VM = ARG_VM;
|
||||||
@@ -52,11 +55,11 @@ public class SdkCommandLine extends CommandLineProcessor {
|
|||||||
{ ACTION_NEW_PROJECT,
|
{ ACTION_NEW_PROJECT,
|
||||||
"Creates a new project using a template." },
|
"Creates a new project using a template." },
|
||||||
{ ACTION_UPDATE_PROJECT,
|
{ ACTION_UPDATE_PROJECT,
|
||||||
"Updates a new project from existing source (must have an AndroidManifest.xml)." },
|
"Updates a project from existing source (must have an AndroidManifest.xml)." },
|
||||||
};
|
};
|
||||||
|
|
||||||
public SdkCommandLine() {
|
public SdkCommandLine(ISdkLog logger) {
|
||||||
super(ACTIONS);
|
super(logger, ACTIONS);
|
||||||
|
|
||||||
define(MODE.ENUM, false, ACTION_LIST, "f", KEY_FILTER,
|
define(MODE.ENUM, false, ACTION_LIST, "f", KEY_FILTER,
|
||||||
"List filter", new String[] { ARG_ALL, ARG_TARGET, ARG_VM });
|
"List filter", new String[] { ARG_ALL, ARG_TARGET, ARG_VM });
|
||||||
@@ -67,6 +70,10 @@ public class SdkCommandLine extends CommandLineProcessor {
|
|||||||
"Name of the new VM", null);
|
"Name of the new VM", null);
|
||||||
define(MODE.INTEGER, true, ACTION_NEW_VM, "t", KEY_TARGET_ID,
|
define(MODE.INTEGER, true, ACTION_NEW_VM, "t", KEY_TARGET_ID,
|
||||||
"Target id of the new VM", null);
|
"Target id of the new VM", null);
|
||||||
|
define(MODE.STRING, true, ACTION_NEW_VM, "s", KEY_SKIN,
|
||||||
|
"Skin of the new VM", null);
|
||||||
|
define(MODE.STRING, true, ACTION_NEW_VM, "p", KEY_SDCARD_PATH,
|
||||||
|
"Path to a shared SD card image for the new VM", null);
|
||||||
|
|
||||||
define(MODE.ENUM, true, ACTION_NEW_PROJECT, "m", KEY_MODE,
|
define(MODE.ENUM, true, ACTION_NEW_PROJECT, "m", KEY_MODE,
|
||||||
"Project mode", new String[] { ARG_ACTIVITY, ARG_ALIAS });
|
"Project mode", new String[] { ARG_ACTIVITY, ARG_ALIAS });
|
||||||
@@ -111,6 +118,17 @@ public class SdkCommandLine extends CommandLineProcessor {
|
|||||||
return ((String) getValue(ACTION_NEW_VM, KEY_NAME));
|
return ((String) getValue(ACTION_NEW_VM, KEY_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Helper to retrieve the --skin name for the new vm action. */
|
||||||
|
public String getNewVmSkin() {
|
||||||
|
return ((String) getValue(ACTION_NEW_VM, KEY_SKIN));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Helper to retrieve the --sdcard name for the new vm action. */
|
||||||
|
public String getNewVmSdCard() {
|
||||||
|
return ((String) getValue(ACTION_NEW_VM, KEY_SDCARD_PATH));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- some helpers for project action flags
|
// -- some helpers for project action flags
|
||||||
|
|
||||||
/** Helper to retrieve the --out location for the new project action. */
|
/** Helper to retrieve the --out location for the new project action. */
|
||||||
|
|||||||
@@ -16,11 +16,15 @@
|
|||||||
|
|
||||||
package com.android.sdkmanager;
|
package com.android.sdkmanager;
|
||||||
|
|
||||||
|
import com.android.sdklib.ISdkLog;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
|
||||||
public class CommandLineProcessorTest extends TestCase {
|
public class CommandLineProcessorTest extends TestCase {
|
||||||
|
|
||||||
|
private MockStdLogger mLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mock version of the {@link CommandLineProcessor} class that does not
|
* A mock version of the {@link CommandLineProcessor} class that does not
|
||||||
* exits and captures its stdout/stderr output.
|
* exits and captures its stdout/stderr output.
|
||||||
@@ -31,8 +35,9 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
private String mStdOut = "";
|
private String mStdOut = "";
|
||||||
private String mStdErr = "";
|
private String mStdErr = "";
|
||||||
|
|
||||||
public MockCommandLineProcessor() {
|
public MockCommandLineProcessor(ISdkLog logger) {
|
||||||
super(new String[][] {
|
super(logger,
|
||||||
|
new String[][] {
|
||||||
{ "action1", "Some action" },
|
{ "action1", "Some action" },
|
||||||
{ "action2", "Another action" },
|
{ "action2", "Another action" },
|
||||||
});
|
});
|
||||||
@@ -87,6 +92,7 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
|
mLog = new MockStdLogger();
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +102,7 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void testPrintHelpAndExit() {
|
public final void testPrintHelpAndExit() {
|
||||||
MockCommandLineProcessor c = new MockCommandLineProcessor();
|
MockCommandLineProcessor c = new MockCommandLineProcessor(mLog);
|
||||||
assertFalse(c.wasExitCalled());
|
assertFalse(c.wasExitCalled());
|
||||||
assertFalse(c.wasHelpCalled());
|
assertFalse(c.wasHelpCalled());
|
||||||
assertTrue(c.getStdOut().equals(""));
|
assertTrue(c.getStdOut().equals(""));
|
||||||
@@ -107,7 +113,7 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
assertTrue(c.getStdErr().equals(""));
|
assertTrue(c.getStdErr().equals(""));
|
||||||
assertTrue(c.wasExitCalled());
|
assertTrue(c.wasExitCalled());
|
||||||
|
|
||||||
c = new MockCommandLineProcessor();
|
c = new MockCommandLineProcessor(mLog);
|
||||||
assertFalse(c.wasExitCalled());
|
assertFalse(c.wasExitCalled());
|
||||||
assertTrue(c.getStdOut().equals(""));
|
assertTrue(c.getStdOut().equals(""));
|
||||||
assertTrue(c.getStdErr().indexOf("Missing parameter") == -1);
|
assertTrue(c.getStdErr().indexOf("Missing parameter") == -1);
|
||||||
@@ -119,7 +125,7 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void testVerbose() {
|
public final void testVerbose() {
|
||||||
MockCommandLineProcessor c = new MockCommandLineProcessor();
|
MockCommandLineProcessor c = new MockCommandLineProcessor(mLog);
|
||||||
|
|
||||||
assertFalse(c.isVerbose());
|
assertFalse(c.isVerbose());
|
||||||
c.parseArgs(new String[] { "-v" });
|
c.parseArgs(new String[] { "-v" });
|
||||||
@@ -128,7 +134,7 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
assertTrue(c.wasHelpCalled());
|
assertTrue(c.wasHelpCalled());
|
||||||
assertTrue(c.getStdErr().indexOf("Missing action name.") != -1);
|
assertTrue(c.getStdErr().indexOf("Missing action name.") != -1);
|
||||||
|
|
||||||
c = new MockCommandLineProcessor();
|
c = new MockCommandLineProcessor(mLog);
|
||||||
c.parseArgs(new String[] { "--verbose" });
|
c.parseArgs(new String[] { "--verbose" });
|
||||||
assertTrue(c.isVerbose());
|
assertTrue(c.isVerbose());
|
||||||
assertTrue(c.wasExitCalled());
|
assertTrue(c.wasExitCalled());
|
||||||
@@ -137,14 +143,14 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void testHelp() {
|
public final void testHelp() {
|
||||||
MockCommandLineProcessor c = new MockCommandLineProcessor();
|
MockCommandLineProcessor c = new MockCommandLineProcessor(mLog);
|
||||||
|
|
||||||
c.parseArgs(new String[] { "-h" });
|
c.parseArgs(new String[] { "-h" });
|
||||||
assertTrue(c.wasExitCalled());
|
assertTrue(c.wasExitCalled());
|
||||||
assertTrue(c.wasHelpCalled());
|
assertTrue(c.wasHelpCalled());
|
||||||
assertTrue(c.getStdErr().indexOf("Missing action name.") == -1);
|
assertTrue(c.getStdErr().indexOf("Missing action name.") == -1);
|
||||||
|
|
||||||
c = new MockCommandLineProcessor();
|
c = new MockCommandLineProcessor(mLog);
|
||||||
c.parseArgs(new String[] { "--help" });
|
c.parseArgs(new String[] { "--help" });
|
||||||
assertTrue(c.wasExitCalled());
|
assertTrue(c.wasExitCalled());
|
||||||
assertTrue(c.wasHelpCalled());
|
assertTrue(c.wasHelpCalled());
|
||||||
@@ -152,7 +158,7 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void testMandatory() {
|
public final void testMandatory() {
|
||||||
MockCommandLineProcessor c = new MockCommandLineProcessor();
|
MockCommandLineProcessor c = new MockCommandLineProcessor(mLog);
|
||||||
|
|
||||||
c.parseArgs(new String[] { "action1", "-1", "value1", "-2", "value2" });
|
c.parseArgs(new String[] { "action1", "-1", "value1", "-2", "value2" });
|
||||||
assertFalse(c.wasExitCalled());
|
assertFalse(c.wasExitCalled());
|
||||||
@@ -161,7 +167,7 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
assertEquals("value1", c.getValue("action1", "first"));
|
assertEquals("value1", c.getValue("action1", "first"));
|
||||||
assertEquals("value2", c.getValue("action1", "second"));
|
assertEquals("value2", c.getValue("action1", "second"));
|
||||||
|
|
||||||
c = new MockCommandLineProcessor();
|
c = new MockCommandLineProcessor(mLog);
|
||||||
c.parseArgs(new String[] { "action1", "-2", "value2" });
|
c.parseArgs(new String[] { "action1", "-2", "value2" });
|
||||||
assertFalse(c.wasExitCalled());
|
assertFalse(c.wasExitCalled());
|
||||||
assertFalse(c.wasHelpCalled());
|
assertFalse(c.wasHelpCalled());
|
||||||
@@ -169,7 +175,7 @@ public class CommandLineProcessorTest extends TestCase {
|
|||||||
assertEquals(null, c.getValue("action1", "first"));
|
assertEquals(null, c.getValue("action1", "first"));
|
||||||
assertEquals("value2", c.getValue("action1", "second"));
|
assertEquals("value2", c.getValue("action1", "second"));
|
||||||
|
|
||||||
c = new MockCommandLineProcessor();
|
c = new MockCommandLineProcessor(mLog);
|
||||||
c.parseArgs(new String[] { "action1" });
|
c.parseArgs(new String[] { "action1" });
|
||||||
assertTrue(c.wasExitCalled());
|
assertTrue(c.wasExitCalled());
|
||||||
assertTrue(c.wasHelpCalled());
|
assertTrue(c.wasHelpCalled());
|
||||||
|
|||||||
@@ -16,10 +16,14 @@
|
|||||||
|
|
||||||
package com.android.sdkmanager;
|
package com.android.sdkmanager;
|
||||||
|
|
||||||
|
import com.android.sdklib.ISdkLog;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
public class SdkCommandLineTest extends TestCase {
|
public class SdkCommandLineTest extends TestCase {
|
||||||
|
|
||||||
|
private MockStdLogger mLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mock version of the {@link SdkCommandLine} class that does not
|
* A mock version of the {@link SdkCommandLine} class that does not
|
||||||
* exits and discards its stdout/stderr output.
|
* exits and discards its stdout/stderr output.
|
||||||
@@ -28,7 +32,8 @@ public class SdkCommandLineTest extends TestCase {
|
|||||||
private boolean mExitCalled;
|
private boolean mExitCalled;
|
||||||
private boolean mHelpCalled;
|
private boolean mHelpCalled;
|
||||||
|
|
||||||
public MockSdkCommandLine() {
|
public MockSdkCommandLine(ISdkLog logger) {
|
||||||
|
super(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -64,6 +69,7 @@ public class SdkCommandLineTest extends TestCase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
|
mLog = new MockStdLogger();
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +80,7 @@ public class SdkCommandLineTest extends TestCase {
|
|||||||
|
|
||||||
/** Test list with long name and verbose */
|
/** Test list with long name and verbose */
|
||||||
public final void testList_Long_Verbose() {
|
public final void testList_Long_Verbose() {
|
||||||
MockSdkCommandLine c = new MockSdkCommandLine();
|
MockSdkCommandLine c = new MockSdkCommandLine(mLog);
|
||||||
assertEquals("all", c.getListFilter());
|
assertEquals("all", c.getListFilter());
|
||||||
c.parseArgs(new String[] { "-v", "list", "--filter", "vm" });
|
c.parseArgs(new String[] { "-v", "list", "--filter", "vm" });
|
||||||
assertFalse(c.wasHelpCalled());
|
assertFalse(c.wasHelpCalled());
|
||||||
@@ -85,7 +91,7 @@ public class SdkCommandLineTest extends TestCase {
|
|||||||
|
|
||||||
/** Test list with short name and no verbose */
|
/** Test list with short name and no verbose */
|
||||||
public final void testList_Short() {
|
public final void testList_Short() {
|
||||||
MockSdkCommandLine c = new MockSdkCommandLine();
|
MockSdkCommandLine c = new MockSdkCommandLine(mLog);
|
||||||
assertEquals("all", c.getListFilter());
|
assertEquals("all", c.getListFilter());
|
||||||
c.parseArgs(new String[] { "list", "-f", "vm" });
|
c.parseArgs(new String[] { "list", "-f", "vm" });
|
||||||
assertFalse(c.wasHelpCalled());
|
assertFalse(c.wasHelpCalled());
|
||||||
@@ -95,7 +101,7 @@ public class SdkCommandLineTest extends TestCase {
|
|||||||
|
|
||||||
/** Test list with long name and missing parameter */
|
/** Test list with long name and missing parameter */
|
||||||
public final void testList_Long_MissingParam() {
|
public final void testList_Long_MissingParam() {
|
||||||
MockSdkCommandLine c = new MockSdkCommandLine();
|
MockSdkCommandLine c = new MockSdkCommandLine(mLog);
|
||||||
assertEquals("all", c.getListFilter());
|
assertEquals("all", c.getListFilter());
|
||||||
c.parseArgs(new String[] { "list", "--filter" });
|
c.parseArgs(new String[] { "list", "--filter" });
|
||||||
assertTrue(c.wasHelpCalled());
|
assertTrue(c.wasHelpCalled());
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
package com.android.sdklib;
|
package com.android.sdklib;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
@@ -35,11 +37,13 @@ final class AddOnTarget implements IAndroidTarget {
|
|||||||
private final String mJarName;
|
private final String mJarName;
|
||||||
private final String mJarPath;
|
private final String mJarPath;
|
||||||
private final String mName;
|
private final String mName;
|
||||||
|
private final String mDescription;
|
||||||
|
|
||||||
OptionalLibrary(String jarName, String jarPath, String name) {
|
OptionalLibrary(String jarName, String jarPath, String name, String description) {
|
||||||
mJarName = jarName;
|
mJarName = jarName;
|
||||||
mJarPath = jarPath;
|
mJarPath = jarPath;
|
||||||
mName = name;
|
mName = name;
|
||||||
|
mDescription = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJarName() {
|
public String getJarName() {
|
||||||
@@ -53,6 +57,10 @@ final class AddOnTarget implements IAndroidTarget {
|
|||||||
public String getName() {
|
public String getName() {
|
||||||
return mName;
|
return mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return mDescription;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String mLocation;
|
private final String mLocation;
|
||||||
@@ -70,11 +78,11 @@ final class AddOnTarget implements IAndroidTarget {
|
|||||||
* @param vendor the vendor name of the add-on
|
* @param vendor the vendor name of the add-on
|
||||||
* @param description the add-on description
|
* @param description the add-on description
|
||||||
* @param libMap A map containing the optional libraries. The map key is the fully-qualified
|
* @param libMap A map containing the optional libraries. The map key is the fully-qualified
|
||||||
* library name. The value is the .jar filename
|
* library name. The value is a 2 string array with the .jar filename, and the description.
|
||||||
* @param basePlatform the platform the add-on is extending.
|
* @param basePlatform the platform the add-on is extending.
|
||||||
*/
|
*/
|
||||||
AddOnTarget(String location, String name, String vendor, String description,
|
AddOnTarget(String location, String name, String vendor, String description,
|
||||||
Map<String, String> libMap, PlatformTarget basePlatform) {
|
Map<String, String[]> libMap, PlatformTarget basePlatform) {
|
||||||
if (location.endsWith(File.separator) == false) {
|
if (location.endsWith(File.separator) == false) {
|
||||||
location = location + File.separator;
|
location = location + File.separator;
|
||||||
}
|
}
|
||||||
@@ -86,12 +94,16 @@ final class AddOnTarget implements IAndroidTarget {
|
|||||||
mBasePlatform = basePlatform;
|
mBasePlatform = basePlatform;
|
||||||
|
|
||||||
// handle the optional libraries.
|
// handle the optional libraries.
|
||||||
mLibraries = new IOptionalLibrary[libMap.size()];
|
if (libMap != null) {
|
||||||
int index = 0;
|
mLibraries = new IOptionalLibrary[libMap.size()];
|
||||||
for (Entry<String, String> entry : libMap.entrySet()) {
|
int index = 0;
|
||||||
mLibraries[index++] = new OptionalLibrary(entry.getValue(),
|
for (Entry<String, String[]> entry : libMap.entrySet()) {
|
||||||
mLocation + SdkConstants.OS_ADDON_LIBS_FOLDER + entry.getValue(),
|
String jarFile = entry.getValue()[0];
|
||||||
entry.getKey());
|
String desc = entry.getValue()[1];
|
||||||
|
mLibraries[index++] = new OptionalLibrary(jarFile,
|
||||||
|
mLocation + SdkConstants.OS_ADDON_LIBS_FOLDER + jarFile,
|
||||||
|
entry.getKey(), desc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +147,8 @@ final class AddOnTarget implements IAndroidTarget {
|
|||||||
return mLocation + SdkConstants.OS_IMAGES_FOLDER;
|
return mLocation + SdkConstants.OS_IMAGES_FOLDER;
|
||||||
case SKINS:
|
case SKINS:
|
||||||
return mLocation + SdkConstants.OS_SKINS_FOLDER;
|
return mLocation + SdkConstants.OS_SKINS_FOLDER;
|
||||||
|
case DOCS:
|
||||||
|
return mLocation + SdkConstants.FD_DOCS + File.separator;
|
||||||
default :
|
default :
|
||||||
return mBasePlatform.getPath(pathId);
|
return mBasePlatform.getPath(pathId);
|
||||||
}
|
}
|
||||||
@@ -223,6 +237,11 @@ final class AddOnTarget implements IAndroidTarget {
|
|||||||
|
|
||||||
|
|
||||||
public void setSkins(String[] skins) {
|
public void setSkins(String[] skins) {
|
||||||
mSkins = skins;
|
// we mix the add-on and base platform skins
|
||||||
|
HashSet<String> skinSet = new HashSet<String>();
|
||||||
|
skinSet.addAll(Arrays.asList(skins));
|
||||||
|
skinSet.addAll(Arrays.asList(mBasePlatform.getSkins()));
|
||||||
|
|
||||||
|
mSkins = skinSet.toArray(new String[skinSet.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,11 +58,14 @@ public interface IAndroidTarget extends Comparable<IAndroidTarget> {
|
|||||||
public static int CATEGORIES = 17;
|
public static int CATEGORIES = 17;
|
||||||
/** OS Path to the "sources" folder. */
|
/** OS Path to the "sources" folder. */
|
||||||
public static int SOURCES = 18;
|
public static int SOURCES = 18;
|
||||||
|
/** OS Path to the target specific docs */
|
||||||
|
public static int DOCS = 19;
|
||||||
|
|
||||||
public interface IOptionalLibrary {
|
public interface IOptionalLibrary {
|
||||||
String getName();
|
String getName();
|
||||||
String getJarName();
|
String getJarName();
|
||||||
String getJarPath();
|
String getJarPath();
|
||||||
|
String getDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +85,6 @@ public interface IAndroidTarget extends Comparable<IAndroidTarget> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the full name of the target, possibly including vendor name.
|
* Returns the full name of the target, possibly including vendor name.
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
String getFullName();
|
String getFullName();
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,18 @@ public final class SdkConstants {
|
|||||||
public final static String OS_ADDON_LIBS_FOLDER = FD_ADDON_LIBS + File.separator;
|
public final static String OS_ADDON_LIBS_FOLDER = FD_ADDON_LIBS + File.separator;
|
||||||
|
|
||||||
|
|
||||||
/* Skin default */
|
/** Skin default **/
|
||||||
public final static String SKIN_DEFAULT = "default";
|
public final static String SKIN_DEFAULT = "default";
|
||||||
|
|
||||||
|
/** Returns the appropriate name for the 'android' command, which is 'android.bat' for
|
||||||
|
* Windows and 'android' for all other platforms. */
|
||||||
|
public static String AndroidCmdName() {
|
||||||
|
String os = System.getProperty("os.name");
|
||||||
|
String cmd = "android";
|
||||||
|
if (os.startsWith("Windows")) {
|
||||||
|
cmd += ".bat";
|
||||||
|
}
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ public final class SdkManager {
|
|||||||
private final static Pattern PATTERN_PROP = Pattern.compile(
|
private final static Pattern PATTERN_PROP = Pattern.compile(
|
||||||
"^([a-zA-Z0-9._-]+)\\s*=\\s*(.*)\\s*$");
|
"^([a-zA-Z0-9._-]+)\\s*=\\s*(.*)\\s*$");
|
||||||
|
|
||||||
|
private final static Pattern PATTERN_LIB_DATA = Pattern.compile(
|
||||||
|
"^([a-zA-Z0-9._-]+\\.jar);(.*)$", Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
/** the location of the SDK */
|
/** the location of the SDK */
|
||||||
private final String mSdkLocation;
|
private final String mSdkLocation;
|
||||||
private IAndroidTarget[] mTargets;
|
private IAndroidTarget[] mTargets;
|
||||||
@@ -96,7 +99,9 @@ public final class SdkManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a target from a hash that was generated by {@link IAndroidTarget#hashString()}.
|
* Returns a target from a hash that was generated by {@link IAndroidTarget#hashString()}.
|
||||||
* @param hash the hash
|
*
|
||||||
|
* @param hash the {@link IAndroidTarget} hash string.
|
||||||
|
* @return The matching {@link IAndroidTarget} or null.
|
||||||
*/
|
*/
|
||||||
public IAndroidTarget getTargetFromHashString(String hash) {
|
public IAndroidTarget getTargetFromHashString(String hash) {
|
||||||
if (hash != null) {
|
if (hash != null) {
|
||||||
@@ -213,13 +218,12 @@ public final class SdkManager {
|
|||||||
File[] addons = addonFolder.listFiles();
|
File[] addons = addonFolder.listFiles();
|
||||||
|
|
||||||
for (File addon : addons) {
|
for (File addon : addons) {
|
||||||
|
// Add-ons have to be folders. Ignore files and no need to warn about them.
|
||||||
if (addon.isDirectory()) {
|
if (addon.isDirectory()) {
|
||||||
AddOnTarget target = loadAddon(addon, list, log);
|
AddOnTarget target = loadAddon(addon, list, log);
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
list.add(target);
|
list.add(target);
|
||||||
}
|
}
|
||||||
} else if (log != null) {
|
|
||||||
log.warning("Ignoring add-on '%1$s', not a folder.", addon.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,24 +251,24 @@ public final class SdkManager {
|
|||||||
File addOnManifest = new File(addon, SdkConstants.FN_MANIFEST_INI);
|
File addOnManifest = new File(addon, SdkConstants.FN_MANIFEST_INI);
|
||||||
|
|
||||||
if (addOnManifest.isFile()) {
|
if (addOnManifest.isFile()) {
|
||||||
Map<String, String> map = parsePropertyFile(addOnManifest, log);
|
Map<String, String> propertyMap = parsePropertyFile(addOnManifest, log);
|
||||||
|
|
||||||
if (map != null) {
|
if (propertyMap != null) {
|
||||||
// look for some specific values in the map.
|
// look for some specific values in the map.
|
||||||
// we require name, vendor, and api
|
// we require name, vendor, and api
|
||||||
String name = map.get(ADDON_NAME);
|
String name = propertyMap.get(ADDON_NAME);
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
displayAddonManifestError(log, addon.getName(), ADDON_NAME);
|
displayAddonManifestError(log, addon.getName(), ADDON_NAME);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String vendor = map.get(ADDON_VENDOR);
|
String vendor = propertyMap.get(ADDON_VENDOR);
|
||||||
if (vendor == null) {
|
if (vendor == null) {
|
||||||
displayAddonManifestError(log, addon.getName(), ADDON_VENDOR);
|
displayAddonManifestError(log, addon.getName(), ADDON_VENDOR);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String api = map.get(ADDON_API);
|
String api = propertyMap.get(ADDON_API);
|
||||||
PlatformTarget baseTarget = null;
|
PlatformTarget baseTarget = null;
|
||||||
if (api == null) {
|
if (api == null) {
|
||||||
displayAddonManifestError(log, addon.getName(), ADDON_API);
|
displayAddonManifestError(log, addon.getName(), ADDON_API);
|
||||||
@@ -302,22 +306,42 @@ public final class SdkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the optional description
|
// get the optional description
|
||||||
String description = map.get(ADDON_DESCRIPTION);
|
String description = propertyMap.get(ADDON_DESCRIPTION);
|
||||||
|
|
||||||
// get the optional libraries
|
// get the optional libraries
|
||||||
String librariesValue = map.get(ADDON_LIBRARIES);
|
String librariesValue = propertyMap.get(ADDON_LIBRARIES);
|
||||||
|
Map<String, String[]> libMap = null;
|
||||||
|
|
||||||
// split in the string into the values we care about
|
if (librariesValue != null) {
|
||||||
String[] libraries = librariesValue.split(";");
|
librariesValue = librariesValue.trim();
|
||||||
Map<String, String> libMap = null;
|
if (librariesValue.length() > 0) {
|
||||||
if (libraries.length > 0) {
|
// split in the string into the libraries name
|
||||||
libMap = new HashMap<String, String>();
|
String[] libraries = librariesValue.split(";");
|
||||||
for (String lib : libraries) {
|
if (libraries.length > 0) {
|
||||||
String[] values = lib.split(":");
|
libMap = new HashMap<String, String[]>();
|
||||||
if (values.length == 2) {
|
for (String libName : libraries) {
|
||||||
libMap.put(values[0], values[1]);
|
libName = libName.trim();
|
||||||
} else {
|
|
||||||
// TODO: log error
|
// get the library data from the properties
|
||||||
|
String libData = propertyMap.get(libName);
|
||||||
|
|
||||||
|
if (libData != null) {
|
||||||
|
// split the jar file from the description
|
||||||
|
Matcher m = PATTERN_LIB_DATA.matcher(libData);
|
||||||
|
if (m.matches()) {
|
||||||
|
libMap.put(libName, new String[] {
|
||||||
|
m.group(1), m.group(2) });
|
||||||
|
} else if (log != null) {
|
||||||
|
log.error(null,
|
||||||
|
"Ignoring library '%1$s', property value has wrong format\n\t%2$s",
|
||||||
|
libName, libData);
|
||||||
|
}
|
||||||
|
} else if (log != null) {
|
||||||
|
log.error(null,
|
||||||
|
"Ignoring library '%1$s', missing property value",
|
||||||
|
libName, libData);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,11 +89,41 @@ public class ProjectCreator {
|
|||||||
String packageName, String activityName, IAndroidTarget target,
|
String packageName, String activityName, IAndroidTarget target,
|
||||||
boolean isTestProject) {
|
boolean isTestProject) {
|
||||||
|
|
||||||
// check project folder exists.
|
// create project folder if it does not exist
|
||||||
File projectFolder = new File(folderPath);
|
File projectFolder = new File(folderPath);
|
||||||
if (projectFolder.isDirectory() == false) {
|
if (!projectFolder.exists()) {
|
||||||
mLog.error(null, "Folder '%s' does not exist. Aborting...", folderPath);
|
|
||||||
return;
|
boolean created = false;
|
||||||
|
Throwable t = null;
|
||||||
|
try {
|
||||||
|
created = projectFolder.mkdirs();
|
||||||
|
} catch (Exception e) {
|
||||||
|
t = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (created) {
|
||||||
|
println("Created project directory: %1$s", projectFolder);
|
||||||
|
} else {
|
||||||
|
mLog.error(t, "Could not create directory: %1$s", projectFolder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Exception e = null;
|
||||||
|
String error = null;
|
||||||
|
try {
|
||||||
|
String[] content = projectFolder.list();
|
||||||
|
if (content == null) {
|
||||||
|
error = "Project directory %1$s is not a directory.";
|
||||||
|
} else if (content.length != 0) {
|
||||||
|
error = "Project directory %1$s is not empty. Please consider using '%2$s update' instead.";
|
||||||
|
}
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e = e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e != null || error != null) {
|
||||||
|
mLog.error(e, error, projectFolder, SdkConstants.AndroidCmdName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -111,6 +141,11 @@ public class ProjectCreator {
|
|||||||
defaultProperties.setAndroidTarget(target);
|
defaultProperties.setAndroidTarget(target);
|
||||||
defaultProperties.save();
|
defaultProperties.save();
|
||||||
|
|
||||||
|
// create an empty build.properties
|
||||||
|
ProjectProperties buildProperties = ProjectProperties.create(folderPath,
|
||||||
|
PropertyType.BUILD);
|
||||||
|
buildProperties.save();
|
||||||
|
|
||||||
// create the map for place-holders of values to replace in the templates
|
// create the map for place-holders of values to replace in the templates
|
||||||
final HashMap<String, String> keywords = new HashMap<String, String>();
|
final HashMap<String, String> keywords = new HashMap<String, String>();
|
||||||
|
|
||||||
@@ -190,7 +225,7 @@ public class ProjectCreator {
|
|||||||
* corresponding value in the created file.
|
* corresponding value in the created file.
|
||||||
*
|
*
|
||||||
* @param templateName the name of to the template file
|
* @param templateName the name of to the template file
|
||||||
* @param dest the path to the destination file, relative to the project
|
* @param destFile the path to the destination file, relative to the project
|
||||||
* @param placeholderMap a map of (place-holder, value) to create the file from the template.
|
* @param placeholderMap a map of (place-holder, value) to create the file from the template.
|
||||||
* @param target the Target of the project that will be providing the template.
|
* @param target the Target of the project that will be providing the template.
|
||||||
* @throws ProjectCreateException
|
* @throws ProjectCreateException
|
||||||
@@ -211,7 +246,7 @@ public class ProjectCreator {
|
|||||||
* corresponding value in the created file.
|
* corresponding value in the created file.
|
||||||
*
|
*
|
||||||
* @param templateName the name of to the template file
|
* @param templateName the name of to the template file
|
||||||
* @param dest the path to the destination file, relative to the project
|
* @param destFile the path to the destination file, relative to the project
|
||||||
* @param placeholderMap a map of (place-holder, value) to create the file from the template.
|
* @param placeholderMap a map of (place-holder, value) to create the file from the template.
|
||||||
* @throws ProjectCreateException
|
* @throws ProjectCreateException
|
||||||
*/
|
*/
|
||||||
@@ -261,7 +296,6 @@ public class ProjectCreator {
|
|||||||
println("Added file %1$s", destFile);
|
println("Added file %1$s", destFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints a message unless silence is enabled.
|
* Prints a message unless silence is enabled.
|
||||||
* @param format Format for String.format
|
* @param format Format for String.format
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public final class ProjectProperties {
|
|||||||
"# This file must be checked in Version Control Systems.\n" +
|
"# This file must be checked in Version Control Systems.\n" +
|
||||||
"# \n" +
|
"# \n" +
|
||||||
"# To customize properties used by the Ant build system use,\n" +
|
"# To customize properties used by the Ant build system use,\n" +
|
||||||
"# \"build.properties\", and override values to adapt the script to your" +
|
"# \"build.properties\", and override values to adapt the script to your\n" +
|
||||||
"# project structure.\n" +
|
"# project structure.\n" +
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
@@ -74,17 +74,18 @@ public final class ProjectProperties {
|
|||||||
// 1-------10--------20--------30--------40--------50--------60--------70--------80
|
// 1-------10--------20--------30--------40--------50--------60--------70--------80
|
||||||
"# This file is used to override default values used by the Ant build system.\n" +
|
"# This file is used to override default values used by the Ant build system.\n" +
|
||||||
"# \n" +
|
"# \n" +
|
||||||
"# This file must be checked in Version Control Systems, as it is" +
|
"# This file must be checked in Version Control Systems, as it is\n" +
|
||||||
"# integral to the build system of your project.\n" +
|
"# integral to the build system of your project.\n" +
|
||||||
"# \n" +
|
"\n" +
|
||||||
"# Use this file to change values like:\n" +
|
"# The name of your application package as defined in the manifest.\n" +
|
||||||
"# application-package\n:" +
|
"# Used by the 'uninstall' rule.\n"+
|
||||||
"# the name of your application package as defined in the manifest.\n" +
|
"#application-package=com.example.myproject\n" +
|
||||||
"# Used by the 'uninstall' rule.\n"+
|
"\n" +
|
||||||
"# source-folder\n:" +
|
"# The name of the source folder.\n" +
|
||||||
"# the name of the source folder. Default is 'src'.\n" +
|
"#source-folder=src\n" +
|
||||||
"# out-folder\n:" +
|
"\n" +
|
||||||
"# the name of the output folder. Default is 'bin'\n" +
|
"# The name of the output folder.\n" +
|
||||||
|
"#out-folder=bin\n" +
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
private final static Map<String, String> COMMENT_MAP = new HashMap<String, String>();
|
private final static Map<String, String> COMMENT_MAP = new HashMap<String, String>();
|
||||||
@@ -104,7 +105,9 @@ public final class ProjectProperties {
|
|||||||
/**
|
/**
|
||||||
* Loads a project properties file and return a {@link ProjectProperties} object
|
* Loads a project properties file and return a {@link ProjectProperties} object
|
||||||
* containing the properties
|
* containing the properties
|
||||||
|
*
|
||||||
* @param projectFolderOsPath the project folder.
|
* @param projectFolderOsPath the project folder.
|
||||||
|
* @param type One the possible {@link PropertyType}s.
|
||||||
*/
|
*/
|
||||||
public static ProjectProperties load(String projectFolderOsPath, PropertyType type) {
|
public static ProjectProperties load(String projectFolderOsPath, PropertyType type) {
|
||||||
File projectFolder = new File(projectFolderOsPath);
|
File projectFolder = new File(projectFolderOsPath);
|
||||||
@@ -120,6 +123,43 @@ public final class ProjectProperties {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merges all properties from the given file into the current properties.
|
||||||
|
* <p/>
|
||||||
|
* This emulates the Ant behavior: existing properties are <em>not</em> overriden.
|
||||||
|
* Only new undefined properties become defined.
|
||||||
|
* <p/>
|
||||||
|
* Typical usage:
|
||||||
|
* <ul>
|
||||||
|
* <li>Create a ProjectProperties with {@link PropertyType#BUILD}
|
||||||
|
* <li>Merge in values using {@link PropertyType#DEFAULT}
|
||||||
|
* <li>The result is that this contains all the properties from default plus those
|
||||||
|
* overridden by the build.properties file.
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @param type One the possible {@link PropertyType}s.
|
||||||
|
* @return this object, for chaining.
|
||||||
|
*/
|
||||||
|
public ProjectProperties merge(PropertyType type) {
|
||||||
|
File projectFolder = new File(mProjectFolderOsPath);
|
||||||
|
if (projectFolder.isDirectory()) {
|
||||||
|
File defaultFile = new File(projectFolder, type.mFilename);
|
||||||
|
if (defaultFile.isFile()) {
|
||||||
|
Map<String, String> map = SdkManager.parsePropertyFile(defaultFile, null /* log */);
|
||||||
|
if (map != null) {
|
||||||
|
for(Entry<String, String> entry : map.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
String value = entry.getValue();
|
||||||
|
if (!mProperties.containsKey(key) && value != null) {
|
||||||
|
mProperties.put(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new project properties object, with no properties.
|
* Creates a new project properties object, with no properties.
|
||||||
* <p/>The file is not created until {@link #save()} is called.
|
* <p/>The file is not created until {@link #save()} is called.
|
||||||
@@ -185,10 +225,9 @@ public final class ProjectProperties {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Private constructor.
|
* Private constructor.
|
||||||
* Use {@link #load(String)} or {@link #create(String)} to instantiate.
|
* <p/>
|
||||||
* @param projectFolderOsPath
|
* Use {@link #load(String, PropertyType)} or {@link #create(String, PropertyType)}
|
||||||
* @param map
|
* to instantiate.
|
||||||
* @param type
|
|
||||||
*/
|
*/
|
||||||
private ProjectProperties(String projectFolderOsPath, Map<String, String> map,
|
private ProjectProperties(String projectFolderOsPath, Map<String, String> map,
|
||||||
PropertyType type) {
|
PropertyType type) {
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ public class HardwareProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the harware definition file.
|
* Parses the hardware definition file.
|
||||||
* @param buildProp the property file to parse
|
* @param file the property file to parse
|
||||||
* @param log the ISdkLog object receiving warning/error from the parsing.
|
* @param log the ISdkLog object receiving warning/error from the parsing.
|
||||||
* @return the map of (key,value) pairs, or null if the parsing failed.
|
* @return the map of (key,value) pairs, or null if the parsing failed.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import com.android.prefs.AndroidLocation;
|
|||||||
import com.android.prefs.AndroidLocation.AndroidLocationException;
|
import com.android.prefs.AndroidLocation.AndroidLocationException;
|
||||||
import com.android.sdklib.IAndroidTarget;
|
import com.android.sdklib.IAndroidTarget;
|
||||||
import com.android.sdklib.ISdkLog;
|
import com.android.sdklib.ISdkLog;
|
||||||
import com.android.sdklib.SdkConstants;
|
|
||||||
import com.android.sdklib.SdkManager;
|
import com.android.sdklib.SdkManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -99,7 +98,7 @@ public final class VmManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new VM.
|
* Creates a new VM. It is expected that there is no existing VM with this name already.
|
||||||
* @param parentFolder the folder to contain the VM. A new folder will be created in this
|
* @param parentFolder the folder to contain the VM. A new folder will be created in this
|
||||||
* folder with the name of the VM
|
* folder with the name of the VM
|
||||||
* @param name the name of the VM
|
* @param name the name of the VM
|
||||||
@@ -109,27 +108,25 @@ public final class VmManager {
|
|||||||
* @param sdcardSize the size of a local sdcard to create. Can be 0 for no local sdcard.
|
* @param sdcardSize the size of a local sdcard to create. Can be 0 for no local sdcard.
|
||||||
* @param hardwareConfig the hardware setup for the VM
|
* @param hardwareConfig the hardware setup for the VM
|
||||||
*/
|
*/
|
||||||
public static void createVm(String parentFolder, String name, IAndroidTarget target,
|
public VmInfo createVm(String parentFolder, String name, IAndroidTarget target,
|
||||||
String skinName, String sdcardPath, int sdcardSize, Map<String,String> hardwareConfig,
|
String skinName, String sdcardPath, int sdcardSize, Map<String,String> hardwareConfig,
|
||||||
ISdkLog log) {
|
ISdkLog log) {
|
||||||
|
|
||||||
// now write the ini file in the vmRoot folder.
|
|
||||||
// get the Android prefs location.
|
|
||||||
try {
|
try {
|
||||||
File rootDirectory = new File(parentFolder);
|
File rootDirectory = new File(parentFolder);
|
||||||
if (rootDirectory.isDirectory() == false) {
|
if (rootDirectory.isDirectory() == false) {
|
||||||
if (log != null) {
|
if (log != null) {
|
||||||
log.error(null, "%s does not exists.", parentFolder);
|
log.error(null, "Folder %s does not exist.", parentFolder);
|
||||||
}
|
}
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
File vmFolder = new File(parentFolder, name + ".avm");
|
File vmFolder = new File(parentFolder, name + ".avm");
|
||||||
if (vmFolder.exists()) {
|
if (vmFolder.exists()) {
|
||||||
if (log != null) {
|
if (log != null) {
|
||||||
log.error(null, "%s already exists.", vmFolder.getAbsolutePath());
|
log.error(null, "Folder %s is in the way.", vmFolder.getAbsolutePath());
|
||||||
}
|
}
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the vm folder.
|
// create the vm folder.
|
||||||
@@ -164,13 +161,29 @@ public final class VmManager {
|
|||||||
// Config file
|
// Config file
|
||||||
values.clear();
|
values.clear();
|
||||||
if (skinName != null) {
|
if (skinName != null) {
|
||||||
values.put("skin", skinName);
|
// check that the skin name is valid
|
||||||
} else {
|
String[] skinNames = target.getSkins();
|
||||||
values.put("skin", SdkConstants.SKIN_DEFAULT);
|
boolean found = false;
|
||||||
|
for (String n : skinNames) {
|
||||||
|
if (n.equals(skinName)) {
|
||||||
|
values.put("skin", skinName);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found == false && log != null) {
|
||||||
|
log.warning("Skin '%1$s' does not exists, using default skin.", skinName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdcardPath != null) {
|
if (sdcardPath != null) {
|
||||||
values.put("sdcard", sdcardPath);
|
File sdcard = new File(sdcardPath);
|
||||||
|
if (sdcard.isFile()) {
|
||||||
|
values.put("sdcard", sdcardPath);
|
||||||
|
} else if (log != null) {
|
||||||
|
log.warning("sdcarad image '%1$s' does not exists.", sdcardPath);
|
||||||
|
}
|
||||||
} else if (sdcardSize != 0) {
|
} else if (sdcardSize != 0) {
|
||||||
// TODO: create sdcard image.
|
// TODO: create sdcard image.
|
||||||
}
|
}
|
||||||
@@ -182,21 +195,36 @@ public final class VmManager {
|
|||||||
File configIniFile = new File(vmFolder, CONFIG_INI);
|
File configIniFile = new File(vmFolder, CONFIG_INI);
|
||||||
createConfigIni(configIniFile, values);
|
createConfigIni(configIniFile, values);
|
||||||
|
|
||||||
if (target.isPlatform()) {
|
if (log != null) {
|
||||||
System.out.println(String.format(
|
if (target.isPlatform()) {
|
||||||
"Created VM '%s' based on %s", name, target.getName()));
|
log.printf("Created VM '%s' based on %s\n", name, target.getName());
|
||||||
} else {
|
} else {
|
||||||
System.out.println(String.format(
|
log.printf(
|
||||||
"Created VM '%s' based on %s (%s)", name, target.getName(),
|
"Created VM '%s' based on %s (%s)\n", name, target.getName(),
|
||||||
target.getVendor()));
|
target.getVendor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create the VmInfo object, and add it to the list
|
||||||
|
VmInfo vmInfo = new VmInfo();
|
||||||
|
vmInfo.name = name;
|
||||||
|
vmInfo.path = vmFolder.getAbsolutePath();
|
||||||
|
vmInfo.target = target;
|
||||||
|
|
||||||
|
mVmList.add(vmInfo);
|
||||||
|
|
||||||
|
return vmInfo;
|
||||||
} catch (AndroidLocationException e) {
|
} catch (AndroidLocationException e) {
|
||||||
// TODO Auto-generated catch block
|
if (log != null) {
|
||||||
e.printStackTrace();
|
log.error(e, null);
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
if (log != null) {
|
||||||
e.printStackTrace();
|
log.error(e, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildVmList(SdkManager sdk) throws AndroidLocationException {
|
private void buildVmList(SdkManager sdk) throws AndroidLocationException {
|
||||||
|
|||||||
Reference in New Issue
Block a user