Hook up android version numbers, too.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4331 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-06-28 23:23:29 +00:00
parent 8f5201b2bc
commit d1eac6c9eb
3 changed files with 19 additions and 5 deletions

View File

@ -3,9 +3,11 @@
MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-builtin-rules
PROJECT = tildefriends VERSION_CODE := 8
VERSION_NUMBER := 0.0.8 VERSION_NUMBER := 0.0.8
VERSION_NAME := The secret ingredient is love. VERSION_NAME := The secret ingredient is love.
PROJECT = tildefriends
BUILD_DIR ?= out BUILD_DIR ?= out
BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease androiddebug-x86_64 androidrelease-x86_64 BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease androiddebug-x86_64 androidrelease-x86_64
UNAME_M := $(shell uname -m) UNAME_M := $(shell uname -m)
@ -438,6 +440,14 @@ src/version.h : $(firstword $(MAKEFILE_LIST))
@echo [version] $@ @echo [version] $@
@echo "#define VERSION_NUMBER \"$(VERSION_NUMBER)\"\n#define VERSION_NAME \"$(VERSION_NAME)\"\n" > $@ @echo "#define VERSION_NUMBER \"$(VERSION_NUMBER)\"\n#define VERSION_NAME \"$(VERSION_NAME)\"\n" > $@
src/android/AndroidManifest.xml : $(firstword $(MAKEFILE_LIST))
@echo [android_version] $@
@sed -i \
-e 's/versionCode=".*"/versionCode="$(VERSION_CODE)"/' \
-e 's/versionName=".*"/versionName="$(VERSION_NUMBER)"/' \
-e 's/android:minSdkVersion=".*"/android:minSdkVersion="$(ANDROID_MIN_SDK_VERSION)"/' \
$@
# Android support. # Android support.
out/res/layout_activity_main.xml.flat: src/android/res/layout/activity_main.xml out/res/layout_activity_main.xml.flat: src/android/res/layout/activity_main.xml
@mkdir -p $(dir $@) @mkdir -p $(dir $@)

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unprompted.tildefriends" package="com.unprompted.tildefriends"
versionCode="1" versionCode="8"
versionName="0.0.4"> versionName="0.0.8">
<uses-sdk android:minSdkVersion="16"/> <uses-sdk android:minSdkVersion="26"/>
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<application android:label="Tilde Friends" android:usesCleartextTraffic="true" android:debuggable="true"> <application android:label="Tilde Friends" android:usesCleartextTraffic="true" android:debuggable="true">
<meta-data android:name="android.max_aspect" android:value="2.1"/> <meta-data android:name="android.max_aspect" android:value="2.1"/>

View File

@ -82,6 +82,8 @@ public class MainActivity extends Activity {
String port_file_path = getFilesDir().toString() + "/port.txt"; String port_file_path = getFilesDir().toString() + "/port.txt";
base_url = "http://127.0.0.1:12345/"; base_url = "http://127.0.0.1:12345/";
MainActivity activity = this;
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -98,7 +100,9 @@ public class MainActivity extends Activity {
if (event.context().toString().equals("port.txt")) { if (event.context().toString().equals("port.txt")) {
Log.w("tildefriends", "Observed file write: " + event.context().toString()); Log.w("tildefriends", "Observed file write: " + event.context().toString());
base_url = "http://127.0.0.1:" + String.valueOf(read_port(port_file_path)) + "/"; base_url = "http://127.0.0.1:" + String.valueOf(read_port(port_file_path)) + "/";
web_view.loadUrl(base_url); activity.runOnUiThread(() -> {
web_view.loadUrl(base_url);
});
watcher.close(); watcher.close();
break; break;
} }