Skip to content

Commit

Permalink
默认libsDirruntimes改为libraries
Browse files Browse the repository at this point in the history
当程序发布多个目标平台和体系结构时,运行时文件将会生成到`runtimes/RID`下,可能会冲突

# Release

## 更新
1. 默认`libsDir`从`runtimes`改为`libraries`

## 优化
1. 优化RID匹配以及主程序集识别
  • Loading branch information
liesauer committed Mar 11, 2020
1 parent 0dc38a0 commit da5d30f
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ __MACOSX
[Rr]elease/
tools/
.nupkg/
Build/*/

# sublime
*.sublime-workspace
Expand Down
9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@ install:
- sudo apt-get -y update
- sudo apt-get -y install dotnet-sdk-2.1
- sudo apt-get -y install nuget
- dotnet tool install --global PowerShell
- dotnet tool install --global PowerShell --version 6.2.4
- export PATH=~/.dotnet/tools:${PATH}
- go env -w GOPROXY=https://goproxy.cn,direct

script:
- make
- dotnet pack NetCoreBeautyNuget -c Release
- dotnet pack NetCoreBeautyGlobalTool -c Release
- pwsh ./Build/build.ps1

before_deploy:
- pwsh ./archive.ps1
- mkdir -p ./Build/Release
- mv ./tools/*.zip ./Build/Release
- mv ./Build/archive/*.zip ./Build/Release

deploy:
provider: script
Expand Down
33 changes: 33 additions & 0 deletions Build/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$workingdir = $pwd
$builddir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$rootdir = "${builddir}/.."
$tooldir = "${builddir}/tools"
$nupkgdir = "${builddir}/nupkg"
$archivedir = "${builddir}/archive"

# 清理
rm -rf $tooldir
rm -rf $nupkgdir
rm -rf $archivedir

# 编译ncbeauty
cd $rootdir
make

# 编译NetCoreBeautyNuget
cd "${rootdir}/NetCoreBeautyNuget"
dotnet pack -c Release /p:PackageOutputPath=${nupkgdir}

# 编译NetCoreBeautyGlobalTool
cd "${rootdir}/NetCoreBeautyGlobalTool"
dotnet pack -c Release /p:PackageOutputPath=${nupkgdir}

# 打包ncbeauty
mkdir ${archivedir}
"win-x86", "win-x64", "linux-x64", "osx-x64" | ForEach-Object -Process {
$rid = $_
cd "${tooldir}/${rid}"
Compress-Archive -Force -Path * -DestinationPath "${archivedir}/${rid}.zip"
}

cd $workingdir
20 changes: 20 additions & 0 deletions Build/push_nuget.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$vars = "NUGET_API_KEY", "GITHUB_SOURCE", "GITHUB_USERNAME", "GITHUB_ACCESS_TOKEN"

$vars | ForEach-Object {
if (!(Test-Path Env:$_)) {
Write-Host "$_ environment variable is missing."
exit 1
}
}

nuget source Add -Name "NuGet" -Source https://api.nuget.org/v3/index.json
nuget source Add -Name "GitHub" -Source $env:GITHUB_SOURCE -UserName $env:GITHUB_USERNAME -Password $env:GITHUB_ACCESS_TOKEN
nuget setApiKey $env:NUGET_API_KEY -Source "NuGet"

$pwd = Split-Path -Parent $MyInvocation.MyCommand.Definition

dir "$pwd/nupkg/*.nupkg" | ForEach-Object {
$package = $_ -Replace $pwd, ""
nuget push "$package" -Source "NuGet"
nuget push "$package" -Source "GitHub"
}
2 changes: 1 addition & 1 deletion Common/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackageOutputPath>.nupkg</PackageOutputPath>
<Version>1.2.4</Version>
<Version>1.2.5</Version>

<Company>nulastudio</Company>
<Authors>LiesAuer</Authors>
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OUTPUT=build/tools
OUTPUT=Build/tools
BINARY_WIN_X86=win-x86/ncbeauty.exe
BINARY_WIN_X64=win-x64/ncbeauty.exe
BINARY_LINUX_X64=linux-x64/ncbeauty
Expand Down
2 changes: 1 addition & 1 deletion src/main/beauty.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var nopatch bool
var force bool
var loglevel string
var beautyDir string
var libsDir = "runtimes"
var libsDir = "libraries"

func main() {
Umask()
Expand Down

0 comments on commit da5d30f

Please sign in to comment.