Skip to content

Commit

Permalink
scons cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanfranke committed Nov 2, 2024
1 parent 7bce1b3 commit f47439f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 33 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,26 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

# TODO: Cache doesn't work yet. SCons rebuilds the objects even if they already exist. Could be caused by modification dates or extension_api.json.
# fetch-depth: 0 May be needed for cache. See: <https://github.com/actions/checkout/issues/468>.
# - name: Set up SCons cache
# uses: actions/cache@v3
# with:
# path: |
# ${{ github.workspace }}/.scons-cache/
# ${{ github.workspace }}/**/.sconsign.dblite
# ${{ github.workspace }}/godot-cpp/gen/
# key: ${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }}
# restore-keys: |
# ${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }}
# ${{ matrix.identifier }}-${{ github.ref }}
# ${{ matrix.identifier }}
- name: Set up SCons cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.scons-cache/
${{ github.workspace }}/**/.sconsign.dblite
${{ github.workspace }}/godot-cpp/gen/
key: ${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }}
${{ matrix.identifier }}-${{ github.ref }}
${{ matrix.identifier }}
- name: Compile extension
shell: sh
# env:
# SCONS_CACHE: '${{ github.workspace }}/.scons-cache/'
# SCONS_CACHE_LIMIT: 8192
env:
SCONS_CACHE: '${{ github.workspace }}/.scons-cache/'
SCONS_CACHE_LIMIT: 4096
run: |
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' -j2
ls -l project/addons/*/bin/
Expand Down
14 changes: 7 additions & 7 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
import os
from glob import glob
from pathlib import Path

Expand All @@ -12,17 +13,16 @@ sources = Glob("src/*.cpp")
# Find gdextension path even if the directory or extension is renamed (e.g. project/addons/example/example.gdextension).
(extension_path,) = glob("project/addons/*/*.gdextension")

# Find the addon path (e.g. project/addons/example).
# Get the addon path (e.g. project/addons/example).
addon_path = Path(extension_path).parent

# Find the project name from the gdextension file (e.g. example).
# Get the project name from the gdextension file (e.g. example).
project_name = Path(extension_path).stem

# TODO: Cache is disabled currently.
# scons_cache_path = os.environ.get("SCONS_CACHE")
# if scons_cache_path != None:
# CacheDir(scons_cache_path)
# print("Scons cache enabled... (path: '" + scons_cache_path + "')")
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path != None:
CacheDir(scons_cache_path)
print("Scons cache enabled... (path: '" + scons_cache_path + "')")

# Create the library target (e.g. libexample.linux.debug.x86_64.so).
debug_or_release = "release" if env["target"] == "template_release" else "debug"
Expand Down
8 changes: 0 additions & 8 deletions project/demo/scene.tscn

This file was deleted.

File renamed without changes.
8 changes: 8 additions & 0 deletions project/demo/test.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://c7u64tpv6byvb"]

[ext_resource type="Script" path="res://demo/test.gd" id="1_b04qc"]

[node name="Test" type="Node"]
script = ExtResource("1_b04qc")

[node name="MyNode" type="MyNode" parent="."]
2 changes: 1 addition & 1 deletion project/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ config_version=5
[application]

config/name="project"
run/main_scene="res://demo/scene.tscn"
run/main_scene="res://demo/test.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")

0 comments on commit f47439f

Please sign in to comment.