Skip to content

Commit

Permalink
让构建脚本完成更多工作.引入单文件发布,修改文件夹结构
Browse files Browse the repository at this point in the history
  • Loading branch information
zsh2401 committed Aug 8, 2020
1 parent bc547e0 commit ae47cc6
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 36 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
id: tag
uses: dawidd6/action-get-tag@v1

- name: Create archive
uses: DuckSoft/create-7z-action@master
with:
pathSource: AutumnBox-Canary
pathTarget: archive.zip
# - name: Create archive
# uses: DuckSoft/create-7z-action@master
# with:
# pathSource: AutumnBox-Canary
# pathTarget: archive.zip

- name: Create release
id: create_release
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.exe.config
*.exp
*.ipch
*.7z
*.metagen
*.ncb
*.nupkg
Expand Down
43 changes: 20 additions & 23 deletions scripts/build_canary.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ $ExtensionsOutputDir = [System.IO.Path]::Combine($CanaryPath, "extensions");
$AdbSetupPath = [System.IO.Path]::Combine($CanaryPath, "adb_binary");
$CompileConfigure = "Canary";
$Runtime ="win-x86";
$ADBBinariesDirectoryPath = [System.IO.Path]::Combine($PSScriptRoot, "../adb_binary")
$RepoRootPath = [System.IO.Path]::Combine($PSScriptRoot,"../");
$ADBBinariesDirectoryPath = [System.IO.Path]::Combine($RepoRootPath, "adb_binary")


function Step($message,$command){
Expand All @@ -20,26 +21,9 @@ function Write-Green($message) {
Write-Output $message
[System.Console]::ResetColor()
}
function Initialize-ADBFiles(){
$ADBBinariesDirectory = [System.IO.DirectoryInfo]::new($ADBBinariesDirectoryPath);
if($ADBBinariesDirectory.Exists){
Remove-Item -Force -Recurse $ADBBinariesDirectoryPath
}

$ADBGitStore = "https://github.com/zsh2401/AutumnBox-AdbBinaries-Store"
$BranchName = "1.0.41"
$ADBBinariesDirectoryPath = [System.IO.Path]::Combine($PSScriptRoot, "../adb_binary")
$ADBBinariesDirectory = [System.IO.DirectoryInfo]::new($ADBBinariesDirectoryPath);

if ($ADBBinariesDirectory.Exists) {
Remove-Item $ADBBinariesDirectory.FullName -Force -Recurse;
$ADBBinariesDirectory.Create();
}
git clone -b $BranchName $ADBGitStore $ADBBinariesDirectory.FullName
}
function Initialize-OutputDir(){
if($CanaryDir.Exists){
Write-Green $CanaryDir.FullName;
if($([System.IO.Directory]::Exists($CanaryPath))){
Write-Green Cleaning
Remove-Item -Force -Recurse $CanaryPath
}
[System.IO.Directory]::CreateDirectory($CanaryPath)
Expand All @@ -48,22 +32,35 @@ function Initialize-Env {
dotnet restore src/
}
function Compile-MainProgram{
dotnet publish $MainProj -c $CompileConfigure -r $Runtime --no-dependencies --self-contained true -o $CanaryPath
dotnet publish $MainProj -c $CompileConfigure -r $Runtime -p:PublishSingleFile=true --no-dependencies --self-contained true -o $CanaryPath
# Remove-Item -Force -Recurse $([System.IO.Path]::Combine($CanaryPath,"*")) -Exclude "AutumnBox.GUI.exe"
}
function Compile-Extensions{
dotnet publish $StdExt -c $CompileConfigure -r $Runtime -o $ExtensionsOutputDir
dotnet publish $EssExt -c $CompileConfigure -r $Runtime -o $ExtensionsOutputDir
Remove-Item -Force -Recurse $([System.IO.Path]::Combine($ExtensionsOutputDir,"*")) -Exclude "AutumnBox.Extensions.*.dll"
}
function Setup-ADB{
Copy-Item -Force -Recurse $ADBBinariesDirectoryPath $AdbSetupPath -Exclude .git
$ADBGitStore = "https://github.com/zsh2401/AutumnBox-AdbBinaries-Store"
$BranchName = "1.0.41"
$Target = [System.IO.Path]::Combine($CanaryPath,"adb_binary")
git clone --depth 1 -b $BranchName $ADBGitStore $Target
Remove-Item -Force -Recurse $([System.IO.Path]::Combine($Target,".git"))
}
function Make-Archive{
$compress = @{
Path = $CanaryPath
CompressionLevel = "Optimal"
DestinationPath = [System.IO.Path]::Combine($RepoRootPath,"archive.zip")
}
Compress-Archive -Force @compress
}

Initialize-OutputDir
Initialize-ADBFiles
Compile-MainProgram
Compile-Extensions
Setup-ADB
Make-Archive

#Finished
Write-Green "===Finished==="
4 changes: 3 additions & 1 deletion src/AutumnBox.Core/AutumnBox.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<AssemblyName>AutumnBox.Core</AssemblyName>
<RootNamespace>AutumnBox.Core</RootNamespace>
<Nullable>enable</Nullable>
<Version>11.7</Version>
<Version>11.7.1</Version>
<Configurations>Debug;Release;SDK;Canary</Configurations>
<Authors>zsh2401</Authors>
<Company>zsh2401</Company>
<AssemblyVersion>11.7.1.0</AssemblyVersion>
<FileVersion>11.7.1.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
5 changes: 3 additions & 2 deletions src/AutumnBox.GUI/AutumnBox.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
<AssemblyName>AutumnBox.GUI</AssemblyName>
<RootNamespace>AutumnBox.GUI</RootNamespace>
<ApplicationIcon>Resources\Icons\icon.ico</ApplicationIcon>
<Version>2020.8.8</Version>
<AssemblyVersion>2020.8.8.0</AssemblyVersion>
<Version>2020.8.9</Version>
<AssemblyVersion>2020.8.9.0</AssemblyVersion>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
<Configurations>Debug;Release;Canary</Configurations>
<FileVersion>2020.8.9.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishSingleFile>True</PublishSingleFile>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishTrimmed>True</PublishTrimmed>
<PublishTrimmed>False</PublishTrimmed>
</PropertyGroup>
</Project>
11 changes: 9 additions & 2 deletions src/AutumnBox.GUI/Services/Impl/StorageManagerImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@ class StorageManagerImpl : IStorageManager
{
public StorageManagerImpl()
{
InitializeVarDirectory();
InitializeCacheDirectory();
InitializeStorageDirectory();
}

private void InitializeVarDirectory()
{
CacheDirectory = new DirectoryInfo("var");
if (!CacheDirectory.Exists) CacheDirectory.Create();
}

private void InitializeCacheDirectory()
{
#if DEBUG || GREEN_RELEASE
CacheDirectory = new DirectoryInfo("cache");
CacheDirectory = new DirectoryInfo("var/cache");
#else
string temp = Environment.GetEnvironmentVariable("TEMP");
CacheDirectory = new DirectoryInfo(Path.Combine(temp, "AutumnBox"));
Expand All @@ -43,7 +50,7 @@ private void InitializeCacheDirectory()
private void InitializeStorageDirectory()
{
#if DEBUG || GREEN_RELEASE
var atmbDirectory = new DirectoryInfo("storage");
var atmbDirectory = new DirectoryInfo("var/storage");
if (!atmbDirectory.Exists) atmbDirectory.Create();
#else
string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
Expand Down
2 changes: 1 addition & 1 deletion src/AutumnBox.GUI/Util/Loader/AbstractAppLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void Load()
return;
}
}
Logger.Info("All done!");
Logger.Info("Done!");
Succeced?.Invoke(this, new EventArgs());
}

Expand Down

0 comments on commit ae47cc6

Please sign in to comment.