Skip to content

Commit d059402

Browse files
committed
switch to android-game-sdk-rs grafted repo at v2.0.2
Also includes our patches on top (branch android-activity-2.0.2). This is mainly to test to make sure everything is still working. We will switch to the android-activity-4.0.0 branch when we're done Signed-off-by: William Casarin <jb55@jb55.com>
1 parent c324243 commit d059402

File tree

15 files changed

+4773
-11
lines changed

15 files changed

+4773
-11
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# android-games-sdk-rs
2+
3+
This is a grafted version of [android-games-sdk-rs][agdk].
4+
5+
The purpose of android-games-sdk-rs is to track our patches on top of the Android Game Development Kit (AGDK) so that it is easier to update to new upstream versions.
6+
7+
## Updating to new agdk version checklist
8+
9+
This is a basic checklist for things that need to be done before updating to a new agdk version:
10+
11+
- [ ] Ensure all patches applied to the local repo have been backported (see section below on backporting patches)
12+
- [ ] Rebase patches on top of a new *release* version of agdk. If you're not sure which version you should be rebasing on, open an issue.
13+
- [ ] Copy any new files over from the new version using the [copy_files](./copy_files) script (see section below on copying files)
14+
- [ ] Update [build.rs](../build.rs) with any new includes and src files
15+
- [ ] Regenerate ffi bindings using [generate_bindings.sh](./generate_bindings.sh)
16+
17+
## Backporting patches
18+
19+
Changes made to these files must be backported to [android-games-sdk-rs][agdk], otherwise they will be lost when updating to newer upstream versions. This can be done like so (running from the project root):
20+
21+
```bash
22+
git format-patch -o ~/agdk-patches last-import.. -- android-activity/android-games-sdk
23+
```
24+
25+
When applying on the [android-games-sdk-rs][agdk] side:
26+
27+
```bash
28+
git checkout android-activity-4.0.0
29+
git am -p3 ~/agdk-patches/*.patch
30+
```
31+
32+
Once these are applied on top of the current imported agdk version (in this example 4.0.0). Then they can be rebased onto future agdk versions easily.
33+
34+
## Copying files from agdk
35+
36+
When updating to a new version of upstream agdk properly, you can use the [copy_files](./copy_files) script.
37+
38+
This script takes in a list of files from [file_list.txt](./file_list.txt), and grafts those files into the local directory. This ensures that pathes are aligned so that patching is easier.
39+
40+
[agdk]: https://github.com/rust-mobile/android-games-sdk-rs
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
# Copies files from android-games-sdk-rs so that we don't have to use
4+
# it has a submodule (see https://github.com/rust-mobile/android-activity/issues/190)
5+
6+
# Usage: ./copy_files source_dir dest_dir file_list.txt
7+
# file_list.txt should contain one filename or path pattern per line
8+
9+
# Check if correct number of arguments
10+
if [ $# -ne 1 ]; then
11+
echo "Usage: $0 <android-games-sdk-rs dir>"
12+
exit 1
13+
fi
14+
15+
SOURCE_DIR="$1"
16+
DEST_DIR="${2:-.}"
17+
FILE_LIST="${3:-file_list.txt}"
18+
19+
# Check if source directory exists
20+
if [ ! -d "$SOURCE_DIR" ]; then
21+
echo "Error: Source directory '$SOURCE_DIR' does not exist."
22+
exit 1
23+
fi
24+
25+
# Check if file list exists
26+
if [ ! -f "$FILE_LIST" ]; then
27+
echo "Error: File list '$FILE_LIST' does not exist."
28+
exit 1
29+
fi
30+
31+
# Create destination directory if it doesn't exist
32+
mkdir -p "$DEST_DIR"
33+
34+
# Read file list and copy each file
35+
while IFS= read -r file || [ -n "$file" ]; do
36+
# Skip empty lines and comments
37+
if [ -z "$file" ] || [[ "$file" =~ ^# ]]; then
38+
continue
39+
fi
40+
41+
# Find matching files
42+
find "$SOURCE_DIR" -name "$file" -type f | while read -r file; do
43+
# Get the relative path
44+
rel_path="${file#$SOURCE_DIR/}"
45+
dest_file="$DEST_DIR/$rel_path"
46+
dest_dir=$(dirname "$dest_file")
47+
48+
# Create destination directory structure
49+
mkdir -p "$dest_dir"
50+
51+
# Copy the file
52+
cp "$file" "$dest_file"
53+
echo "Copied: $rel_path"
54+
done
55+
done < "$FILE_LIST"
56+
57+
echo "Copy operation completed."
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
GameActivity.h
2+
GameActivity.cpp
3+
GameActivityEvents.h
4+
GameActivityEvents.cpp
5+
GameActivityLog.h
6+
gametextinput.cpp
7+
gametextinput.h
8+
gamecommon.h
9+
gamesdk_common.h
10+
android_native_app_glue.h
11+
android_native_app_glue.c

0 commit comments

Comments
 (0)