Files
UnrealEngineUWP/Engine/Source/Developer/Android/AndroidPlatformEditor/Private/AndroidSDKSettingsCustomization.cpp
Josh Adams 2593ae3cf3 - Added some in-editor documentation/tips to clarify some of the project settings [UE-8127]
- Only allow ES31+AEP if the project settings allows it. Told user to restart editor if they change the ES31+AEP setting to fix the Launch On menu. (This is only until 4.8) [UE-6585]
- Noted that ES31 is only for Tegra K1, in the name [UE-6604]
- Hide JAVA_HOME settings on MacOS, as it would be confusing to try to find it

#codereview peter.sauerbrei,robert.jones

[CL 2420419 by Josh Adams in Main branch]
2015-01-27 10:57:03 -05:00

126 lines
3.3 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "AndroidPlatformEditorPrivatePCH.h"
#include "AndroidSDKSettingsCustomization.h"
#include "DetailLayoutBuilder.h"
#include "DetailCategoryBuilder.h"
#include "PropertyEditing.h"
#include "ScopedTransaction.h"
#include "SExternalImageReference.h"
#include "SHyperlinkLaunchURL.h"
#include "SPlatformSetupMessage.h"
#include "SFilePathPicker.h"
#include "PlatformIconInfo.h"
#include "SourceControlHelpers.h"
#include "ManifestUpdateHelper.h"
#include "SNotificationList.h"
#include "NotificationManager.h"
#include "ITargetPlatformManagerModule.h"
#define LOCTEXT_NAMESPACE "AndroidSDKSettings"
//////////////////////////////////////////////////////////////////////////
// FAndroidSDKSettingsCustomization
TSharedRef<IDetailCustomization> FAndroidSDKSettingsCustomization::MakeInstance()
{
return MakeShareable(new FAndroidSDKSettingsCustomization);
}
FAndroidSDKSettingsCustomization::FAndroidSDKSettingsCustomization()
{
TargetPlatformManagerModule = &FModuleManager::LoadModuleChecked<ITargetPlatformManagerModule>("TargetPlatform");
SetupSDKPaths();
}
void FAndroidSDKSettingsCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailLayout)
{
SavedLayoutBuilder = &DetailLayout;
BuildSDKPathSection(DetailLayout);
}
void FAndroidSDKSettingsCustomization::BuildSDKPathSection(IDetailLayoutBuilder& DetailLayout)
{
SetupSDKPaths();
#if PLATFORM_MAC
IDetailCategoryBuilder& SDKConfigCategory = DetailLayout.EditCategory(TEXT("SDKConfig"));
// hide the property on Mac only
TSharedRef<IPropertyHandle> JavaPathProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UAndroidSDKSettings, JavaPath));
SDKConfigCategory.AddProperty(JavaPathProperty)
.Visibility(EVisibility::Hidden);
#endif
}
void FAndroidSDKSettingsCustomization::SetupSDKPaths()
{
// Try and query the env vars
UAndroidSDKSettings * settings = GetMutableDefault<UAndroidSDKSettings>();
bool changed = false;
if (settings->SDKPath.Path.IsEmpty())
{
TCHAR AndroidSDKPath[256];
FPlatformMisc::GetEnvironmentVariable(TEXT("ANDROID_HOME"), AndroidSDKPath, ARRAY_COUNT(AndroidSDKPath));
if (AndroidSDKPath[0])
{
settings->SDKPath.Path = AndroidSDKPath;
changed |= true;
}
}
if (settings->NDKPath.Path.IsEmpty())
{
TCHAR AndroidNDKPath[256];
FPlatformMisc::GetEnvironmentVariable(TEXT("NDKROOT"), AndroidNDKPath, ARRAY_COUNT(AndroidNDKPath));
if (AndroidNDKPath[0])
{
settings->NDKPath.Path = AndroidNDKPath;
changed |= true;
}
}
if (settings->ANTPath.Path.IsEmpty())
{
TCHAR AndroidANTPath[256];
FPlatformMisc::GetEnvironmentVariable(TEXT("ANT_HOME"), AndroidANTPath, ARRAY_COUNT(AndroidANTPath));
if (AndroidANTPath[0])
{
settings->ANTPath.Path = AndroidANTPath;
changed |= true;
}
}
#if PLATFORM_MAC == 0
if (settings->JavaPath.Path.IsEmpty())
{
TCHAR AndroidJavaPath[256];
FPlatformMisc::GetEnvironmentVariable(TEXT("JAVA_HOME"), AndroidJavaPath, ARRAY_COUNT(AndroidJavaPath));
if (AndroidJavaPath[0])
{
settings->JavaPath.Path = AndroidJavaPath;
changed |= true;
}
}
#endif
if (changed)
{
settings->Modify();
settings->SaveConfig();
}
settings->UpdateTargetModulePaths(false);
}
//////////////////////////////////////////////////////////////////////////
#undef LOCTEXT_NAMESPACE