chiark / gitweb /
Fix JAVA_HOME environment variable handling
[fdroidserver.git] / fdroidserver / common.py
index e337a7f13a94205ea0981e9d93898321db83605b..229c6e4d69cfbd462aba80f90df38d05b11d9a85 100644 (file)
@@ -56,8 +56,7 @@ default_config = {
     'sdk_path': "$ANDROID_HOME",
     'ndk_paths': {
         'r9b': None,
-        'r10e': None,
-        'r12b': "$ANDROID_NDK",
+        'r10e': "$ANDROID_NDK",
     },
     'build_tools': "24.0.0",
     'force_build_tools': False,
@@ -136,7 +135,7 @@ def fill_config_defaults(thisconfig):
         pathlist += glob.glob('/System/Library/Java/JavaVirtualMachines/1.[6-9].0.jdk')
         pathlist += glob.glob('/Library/Java/JavaVirtualMachines/*jdk*[6-9]*')
         if os.getenv('JAVA_HOME') is not None:
-            pathlist += os.getenv('JAVA_HOME')
+            pathlist.append(os.getenv('JAVA_HOME'))
         if os.getenv('PROGRAMFILES') is not None:
             pathlist += glob.glob(os.path.join(os.getenv('PROGRAMFILES'), 'Java', 'jdk1.[6-9].*'))
         for d in sorted(pathlist):
@@ -1373,7 +1372,11 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
             props += "sdk.dir=%s\n" % config['sdk_path']
             props += "sdk-location=%s\n" % config['sdk_path']
         ndk_path = build.ndk_path()
-        if ndk_path:
+        # if for any reason the path isn't valid or the directory
+        # doesn't exist, some versions of Gradle will error with a
+        # cryptic message (even if the NDK is not even necessary).
+        # https://gitlab.com/fdroid/fdroidserver/issues/171
+        if ndk_path and os.path.exists(ndk_path):
             # Add ndk location
             props += "ndk.dir=%s\n" % ndk_path
             props += "ndk-location=%s\n" % ndk_path