Skip to content

Commit 03df7d6

Browse files
Rename android to NO_CREATED_JAVA_VMS
1 parent d55c25e commit 03df7d6

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

jni/jni.cabal

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ source-repository head
1818
location: https://github.com/tweag/inline-java
1919
subdir: jni
2020

21-
Flag android
22-
Description: Turn on JNI Android compatibility
21+
Flag no-get-created-java-vms
22+
Description: Enable builds without JNI_GetCreatedJavaVMs
2323
Default: False
2424

2525
library
2626
hs-source-dirs: src/common src/linear-types
2727
cc-options: -std=c11
28-
if flag(android)
29-
cpp-options: -DANDROID
28+
if flag(no-get-created-java-vms)
29+
cpp-options: -DNO_GET_CREATED_JAVA_VMS
3030
extra-libraries: jvm
3131
exposed-modules:
3232
Foreign.JNI

jni/src/common/Foreign/JNI/Unsafe/Internal/JVM.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ checkBoundness =
174174
]
175175

176176

177-
#if defined(ANDROID)
177+
#if defined(NO_CREATED_JAVA_VMS)
178178

179179
$(C.verbatim "static JavaVM* jniJVM; ")
180180

@@ -185,17 +185,17 @@ setJVM (JVM_ jvm) = do
185185
jniJVM = $(JavaVM *jvm)
186186
} |]
187187

188-
-- | Unsupported in ANDROID
188+
-- | Unsupported if NO_CREATED_JAVA_VMS is set
189189
newJVM :: [ByteString] -> IO JVM
190-
newJVM = error "newJVM is unsupported in ANDROID"
190+
newJVM = error "newJVM is unsupported in NO_CREATED_JAVA_VMS"
191191

192-
-- | Unsupported in ANDROID
192+
-- | Unsupported in NO_CREATED_JAVA_VMS
193193
destroyJVM :: JVM -> IO ()
194-
destroyJVM = error "destroyJVM is unsupported in ANDROID"
194+
destroyJVM = error "destroyJVM is unsupported if NO_CREATED_JAVA_VMS"
195195

196-
-- | Unsupported in ANDROID
196+
-- | Unsupported in NO_CREATED_JAVA_VMS
197197
withJVM :: [ByteString] -> IO a -> IO a
198-
withJVM = error "withJVM is unsupported in ANDROID"
198+
withJVM = error "withJVM is unsupported in NO_CREATED_JAVA_VMS"
199199

200200
-- | The JVM set with setJVM
201201
{-# NOINLINE jvmPtr #-}
@@ -209,7 +209,7 @@ jvmPtr = unsafePerformIO $ [CU.exp| JavaVM* { jniJVM } |] >>= \case
209209

210210
-- | Sets the current JVM
211211
--
212-
-- Does nothing if not in ANDROID
212+
-- Does nothing if NO_CREATED_JAVA_VMS is unset
213213
setJVM :: JVM -> IO ()
214214
setJVM _ = return ()
215215

jni/src/linear-types/Foreign/JNI/Safe.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@
6767

6868
module Foreign.JNI.Safe
6969
( module Foreign.JNI.Safe
70-
#if !defined(ANDROID)
7170
, JNI.withJVM
72-
#endif
7371
) where
7472

7573
import Control.Exception hiding (throw)

0 commit comments

Comments
 (0)