Browse Source

Projucer: Added an option to set the path to the Android Studio executable in the "Global Paths" settings

tags/2021-05-28
ed 7 years ago
parent
commit
bf8adbc29a
4 changed files with 35 additions and 33 deletions
  1. +3
    -0
      extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h
  2. +1
    -33
      extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h
  3. +30
    -0
      extras/Projucer/Source/Settings/jucer_StoredSettings.cpp
  4. +1
    -0
      extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h

+ 3
- 0
extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h View File

@@ -225,6 +225,9 @@ private:
#endif #endif
addAndMakeVisible (pathPropertyComponents.add (new FilePathPropertyComponent (settings.getStoredPath (Ids::clionExePath), addAndMakeVisible (pathPropertyComponents.add (new FilePathPropertyComponent (settings.getStoredPath (Ids::clionExePath),
"CLion " + exeLabel, false))); "CLion " + exeLabel, false)));
addAndMakeVisible (pathPropertyComponents.add (new FilePathPropertyComponent (settings.getStoredPath (Ids::androidStudioExePath),
"Android Studio " + exeLabel, false)));
} }
else else
{ {


+ 1
- 33
extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h View File

@@ -146,7 +146,7 @@ public:
gradleToolchain (settings, Ids::gradleToolchain, getUndoManager(), "clang"), gradleToolchain (settings, Ids::gradleToolchain, getUndoManager(), "clang"),
androidPluginVersion (settings, Ids::androidPluginVersion, getUndoManager(), "3.1.3"), androidPluginVersion (settings, Ids::androidPluginVersion, getUndoManager(), "3.1.3"),
buildToolsVersion (settings, Ids::buildToolsVersion, getUndoManager(), "28.0.0"), buildToolsVersion (settings, Ids::buildToolsVersion, getUndoManager(), "28.0.0"),
AndroidExecutable (findAndroidExecutable())
AndroidExecutable (getAppSettings().getStoredPath (Ids::androidStudioExePath).toString())
{ {
name = getName(); name = getName();
@@ -276,38 +276,6 @@ public:
overwriteFileIfDifferentOrThrow (gradleProjectFolder.getChildFile (filePath), outStream); overwriteFileIfDifferentOrThrow (gradleProjectFolder.getChildFile (filePath), outStream);
} }
//==============================================================================
static File findAndroidExecutable()
{
#if JUCE_WINDOWS
File defaultInstallation ("C:\\Program Files\\Android\\Android Studio\\bin");
if (defaultInstallation.exists())
{
{
auto studio64 = defaultInstallation.getChildFile ("studio64.exe");
if (studio64.existsAsFile())
return studio64;
}
{
auto studio = defaultInstallation.getChildFile ("studio.exe");
if (studio.existsAsFile())
return studio;
}
}
#elif JUCE_MAC
File defaultInstallation ("/Applications/Android Studio.app");
if (defaultInstallation.exists())
return defaultInstallation;
#endif
return {};
}
protected: protected:
//============================================================================== //==============================================================================
class AndroidBuildConfiguration : public BuildConfiguration class AndroidBuildConfiguration : public BuildConfiguration


+ 30
- 0
extras/Projucer/Source/Settings/jucer_StoredSettings.cpp View File

@@ -365,6 +365,28 @@ Value StoredSettings::getFallbackPathForOS (const Identifier& key, DependencyPat
v = "${user.home}/clion/bin/clion.sh"; v = "${user.home}/clion/bin/clion.sh";
} }
} }
else if (key == Ids::androidStudioExePath)
{
if (os == TargetOS::windows)
{
#if JUCE_WINDOWS
auto path = WindowsRegistry::getValue ("HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio\\Path", {}, {});
if (! path.isEmpty())
return Value (path.unquoted() + "\\bin\\studio64.exe");
#endif
v = "C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";
}
else if (os == TargetOS::osx)
{
v = "/Applications/Android Studio.app";
}
else
{
jassertfalse; // no Android Studio on this OS!
}
}
} }
return v; return v;
@@ -436,6 +458,14 @@ bool StoredSettings::isGlobalPathValid (const File& relativeTo, const Identifier
fileToCheckFor = "../clion.sh"; fileToCheckFor = "../clion.sh";
#endif #endif
} }
else if (key == Ids::androidStudioExePath)
{
#if JUCE_MAC
fileToCheckFor = "Android Studio.app";
#elif JUCE_WINDOWS
fileToCheckFor = "studio64.exe";
#endif
}
else if (key == Ids::jucePath) else if (key == Ids::jucePath)
{ {
fileToCheckFor = "ChangeList.txt"; fileToCheckFor = "ChangeList.txt";


+ 1
- 0
extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h View File

@@ -220,6 +220,7 @@ namespace Ids
DECLARE_ID (androidSharedLibraries); DECLARE_ID (androidSharedLibraries);
DECLARE_ID (androidScreenOrientation); DECLARE_ID (androidScreenOrientation);
DECLARE_ID (androidExtraAssetsFolder); DECLARE_ID (androidExtraAssetsFolder);
DECLARE_ID (androidStudioExePath);
DECLARE_ID (iosDeviceFamily); DECLARE_ID (iosDeviceFamily);
const Identifier iPhoneScreenOrientation ("iosScreenOrientation"); // old name is confusing const Identifier iPhoneScreenOrientation ("iosScreenOrientation"); // old name is confusing
DECLARE_ID (iPadScreenOrientation); DECLARE_ID (iPadScreenOrientation);


Loading…
Cancel
Save