mirror of
https://github.com/vale981/VoiDPlugins
synced 2025-03-04 16:51:38 -05:00
Restructure project and improve CI
This commit is contained in:
parent
5853e948bd
commit
c97bfa6096
52 changed files with 168 additions and 11 deletions
2
.github/workflows/dotnet.yml
vendored
2
.github/workflows/dotnet.yml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
|||
env:
|
||||
path: ${{ matrix.path }}
|
||||
plugin: ${{ matrix.plugin }}
|
||||
run: dotnet publish $path/$plugin --configuration Release --framework net6.0 -o ./build/$plugin
|
||||
run: dotnet publish ./src/$path/$plugin --configuration Release --framework net6.0 -o ./build/$plugin
|
||||
|
||||
- uses: actions/upload-artifact@main
|
||||
with:
|
||||
|
|
37
.github/workflows/generate_release.yml
vendored
Normal file
37
.github/workflows/generate_release.yml
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
name: Generate Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'The tag to create for the release'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
name: Generate Release
|
||||
env:
|
||||
TAG: ${{ github.event.inputs.tag }}
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@main
|
||||
with:
|
||||
dotnet-version: '6.0'
|
||||
|
||||
- name: Build
|
||||
run: ./build.sh
|
||||
|
||||
- name: Create Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
declare -a files
|
||||
for file in $(ls ./build); do
|
||||
files+=("-a" "./build/$file")
|
||||
done
|
||||
hub release create -d -m "VoiDPlugins v$TAG" "$TAG" "${files[@]}"
|
|
@ -1,2 +0,0 @@
|
|||
<Project>
|
||||
</Project>
|
|
@ -1,2 +0,0 @@
|
|||
<Project>
|
||||
</Project>
|
|
@ -1,5 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HidSharpCore" Version="1.2.1.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
120
build.sh
Normal file
120
build.sh
Normal file
|
@ -0,0 +1,120 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
orig_pwd=$(pwd)
|
||||
config="Release"
|
||||
framework="net6.0"
|
||||
output="./build"
|
||||
declare -a extra_options
|
||||
dry_run="false"
|
||||
plugins=("Binding/ScriptRunner" "Filter/MeL" "Filter/PrecisionControl" "Filter/Reconstructor" "OutputMode/TouchEmu" "OutputMode/VMultiMode" "OutputMode/WindowsInk")
|
||||
generate_zip="true"
|
||||
generate_sha256="true"
|
||||
clean_builds="true"
|
||||
sources="./src"
|
||||
|
||||
contains_space() { [[ "$1" =~ " " ]]; return $?; }
|
||||
|
||||
wrap_exec() {
|
||||
if [ "$dry_run" == "true" ]; then
|
||||
eval echo "Would execute: \"$@\""
|
||||
else
|
||||
eval "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
clean_output() {
|
||||
if [ -d "$output" ]; then
|
||||
wrap_exec rm -rf "$output"
|
||||
fi
|
||||
}
|
||||
|
||||
build_plugin() {
|
||||
echo "Building $1"
|
||||
echo
|
||||
local plugin="$1"
|
||||
local plugin_output="$2"
|
||||
wrap_exec dotnet publish "$sources/$plugin" -c $config -f $framework -o "$plugin_output" "${extra_options[@]}"
|
||||
wrap_exec rm "$plugin_output/${plugin##*/}.deps.json"
|
||||
wrap_exec rm "$plugin_output/OpenTabletDriver.Plugin.dll"
|
||||
wrap_exec rm "$plugin_output/OpenTabletDriver.Plugin.pdb"
|
||||
}
|
||||
|
||||
generate_zip() {
|
||||
local files="$1"
|
||||
local zip_file="$2"
|
||||
local zip_name=${zip_file##*/}
|
||||
|
||||
wrap_exec zip -rj "$zip_file" "$files"
|
||||
|
||||
if [ "$generate_sha256" = "true" ]; then
|
||||
local abs_output="$(readlink -f $output)"
|
||||
cd $(dirname "$zip_file")
|
||||
wrap_exec 'sha256sum "$zip_name" >> "$abs_output/zip_hashes.sha256"'
|
||||
cd "$orig_pwd"
|
||||
fi
|
||||
|
||||
if [ "$clean_builds" = "true" ]; then
|
||||
wrap_exec rm -rf "$files"
|
||||
fi
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--sources)
|
||||
sources="$2"
|
||||
shift
|
||||
;;
|
||||
-c=*|--config=*)
|
||||
config="${1#*=}"
|
||||
;;
|
||||
-c|--config)
|
||||
config="$2"
|
||||
shift
|
||||
;;
|
||||
-f=*|--framework=*)
|
||||
framework="${1#*=}"
|
||||
;;
|
||||
-f|--framework)
|
||||
framework="$2"
|
||||
shift
|
||||
;;
|
||||
-o=*|--output=*)
|
||||
output="${1#*=}"
|
||||
;;
|
||||
-o|--output)
|
||||
output="$2"
|
||||
shift
|
||||
;;
|
||||
--dry-run)
|
||||
dry_run="true"
|
||||
;;
|
||||
--no-zip)
|
||||
generate_zip="false"
|
||||
;;
|
||||
--no-sha256)
|
||||
generate_sha256="false"
|
||||
;;
|
||||
--no-clean)
|
||||
clean_builds="false"
|
||||
;;
|
||||
*)
|
||||
if contains_space "$1"; then
|
||||
extra_options+=("\"$1\"")
|
||||
else
|
||||
extra_options+=("$1")
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
clean_output
|
||||
|
||||
for plugin in "${plugins[@]}"; do
|
||||
plugin_output="$output/${plugin##*/}"
|
||||
build_plugin "$plugin" "$plugin_output"
|
||||
if [ "$generate_zip" = "true" ]; then
|
||||
generate_zip "$plugin_output" "$plugin_output.zip"
|
||||
fi
|
||||
echo
|
||||
done
|
|
@ -1,6 +1,8 @@
|
|||
<Project>
|
||||
<ItemGroup>
|
||||
<ProjectReference Condition="'$(NotPluginProject)' != 'true'" Include="$(MSBuildThisFileDirectory)/.modules/OpenTabletDriver/OpenTabletDriver.Plugin/OpenTabletDriver.Plugin.csproj" />
|
||||
<ProjectReference Condition="'$(NotPluginProject)' != 'true'" Include="$(MSBuildThisFileDirectory)/../.modules/OpenTabletDriver/OpenTabletDriver.Plugin/OpenTabletDriver.Plugin.csproj" >
|
||||
<Private>True</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Condition="'$(VMultiLibrary)' == 'true'" Include="$(MSBuildThisFileDirectory)/VoiDPlugins.Library/VMulti/VMulti.csproj" />
|
||||
<ProjectReference Condition="'$(VoiDLibrary)' == 'true'" Include="$(MSBuildThisFileDirectory)/VoiDPlugins.Library/VoiD/VoiD.csproj" />
|
||||
</ItemGroup>
|
7
src/VoiDPlugins.Library/VMulti/VMulti.csproj
Normal file
7
src/VoiDPlugins.Library/VMulti/VMulti.csproj
Normal file
|
@ -0,0 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HidSharpCore" Version="1.2.1.1" >
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Add table
Reference in a new issue