Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTheMan827 committed Mar 23, 2024
0 parents commit 5ae5bfc
Show file tree
Hide file tree
Showing 22 changed files with 1,332 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/actions/canary-ndk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Setup canary ndk"
description: "Sets up canary ndk"
outputs:
ndk-path:
value: ${{ steps.path.outputs.path }}
description: "Output path of the ndk"
cache-hit:
value: ${{ steps.cache.outputs.cache-hit }}
description: "Whether a cache hit occurred for the ndk"
runs:
using: "composite"
steps:
- name: NDK cache
id: cache
uses: actions/cache@v3
with:
path: ${HOME}/android-ndk-r27-canary/
key: ${{ runner.os }}-ndk-r27-canary

- name: Download canary ndk
if: ${{ !steps.cache.outputs.cache-hit }}
env:
CANARY_URL: https://github.com/QuestPackageManager/ndk-canary-archive/releases/download/27.0.1/android-ndk-10883340-linux-x86_64.zip
run: wget ${CANARY_URL} -O ${HOME}/ndk.zip
shell: bash

- name: Unzip ndk
if: ${{ !steps.cache.outputs.cache-hit }}
run: 7z x "${HOME}/ndk.zip" -o"${HOME}/"
shell: bash

- name: Set output
id: path
shell: bash
run: echo "path=${HOME}/android-ndk-r27-canary" >> ${GITHUB_OUTPUT}
124 changes: 124 additions & 0 deletions .github/workflows/build-ndk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: NDK build

on:
workflow_dispatch:
push:
tags:
- "v*"
branches:
- 'master'
- 'dev/*'
- 'feat/*'
- 'fix/*'
paths-ignore:
- '**.yml'
- '!.github/workflows/build-ndk.yml'
- '**.json'
- '!qpm.json'
- '!qpm.shared.json'
- '!mod.template.json'
- '**.txt'
- '!CMakeLists.txt'
- '**.ps1'
- '!build.ps1'
- '!createqmod.ps1'
- '**.md'
- '.gitignore'
pull_request:
branches: master

env:
module_id: NoWarning
qmod_name: NoWarning

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
name: Checkout
with:
submodules: true
lfs: true

- uses: seanmiddleditch/gha-setup-ninja@v3

# Use canary NDK to avoid lesser known compile bugs
- name: Setup canary NDK
id: setup-ndk
uses: ./.github/actions/canary-ndk

- name: Create ndkpath.txt
run: |
echo ${{ steps.setup-ndk.outputs.ndk-path }} > ${GITHUB_WORKSPACE}/ndkpath.txt
cat ${GITHUB_WORKSPACE}/ndkpath.txt
# get version from pushed tag
- name: Extract version
if: startsWith(github.ref, 'refs/tags/v')
id: version
run: |
echo "TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT}
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> ${GITHUB_OUTPUT}
# if we don't have a tag, don't do anything special
- name: Setup qpm
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: Fernthedev/qpm-action@main
with:
workflow_token: ${{ secrets.GITHUB_TOKEN }}
restore: true
cache: true
publish: false

- name: Build & Create Qmod
run: |
cd ${GITHUB_WORKSPACE}
qpm s qmod
- name: Get Library Name
id: libname
run: |
cd ./build/
pattern="lib${module_id}*.so"
files=( $pattern )
echo "NAME=${files[0]}" >> ${GITHUB_OUTPUT}
- name: Rename debug artifact
run: mv "./build/debug/${{ steps.libname.outputs.NAME }}" "./build/debug_${{ steps.libname.outputs.NAME }}"

- name: Upload non-debug artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.libname.outputs.NAME }}
path: ./build/${{ steps.libname.outputs.NAME }}
if-no-files-found: error

- name: Upload debug artifact
uses: actions/upload-artifact@v2
with:
name: debug_${{ steps.libname.outputs.NAME }}
path: ./build/debug_${{ steps.libname.outputs.NAME }}
if-no-files-found: error

- name: Upload qmod artifact
uses: actions/upload-artifact@v2
with:
name: ${{env.qmod_name}}.qmod
path: ./${{ env.qmod_name }}.qmod
if-no-files-found: error

# if we had a tag, we should make a release
- name: Upload release artifacts
if: startsWith(github.ref, 'refs/tags/v')
id: upload_file_release
uses: softprops/[email protected]
with:
tag_name: ${{ github.event.inputs.version }}
files: |
./build/${{ steps.libname.outputs.NAME }}
./build/debug_${{ steps.libname.outputs.NAME }}
./${{ env.qmod_name }}.qmod
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Ignore clangd cache
.cache/

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# VSCode config stuff
!.vscode/c_cpp_properties.json
!.vscode/tasks.json
!.vscode/settings.json

# Jetbrains IDEs
.idea/

# NDK stuff
out/
[Ll]ib/
[Ll]ibs/
[Oo]bj/
[Oo]bjs/
ndkpath.txt
*.zip
*.txt
*.log
Android.mk.backup

# QPM stuff
[Ee]xtern/
*.qmod
mod.json
qpm_defines.cmake
![Cc][Mm]ake[Ll]ists.txt

# CMake stuff
[Bb]uild/
cmake-build-*/
extern.cmake

# QMOD Schema
mod.json.schema
27 changes: 27 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"configurations": [
{
"defines": [
"MOD_ID=\"NoWarning\"",
"VERSION=\"0.1.0\"",
"__GNUC__",
"__aarch64__"
],
"includePath": [
"${workspaceFolder}/extern/includes/libil2cpp/il2cpp/libil2cpp",
"${workspaceFolder}/extern/includes/codegen/include",
"${workspaceFolder}/extern/includes",
"${workspaceFolder}/include",
"${workspaceFolder}/shared",
"${workspaceFolder}",
"${default}"
],
"name": "Quest",
"cStandard": "c11",
"cppStandard": "c++20",
"intelliSenseMode": "clang-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
42 changes: 42 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Beat Saber",
"type": "fb-lldb",
"request": "launch",
"preLaunchTask": "Powershell Build and Copy",
"android": {
"application": {
"package": "com.beatgames.beatsaber",
"activity": "com.unity3d.player.UnityPlayerActivity"
},
"lldbConfig": {
"sourceMaps": [],
"librarySearchPaths": [
"${workspaceFolder}/build/debug/",
"${workspaceFolder}/extern/libs/"
]
}
}
},
{
"name": "Attach to running Beat Saber Instance",
"type": "fb-lldb",
"request": "attach",
"android": {
"application": {
"package": "com.beatgames.beatsaber",
"activity": "com.unity3d.player.UnityPlayerActivity"
},
"lldbConfig": {
"sourceMaps": [],
"librarySearchPaths": [
"${workspaceFolder}/build/debug/",
"${workspaceFolder}/extern/libs/",
]
}
}
}
]
}
Loading

0 comments on commit 5ae5bfc

Please sign in to comment.