aboutsummaryrefslogtreecommitdiffstats
path: root/find_java2/WinLauncher2
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2014-09-05 15:54:04 -0700
committerRaphael Moll <ralf@android.com>2014-09-16 12:42:44 -0700
commit6b94c869cda8de4481f923d3fd722a72665ba55c (patch)
tree3ea0b0483a78d8b0ddfac145c499c614275f316b /find_java2/WinLauncher2
parent9b200998ffe3485b6b3b2063b4e876f41cc430ea (diff)
downloadsdk-6b94c869cda8de4481f923d3fd722a72665ba55c.zip
sdk-6b94c869cda8de4481f923d3fd722a72665ba55c.tar.gz
sdk-6b94c869cda8de4481f923d3fd722a72665ba55c.tar.bz2
FindJava2+WinLauncher2 MFC app for Windows.
In the code base we have a "find_java" directory that compiles using mingw32 + an Android.mk; it is used to create the find_java.dll used by the NSIS installer, the find_java.exe that is used by android.bat to locate java before executing the SDK/AVD Manager and finally also used by the Android Studio WinLauncher. This reworks find_java to create 2 new MFC apps: - FindJava2 is a straight replacement for the previous find_java.exe. - WinLauncher2 will be a replacement for the Studio launcher. The main change is that the new app has a UI so it lists all the Java.exe paths and let the user add his/her own. Then it remembers the selected path using a registry key and reuses the next time if it's available. The app is built using VS2013 and MFC and there's no Android.mk for it. The goal is to just make prebuilts (that's how find_java.exe/dll and WinLauncher are actually used right now.) The FindJava2 part is final. What's left to do: - Merge the code of WinLauncher into WinLauncher2 to actually run Studio (they will be a need for both a 32-bit version and 64-bit version support.) - Create a new FindJava2.dll for NSIS once we decide how we want to use this in the new installer (e.g. do we just want to make sure there is "some" version of Java or do we want to include the select-and-register functionality too so that the user doesn't have to be asked again later?) Change-Id: I814ed46711ac17a66cd63b9e7c7d485632169ff1
Diffstat (limited to 'find_java2/WinLauncher2')
-rwxr-xr-xfind_java2/WinLauncher2/Resource.h19
-rwxr-xr-xfind_java2/WinLauncher2/WinLauncher2.rc174
-rwxr-xr-xfind_java2/WinLauncher2/WinLauncher2.vcxproj132
-rwxr-xr-xfind_java2/WinLauncher2/res/WinLauncher2.icobin0 -> 67777 bytes
-rwxr-xr-xfind_java2/WinLauncher2/stdafx.cpp24
-rwxr-xr-xfind_java2/WinLauncher2/stdafx.h66
-rwxr-xr-xfind_java2/WinLauncher2/targetver.h24
7 files changed, 439 insertions, 0 deletions
diff --git a/find_java2/WinLauncher2/Resource.h b/find_java2/WinLauncher2/Resource.h
new file mode 100755
index 0000000..c3b2e0f
--- /dev/null
+++ b/find_java2/WinLauncher2/Resource.h
@@ -0,0 +1,19 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by WinLauncher2.rc
+//
+#define IDI_ANDROID_ICON 5
+#define IDD_FINDJAVA2_DIALOG 102
+#define IDC_BUTTON_ADD 1000
+#define IDC_PATH_LIST 1001
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 130
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/find_java2/WinLauncher2/WinLauncher2.rc b/find_java2/WinLauncher2/WinLauncher2.rc
new file mode 100755
index 0000000..bee2edf
--- /dev/null
+++ b/find_java2/WinLauncher2/WinLauncher2.rc
@@ -0,0 +1,174 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+#include "verrsrc.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (United States) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#ifndef APSTUDIO_INVOKED\r\n"
+ "#include ""targetver.h""\r\n"
+ "#endif\r\n"
+ "#include ""afxres.h""\r\n"
+ "#include ""verrsrc.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#include ""res\\WinLauncher2.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#if !defined(_AFXDLL)\r\n"
+ "#include ""afxribbon.rc"" // MFC ribbon and control bar resources\r\n"
+ "#endif\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 2,0,0,1
+ PRODUCTVERSION 2,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Android"
+ VALUE "FileDescription", "Android Studio Windows Launcher"
+ VALUE "FileVersion", "2.0.0.1"
+ VALUE "InternalName", "WinLauncher2.exe"
+ VALUE "LegalCopyright", "(c) Android. All rights reserved."
+ VALUE "OriginalFilename", "WinLauncher2.exe"
+ VALUE "ProductName", "Android SDK"
+ VALUE "ProductVersion", "2.0.0.1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_FINDJAVA2_DIALOG DIALOGEX 0, 0, 317, 197
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_APPWINDOW
+CAPTION "Find Java 2 for Android"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "Start",IDOK,205,174,50,14
+ PUSHBUTTON "Quit",IDCANCEL,260,174,50,14
+ PUSHBUTTON "Add...",IDC_BUTTON_ADD,7,174,50,14
+ LTEXT "Select which version of Java to use:",IDC_STATIC,7,7,116,8
+ CONTROL "",IDC_PATH_LIST,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,18,300,150
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ANDROID_ICON ICON "..\\android_icon.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_FINDJAVA2_DIALOG, DIALOG
+ BEGIN
+ BOTTOMMARGIN, 196
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#include "afxres.rc" // Standard components
+#if !defined(_AFXDLL)
+#include "afxribbon.rc" // MFC ribbon and control bar resources
+#endif
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/find_java2/WinLauncher2/WinLauncher2.vcxproj b/find_java2/WinLauncher2/WinLauncher2.vcxproj
new file mode 100755
index 0000000..9dfdca7
--- /dev/null
+++ b/find_java2/WinLauncher2/WinLauncher2.vcxproj
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{64980924-B76E-4E00-90A4-647E67CEB050}</ProjectGuid>
+ <RootNamespace>WinLauncher2</RootNamespace>
+ <Keyword>MFCProj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>Dynamic</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>Dynamic</UseOfMfc>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>version.lib</AdditionalDependencies>
+ </Link>
+ <Midl>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <ValidateAllParameters>true</ValidateAllParameters>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>version.lib</AdditionalDependencies>
+ </Link>
+ <Midl>
+ <MkTypLibCompatible>false</MkTypLibCompatible>
+ <ValidateAllParameters>true</ValidateAllParameters>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </Midl>
+ <ResourceCompile>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\src\FindJava2Dlg.h" />
+ <ClInclude Include="..\src\JavaFinder.h" />
+ <ClInclude Include="..\src\JavaPath.h" />
+ <ClInclude Include="..\src\utils.h" />
+ <ClInclude Include="..\src\WinLauncher2App.h" />
+ <ClInclude Include="Resource.h" />
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="targetver.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\src\FindJava2Dlg.cpp" />
+ <ClCompile Include="..\src\JavaFinder.cpp" />
+ <ClCompile Include="..\src\JavaPath.cpp" />
+ <ClCompile Include="..\src\utils.cpp" />
+ <ClCompile Include="..\src\WinLauncher2App.cpp" />
+ <ClCompile Include="stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="WinLauncher2.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="..\android_icon.ico" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/find_java2/WinLauncher2/res/WinLauncher2.ico b/find_java2/WinLauncher2/res/WinLauncher2.ico
new file mode 100755
index 0000000..d56fbcd
--- /dev/null
+++ b/find_java2/WinLauncher2/res/WinLauncher2.ico
Binary files differ
diff --git a/find_java2/WinLauncher2/stdafx.cpp b/find_java2/WinLauncher2/stdafx.cpp
new file mode 100755
index 0000000..00a69d2
--- /dev/null
+++ b/find_java2/WinLauncher2/stdafx.cpp
@@ -0,0 +1,24 @@
+/*
+* Copyright (C) 2014 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.
+*/
+
+
+// stdafx.cpp : source file that includes just the standard includes
+// WinLauncher2.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
diff --git a/find_java2/WinLauncher2/stdafx.h b/find_java2/WinLauncher2/stdafx.h
new file mode 100755
index 0000000..86caf00
--- /dev/null
+++ b/find_java2/WinLauncher2/stdafx.h
@@ -0,0 +1,66 @@
+/*
+* Copyright (C) 2014 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.
+*/
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include "targetver.h"
+
+#define _CRT_SECURE_NO_WARNINGS
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+
+#include <afxdisp.h> // MFC Automation classes
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <afxcontrolbars.h> // MFC support for ribbons and control bars
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+
diff --git a/find_java2/WinLauncher2/targetver.h b/find_java2/WinLauncher2/targetver.h
new file mode 100755
index 0000000..fc6d20b
--- /dev/null
+++ b/find_java2/WinLauncher2/targetver.h
@@ -0,0 +1,24 @@
+/*
+* Copyright (C) 2014 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.
+*/
+
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>