Explorar el Código

Refactor code structure for improved readability and maintainability

Co-authored-by: Copilot <copilot@github.com>
TheWildJames hace 4 meses
padre
commit
63ea472afc
Se han modificado 1 ficheros con 22 adiciones y 13 borrados
  1. 22 13
      .github/actions/build-kernel/action.yml

+ 22 - 13
.github/actions/build-kernel/action.yml

@@ -22,21 +22,29 @@ runs:
         fi
         echo "✅ ccache binary verified: $(/usr/bin/ccache --version | head -1)"
         
-        # Create wrapper paths so build.sh cannot bypass ccache by rewriting CC/CXX.
-        mkdir -p /tmp/ccache-bin
-        ln -sf /usr/bin/ccache /tmp/ccache-bin/clang
-        ln -sf /usr/bin/ccache /tmp/ccache-bin/clang++
-        ln -sf /usr/bin/ccache /tmp/ccache-bin/gcc
-        ln -sf /usr/bin/ccache /tmp/ccache-bin/g++
-        export PATH="/tmp/ccache-bin:/usr/bin:$PATH"
-        echo "✅ ccache wrappers created in /tmp/ccache-bin"
+        # Replace compiler binaries with ccache to force usage regardless of how build system invokes them
+        # Rename real compilers first
+        sudo mv /usr/bin/clang /usr/bin/clang.real
+        sudo mv /usr/bin/clang++ /usr/bin/clang++.real
+        sudo mv /usr/bin/gcc /usr/bin/gcc.real
+        sudo mv /usr/bin/g++ /usr/bin/g++.real
+        
+        # Create ccache wrapper scripts that call the real compiler through ccache
+        for compiler in clang clang++ gcc g++; do
+          sudo tee /usr/bin/$compiler > /dev/null <<'EOF'
+#!/bin/bash
+exec /usr/bin/ccache /usr/bin/${0##*/}.real "$@"
+EOF
+          sudo chmod +x /usr/bin/$compiler
+        done
+        echo "✅ Compilers replaced with ccache wrappers"
         
         export CCACHE_DIR="$GITHUB_WORKSPACE/kernel/.ccache"
         export LDCACHE_DIR="$GITHUB_WORKSPACE/kernel/.ld_cache"
-        export CC="/tmp/ccache-bin/clang"
-        export CXX="/tmp/ccache-bin/clang++"
-        export HOSTCC="/tmp/ccache-bin/clang"
-        export HOSTCXX="/tmp/ccache-bin/clang++"
+        export CC="clang"
+        export CXX="clang++"
+        export HOSTCC="clang"
+        export HOSTCXX="clang++"
         export CCACHE_MAXSIZE=10G
         export CCACHE_COMPILERCHECK=content
         export CCACHE_BASEDIR="$GITHUB_WORKSPACE/kernel"
@@ -66,13 +74,14 @@ runs:
           exit 1
         fi
         echo "✅ clang resolves to: $(command -v clang)"
+        echo "   Verified as: $(file $(command -v clang))"
 
         if [ -f "build/build.sh" ]; then
           echo "🔨 Building with legacy build.sh (LTO caching to $LDCACHE_DIR)"
           mkdir -p "$LDCACHE_DIR"
           # Monitor ccache during build
           /usr/bin/ccache -z  # Reset stats
-          SKIP_MRPROPER=1 LTO=thin SKIP_EXT_MODULES=1 SKIP_CP_KERNEL_HDR=1 GKI_DEFCONFIG_FRAGMENT="$GITHUB_WORKSPACE/wild_gki.fragment" BUILD_CONFIG=common/build.config.gki.aarch64 CC="$CC" CXX="$CXX" LDCACHE_DIR="$LDCACHE_DIR" build/build.sh
+          SKIP_MRPROPER=1 LTO=thin SKIP_VENDOR_BOOT=1 SKIP_EXT_MODULES=1 SKIP_CP_KERNEL_HDR=1 GKI_DEFCONFIG_FRAGMENT="$GITHUB_WORKSPACE/wild_gki.fragment" BUILD_CONFIG=common/build.config.gki.aarch64 CC="$CC" CXX="$CXX" LDCACHE_DIR="$LDCACHE_DIR" build/build.sh
           echo "📊 ccache stats after build:"
           /usr/bin/ccache -s || true
         else