Skip to content

Commit 6df0ebf

Browse files
authored
Modernize build and CI to match recent changes to godot_openxr_vendors (#5)
1 parent 9910f0c commit 6df0ebf

File tree

13 files changed

+278
-261
lines changed

13 files changed

+278
-261
lines changed

.github/workflows/build-addon-on-push.yml

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,48 +24,46 @@ jobs:
2424
fail-fast: true
2525
matrix:
2626
include:
27-
# Godot Meta Toolkit
28-
- name: Godot Meta Toolkit Linux (x86_64)
27+
- name: 🐧 Linux (x86_64)
2928
os: ubuntu-20.04
3029
platform: linux
3130
flags: arch=x86_64
3231
artifact_name: godotmetatoolkit-build-files-linux-x86_64
3332
artifact_path: godot_meta_toolkit/demo/addons/godot_meta_toolkit/.bin/linux/*/*/*.so
3433
cache-name: linux-x86_64
35-
- name: Godot Meta Toolkit Windows
34+
- name: 🏁 Windows (x86_64)
3635
os: windows-latest
3736
platform: windows
3837
artifact_name: godotmetatoolkit-build-files-windows
3938
artifact_path: godot_meta_toolkit/demo/addons/godot_meta_toolkit/.bin/windows/*/*/*.dll
4039
cache-name: windows-x86_64
41-
- name: Godot Meta Toolkit MacOS
40+
- name: 🍎 MacOS (universal)
4241
os: macos-latest
4342
platform: macos
4443
flags: arch=universal
4544
artifact_name: godotmetatoolkit-build-files-macos
4645
artifact_path: godot_meta_toolkit/demo/addons/godot_meta_toolkit/.bin/macos/*/*.framework
4746
cache-name: macos-universal
48-
- name: Godot Meta Toolkit Android
47+
- name: 🤖 Android (arm64)
4948
os: ubuntu-20.04
5049
platform: android
5150
flags: arch=arm64
5251
artifact_name: godotmetatoolkit-build-files-android
5352
artifact_path: |
54-
godot_meta_toolkit/demo/addons/godot_meta_toolkit/.bin/android/*/*.aar
5553
godot_meta_toolkit/demo/addons/godot_meta_toolkit/.bin/android/*/*/*.so
5654
cache-name: android
5755

5856
# Note, to satisfy the asset library we need to make sure our zip files have a root folder
5957
# this is why we checkout into godot_meta_toolkit and build into asset
6058
steps:
6159
- name: Checkout
62-
uses: actions/checkout@v3
60+
uses: actions/checkout@v4
6361
with:
6462
path: godot_meta_toolkit
6563
submodules: recursive
6664
lfs: 'true'
67-
- name: Setup Godot build cache
68-
uses: ./godot_meta_toolkit/thirdparty/godot-cpp/.github/actions/godot-cache
65+
- name: Restore Godot build cache
66+
uses: ./godot_meta_toolkit/thirdparty/godot-cpp/.github/actions/godot-cache-restore
6967
with:
7068
cache-name: ${{ matrix.cache-name }}
7169
continue-on-error: true
@@ -74,6 +72,7 @@ jobs:
7472
wget "${{ env.META_PLATFORM_SDK_URL }}" -O meta_platform_sdk.zip
7573
cd godot_meta_toolkit/thirdparty/ovr_platform_sdk
7674
unzip -a ../../../meta_platform_sdk.zip
75+
rm -rf Android/libs/armeabi-v7a
7776
cd ../../..
7877
rm meta_platform_sdk.zip
7978
if: runner.os != 'Windows'
@@ -87,71 +86,76 @@ jobs:
8786
Remove-Item "meta_platform_sdk.zip"
8887
if: runner.os == 'Windows'
8988
- name: Set up Python (for SCons)
90-
uses: actions/setup-python@v4
89+
uses: actions/setup-python@v5
9190
with:
9291
python-version: "3.x"
9392
- name: Android dependencies
9493
uses: nttld/setup-ndk@v1
9594
with:
9695
ndk-version: r23c
9796
link-to-sdk: true
97+
if: matrix.platform == 'android'
9898
- name: Install scons
9999
run: |
100100
python -m pip install scons==4.0.0
101101
- name: Create extension library
102102
run: |
103103
cd godot_meta_toolkit
104-
scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }}
105-
scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }}
104+
scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }} build_profile=thirdparty/godot_cpp_build_profile/build_profile.json
105+
scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }} build_profile=thirdparty/godot_cpp_build_profile/build_profile.json
106106
cd ..
107-
108-
# On Android we build our loaders and build our extension with gradlew
109-
- name: Setup java
110-
uses: actions/setup-java@v3
107+
- name: Save Godot build cache
108+
uses: ./godot_meta_toolkit/thirdparty/godot-cpp/.github/actions/godot-cache-save
111109
with:
112-
java-version: 17
113-
distribution: "adopt"
114-
if: matrix.platform == 'android'
115-
- name: Validate Gradle wrapper
116-
uses: gradle/wrapper-validation-action@v1
117-
if: matrix.platform == 'android'
118-
- name: Create Godot-CPP library
119-
run: |
120-
cd godot_meta_toolkit/thirdparty/godot-cpp
121-
scons platform=${{ matrix.platform }} target=template_debug arch=arm64
122-
scons platform=${{ matrix.platform }} target=template_release arch=arm64
123-
scons platform=${{ matrix.platform }} target=template_debug arch=x86_64
124-
scons platform=${{ matrix.platform }} target=template_release arch=x86_64
125-
cd ../../..
126-
if: matrix.platform == 'android'
127-
- name: Create Godot Meta Toolkit AARs
128-
uses: burrunan/gradle-cache-action@v1
129-
with:
130-
build-root-directory: godot_meta_toolkit
131-
arguments: build
132-
if: matrix.platform == 'android'
133-
110+
cache-name: ${{ matrix.cache-name }}
111+
continue-on-error: true
134112
- name: Upload build files (artifacts)
135-
uses: actions/upload-artifact@v3
113+
uses: actions/upload-artifact@v4
136114
with:
137115
name: ${{ matrix.artifact_name }}
116+
include-hidden-files: true
138117
path: |
139118
${{ matrix.artifact_path }}
140119
141-
# GODOT 4.2 ADDON GENERATION SECTION
142120
asset:
143121
name: Assembling the asset
144122
runs-on: ubuntu-20.04
145123
needs: build
146124

147-
# Steps represent a sequence of tasks that will be executed as part of the job
148125
steps:
149126
- name: Checkout
150-
uses: actions/checkout@v3
127+
uses: actions/checkout@v4
151128
with:
152129
path: godot_meta_toolkit
153130
- name: Download all workflow run artifacts
154-
uses: actions/download-artifact@v3
131+
uses: actions/download-artifact@v4
132+
- name: Download Meta Platform SDK
133+
run: |
134+
wget "${{ env.META_PLATFORM_SDK_URL }}" -O meta_platform_sdk.zip
135+
cd godot_meta_toolkit/thirdparty/ovr_platform_sdk
136+
unzip -a ../../../meta_platform_sdk.zip
137+
rm -rf Android/libs/armeabi-v7a
138+
cd ../../..
139+
rm meta_platform_sdk.zip
140+
- name: Setup java
141+
uses: actions/setup-java@v4
142+
with:
143+
java-version: 17
144+
distribution: "adopt"
145+
- name: Validate Gradle wrapper
146+
uses: gradle/actions/wrapper-validation@v3
147+
- name: Copy Android binaries
148+
run: |
149+
mkdir -p godot_meta_toolkit/toolkit/src/main/libs/debug/arm64-v8a/arm64-v8a
150+
cp godotmetatoolkit-build-files-android/template_debug/arm64/libgodot_meta_toolkit.so godot_meta_toolkit/toolkit/src/main/libs/debug/arm64-v8a/arm64-v8a/
151+
152+
mkdir -p godot_meta_toolkit/toolkit/src/main/libs/release/arm64-v8a/arm64-v8a
153+
cp godotmetatoolkit-build-files-android/template_release/arm64/libgodot_meta_toolkit.so godot_meta_toolkit/toolkit/src/main/libs/release/arm64-v8a/arm64-v8a/
154+
- name: Create Godot Meta Toolkit AARs
155+
run: |
156+
cd godot_meta_toolkit
157+
./gradlew build
158+
cd ..
155159
- name: Create Godot Meta Toolkit Addon
156160
run: |
157161
mkdir asset
@@ -172,9 +176,10 @@ jobs:
172176
cp -r godotmetatoolkit-build-files-macos/* asset/addons/godot_meta_toolkit/.bin/macos/
173177
174178
- name: Create Godot Meta Toolkit addon artifact
175-
uses: actions/upload-artifact@v3
179+
uses: actions/upload-artifact@v4
176180
with:
177181
name: GodotMetaToolkitAddon
182+
include-hidden-files: true
178183
path: |
179184
asset
180185
- name: Zip addon
@@ -186,6 +191,7 @@ jobs:
186191
with:
187192
allowUpdates: true
188193
artifacts: "godotmetatoolkitaddon.zip"
194+
draft: true
189195
omitNameDuringUpdate: true
190196
omitBodyDuringUpdate: true
191197
omitDraftDuringUpdate: true

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313

1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717

1818
- name: Set up Python
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: '3.10'
2222

.github/workflows/static_checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-20.04
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1818

1919
- name: Install dependencies
2020
run: |

SConstruct

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ sources += Glob("#toolkit/src/main/cpp/platform_sdk/*.cpp")
3333
sources += Glob("#toolkit/gen/src/*.cpp")
3434

3535
binary_path = '#demo/addons/godot_meta_toolkit/.bin'
36+
android_src_path = '#toolkit/src'
3637
project_name = 'godot_meta_toolkit'
3738

39+
if env['platform'] == "android":
40+
env.Append(LIBPATH=['thirdparty/ovr_platform_sdk/Android/libs/arm64-v8a'])
41+
env.Append(LIBS=['ovrplatformloader'])
42+
3843
# Create the library target
3944
if env["platform"] == "macos":
4045
library = env.SharedLibrary(
@@ -61,3 +66,24 @@ else:
6166

6267
Default(library)
6368

69+
if env["platform"] == "android":
70+
android_target = "release" if env["target"] == "template_release" else "debug"
71+
android_arch = ""
72+
if env["arch"] == "arm64":
73+
android_arch = "arm64-v8a"
74+
elif env["arch"] == "x86_64":
75+
android_arch = "x86_64"
76+
else:
77+
raise Exception("Unable to map %s to Android architecture name" % env["arch"])
78+
79+
library_copy_path = "{}/main/libs/{}/{}/{}/lib{}{}".format(
80+
android_src_path,
81+
android_target,
82+
android_arch,
83+
android_arch,
84+
project_name,
85+
env["SHLIBSUFFIX"])
86+
87+
library_copy = env.Command(library_copy_path, library, Copy('$TARGET', '$SOURCE'))
88+
89+
Default(library_copy)

build.gradle

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,35 +65,41 @@ task buildSconsArtifacts {
6565
break
6666
}
6767
}
68-
if (sconsExecutableFile == null) {
69-
throw new GradleException("Unable to find executable path for the '$sconsName' command.")
70-
} else {
71-
logger.debug("Found executable path for $sconsName: ${sconsExecutableFile.absolutePath}")
72-
}
7368

74-
// Build the Godot-CPP bindings
75-
tasks.create(name: "buildGodotCPPDebug", type: Exec) {
76-
executable sconsExecutableFile.absolutePath
77-
args "--directory=thirdparty/godot-cpp", "platform=android", "target=template_debug", "arch=arm64"
78-
}
79-
tasks.create(name: "buildGodotCPPRelease", type: Exec) {
80-
executable sconsExecutableFile.absolutePath
81-
args "--directory=thirdparty/godot-cpp", "platform=android", "target=template_release", "arch=arm64"
69+
// Using `doFirst` so the exception doesn't happen until this task actually runs.
70+
doFirst {
71+
if (sconsExecutableFile == null) {
72+
throw new GradleException("Unable to find executable path for the '$sconsName' command.")
73+
} else {
74+
logger.debug("Found executable path for $sconsName: ${sconsExecutableFile.absolutePath}")
75+
}
8276
}
8377

84-
dependsOn 'buildGodotCPPDebug'
85-
dependsOn 'buildGodotCPPRelease'
78+
if (sconsExecutableFile != null) {
79+
// Build the GDExtension library for Android.
80+
tasks.create(name: "buildGodotMetaToolkitAndroidArm64Debug", type: Exec) {
81+
executable sconsExecutableFile.absolutePath
82+
args "--directory=.", "platform=android", "target=template_debug", "arch=arm64", "build_profile=thirdparty/godot_cpp_build_profile/build_profile.json"
83+
}
84+
tasks.create(name: "buildGodotMetaToolkitAndroidArm64Release", type: Exec) {
85+
executable sconsExecutableFile.absolutePath
86+
args "--directory=.", "platform=android", "target=template_release", "arch=arm64", "build_profile=thirdparty/godot_cpp_build_profile/build_profile.json"
87+
}
8688

87-
// Creating gradle task to generate the editor gdextension binaries for the godot_meta_toolkit addon
88-
tasks.create(name: "buildGodotMetaToolkitDebugGDExtension", type: Exec) {
89-
executable sconsExecutableFile.absolutePath
90-
args "--directory=.", "target=template_debug"
91-
}
92-
tasks.create(name: "buildGodotMetaToolkitReleaseGDExtension", type: Exec) {
93-
executable sconsExecutableFile.absolutePath
94-
args "--directory=.", "target=template_release"
95-
}
89+
dependsOn 'buildGodotMetaToolkitAndroidArm64Debug'
90+
dependsOn 'buildGodotMetaToolkitAndroidArm64Release'
9691

97-
dependsOn 'buildGodotMetaToolkitDebugGDExtension'
98-
dependsOn 'buildGodotMetaToolkitReleaseGDExtension'
92+
// Build the GDExtension library for desktop.
93+
tasks.create(name: "buildGodotMetaToolkitDesktopDebug", type: Exec) {
94+
executable sconsExecutableFile.absolutePath
95+
args "--directory=.", "target=template_debug", "build_profile=thirdparty/godot_cpp_build_profile/build_profile.json"
96+
}
97+
tasks.create(name: "buildGodotMetaToolkitDesktopRelease", type: Exec) {
98+
executable sconsExecutableFile.absolutePath
99+
args "--directory=.", "target=template_release", "build_profile=thirdparty/godot_cpp_build_profile/build_profile.json"
100+
}
101+
102+
dependsOn 'buildGodotMetaToolkitDesktopDebug'
103+
dependsOn 'buildGodotMetaToolkitDesktopRelease'
104+
}
99105
}

config.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ ext {
66
targetSdk : 34,
77
javaVersion : JavaVersion.VERSION_17,
88
kotlinVersion : '1.9.20',
9-
cmakeVersion : '3.22.1',
109
ndkVersion : '23.2.8568313'
1110
]
1211

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#Mon Mar 25 17:51:26 PDT 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4+
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
45
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"enabled_classes": [
3+
"AcceptDialog",
4+
"BaseButton",
5+
"BoxContainer",
6+
"Button",
7+
"CanvasItem",
8+
"ConfirmationDialog",
9+
"Container",
10+
"Control",
11+
"EditorExportPlatform",
12+
"EditorExportPlatformAndroid",
13+
"EditorExportPlugin",
14+
"EditorFileDialog",
15+
"EditorInterface",
16+
"EditorPlugin",
17+
"EditorSettings",
18+
"Engine",
19+
"FileAccess",
20+
"HBoxContainer",
21+
"Label",
22+
"LineEdit",
23+
"MainLoop",
24+
"Node",
25+
"OS",
26+
"ProjectSettings",
27+
"RefCounted",
28+
"Resource",
29+
"RichTextLabel",
30+
"ScrollContainer",
31+
"Shortcut",
32+
"TextServer",
33+
"Texture",
34+
"Texture2D",
35+
"VBoxContainer",
36+
"Viewport",
37+
"Window"
38+
]
39+
}

0 commit comments

Comments
 (0)