android: fix and test compilation to raw Android C code (#13080)
							parent
							
								
									a73e1462f0
								
							
						
					
					
						commit
						17911432b9
					
				|  | @ -41,6 +41,11 @@ jobs: | |||
|           ./v -os windows cmd/v | ||||
|           ./v -os windows examples/2048/2048.v | ||||
| 
 | ||||
|       - name: Compile to raw Android (non-graphic) compatible | ||||
|         run: | | ||||
|           # Test that V can compile non-graphic app to Android compatible code *without* using the -apk flag | ||||
|           ./v -os android examples/toml.v | ||||
| 
 | ||||
|   linux-cross: | ||||
|     runs-on: ubuntu-20.04 | ||||
|     timeout-minutes: 15 | ||||
|  | @ -88,6 +93,12 @@ jobs: | |||
|           ./v -os windows examples/2048/2048.v | ||||
|           ls -lart examples/2048/2048.exe | ||||
| 
 | ||||
|       - name: toml.v can be compiled to raw Android C | ||||
|         run: | | ||||
|           # Test that V can compile non-graphic app to Android compatible code *without* using the -apk flag | ||||
|           ./v -os android examples/toml.v | ||||
| 
 | ||||
| 
 | ||||
|   windows-cross: | ||||
|     runs-on: windows-2019 | ||||
|     timeout-minutes: 15 | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ fn C.AAsset_read(&C.AAsset, voidptr, int) int | |||
| fn C.AAsset_close(&C.AAsset) | ||||
| 
 | ||||
| pub fn read_apk_asset(file string) ?[]byte { | ||||
| 	$if apk { | ||||
| 		act := &C.ANativeActivity(C.sapp_android_get_native_activity()) | ||||
| 		if isnil(act) { | ||||
| 			return error('Could not get reference to Android activity') | ||||
|  | @ -36,4 +37,7 @@ pub fn read_apk_asset(file string) ?[]byte { | |||
| 		} | ||||
| 		C.AAsset_close(asset) | ||||
| 		return buf | ||||
| 	} $else { | ||||
| 		return error(@FN + ' can only be used with APK/AAB packaged Android apps') | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue