diff --git a/.github/workflows/maa-dev-build.yaml b/.github/workflows/maa-dev-build.yaml
new file mode 100644
index 0000000000..aa321e67d0
--- /dev/null
+++ b/.github/workflows/maa-dev-build.yaml
@@ -0,0 +1,61 @@
+name: "Maa Dev Build"
+
+on:
+ push:
+ branches:
+ - dev
+ paths:
+ - src/MeoAssistant/**
+ - src/MeoAssistantBuilder/**
+ - src/MeoAsstGui/**
+ - 3rdparty/**
+ - include/**
+ - MeoAssistantArknights.sln
+ pull_request:
+ paths:
+ - src/MeoAssistant/**
+ - src/MeoAssistantBuilder/**
+ - src/MeoAsstGui/**
+ - 3rdparty/**
+ - include/**
+ - MeoAssistantArknights.sln
+ workflow_dispatch:
+
+jobs:
+ build:
+
+ runs-on: windows-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Setup .NET 6.0.x
+ uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: 6.0.x
+
+ - name: Run dev build task
+ run: pwsh .\build.ps1 DevBuild
+
+ - name: Read file name
+ id: read_path
+ run: pwsh .\read_path.ps1 ./artifacts MaaBundle*
+
+ - name: Upload Artifacts 0
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ steps.read_path.outputs.name_0 }}
+ path: ${{ steps.read_path.outputs.path_0 }}
+
+ - name: Upload Artifacts 1
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ steps.read_path.outputs.name_1 }}
+ path: ${{ steps.read_path.outputs.path_1 }}
+
+ - name: Upload Artifacts 2
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ steps.read_path.outputs.name_2 }}
+ path: ${{ steps.read_path.outputs.path_2 }}
diff --git a/.github/workflows/maa-doc-azure-deploy.yaml b/.github/workflows/maa-doc-azure-deploy.yaml
index f71103aa47..83b47e6832 100644
--- a/.github/workflows/maa-doc-azure-deploy.yaml
+++ b/.github/workflows/maa-doc-azure-deploy.yaml
@@ -1,30 +1,30 @@
-name: Azure Static Web Apps CI/CD
-
-on:
- push:
- branches:
- - master
- paths:
- - "docs/*"
-
-jobs:
- build_and_deploy:
- runs-on: ubuntu-latest
- name: Build and Deploy Job
- if: github.repository_owner == 'MaaAssistantArknights'
- steps:
- - uses: actions/checkout@v2
- with:
- submodules: true
- - name: Build And Deploy
- id: builddeploy
- uses: Azure/static-web-apps-deploy@v1
- with:
- azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_DESERT_00290F400 }}
- repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
- action: "upload"
- ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
- # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
- app_location: "/docs" # App source code path
- api_location: "" # Api source code path - optional
- output_location: ".vuepress/dist" # Built app content directory - optional
+name: Deploy Docs
+
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - "docs/*"
+ workflow_dispatch:
+
+jobs:
+ build_and_deploy:
+ runs-on: ubuntu-latest
+ name: Build and Deploy Job
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ - name: Build And Deploy
+ id: builddeploy
+ uses: Azure/static-web-apps-deploy@v1
+ with:
+ azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_DESERT_00290F400 }}
+ repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
+ action: "upload"
+ ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
+ # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
+ app_location: "/docs" # App source code path
+ api_location: "" # Api source code path - optional
+ output_location: ".vuepress/dist" # Built app content directory - optional
diff --git a/.github/workflows/maa-release-bundle.yaml b/.github/workflows/maa-release-bundle.yaml
new file mode 100644
index 0000000000..eb25aaa7f0
--- /dev/null
+++ b/.github/workflows/maa-release-bundle.yaml
@@ -0,0 +1,45 @@
+name: Release MaaBundle
+
+on:
+ release:
+ types:
+ - published
+
+jobs:
+
+ release-bundle:
+
+ runs-on: windows-latest
+
+ steps:
+
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Get tag
+ id: tag
+ uses: dawidd6/action-get-tag@v1
+
+ - name: Setup .NET 6.0.x
+ uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: 6.0.x
+
+ - name: Run release core task
+ run: pwsh .\build.ps1 ReleaseBundle
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v3
+ with:
+ name: MaaBundle-${{ steps.tag.outputs.tag }}
+ path: ./artifacts/MaaBundle*
+
+ - name: Upload release assets
+ uses: xresloader/upload-to-github-release@master
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ file: ./artifacts/MaaBundle*
+ tags: true
+ draft: false
+ verbose: true
diff --git a/.github/workflows/maa-release-core.yaml b/.github/workflows/maa-release-core.yaml
new file mode 100644
index 0000000000..c8735c956f
--- /dev/null
+++ b/.github/workflows/maa-release-core.yaml
@@ -0,0 +1,45 @@
+name: Release MaaCore
+
+on:
+ release:
+ types:
+ - published
+
+jobs:
+
+ release-core:
+
+ runs-on: windows-latest
+
+ steps:
+
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Get tag
+ id: tag
+ uses: dawidd6/action-get-tag@v1
+
+ - name: Setup .NET 6.0.x
+ uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: 6.0.x
+
+ - name: Run release core task
+ run: pwsh .\build.ps1 ReleaseCore
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v3
+ with:
+ name: MaaCore-${{ steps.tag.outputs.tag }}
+ path: ./artifacts/MaaCore*
+
+ - name: Upload release assets
+ uses: xresloader/upload-to-github-release@master
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ file: ./artifacts/MaaCore*
+ tags: true
+ draft: false
+ verbose: true
diff --git a/.github/workflows/maa-release-resource.yaml b/.github/workflows/maa-release-resource.yaml
new file mode 100644
index 0000000000..d68e94c4da
--- /dev/null
+++ b/.github/workflows/maa-release-resource.yaml
@@ -0,0 +1,39 @@
+name: Release MaaResource
+
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - resource/**
+ - 3rdparty/resource/**
+ workflow_dispatch:
+
+jobs:
+
+ release-resource:
+
+ runs-on: windows-latest
+
+ steps:
+
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Setup .NET 6.0.x
+ uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: 6.0.x
+
+ - name: Run release resource task
+ run: pwsh .\build.ps1 ReleaseResource
+
+ - name: Read file name
+ id: read_path
+ run: pwsh .\read_path.ps1 ./artifacts MaaResource*
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ steps.read_path.outputs.name_0 }}
+ path: ${{ steps.read_path.outputs.path_0 }}
diff --git a/.github/workflows/maa-release-wpf.yaml b/.github/workflows/maa-release-wpf.yaml
new file mode 100644
index 0000000000..6dadea0963
--- /dev/null
+++ b/.github/workflows/maa-release-wpf.yaml
@@ -0,0 +1,38 @@
+name: Release MaaWpf
+
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - src/MeoAsstGui/**
+ workflow_dispatch:
+
+jobs:
+
+ release-wpf:
+
+ runs-on: windows-latest
+
+ steps:
+
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Setup .NET 6.0.x
+ uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: 6.0.x
+
+ - name: Run release wpf task
+ run: pwsh .\build.ps1 ReleaseWpf
+
+ - name: Read file name
+ id: read_path
+ run: pwsh .\read_path.ps1 ./artifacts MaaWpf*
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ steps.read_path.outputs.name_0 }}
+ path: ${{ steps.read_path.outputs.path_0 }}
diff --git a/.gitignore b/.gitignore
index 025aa6f8be..77f946f4f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -436,3 +436,4 @@ adb_screen.png
tools/**/*.png
resource/infrast
.vscode
+!3rdparty/tools/*
diff --git a/MeoAssistantArknights.sln b/MeoAssistantArknights.sln
index 513ca97847..a2deaf4e91 100644
--- a/MeoAssistantArknights.sln
+++ b/MeoAssistantArknights.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.31515.178
+# Visual Studio Version 17
+VisualStudioVersion = 17.1.32414.318
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{6C4B8D52-51D1-45F8-AAEC-808035443FD6}"
EndProject
@@ -11,9 +11,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCaller", "tools\TestCal
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeoAsstGui", "src\MeoAsstGui\MeoAsstGui.csproj", "{FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}"
- ProjectSection(ProjectDependencies) = postProject
- {362D1E30-F5AE-4279-9985-65C27B3BA300} = {362D1E30-F5AE-4279-9985-65C27B3BA300}
- EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TransparentImageCvt", "tools\TransparentImageCvt\TransparentImageCvt.vcxproj", "{093A3174-A27E-4D23-B64E-16F9448AD5AC}"
EndProject
@@ -24,44 +21,52 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
EndProjectSection
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeoAssistantBuilder", "src\MeoAssistantBuilder\MeoAssistantBuilder.csproj", "{8D9036DD-75F1-4BD0-89E2-DFB37B925DA3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ CICD|x64 = CICD|x64
+ Debug|x64 = Debug|x64
Release|x64 = Release|x64
- Release|x86 = Release|x86
RelWithDebInfo|x64 = RelWithDebInfo|x64
- RelWithDebInfo|x86 = RelWithDebInfo|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.CICD|x64.ActiveCfg = RelWithDebInfo|x64
+ {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.CICD|x64.Build.0 = RelWithDebInfo|x64
+ {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.Debug|x64.ActiveCfg = RelWithDebInfo|x64
+ {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.Debug|x64.Build.0 = RelWithDebInfo|x64
{63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.Release|x64.ActiveCfg = Release|x64
{63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.Release|x64.Build.0 = Release|x64
- {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.Release|x86.ActiveCfg = Release|x64
{63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
- {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64
- {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x64.ActiveCfg = Release|Any CPU
- {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x64.Build.0 = Release|Any CPU
- {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x86.ActiveCfg = Release|Any CPU
- {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x86.Build.0 = Release|Any CPU
- {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|Any CPU
- {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|Any CPU
- {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|Any CPU
- {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|Any CPU
+ {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.CICD|x64.ActiveCfg = CICD|x64
+ {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.CICD|x64.Build.0 = CICD|x64
+ {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Debug|x64.ActiveCfg = Release|x64
+ {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x64.ActiveCfg = Release|x64
+ {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x64.Build.0 = Release|x64
+ {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {093A3174-A27E-4D23-B64E-16F9448AD5AC}.CICD|x64.ActiveCfg = Release|x64
+ {093A3174-A27E-4D23-B64E-16F9448AD5AC}.CICD|x64.Build.0 = Release|x64
+ {093A3174-A27E-4D23-B64E-16F9448AD5AC}.Debug|x64.ActiveCfg = Release|x64
+ {093A3174-A27E-4D23-B64E-16F9448AD5AC}.Debug|x64.Build.0 = Release|x64
{093A3174-A27E-4D23-B64E-16F9448AD5AC}.Release|x64.ActiveCfg = Release|x64
{093A3174-A27E-4D23-B64E-16F9448AD5AC}.Release|x64.Build.0 = Release|x64
- {093A3174-A27E-4D23-B64E-16F9448AD5AC}.Release|x86.ActiveCfg = Release|Win32
- {093A3174-A27E-4D23-B64E-16F9448AD5AC}.Release|x86.Build.0 = Release|Win32
{093A3174-A27E-4D23-B64E-16F9448AD5AC}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{093A3174-A27E-4D23-B64E-16F9448AD5AC}.RelWithDebInfo|x64.Build.0 = Release|x64
- {093A3174-A27E-4D23-B64E-16F9448AD5AC}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
- {093A3174-A27E-4D23-B64E-16F9448AD5AC}.RelWithDebInfo|x86.Build.0 = Release|Win32
+ {362D1E30-F5AE-4279-9985-65C27B3BA300}.CICD|x64.ActiveCfg = CICD|x64
+ {362D1E30-F5AE-4279-9985-65C27B3BA300}.CICD|x64.Build.0 = CICD|x64
+ {362D1E30-F5AE-4279-9985-65C27B3BA300}.Debug|x64.ActiveCfg = RelWithDebInfo|x64
+ {362D1E30-F5AE-4279-9985-65C27B3BA300}.Debug|x64.Build.0 = RelWithDebInfo|x64
{362D1E30-F5AE-4279-9985-65C27B3BA300}.Release|x64.ActiveCfg = Release|x64
{362D1E30-F5AE-4279-9985-65C27B3BA300}.Release|x64.Build.0 = Release|x64
- {362D1E30-F5AE-4279-9985-65C27B3BA300}.Release|x86.ActiveCfg = Release|x64
- {362D1E30-F5AE-4279-9985-65C27B3BA300}.Release|x86.Build.0 = Release|x64
{362D1E30-F5AE-4279-9985-65C27B3BA300}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{362D1E30-F5AE-4279-9985-65C27B3BA300}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
- {362D1E30-F5AE-4279-9985-65C27B3BA300}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64
- {362D1E30-F5AE-4279-9985-65C27B3BA300}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x64
+ {8D9036DD-75F1-4BD0-89E2-DFB37B925DA3}.CICD|x64.ActiveCfg = Release|x64
+ {8D9036DD-75F1-4BD0-89E2-DFB37B925DA3}.CICD|x64.Build.0 = Release|x64
+ {8D9036DD-75F1-4BD0-89E2-DFB37B925DA3}.Debug|x64.ActiveCfg = Debug|x64
+ {8D9036DD-75F1-4BD0-89E2-DFB37B925DA3}.Release|x64.ActiveCfg = Release|x64
+ {8D9036DD-75F1-4BD0-89E2-DFB37B925DA3}.Release|x64.Build.0 = Release|x64
+ {8D9036DD-75F1-4BD0-89E2-DFB37B925DA3}.RelWithDebInfo|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/build.ps1 b/build.ps1
new file mode 100644
index 0000000000..ee59fbc4fe
--- /dev/null
+++ b/build.ps1
@@ -0,0 +1,16 @@
+if ($args.Length -ne 1) {
+ throw "One argument required"
+}
+
+$target = $args[0]
+$valid_targets = @("ReleaseCore", "ReleaseWpf", "ReleaseResource", "ReleaseBundle", "DevBuild")
+
+if (!$valid_targets.Contains($target)) {
+ throw "$target is not a valid target"
+}
+
+Set-Location -Path .\src\MeoAssistantBuilder
+
+dotnet run -- --target $target
+
+Set-Location -Path ..\..\
diff --git a/read_path.ps1 b/read_path.ps1
new file mode 100644
index 0000000000..6cfb1aaf0e
--- /dev/null
+++ b/read_path.ps1
@@ -0,0 +1,16 @@
+if ($args.Length -ne 2) {
+ throw "Need two arguments"
+}
+
+$fs = Get-ChildItem -Path $args[0] -Filter $args[1]
+
+$index = 0
+foreach($f in $fs) {
+
+ $name = $f.Name
+ $path = $f.FullName
+ Write-Output "::set-output name=name_$index::$name"
+ Write-Output "::set-output name=path_$index::$path"
+
+ $index = $index + 1
+}
diff --git a/src/MeoAssistant/MeoAssistant.vcxproj b/src/MeoAssistant/MeoAssistant.vcxproj
index d3be7e62ce..bc44ff174b 100644
--- a/src/MeoAssistant/MeoAssistant.vcxproj
+++ b/src/MeoAssistant/MeoAssistant.vcxproj
@@ -1,280 +1,337 @@
-
-
-
-
- Release
- x64
-
-
- RelWithDebInfo
- x64
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 16.0
- Win32Proj
- {362d1e30-f5ae-4279-9985-65c27b3ba300}
- MeoAssistant
- 10.0
-
-
-
- DynamicLibrary
- false
- v143
- true
- Unicode
-
-
- DynamicLibrary
- false
- v143
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- $(SolutionDir)include;$(SolutionDir)3rdparty\include;$(IncludePath)
- $(TargetDir);$(SolutionDir)\3rdparty\lib;$(LibraryPath)
-
-
- false
- $(SolutionDir)include;$(SolutionDir)3rdparty\include;$(IncludePath)
- $(TargetDir);$(SolutionDir)\3rdparty\lib;$(LibraryPath)
-
-
-
- Level4
- true
- true
- true
- NDEBUG;_CONSOLE;ASST_DLL_EXPORTS;%(PreprocessorDefinitions)
- true
- stdcpp17
- stdc11
- MultiThreaded
- MaxSpeed
- /utf-8 /MP %(AdditionalOptions)
-
-
- Console
- true
- true
- true
- ppocr.lib;opencv_world453.lib;zlibstatic.lib;%(AdditionalDependencies)
- RequireAdministrator
-
-
- true
- msvcrt.lib
-
-
-
-
-
-
- xcopy /e /y /i /c $(SolutionDir)resource $(TargetDir)resource
-xcopy /e /y /i /c $(SolutionDir)3rdparty\resource $(TargetDir)resource
-
-
- copy resource
-
-
- xcopy /e /y /i /c $(SolutionDir)3rdparty\bin $(TargetDir)
-
-
- copy 3rd party dll
-
-
-
-
- Level4
-
-
- false
- true
- NDEBUG;_CONSOLE;ASST_DLL_EXPORTS;ASST_DEBUG;%(PreprocessorDefinitions)
- true
- stdcpp17
- stdc11
- MultiThreaded
- Disabled
- true
- EnableFastChecks
- /utf-8 /MP %(AdditionalOptions)
-
-
- Console
- true
- true
- true
- ppocr.lib;opencv_world453.lib;zlibstatic.lib;%(AdditionalDependencies)
- RequireAdministrator
-
-
- true
- msvcrt.lib
-
-
-
-
-
-
- xcopy /e /y /i /c $(SolutionDir)resource $(TargetDir)resource
-xcopy /e /y /i /c $(SolutionDir)3rdparty\resource $(TargetDir)resource
-
-
- copy resource
-
-
- xcopy /e /y /i /c $(SolutionDir)3rdparty\bin $(TargetDir)
-
-
- copy 3rd party dll
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+ Release
+ x64
+
+
+ RelWithDebInfo
+ x64
+
+
+ CICD
+ x64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 16.0
+ Win32Proj
+ {362d1e30-f5ae-4279-9985-65c27b3ba300}
+ MeoAssistant
+ 10.0
+
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+ $(ProjectDir)..\..\include;$(ProjectDir)..\..\3rdparty\include;$(IncludePath)
+ $(TargetDir);$(ProjectDir)..\..\3rdparty\lib;$(LibraryPath)
+ $(ProjectDir)..\..\$(Platform)\$(Configuration)\
+
+
+ false
+ $(ProjectDir)..\..\include;$(ProjectDir)..\..\3rdparty\include;$(IncludePath)
+ $(TargetDir);$(ProjectDir)..\..\3rdparty\lib;$(LibraryPath)
+ $(ProjectDir)..\..\$(Platform)\$(Configuration)\
+
+
+ false
+ $(ProjectDir)..\..\include;$(ProjectDir)..\..\3rdparty\include;$(IncludePath)
+ $(TargetDir);$(ProjectDir)..\..\3rdparty\lib;$(LibraryPath)
+ $(ProjectDir)..\..\$(Platform)\$(Configuration)\
+
+
+
+ Level4
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;ASST_DLL_EXPORTS;%(PreprocessorDefinitions)
+ true
+ stdcpp17
+ stdc11
+ MultiThreaded
+ MaxSpeed
+ /utf-8 /MP %(AdditionalOptions)
+
+
+ Console
+ true
+ true
+ true
+ ppocr.lib;opencv_world453.lib;zlibstatic.lib;%(AdditionalDependencies)
+ RequireAdministrator
+
+
+ true
+ msvcrt.lib
+
+
+
+
+
+
+
+ xcopy /e /y /i /c $(ProjectDir)..\..\resource $(TargetDir)resource
+ xcopy /e /y /i /c $(ProjectDir)..\..\3rdparty\resource $(TargetDir)resource
+
+
+
+ Copy resource
+
+
+
+ xcopy /e /y /i /c $(ProjectDir)..\..\3rdparty\bin $(TargetDir)
+
+
+
+ Copy 3rd party dll
+
+
+
+
+ Level4
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;ASST_DLL_EXPORTS;%(PreprocessorDefinitions)
+ true
+ stdcpp17
+ stdc11
+ MultiThreaded
+ MaxSpeed
+ /utf-8 /MP %(AdditionalOptions)
+
+
+ Console
+ true
+ true
+ true
+ ppocr.lib;opencv_world453.lib;zlibstatic.lib;%(AdditionalDependencies)
+ RequireAdministrator
+
+
+ true
+ msvcrt.lib
+
+
+
+
+ Level4
+
+
+ false
+ true
+ NDEBUG;_CONSOLE;ASST_DLL_EXPORTS;ASST_DEBUG;%(PreprocessorDefinitions)
+ true
+ stdcpp17
+ stdc11
+ MultiThreaded
+ Disabled
+ true
+ EnableFastChecks
+ /utf-8 /MP %(AdditionalOptions)
+
+
+ Console
+ true
+ true
+ true
+ ppocr.lib;opencv_world453.lib;zlibstatic.lib;%(AdditionalDependencies)
+ RequireAdministrator
+
+
+ true
+ msvcrt.lib
+
+
+
+
+
+
+
+ xcopy /e /y /i /c $(ProjectDir)..\..\resource $(TargetDir)resource
+ xcopy /e /y /i /c $(ProjectDir)..\..\3rdparty\resource $(TargetDir)resource
+
+
+
+ Copy resource
+
+
+
+ xcopy /e /y /i /c $(ProjectDir)..\..\3rdparty\bin $(TargetDir)
+
+
+
+ Copy 3rd party dll
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MeoAssistantBuilder/Constants.cs b/src/MeoAssistantBuilder/Constants.cs
new file mode 100644
index 0000000000..7b67b1daf4
--- /dev/null
+++ b/src/MeoAssistantBuilder/Constants.cs
@@ -0,0 +1,23 @@
+namespace MeoAssistantBuilder;
+
+public static class Constants
+{
+ public const string MaaProjectRootDirectory = "../../";
+ public const string MaaProjectThirdPartyDirectory = "../../3rdparty";
+ public const string MaaProjectResourceDirectory = "../../resource";
+ public const string MaaProjectArtifactDirectory = "../../artifacts";
+
+ public const string MaaCoreProjectDirectory = "../MeoAssistant";
+ public const string MaaWpfProjectDirectory = "../MeoAsstGui";
+
+ public const string MaaCoreProjectFilePath = $"{MaaCoreProjectDirectory}/MeoAssistant.vcxproj";
+ public const string MaaWpfProjectFilePath = $"{MaaWpfProjectDirectory}/MeoAsstGui.csproj";
+
+ public const string MaaBuildOutputDirectory = $"{MaaProjectRootDirectory}/x64";
+
+ public const string MaaCoreBuildIntermediatOutputDirectory = $"{MaaCoreProjectDirectory}/x64";
+
+ public static readonly string[] MaaCoreExtraFiles = new [] { "MeoAssistant.pdb", "MeoAssistant.lib", "MeoAssistant.exp" };
+
+ public static readonly string[] MaaWpfExtraFiles = new[] { "MeoAsstGui.pdb", "MeoAsstGui.exe.config" };
+}
diff --git a/src/MeoAssistantBuilder/Helper/BuildCoreHelper.cs b/src/MeoAssistantBuilder/Helper/BuildCoreHelper.cs
new file mode 100644
index 0000000000..078a94f099
--- /dev/null
+++ b/src/MeoAssistantBuilder/Helper/BuildCoreHelper.cs
@@ -0,0 +1,17 @@
+using Cake.Common.Tools.MSBuild;
+
+namespace MeoAssistantBuilder.Helper;
+
+public static class BuildCoreHelper
+{
+ public static void BuildCore(this MaaBuildContext context, string configuration)
+ {
+ context.MSBuild(Constants.MaaCoreProjectFilePath, new MSBuildSettings
+ {
+ WorkingDirectory = Constants.MaaProjectRootDirectory,
+ ToolPath = context.MsBuildExecutable,
+ Configuration = configuration,
+ PlatformTarget = PlatformTarget.x64
+ });
+ }
+}
diff --git a/src/MeoAssistantBuilder/Helper/BuildWpfHelper.cs b/src/MeoAssistantBuilder/Helper/BuildWpfHelper.cs
new file mode 100644
index 0000000000..d3ed8f052a
--- /dev/null
+++ b/src/MeoAssistantBuilder/Helper/BuildWpfHelper.cs
@@ -0,0 +1,18 @@
+using Cake.Common.Tools.MSBuild;
+
+namespace MeoAssistantBuilder.Helper;
+
+public static class BuildWpfHelper
+{
+ public static void BuildWpf(this MaaBuildContext context, string configuration)
+ {
+ context.MSBuild(Constants.MaaWpfProjectFilePath, new MSBuildSettings
+ {
+ WorkingDirectory = Constants.MaaProjectRootDirectory,
+ Restore = true,
+ ToolPath = context.MsBuildExecutable,
+ Configuration = configuration,
+ PlatformTarget = PlatformTarget.x64
+ });
+ }
+}
diff --git a/src/MeoAssistantBuilder/Helper/CleanDirectoryHelper.cs b/src/MeoAssistantBuilder/Helper/CleanDirectoryHelper.cs
new file mode 100644
index 0000000000..44611e9631
--- /dev/null
+++ b/src/MeoAssistantBuilder/Helper/CleanDirectoryHelper.cs
@@ -0,0 +1,60 @@
+using Cake.Common.Diagnostics;
+using Cake.Common.IO;
+
+namespace MeoAssistantBuilder.Helper;
+public static class CleanDirectoryHelper
+{
+ public static void CleanArtifacts(this MaaBuildContext context)
+ {
+ context.CleanDirectory(Constants.MaaProjectArtifactDirectory);
+ if (Directory.Exists(Constants.MaaProjectArtifactDirectory))
+ {
+ Directory.CreateDirectory(Constants.MaaProjectArtifactDirectory);
+ }
+ }
+
+ public static void CleanCore(this MaaBuildContext context)
+ {
+ context.CleanDirectory(Constants.MaaBuildOutputDirectory);
+ context.CleanDirectory(Constants.MaaCoreBuildIntermediatOutputDirectory);
+ }
+
+ public static void CleanWpf(this MaaBuildContext context)
+ {
+ context.CleanDirectory(Constants.MaaBuildOutputDirectory);
+ context.CleanDirectory(Path.Combine(Constants.MaaWpfProjectDirectory, "bin"));
+ context.CleanDirectory(Path.Combine(Constants.MaaWpfProjectDirectory, "obj"));
+ }
+
+ public static void CleanAll(this MaaBuildContext context)
+ {
+ CleanCore(context);
+ CleanWpf(context);
+ }
+
+ public static void RemoveExtraCore(this MaaBuildContext context, string buildOutput)
+ {
+ foreach (var extra in Constants.MaaCoreExtraFiles)
+ {
+ var file = Path.Combine(buildOutput, extra);
+ if (File.Exists(file))
+ {
+ File.Delete(file);
+ context.Information($"Delete file: {file}");
+ }
+ }
+ }
+
+ public static void RemoveExtraWpf(this MaaBuildContext context, string buildOutput)
+ {
+ foreach (var extra in Constants.MaaWpfExtraFiles)
+ {
+ var file = Path.Combine(buildOutput, extra);
+ if (File.Exists(file))
+ {
+ File.Delete(file);
+ context.Information($"Delete file: {file}");
+ }
+ }
+ }
+}
diff --git a/src/MeoAssistantBuilder/Helper/FileCopyHelper.cs b/src/MeoAssistantBuilder/Helper/FileCopyHelper.cs
new file mode 100644
index 0000000000..be2e4dcd73
--- /dev/null
+++ b/src/MeoAssistantBuilder/Helper/FileCopyHelper.cs
@@ -0,0 +1,53 @@
+using Cake.Common.Diagnostics;
+using Cake.Common.IO;
+
+namespace MeoAssistantBuilder.Helper
+{
+ public static class FileCopyHelper
+ {
+ public static void CopyThirdPartyDlls(this MaaBuildContext context, string outputDir)
+ {
+ var thirdPartyDlls = Directory.GetFiles(Path.Combine(Constants.MaaProjectThirdPartyDirectory, "bin"));
+ foreach (var f in thirdPartyDlls)
+ {
+ var fileName = new FileInfo(f).Name;
+ context.CopyFile(f, Path.Combine(outputDir, fileName));
+ context.Information($"Copy file: FROM {f} to {Path.Combine(outputDir, fileName)}");
+ }
+ }
+
+ public static void CopyResources(this MaaBuildContext context, string outputDir)
+ {
+ var resourceTargetDir = Path.Combine(outputDir, "resource");
+ var resourceThirdParty = Path.Combine(Constants.MaaProjectRootDirectory, "3rdparty\\resource");
+ var resoutceMaa = Path.Combine(Constants.MaaProjectRootDirectory, "resource");
+
+ var files = new List();
+ var directories = new List();
+
+ files.AddRange(Directory.GetFiles(resourceThirdParty));
+ files.AddRange(Directory.GetFiles(resoutceMaa));
+ directories.AddRange(Directory.GetDirectories(resourceThirdParty));
+ directories.AddRange(Directory.GetDirectories(resoutceMaa));
+
+ if (Directory.Exists(resourceTargetDir) is false)
+ {
+ Directory.CreateDirectory(resourceTargetDir);
+ }
+
+ foreach (var f in files)
+ {
+ var fileName = new FileInfo(f).Name;
+ context.CopyFile(f, Path.Combine(resourceTargetDir, fileName));
+ context.Information($"Copy file: FROM {f} TO {Path.Combine(resourceTargetDir, fileName)}");
+ }
+
+ foreach (var d in directories)
+ {
+ var dirName = new DirectoryInfo(d).Name;
+ context.CopyDirectory(d, Path.Combine(resourceTargetDir, dirName));
+ context.Information($"Copy directory: FROM {d} TO {Path.Combine(resourceTargetDir, dirName)}");
+ }
+ }
+ }
+}
diff --git a/src/MeoAssistantBuilder/Helper/GetBuildInformationHelper.cs b/src/MeoAssistantBuilder/Helper/GetBuildInformationHelper.cs
new file mode 100644
index 0000000000..ac87a4c998
--- /dev/null
+++ b/src/MeoAssistantBuilder/Helper/GetBuildInformationHelper.cs
@@ -0,0 +1,38 @@
+using Cake.Common.Build;
+using Cake.Common.Diagnostics;
+
+namespace MeoAssistantBuilder.Helper;
+
+public static class GetBuildInformationHelper
+{
+ public static (string, string) GetBuildInformation(this MaaBuildContext context)
+ {
+ var ghAction = context.GitHubActions();
+
+ var buildTime = DateTime.UtcNow.AddHours(8);
+ var bt = buildTime.ToString("yyyy-MM-dd-HH-mm-ss");
+ string hash;
+
+ if (ghAction.IsRunningOnGitHubActions)
+ {
+ hash = ghAction.Environment.Workflow.Sha.ToLower()[..7];
+ }
+ else
+ {
+ try
+ {
+ var realPath = new DirectoryInfo(Constants.MaaProjectRootDirectory).FullName;
+ var repo = new LibGit2Sharp.Repository(realPath);
+ var commit = repo.Commits.First();
+ hash = commit.Sha.ToLower()[..7];
+ }
+ catch (Exception e)
+ {
+ context.Warning($"Failed to get git log: {e.Message}");
+ hash = "Unknown";
+ }
+ }
+
+ return (bt, hash);
+ }
+}
diff --git a/src/MeoAssistantBuilder/MaaBuildContext.cs b/src/MeoAssistantBuilder/MaaBuildContext.cs
new file mode 100644
index 0000000000..01044eed84
--- /dev/null
+++ b/src/MeoAssistantBuilder/MaaBuildContext.cs
@@ -0,0 +1,28 @@
+using Cake.Common;
+using Cake.Common.Tools.VSWhere;
+using Cake.Core;
+using Cake.Core.Diagnostics;
+using Cake.Frosting;
+
+namespace MeoAssistantBuilder;
+
+public class MaaBuildContext : FrostingContext
+{
+ public string MsBuildExecutable { get; set; }
+
+ public MaaBuildContext(ICakeContext context) : base(context)
+ {
+ MsBuildExecutable = context.Argument("tool", "");
+ if (MsBuildExecutable == "")
+ {
+ var vsPath = context.VSWhereLatest();
+ if (vsPath == null)
+ {
+ context.Log.Write(Verbosity.Normal, LogLevel.Fatal, "Can not find Visual Studio install path");
+ System.Environment.Exit(-1);
+ }
+ MsBuildExecutable = Path.Combine(vsPath.FullPath, "Msbuild\\Current\\Bin\\MsBuild.exe");
+ }
+ context.Log.Information($"Use MsBuild at: {MsBuildExecutable}");
+ }
+}
diff --git a/src/MeoAssistantBuilder/MeoAssistantBuilder.csproj b/src/MeoAssistantBuilder/MeoAssistantBuilder.csproj
new file mode 100644
index 0000000000..c8d02f6130
--- /dev/null
+++ b/src/MeoAssistantBuilder/MeoAssistantBuilder.csproj
@@ -0,0 +1,17 @@
+
+
+
+ Exe
+ net6.0
+ enable
+ disable
+ x64
+ Debug;Release;CICD
+
+
+
+
+
+
+
+
diff --git a/src/MeoAssistantBuilder/Program.cs b/src/MeoAssistantBuilder/Program.cs
new file mode 100644
index 0000000000..c14c37d4ef
--- /dev/null
+++ b/src/MeoAssistantBuilder/Program.cs
@@ -0,0 +1,15 @@
+using Cake.Frosting;
+using MeoAssistantBuilder;
+
+var sArgs = new List();
+foreach (var arg in args)
+{
+ var sa = arg.Split(" ")
+ .ToList();
+ sa.RemoveAll(x => string.IsNullOrEmpty(x) || string.IsNullOrWhiteSpace(x));
+ sArgs.AddRange(sa);
+}
+
+return new CakeHost()
+ .UseContext()
+ .Run(sArgs);
diff --git a/src/MeoAssistantBuilder/README.md b/src/MeoAssistantBuilder/README.md
new file mode 100644
index 0000000000..c4288f5cd3
--- /dev/null
+++ b/src/MeoAssistantBuilder/README.md
@@ -0,0 +1,23 @@
+# MeoAssistantBuilder
+
+MAA 构建项目
+
+## 构建 MAA
+
+需要安装
+- `.NET SDK 6.0`
+- `.NET Framework SDK 4.8`
+- `MSVC v143 x64`
+- `MSBuild (VS2022)`
+
+在本项目根目录执行
+```
+dotnet run -- --target
+```
+
+TARGET 可选项
+
+- `DevBuild`
+- `ReleaseCore`
+- `ReleaseWpf`
+- `ReleaseResource`
diff --git a/src/MeoAssistantBuilder/Tasks/DevBuildTask.cs b/src/MeoAssistantBuilder/Tasks/DevBuildTask.cs
new file mode 100644
index 0000000000..6b7ce804c7
--- /dev/null
+++ b/src/MeoAssistantBuilder/Tasks/DevBuildTask.cs
@@ -0,0 +1,61 @@
+using Cake.Common.Build;
+using Cake.Common.Diagnostics;
+using Cake.Frosting;
+using MeoAssistantBuilder.Helper;
+using System.IO.Compression;
+
+namespace MeoAssistantBuilder.Tasks;
+
+[TaskName("DevBuild")]
+public sealed class DevBuildTask : FrostingTask
+{
+ public override void Run(MaaBuildContext context)
+ {
+ context.Information("--------------------------------------------------");
+ context.Information("1. Get build information");
+ context.Information("--------------------------------------------------");
+
+ context.CleanArtifacts();
+ var (bt, hash) = context.GetBuildInformation();
+ var artifact = $"MaaBundle-DevBuild-(CONF)-{hash}-{bt}.zip";
+ context.Information($"Dev build of commit {hash} at {bt}");
+
+ context.Information("--------------------------------------------------");
+ context.Information("2. Build MaaBundle with configuration Release");
+ context.Information("--------------------------------------------------");
+
+ context.CleanAll();
+
+ context.BuildCore("Release");
+ context.BuildWpf("Release");
+ var releaseOutput = Path.Combine(Constants.MaaBuildOutputDirectory, "Release");
+ var releaseArtifact = Path.Combine(Constants.MaaProjectArtifactDirectory, artifact.Replace("(CONF)", "Release"));
+ ZipFile.CreateFromDirectory(releaseOutput, releaseArtifact);
+
+ context.Information("--------------------------------------------------");
+ context.Information("3. Build MaaBundle with configuration RelWithDebInfo");
+ context.Information("--------------------------------------------------");
+
+ context.CleanAll();
+
+ context.BuildCore("RelWithDebInfo");
+ context.BuildWpf("RelWithDebInfo");
+ var releaseDebugOutput = Path.Combine(Constants.MaaBuildOutputDirectory, "RelWithDebInfo");
+ var releaseDebugArtifact = Path.Combine(Constants.MaaProjectArtifactDirectory, artifact.Replace("(CONF)", "RelWithDebInfo"));
+ ZipFile.CreateFromDirectory(releaseDebugOutput, releaseDebugArtifact);
+
+ context.Information("--------------------------------------------------");
+ context.Information("4. Build MaaBundle with configuration CICD");
+ context.Information("--------------------------------------------------");
+
+ context.CleanAll();
+
+ context.BuildCore("CICD");
+ context.BuildWpf("CICD");
+ var releaseCiOutput = Path.Combine(Constants.MaaBuildOutputDirectory, "CICD");
+ var releaseCiArtifact = Path.Combine(Constants.MaaProjectArtifactDirectory, artifact.Replace("(CONF)", "CICD"));
+ context.CopyThirdPartyDlls(releaseCiOutput);
+ context.CopyResources(releaseCiOutput);
+ ZipFile.CreateFromDirectory(releaseCiOutput, releaseCiArtifact);
+ }
+}
diff --git a/src/MeoAssistantBuilder/Tasks/ReleaseBundleTask.cs b/src/MeoAssistantBuilder/Tasks/ReleaseBundleTask.cs
new file mode 100644
index 0000000000..1a75549b30
--- /dev/null
+++ b/src/MeoAssistantBuilder/Tasks/ReleaseBundleTask.cs
@@ -0,0 +1,88 @@
+using Cake.Common.Build;
+using Cake.Common.Diagnostics;
+using Cake.Frosting;
+using MeoAssistantBuilder.Helper;
+using System.IO.Compression;
+using System.Text.RegularExpressions;
+
+namespace MeoAssistantBuilder.Tasks;
+
+[TaskName("ReleaseBundle")]
+public sealed class ReleaseBundleTask : FrostingTask
+{
+ public override void Run(MaaBuildContext context)
+ {
+ context.Information("--------------------------------------------------");
+ context.Information("1. Read MaaCore version string");
+ context.Information("--------------------------------------------------");
+
+ var version = "UNKNOWN";
+ var versionFile = Path.Combine(Constants.MaaCoreProjectDirectory, "Version.h");
+ var versionFileContent = File.ReadAllText(versionFile);
+
+ var regex = @"v((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)";
+
+ var match = Regex.Match(versionFileContent, regex);
+ if (match.Success is false)
+ {
+ context.Warning("Can not read version");
+ Environment.Exit(-1);
+ }
+ else
+ {
+ version = match.Value;
+ }
+
+ var ghActions = context.GitHubActions();
+ if (ghActions.IsRunningOnGitHubActions is false)
+ {
+ version += "-Local";
+ }
+ else
+ {
+ context.Information($"Running in GitHub Action with workflow name: {ghActions.Environment.Workflow.Workflow}, ref: {ghActions.Environment.Workflow.Ref}");
+ if (ghActions.Environment.Workflow.Workflow != "Release MaaCore")
+ {
+ version += $"-{ghActions.Environment.Workflow.RunId}";
+ }
+ else
+ {
+ var tag = ghActions.Environment.Workflow.Ref.Replace("refs/tags/", "");
+ if (tag != version)
+ {
+ context.Error($"Version do not match. From File: {version}. From Ref: {tag}");
+ Environment.Exit(-1);
+ }
+ }
+ }
+
+ context.Information($"MaaCore Version: {version}");
+
+ context.Information("--------------------------------------------------");
+ context.Information("2. Release MaaCore with third party dlls and resource");
+ context.Information("--------------------------------------------------");
+
+ var buildOutput = Path.Combine(Constants.MaaBuildOutputDirectory, "Release");
+ context.CleanAll();
+ context.CleanArtifacts();
+
+ context.BuildCore("Release");
+ context.RemoveExtraCore(buildOutput);
+
+ context.Information("--------------------------------------------------");
+ context.Information("3. Release MaaWpf with third party executables");
+ context.Information("--------------------------------------------------");
+
+ context.BuildWpf("Release");
+ context.RemoveExtraWpf(buildOutput);
+
+ context.Information("--------------------------------------------------");
+ context.Information("4. Bundle MaaBundle package");
+ context.Information("--------------------------------------------------");
+
+ var bundle = Path.Combine(Constants.MaaProjectArtifactDirectory, $"MaaBundle-{version}.zip");
+ ZipFile.CreateFromDirectory(buildOutput, bundle);
+
+ context.Information($"Bundled MaaBundle file: {bundle}");
+ }
+}
diff --git a/src/MeoAssistantBuilder/Tasks/ReleaseCoreTask.cs b/src/MeoAssistantBuilder/Tasks/ReleaseCoreTask.cs
new file mode 100644
index 0000000000..8a2131b5e4
--- /dev/null
+++ b/src/MeoAssistantBuilder/Tasks/ReleaseCoreTask.cs
@@ -0,0 +1,97 @@
+using Cake.Common.Build;
+using Cake.Common.Diagnostics;
+using Cake.Frosting;
+using MeoAssistantBuilder.Helper;
+using System.IO.Compression;
+using System.Text.RegularExpressions;
+
+namespace MeoAssistantBuilder.Tasks;
+
+[TaskName("ReleaseCore")]
+public sealed class ReleaseCoreTask : FrostingTask
+{
+ public override void Run(MaaBuildContext context)
+ {
+ context.Information("--------------------------------------------------");
+ context.Information("1. Read MaaCore version string");
+ context.Information("--------------------------------------------------");
+
+ var version = "UNKNOWN";
+ var versionFile = Path.Combine(Constants.MaaCoreProjectDirectory, "Version.h");
+ var versionFileContent = File.ReadAllText(versionFile);
+
+ var regex = @"v((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)";
+
+ var match = Regex.Match(versionFileContent, regex);
+ if (match.Success is false)
+ {
+ context.Warning("Can not read version");
+ Environment.Exit(-1);
+ }
+ else
+ {
+ version = match.Value;
+ }
+
+ var ghActions = context.GitHubActions();
+ if (ghActions.IsRunningOnGitHubActions is false)
+ {
+ version += "-Local";
+ }
+ else
+ {
+ context.Information($"Running in GitHub Action with workflow name: {ghActions.Environment.Workflow.Workflow}, ref: {ghActions.Environment.Workflow.Ref}");
+ if (ghActions.Environment.Workflow.Workflow != "Release MaaCore")
+ {
+ version += $"-{ghActions.Environment.Workflow.RunId}";
+ }
+ else
+ {
+ var tag = ghActions.Environment.Workflow.Ref.Replace("refs/tags/", "");
+ if (tag != version)
+ {
+ context.Error($"Version do not match. From File: {version}. From Ref: {tag}");
+ Environment.Exit(-1);
+ }
+ }
+ }
+
+ context.Information($"MaaCore Version: {version}");
+
+ context.Information("--------------------------------------------------");
+ context.Information("2. Build MaaCore with CICD configuration");
+ context.Information("--------------------------------------------------");
+
+ context.CleanCore();
+ context.CleanArtifacts();
+ context.BuildCore("CICD");
+
+ context.Information("--------------------------------------------------");
+ context.Information("3. Remove extra files from build output");
+ context.Information("--------------------------------------------------");
+
+ var buildOutput = Path.Combine(Constants.MaaBuildOutputDirectory, "CICD");
+ context.RemoveExtraCore(buildOutput);
+
+ context.Information("--------------------------------------------------");
+ context.Information("4. Copy 3rd party library DLLs to output directory");
+ context.Information("--------------------------------------------------");
+
+ var thirdPartyDlls = Directory.GetFiles(Path.Combine(Constants.MaaProjectThirdPartyDirectory, "bin"));
+ foreach(var f in thirdPartyDlls)
+ {
+ var fileName = new FileInfo(f).Name;
+ File.Copy(f, Path.Combine(buildOutput, fileName));
+ context.Information($"Copy file: FROM {f} to {Path.Combine(buildOutput, fileName)}");
+ }
+
+ context.Information("--------------------------------------------------");
+ context.Information("5. Bundle MaaCore DLLs");
+ context.Information("--------------------------------------------------");
+
+ var bundle = Path.Combine(Constants.MaaProjectArtifactDirectory, $"MaaCore-{version}.zip");
+ ZipFile.CreateFromDirectory(buildOutput, bundle);
+
+ context.Information($"Bundled MAACore DLLs file: {bundle}");
+ }
+}
diff --git a/src/MeoAssistantBuilder/Tasks/ReleaseResourceTask.cs b/src/MeoAssistantBuilder/Tasks/ReleaseResourceTask.cs
new file mode 100644
index 0000000000..de89df2d60
--- /dev/null
+++ b/src/MeoAssistantBuilder/Tasks/ReleaseResourceTask.cs
@@ -0,0 +1,43 @@
+using Cake.Common.Build;
+using Cake.Common.Diagnostics;
+using Cake.Frosting;
+using MeoAssistantBuilder.Helper;
+using System.IO.Compression;
+
+namespace MeoAssistantBuilder.Tasks;
+
+[TaskName("ReleaseResource")]
+public sealed class ReleaseResourceTask : FrostingTask
+{
+ public override void Run(MaaBuildContext context)
+ {
+ context.Information("--------------------------------------------------");
+ context.Information("1. Get bundle information");
+ context.Information("--------------------------------------------------");
+
+ var (hash, bt) = context.GetBuildInformation();
+ context.CleanArtifacts();
+ var version = $"{hash}-{bt}";
+ context.Information($"MaaResource Version: {version}");
+
+ context.Information("--------------------------------------------------");
+ context.Information("2. Copy MaaResource");
+ context.Information("--------------------------------------------------");
+
+ var resDir = Path.Combine(Constants.MaaBuildOutputDirectory, "resource");
+ if (Directory.Exists(resDir) is false)
+ {
+ Directory.CreateDirectory(resDir);
+ }
+ context.CopyResources(resDir);
+
+ context.Information("--------------------------------------------------");
+ context.Information("3. Bundle MaaResource");
+ context.Information("--------------------------------------------------");
+
+ var bundle = Path.Combine(Constants.MaaProjectArtifactDirectory, $"MaaResource-{version}.zip");
+ ZipFile.CreateFromDirectory(resDir, bundle);
+
+ context.Information($"Bundled MaaResource file: {bundle}");
+ }
+}
diff --git a/src/MeoAssistantBuilder/Tasks/ReleaseWpfTask.cs b/src/MeoAssistantBuilder/Tasks/ReleaseWpfTask.cs
new file mode 100644
index 0000000000..43b7ceb0b9
--- /dev/null
+++ b/src/MeoAssistantBuilder/Tasks/ReleaseWpfTask.cs
@@ -0,0 +1,46 @@
+using Cake.Common.Build;
+using Cake.Common.Diagnostics;
+using Cake.Frosting;
+using MeoAssistantBuilder.Helper;
+using System.IO.Compression;
+
+namespace MeoAssistantBuilder.Tasks;
+
+[TaskName("ReleaseWpf")]
+public sealed class ReleaseWpfTask : FrostingTask
+{
+ public override void Run(MaaBuildContext context)
+ {
+ context.Information("--------------------------------------------------");
+ context.Information("1. Build MaaWpf with ReleaseCore configuration");
+ context.Information("--------------------------------------------------");
+
+ var (hash, bt) = context.GetBuildInformation();
+ context.CleanWpf();
+ context.CleanArtifacts();
+ context.BuildWpf("CICD");
+
+ context.Information("--------------------------------------------------");
+ context.Information("2. Remove extra files from build output");
+ context.Information("--------------------------------------------------");
+
+ var buildOutput = Path.Combine(Constants.MaaBuildOutputDirectory, "CICD");
+ context.RemoveExtraWpf(buildOutput);
+
+ context.Information("--------------------------------------------------");
+ context.Information("3. Set MaaWpf Version Number");
+ context.Information("--------------------------------------------------");
+
+ var version = $"{hash}-{bt}";
+ context.Information($"MaaWpf Version: {version}");
+
+ context.Information("--------------------------------------------------");
+ context.Information("4. Bundle MaaWpf Executables");
+ context.Information("--------------------------------------------------");
+
+ var bundle = Path.Combine(Constants.MaaProjectArtifactDirectory, $"MaaWpf-{version}.zip");
+ ZipFile.CreateFromDirectory(buildOutput, bundle);
+
+ context.Information($"Bundled MaaWpf Executables file: {bundle}");
+ }
+}
diff --git a/src/MeoAsstGui/MeoAsstGui.csproj b/src/MeoAsstGui/MeoAsstGui.csproj
index 7d8ee09952..9d8e758887 100644
--- a/src/MeoAsstGui/MeoAsstGui.csproj
+++ b/src/MeoAsstGui/MeoAsstGui.csproj
@@ -38,23 +38,25 @@
false
true
-
- x64
- pdbonly
- true
- ..\..\x64\Release\
- TRACE
- prompt
- 4
- false
-
- Always
+ OnBuildSuccess
newlogo.ico
-
+
+ MeoAsstGui.App
+
+
+ ..\..\x64\Release\
+ TRACE
+ true
+ pdbonly
+ x64
+ 7.3
+ prompt
+
+
..\..\x64\RelWithDebInfo\
DEBUG;TRACE
false
@@ -63,28 +65,20 @@
7.3
prompt
-
- MeoAsstGui.App
+
+ ..\..\x64\CICD\
+ TRACE
+ true
+ pdbonly
+ x64
+ 7.3
+ prompt
+ true
-
- ..\..\packages\Costura.Fody.5.6.0\lib\netstandard1.0\Costura.dll
-
-
- ..\..\packages\gong-wpf-dragdrop.2.4.1\lib\net47\GongSolutions.WPF.DragDrop.dll
-
-
- ..\..\packages\HandyControl.3.2.0\lib\net472\HandyControl.dll
-
-
- ..\..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll
-
..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
-
- ..\..\packages\Stylet.1.3.6\lib\net45\Stylet.dll
-
@@ -225,26 +219,7 @@
Code
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
@@ -252,7 +227,7 @@
False
- Microsoft .NET Framework 4.7.2 %28x86 和 x64%29
+ Microsoft .NET Framework 4.7.2 %28x86 and x64%29
true
@@ -271,13 +246,13 @@
all
- 2.4.3
+ 3.1.1
3.3.0
- 5.0.4
+ 6.0.3
4.3.0
@@ -289,7 +264,7 @@
13.0.1
- 6.1.0.1
+ 6.1.0.5
1.3.6
@@ -310,7 +285,7 @@
4.3.0
- 5.0.1
+ 6.0.0
4.3.0
@@ -417,6 +392,6 @@
- xcopy /e /y /i /c $(SolutionDir)resource $(TargetDir)resource
+ xcopy /e /y /i /c $(ProjectDir)..\..\3rdparty\tools $(TargetDir)
\ No newline at end of file
diff --git a/src/MeoAsstGui/Properties/Resources.Designer.cs b/src/MeoAsstGui/Properties/Resources.Designer.cs
deleted file mode 100644
index 18701c716e..0000000000
--- a/src/MeoAsstGui/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 此代码由工具生成。
-// 运行时版本:4.0.30319.42000
-//
-// 对此文件的更改可能会导致不正确的行为,并且如果
-// 重新生成代码,这些更改将会丢失。
-//
-//------------------------------------------------------------------------------
-
-namespace MeoAsstGui.Properties
-{
- using System;
-
-
- ///
- /// 一个强类型的资源类,用于查找本地化的字符串等。
- ///
- // 此类是由 StronglyTypedResourceBuilder
- // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
- // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
- // (以 /str 作为命令选项),或重新生成 VS 项目。
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// 返回此类使用的缓存的 ResourceManager 实例。
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if (object.ReferenceEquals(resourceMan, null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MeoAsstGui.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// 重写当前线程的 CurrentUICulture 属性,对
- /// 使用此强类型资源类的所有资源查找执行重写。
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/src/MeoAsstGui/Properties/Resources.resx b/src/MeoAsstGui/Properties/Resources.resx
deleted file mode 100644
index af7dbebbac..0000000000
--- a/src/MeoAsstGui/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/src/MeoAsstGui/Properties/Settings.Designer.cs b/src/MeoAsstGui/Properties/Settings.Designer.cs
deleted file mode 100644
index af956e4392..0000000000
--- a/src/MeoAsstGui/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 此代码由工具生成。
-// 运行时版本:4.0.30319.42000
-//
-// 对此文件的更改可能会导致不正确的行为,并且如果
-// 重新生成代码,这些更改将会丢失。
-//
-//------------------------------------------------------------------------------
-
-namespace MeoAsstGui.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/src/MeoAsstGui/Properties/Settings.settings b/src/MeoAsstGui/Properties/Settings.settings
deleted file mode 100644
index 033d7a5e9e..0000000000
--- a/src/MeoAsstGui/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file