am 5ca98eb0: Merge change I5359971f into eclair
Merge commit '5ca98eb00860a76eef474f78b8c077c1c50f4dd1' into eclair-mr2 * commit '5ca98eb00860a76eef474f78b8c077c1c50f4dd1': New "SDK Launcher" for Windows.
This commit is contained in:
1
tools/sdklauncher/.gitignore
vendored
Normal file
1
tools/sdklauncher/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
images/android_icon.o
|
||||
43
tools/sdklauncher/Android.mk
Normal file
43
tools/sdklauncher/Android.mk
Normal file
@@ -0,0 +1,43 @@
|
||||
# Copyright 2009 The Android Open Source Project
|
||||
#
|
||||
# Android.mk for sdklauncher
|
||||
#
|
||||
# The "SDK Launcher" is for Windows only.
|
||||
# This simple .exe will sit at the root of the Windows SDK
|
||||
# and currently simply executes tools\android.bat.
|
||||
# Eventually it should simply replace the batch file.
|
||||
|
||||
ifeq ($(HOST_OS),windows)
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
sdklauncher.c
|
||||
|
||||
LOCAL_CFLAGS += -Wall -Wno-unused-parameter
|
||||
LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE -DSH_HISTORY
|
||||
LOCAL_MODULE := sdklauncher
|
||||
|
||||
# Link the Windows icon file as well into the executable, based on the technique
|
||||
# used in external/qemu/Makefile.android.
|
||||
#
|
||||
INTERMEDIATE := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
|
||||
ANDROID_ICON_OBJ := android_icon.o
|
||||
ANDROID_ICON_PATH := $(LOCAL_PATH)/images
|
||||
$(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc
|
||||
windres $< -I $(ANDROID_ICON_PATH) -o $@
|
||||
|
||||
# seems to be the only way to add an object file that was not generated from
|
||||
# a C/C++/Java source file to our build system. and very unfortunately,
|
||||
# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces
|
||||
# us to put the object file in the source directory...
|
||||
#
|
||||
LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ)
|
||||
|
||||
include $(BUILD_HOST_EXECUTABLE)
|
||||
|
||||
$(call dist-for-goals,droid,$(LOCAL_BUILT_MODULE))
|
||||
|
||||
endif
|
||||
BIN
tools/sdklauncher/images/android_icon.ico
Normal file
BIN
tools/sdklauncher/images/android_icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 293 KiB |
3
tools/sdklauncher/images/android_icon.rc
Normal file
3
tools/sdklauncher/images/android_icon.rc
Normal file
@@ -0,0 +1,3 @@
|
||||
1 ICON "../images/android_icon.ico"
|
||||
|
||||
|
||||
88
tools/sdklauncher/sdklauncher.c
Normal file
88
tools/sdklauncher/sdklauncher.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2009 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The "SDK Launcher" is for Windows only.
|
||||
* This simple .exe will sit at the root of the Windows SDK
|
||||
* and currently simply executes tools\android.bat.
|
||||
* Eventually it should simply replace the batch file.
|
||||
*
|
||||
* TODO:
|
||||
* - detect that java is installed; error dialog if not, explaning where to get it.
|
||||
* - create temp dir, always copy *.jar there, exec android.jar
|
||||
* - get jars to copy from some file
|
||||
* - use a version number to copy jars only if needed (tools.revision?)
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
int sdk_launcher() {
|
||||
STARTUPINFO startup;
|
||||
PROCESS_INFORMATION pinfo;
|
||||
char program_path[MAX_PATH];
|
||||
int ret;
|
||||
|
||||
ZeroMemory(&startup, sizeof(startup));
|
||||
startup.cb = sizeof(startup);
|
||||
|
||||
ZeroMemory(&pinfo, sizeof(pinfo));
|
||||
|
||||
/* get path of current program */
|
||||
GetModuleFileName(NULL, program_path, sizeof(program_path));
|
||||
|
||||
ret = CreateProcess(
|
||||
NULL, /* program path */
|
||||
"tools\\android.bat update sdk", /* command-line */
|
||||
NULL, /* process handle is not inheritable */
|
||||
NULL, /* thread handle is not inheritable */
|
||||
TRUE, /* yes, inherit some handles */
|
||||
CREATE_NO_WINDOW, /* we don't want a console */
|
||||
NULL, /* use parent's environment block */
|
||||
NULL, /* use parent's starting directory */
|
||||
&startup, /* startup info, i.e. std handles */
|
||||
&pinfo);
|
||||
|
||||
if (!ret) {
|
||||
DWORD err = GetLastError();
|
||||
fprintf(stderr, "CreateProcess failure, error %ld\n", err);
|
||||
|
||||
LPSTR s;
|
||||
if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | /* dwFlags */
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL, /* lpSource */
|
||||
err, /* dwMessageId */
|
||||
0, /* dwLanguageId */
|
||||
(LPSTR)&s, /* lpBuffer */
|
||||
0, /* nSize */
|
||||
NULL) != 0) { /* va_list args */
|
||||
fprintf(stderr, "%s", s);
|
||||
LocalFree(s);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
return sdk_launcher();
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
Reference in New Issue
Block a user