Skip to content

Commit

Permalink
Add --roll-forward option(nbeauty only), see [Control roll-forwar…
Browse files Browse the repository at this point in the history
  • Loading branch information
liesauer committed May 22, 2023
1 parent 8285d66 commit 46d888e
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 16 deletions.
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>2.1.3.0-beta.1</Version>
<Version>2.1.3.1</Version>

<Company>nulastudio</Company>
<Authors>LiesAuer</Authors>
Expand Down
8 changes: 5 additions & 3 deletions NetBeauty/src/main/beauty.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var sharedRuntimeMode = false
var enableDebug = false
var usePatch = false
var isNetFx = false
var rollForward = ""

var gitcdn string
var gittree string = ""
Expand Down Expand Up @@ -238,7 +239,7 @@ func main() {

log.LogDetail(fmt.Sprintf("fixing %s", runtimeConfig))

success := manager.AddStartUpHookToRuntimeConfig(runtimeConfig, startupHook) && manager.FixRuntimeConfig(runtimeConfig, libsDir, uniqieSubDirs, srmMapping, sharedRuntimeMode, usePatch, useWPF)
success := manager.AddStartUpHookToRuntimeConfig(runtimeConfig, startupHook) && manager.FixRuntimeConfig(runtimeConfig, libsDir, uniqieSubDirs, srmMapping, sharedRuntimeMode, usePatch, useWPF, rollForward)

if success {
log.LogDetail(fmt.Sprintf("%s fixed", runtimeConfig))
Expand Down Expand Up @@ -292,7 +293,8 @@ Info: Log everything.
flag.BoolVar(&sharedRuntimeMode, "srmode", false, `[.NET Core App Only] share the runtime between apps`)
flag.BoolVar(&enableDebug, "enabledebug", false, `[.NET Core App Only] allow 3rd debuggers(like dnSpy) debugs the app`)
flag.BoolVar(&usePatch, "usepatch", false, `[.NET Core App Only] use the patched hostfxr to reduce files`)
flag.StringVar(&hiddens, "hiddens", "", `dlls that end users never needed, so hide them`)
flag.StringVar(&hiddens, "hiddens", "", `dlls that end users never needed, so hide them.`)
flag.StringVar(&rollForward, "roll-forward", "", `override default roll-forward behavior, see https://learn.microsoft.com/en-us/dotnet/core/versions/selection#control-roll-forward-behavior for more details.`)

flag.Parse()

Expand Down Expand Up @@ -399,7 +401,7 @@ func exit() {

func usage() {
fmt.Println("Usage:")
fmt.Println("nbeauty [--loglevel=(Error|Detail|Info)] [--hiddens=hiddenFiles] <beautyDir> [<libsDir> [<excludes>]]")
fmt.Println("nbeauty [--loglevel=(Error|Detail|Info)] [--hiddens=hiddenFiles] [--roll-forward=<rollForward>] <beautyDir> [<libsDir> [<excludes>]]")
fmt.Println("")
fmt.Println("Arguments")
fmt.Println(" <excludes> dlls that no need to be moved, multi-dlls separated with \";\". Example: dll1.dll;lib*;...")
Expand Down
4 changes: 2 additions & 2 deletions NetBeauty/src/main/bindata.go

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion NetBeauty/src/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func FixExeConfig(exeConfig string, libsDir string) ([]Deps, bool) {
}

// FixRuntimeConfig 添加libs到runtimeconfig.json
func FixRuntimeConfig(runtimeConfig string, libsDir string, subDirs []string, srmMapping map[string]string, sharedRuntimeMode bool, usePatch bool, useWPF bool) bool {
func FixRuntimeConfig(runtimeConfig string, libsDir string, subDirs []string, srmMapping map[string]string, sharedRuntimeMode bool, usePatch bool, useWPF bool, rollForward string) bool {
jsonBytes, err := ioutil.ReadFile(runtimeConfig)
if err != nil {
log.LogError(fmt.Errorf("can not read runtimeconfig.json: %s : %s", runtimeConfig, err.Error()), false)
Expand Down Expand Up @@ -486,6 +486,13 @@ func FixRuntimeConfig(runtimeConfig string, libsDir string, subDirs []string, sr
runtimeOptions.Set("additionalProbingPaths", resultPaths)
}

if rollForward != "" {
json.SetPath([]string{
"runtimeOptions",
"rollForward",
}, rollForward)
}

jsonBytes, _ = json.EncodePretty()
if err := ioutil.WriteFile(runtimeConfig, jsonBytes, 0666); err != nil {
log.LogError(fmt.Errorf("add NetBeautyLibsDir to runtimeconfig.json failed: %s : %s", runtimeConfig, err.Error()), false)
Expand Down
Binary file modified NetBeauty/src/nbloader/nbloader.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.0-beta.1" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion NetBeautyTest/ChromelyTest/ChromelyTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.0-beta.1" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion NetBeautyTest/NetFxTest/NetFxTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.0-beta.1" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.1" />
<PackageReference Include="SixLabors.ImageSharp">
<Version>2.1.3</Version>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion NetBeautyTest/SharedRuntimeTest/WsClient/WsClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<ItemGroup>
<PackageReference Include="WatsonWebsocket" Version="2.3.2.5" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.0-beta.1" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion NetBeautyTest/SharedRuntimeTest/WsServer/WsServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<ItemGroup>
<PackageReference Include="WatsonWebsocket" Version="2.3.2.5" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.0-beta.1" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion NetBeautyTest/WPFTest/WPFTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.0-beta.1" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion NetBeautyTest/WebAppTest/WebAppTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.0-beta.1" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.1" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Your `*.csproj` should be like:
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.0-beta.1" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.3.1" />
</ItemGroup>

</Project>
Expand All @@ -86,7 +86,7 @@ When you run `dotnet build` or `dotnet publish`, everything will be done automat
### Use the binary application if your project has already been published.
```
Usage:
nbeauty2 [--srmode] [--usepatch] [--enabledebug] [--loglevel=(Error|Detail|Info)] [--hiddens=<HiddenFiles>] [--gitcdn=<GitCDN>] [--gittree=<GitTree>] <beautyDir> [<libsDir> [<excludes>]]
nbeauty2 [--srmode] [--usepatch] [--enabledebug] [--loglevel=(Error|Detail|Info)] [--hiddens=<HiddenFiles>] [--roll-forward=<rollForward>] [--gitcdn=<GitCDN>] [--gittree=<GitTree>] <beautyDir> [<libsDir> [<excludes>]]
```

for example
Expand Down

0 comments on commit 46d888e

Please sign in to comment.