Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion build-android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ set -e

# Config

# Debug symbols are enabled for the Android builds so we can generate a separate debug symbols file.
# Debug symbols are enabled for the Android builds so we can generate a separate debug symbols file.
# Gradle will strip them out of the final artifacts.
export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_build_objects=no"
export OPTIONS="production=yes debug_symbols=yes"
export OPTIONS_MONO="module_mono_enabled=yes"
export OPTIONS_DOTNET="module_dotnet_enabled=yes"
export TERM=xterm

prepare_source() {
Expand Down Expand Up @@ -143,4 +144,34 @@ if [ "${MONO}" == "1" ]; then
cp bin/godot-lib.template_release.aar /root/out/templates-mono/
fi

# .NET

if [ "${DOTNET}" == "1" ]; then
echo "Starting .NET build for Android..."

prepare_source

$SCONS platform=android arch=arm32 $OPTIONS $OPTIONS_DOTNET target=template_debug
$SCONS platform=android arch=arm32 $OPTIONS $OPTIONS_DOTNET target=template_release

$SCONS platform=android arch=arm64 $OPTIONS $OPTIONS_DOTNET target=template_debug
$SCONS platform=android arch=arm64 $OPTIONS $OPTIONS_DOTNET target=template_release

$SCONS platform=android arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_debug
$SCONS platform=android arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_release

$SCONS platform=android arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_debug
$SCONS platform=android arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_release

pushd platform/android/java
./gradlew generateGodotMonoTemplates
popd

mkdir -p /root/out/templates-dotnet
cp bin/android_source.zip /root/out/templates-dotnet/
cp bin/android_monoDebug.apk /root/out/templates-dotnet/android_debug.apk
cp bin/android_monoRelease.apk /root/out/templates-dotnet/android_release.apk
cp bin/godot-lib.template_release.aar /root/out/templates-dotnet/
fi

echo "Android build successful"
71 changes: 71 additions & 0 deletions build-dotnet/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

set -e

if [ "${DOTNET}" != "1" ]; then
exit 0
fi

dnf install -y clang python-unversioned-command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't need to install python-unversioned-command in my changes, is this to fix this error?:

urllib.request.urlretrieve fails with <urlopen error unknown url type: https>

I "fixed" it by downloading the .NET SDK outside of the container. (raulsntos@ca22bd4#diff-4d2a8eefdf2a9783512a35da4dc7676a66404b6f3826a8af9aad038722da6823R273-R285)

But we could alternatively download the .NET SDK with the dotnet install script in the container image, so it's pre-downloaded, and then in this build script we just copy it to the .dotnet directory. We just need to make sure it matches the version required in global.json (which right now is a moving target).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get that error myself. It's a bit weird that you fixed it by installing .NET outside the container, as it shouldn't use anything outside the container when in-container.

The reason I needed python-unversioned-command is that there's no /usr/bin/python by default in a barebones Fedora image. You had it working because you used our Linux SDK which provides python, but I don't think it's relevant to use our Linux SDK here as we don't need to create portable Linux binaries with GCC (I assume we only use dotnet and ClangSharp in this build?).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit weird that you fixed it by installing .NET outside the container, as it shouldn't use anything outside the container when in-container.

To be clear, when I said downloading .NET SDK outside the container, this just creates a .dotnet directory inside the cloned repo that gets archived and sent to the container.

I don't think it's relevant to use our Linux SDK here as we don't need to create portable Linux binaries with GCC (I assume we only use dotnet and ClangSharp in this build?)

That's correct, I just copied it from the build-mono-glue script without giving it much thought.


git clone https://github.com/raulsntos/godot-dotnet
cd godot-dotnet
git checkout upgrade-assistant-plus-source-code-plugin-wip
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it's using the latest commit on the WIP branch.

We'll have to decide whether we want to have a local Git checkout and set the commit manually (like we do for Godot itself), or always build the latest dev branch. I'm not sure how the versioning for godot-dotnet will be like long term.


echo "Building and generating .NET extension..."

# TODO: Get rid of this when we fix all these trimming warnings in godot-dotnet.
cat << EOF >> .editorconfig
# Disable trimming warnings because it spams the output too much.
dotnet_diagnostics.IL2111.severity = none
EOF

prerelease_label="${GODOT_VERSION#*-}"
version_prefix="${GODOT_VERSION%-*}"

if [[ "${prerelease_label}" == "${GODOT_VERSION}" ]]; then
prerelease_label=""
fi

# TODO: Ensure we don't accidentally make stable releases. We can remove this when we're ready for a stable release.
if [[ -z "$prerelease_label" ]]; then
echo "YOU ARE NOT SUPPOSED TO MAKE A STABLE RELEASE WITH THIS"
exit -1
fi

version_component_count=$(grep -o "\." <<< "$version_prefix" | wc -l)

if [ "$version_component_count" -eq 0 ]; then
version_prefix="${version_prefix}.0.0"
elif [ "$version_component_count" -eq 1 ]; then
version_prefix="${version_prefix}.0"
fi

if [[ -n "$prerelease_label" ]]; then
if [[ "$prerelease_label" =~ ^dev ]]; then
prerelease_label="${prerelease_label/dev/alpha}"
fi

prerelease_label=$(echo "$prerelease_label" | sed -E 's/([^0-9])([0-9])/\1.\2/g')
fi

echo "Building Godot .NET version ${version_prefix} (prerelease: '${prerelease_label}')"

dotnet --info

build_id="$(date +%Y%m%d).1"
final_version_kind="release"
if [[ -n "$prerelease_label" ]]; then
final_version_kind="prerelease"
fi

./build.sh --productBuild --ci --warnAsError false \
/p:GenerateGodotBindings=true \
/p:VersionPrefix=${version_prefix} \
/p:OfficialBuildId=${build_id} \
/p:FinalVersionKind=${final_version_kind} \
/p:PreReleaseVersionLabel=${prerelease_label}

cp -r artifacts/packages/Release/Shipping/* /root/out/

echo ".NET bindings generated successfully"
27 changes: 27 additions & 0 deletions build-ios/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_
# which is seen as a regression in the current workflow.
export OPTIONS="production=yes use_lto=no SWIFT_FRONTEND=/root/.local/share/swiftly/toolchains/6.2.0/usr/bin/swift-frontend"
export OPTIONS_MONO="module_mono_enabled=yes"
export OPTIONS_DOTNET="module_dotnet_enabled=yes"
export TERM=xterm

export IOS_SDK="26.0"
Expand Down Expand Up @@ -76,4 +77,30 @@ if [ "${MONO}" == "1" ]; then
cp bin/libgodot.ios.template_debug.x86_64.simulator.a /root/out/templates-mono/libgodot.ios.debug.simulator.a
fi

# .NET

if [ "${DOTNET}" == "1" ]; then
echo "Starting .NET build for iOS..."

# arm64 device
$SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_debug $IOS_DEVICE $APPLE_TARGET_ARM64
$SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_release $IOS_DEVICE $APPLE_TARGET_ARM64

# arm64 simulator
# Disabled for now as it doesn't work with cctools-port and current LLVM.
# See https://github.com/godotengine/build-containers/pull/85.
#$SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_debug $IOS_SIMULATOR $APPLE_TARGET_ARM64
#$SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_release $IOS_SIMULATOR $APPLE_TARGET_ARM64

# x86_64 simulator
$SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=template_debug $IOS_SIMULATOR $APPLE_TARGET_X86_64
$SCONS platform=ios $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=template_release $IOS_SIMULATOR $APPLE_TARGET_X86_64

mkdir -p /root/out/templates-dotnet
cp bin/libgodot.ios.template_release.arm64.a /root/out/templates-dotnet/libgodot.ios.a
cp bin/libgodot.ios.template_debug.arm64.a /root/out/templates-dotnet/libgodot.ios.debug.a
cp bin/libgodot.ios.template_release.x86_64.simulator.a /root/out/templates-dotnet/libgodot.ios.simulator.a
cp bin/libgodot.ios.template_debug.x86_64.simulator.a /root/out/templates-dotnet/libgodot.ios.debug.simulator.a
fi

echo "iOS build successful"
59 changes: 59 additions & 0 deletions build-linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set -e
export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_build_objects=no"
export OPTIONS="production=yes accesskit_sdk_path=/root/accesskit/accesskit-c"
export OPTIONS_MONO="module_mono_enabled=yes"
export OPTIONS_DOTNET="module_dotnet_enabled=yes"
export TERM=xterm

rm -rf godot
Expand Down Expand Up @@ -137,4 +138,62 @@ if [ "${MONO}" == "1" ]; then
rm -rf bin
fi

# .NET

if [ "${DOTNET}" == "1" ]; then
echo "Starting .NET build for Linux..."

export PATH="${GODOT_SDK_LINUX_X86_64}/bin:${BASE_PATH}"

$SCONS platform=linuxbsd arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=editor
mkdir -p /root/out/x86_64/tools-dotnet
cp -rvp bin/* /root/out/x86_64/tools-dotnet
rm -rf bin

$SCONS platform=linuxbsd arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_debug
$SCONS platform=linuxbsd arch=x86_64 $OPTIONS $OPTIONS_DOTNET target=template_release
mkdir -p /root/out/x86_64/templates-dotnet
cp -rvp bin/* /root/out/x86_64/templates-dotnet
rm -rf bin

export PATH="${GODOT_SDK_LINUX_X86_32}/bin:${BASE_PATH}"

$SCONS platform=linuxbsd arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=editor
mkdir -p /root/out/x86_32/tools-dotnet
cp -rvp bin/* /root/out/x86_32/tools-dotnet
rm -rf bin

$SCONS platform=linuxbsd arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_debug
$SCONS platform=linuxbsd arch=x86_32 $OPTIONS $OPTIONS_DOTNET target=template_release
mkdir -p /root/out/x86_32/templates-dotnet
cp -rvp bin/* /root/out/x86_32/templates-dotnet
rm -rf bin

export PATH="${GODOT_SDK_LINUX_ARM64}/bin:${BASE_PATH}"

$SCONS platform=linuxbsd arch=arm64 $OPTIONS $OPTIONS_DOTNET target=editor
mkdir -p /root/out/arm64/tools-dotnet
cp -rvp bin/* /root/out/arm64/tools-dotnet
rm -rf bin

$SCONS platform=linuxbsd arch=arm64 $OPTIONS $OPTIONS_DOTNET target=template_debug
$SCONS platform=linuxbsd arch=arm64 $OPTIONS $OPTIONS_DOTNET target=template_release
mkdir -p /root/out/arm64/templates-dotnet
cp -rvp bin/* /root/out/arm64/templates-dotnet
rm -rf bin

export PATH="${GODOT_SDK_LINUX_ARM32}/bin:${BASE_PATH}"

$SCONS platform=linuxbsd arch=arm32 $OPTIONS $OPTIONS_DOTNET target=editor
mkdir -p /root/out/arm32/tools-dotnet
cp -rvp bin/* /root/out/arm32/tools-dotnet
rm -rf bin

$SCONS platform=linuxbsd arch=arm32 $OPTIONS $OPTIONS_DOTNET target=template_debug
$SCONS platform=linuxbsd arch=arm32 $OPTIONS $OPTIONS_DOTNET target=template_release
mkdir -p /root/out/arm32/templates-dotnet
cp -rvp bin/* /root/out/arm32/templates-dotnet
rm -rf bin
fi

echo "Linux build successful"
26 changes: 26 additions & 0 deletions build-macos/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set -e
export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no redirect_build_objects=no"
export OPTIONS="osxcross_sdk=darwin25 production=yes use_volk=no vulkan_sdk_path=/root/moltenvk angle_libs=/root/angle accesskit_sdk_path=/root/accesskit/accesskit-c SWIFT_FRONTEND=/root/.local/share/swiftly/toolchains/6.2.0/usr/bin/swift-frontend"
export OPTIONS_MONO="module_mono_enabled=yes"
export OPTIONS_DOTNET="module_dotnet_enabled=yes"
export TERM=xterm

rm -rf godot
Expand Down Expand Up @@ -68,4 +69,29 @@ if [ "${MONO}" == "1" ]; then
rm -rf bin
fi

# .NET

if [ "${DOTNET}" == "1" ]; then
echo "Starting .NET build for macOS..."

$SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=editor
$SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=editor
lipo -create bin/godot.macos.editor.x86_64.dotnet bin/godot.macos.editor.arm64.dotnet -output bin/godot.macos.editor.universal.dotnet

mkdir -p /root/out/tools-dotnet
cp -rvp bin/* /root/out/tools-dotnet
rm -rf bin

$SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=template_debug
$SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_debug
lipo -create bin/godot.macos.template_debug.x86_64.dotnet bin/godot.macos.template_debug.arm64.dotnet -output bin/godot.macos.template_debug.universal.dotnet
$SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=x86_64 target=template_release
$SCONS platform=macos $OPTIONS $OPTIONS_DOTNET arch=arm64 target=template_release
lipo -create bin/godot.macos.template_release.x86_64.dotnet bin/godot.macos.template_release.arm64.dotnet -output bin/godot.macos.template_release.universal.dotnet

mkdir -p /root/out/templates-dotnet
cp -rvp bin/* /root/out/templates-dotnet
rm -rf bin
fi

echo "macOS build successful"
Loading