Skip to content

Commit fb3cfc7

Browse files
committed
Merge branch 'dev'
2 parents 9b875ce + 2705400 commit fb3cfc7

29 files changed

Lines changed: 808 additions & 75 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
/archive
1111
/release
1212
/applibs
13+
/res/setup
1314

1415
/docs
1516

BenchManager/BenchCLI/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
3333
// übernehmen, indem Sie "*" eingeben:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.22.6.0")]
36-
[assembly: AssemblyFileVersion("0.22.6.0")]
35+
[assembly: AssemblyVersion("0.23.0.0")]
36+
[assembly: AssemblyFileVersion("0.23.0.0")]

BenchManager/BenchDashboard/ExportForm.Designer.cs

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BenchManager/BenchDashboard/ExportForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private void BrowseForTargetFile()
183183
OverwritePrompt = true,
184184
CheckPathExists = true,
185185
AddExtension = true,
186-
Filter = "SFX Archive (*.exe)|*.exe|7-Zip Archive (*.7z)|*.7z|ZIP Archive (*.zip)|*.zip",
186+
Filter = "Setup Program (*.exe)|*.exe|7-Zip Archive (*.7z)|*.7z|ZIP Archive (*.zip)|*.zip",
187187
FilterIndex = 0,
188188
ValidateNames = true,
189189
FileName = txtTarget.Text,

BenchManager/BenchDashboard/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.22.6.0")]
36-
[assembly: AssemblyFileVersion("0.22.6.0")]
35+
[assembly: AssemblyVersion("0.23.0.0")]
36+
[assembly: AssemblyFileVersion("0.23.0.0")]

BenchManager/BenchLib/BenchTasks.cs

Lines changed: 87 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,6 +2308,7 @@ private static void InstallPythonPackage(BenchConfiguration config, IProcessExec
23082308
}
23092309
var argList = new List<string>();
23102310
argList.Add("install");
2311+
argList.Add("--no-warn-script-location");
23112312
if (app.IsInstalled) argList.Add("--upgrade");
23122313
//argList.Add("--quiet");
23132314
if (!app.IsManagedPackageFromRemoteRepo) // python wheel file
@@ -3008,7 +3009,7 @@ private static void ExportBenchEnvironment(IBenchManager man,
30083009
}
30093010
var sfxArchive = extension == ".exe";
30103011
if (sfxArchive)
3011-
ExportBenchEnvironmentSfx(man, notify, targetFile, paths);
3012+
ExportBenchEnvironmentSetupProgram(man, notify, targetFile, paths);
30123013
else
30133014
ExportBenchEnvironmentArchive(man, notify, targetFile, paths);
30143015
}
@@ -3031,58 +3032,113 @@ private static void CopyFileToStream(string file, Stream trg, int bufferSize = 6
30313032
}
30323033
}
30333034

3034-
private static TextWriter WriteSfxConfig(BenchConfiguration cfg, Stream trg, bool withInfoText, bool userProfileChangeWarning)
3035+
private static void WriteSetupText(string targetDir, string title, bool preConfigured, bool userProfileChangeWarning)
30353036
{
30363037
var enc = new UTF8Encoding(false);
3037-
var w = new StreamWriter(trg, enc, 1024);
3038-
w.WriteLine(";!@Install@!UTF-8!");
3039-
if (withInfoText)
3038+
File.WriteAllText(Path.Combine(targetDir, "Title.txt"), title, enc);
3039+
using (var w = new StreamWriter(Path.Combine(targetDir, "Info.txt"), append: false, encoding: enc))
30403040
{
3041-
w.WriteLine("Title=\"Bench Transfer Package\"");
3042-
w.Write("BeginPrompt=\"This is a pre - configured Bench environment. If you proceed, you will be asked for a target directory to extract and setup the Bench environment.\n\n");
3043-
if (userProfileChangeWarning)
3041+
if (preConfigured)
30443042
{
3045-
w.Write("Warning: Because this bench environment is configured to register in the user profile, the environment variables and possibly some registry keys of your user profile will be modified during setup.\n\n");
3043+
w.WriteLine("This is a pre-configured Bench environment.");
3044+
w.WriteLine();
3045+
if (userProfileChangeWarning)
3046+
{
3047+
w.WriteLine("Warning: Because this bench environment is configured to register in the user profile, the environment variables and possibly some registry keys of your user profile will be modified during setup.");
3048+
w.WriteLine();
3049+
}
3050+
w.WriteLine("See https://winbench.org/ for more info.");
3051+
}
3052+
else
3053+
{
3054+
w.WriteLine("This is the standard Bench setup package with the default environment.");
30463055
}
3047-
w.WriteLine("See https://winbench.org/ for more info.\n\nAre you sure you want to extract and setup this Bench environment?\"");
30483056
}
3049-
w.WriteLine(@"RunProgram="".\\auto\\bin\\bench.exe --verbose transfer install""");
3050-
w.Write(";!@InstallEnd@!");
3051-
w.Flush();
3052-
return w;
30533057
}
30543058

3055-
private static bool ExportBenchEnvironmentSfx(IBenchManager man, Action<TaskInfo> notify, string targetFile, string[] paths)
3059+
private static bool ExportBenchEnvironmentSetupProgram(IBenchManager man, Action<TaskInfo> notify, string targetFile, string[] paths)
30563060
{
3057-
var tmpArchive = Path.Combine(
3061+
var msbuild = Environment.ExpandEnvironmentVariables("%SystemRoot%\\Microsoft.NET\\Framework64\\v4.0.30319\\msbuild.exe");
3062+
if (!File.Exists(msbuild))
3063+
{
3064+
msbuild = Environment.ExpandEnvironmentVariables("%SystemRoot%\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe");
3065+
}
3066+
if (!File.Exists(msbuild))
3067+
{
3068+
notify(new TaskError("Can not find the MSBuild CLI as part of the .NET Framework 4"));
3069+
return false;
3070+
}
3071+
3072+
var tmpDir = Path.Combine(
30583073
man.Config.GetStringValue(ConfigPropertyKeys.TempDir),
3059-
"bench_export_" + Path.ChangeExtension(Path.GetRandomFileName(), ".7z"));
3074+
"bench_setup_" + Path.GetRandomFileName().Replace(".", ""));
30603075

3061-
if (!ExportBenchEnvironmentArchive(man, notify, tmpArchive, paths)) return false;
3076+
Directory.CreateDirectory(tmpDir);
3077+
var cleanup = true;
30623078

3063-
var sfxPath = Path.Combine(Path.Combine(man.Config.BenchRootDir, "res"), "bench.sfx");
30643079
try
30653080
{
3066-
using (var s = File.Open(targetFile, FileMode.Create, FileAccess.Write))
3081+
var setupProjectDir = Path.Combine(Path.Combine(man.Config.BenchRootDir, "res"), "setup");
3082+
var fileList = File.ReadAllLines(Path.Combine(setupProjectDir, "files.txt"));
3083+
foreach (var file in fileList)
30673084
{
3068-
CopyFileToStream(sfxPath, s);
3069-
var userConfigDir = man.Config.GetStringValue(ConfigPropertyKeys.UserConfigDir);
3070-
var includeUserConfig = Seq(paths).Any(p => string.Equals(userConfigDir,
3071-
Path.Combine(man.Config.BenchRootDir, p), StringComparison.InvariantCultureIgnoreCase));
3072-
WriteSfxConfig(man.Config, s,
3073-
withInfoText: includeUserConfig,
3074-
userProfileChangeWarning: man.Config.GetBooleanValue(ConfigPropertyKeys.RegisterInUserProfile));
3075-
CopyFileToStream(tmpArchive, s);
3085+
if (string.IsNullOrWhiteSpace(file)) continue;
3086+
File.Copy(Path.Combine(setupProjectDir, file), Path.Combine(tmpDir, file));
30763087
}
3077-
File.Delete(tmpArchive);
3088+
3089+
var userConfigDir = man.Config.GetStringValue(ConfigPropertyKeys.UserConfigDir);
3090+
var includeUserConfig = Seq(paths).Any(p => string.Equals(userConfigDir,
3091+
Path.Combine(man.Config.BenchRootDir, p), StringComparison.InvariantCultureIgnoreCase));
3092+
3093+
WriteSetupText(tmpDir, "Bench Setup",
3094+
preConfigured: includeUserConfig,
3095+
userProfileChangeWarning: man.Config.GetBooleanValue(ConfigPropertyKeys.RegisterInUserProfile));
3096+
var tmpArchive = Path.Combine(tmpDir, "Bench.zip");
3097+
3098+
if (!ExportBenchEnvironmentArchive(man, notify, tmpArchive, paths)) return false;
3099+
3100+
if (File.Exists(targetFile)) File.Delete(targetFile);
3101+
3102+
var execHost = man.ProcessExecutionHost;
3103+
var result = execHost.RunProcess(man.Env, tmpDir, msbuild,
3104+
string.Join(" ",
3105+
"-nologo",
3106+
"-verbosity:normal",
3107+
"-t:Clean;PrepareResources;Compile",
3108+
"-p:Configuration=Release",
3109+
"-fileLogger",
3110+
"-fileLoggerParameters:logfile=build.log;verbosity=detailed",
3111+
"BenchSetup.csproj"),
3112+
ProcessMonitoring.ExitCode);
3113+
if (result.ExitCode != 0)
3114+
{
3115+
notify(new TaskError("MSBuild exited with error. Exit status: " + result.ExitCode));
3116+
return false;
3117+
}
3118+
3119+
var setupExe = Path.Combine(tmpDir, "obj", "Release", "BenchSetup.exe");
3120+
if (!File.Exists(setupExe))
3121+
{
3122+
cleanup = false;
3123+
notify(new TaskError("Compiling the transfer package failed."));
3124+
return false;
3125+
}
3126+
File.Move(setupExe, targetFile);
30783127
}
30793128
catch (Exception e)
30803129
{
3081-
notify(new TaskError(
3082-
"Failed to export the Bench environment.",
3130+
notify(new TaskError("Failed to export the Bench environment.",
30833131
exception: e));
30843132
return false;
30853133
}
3134+
finally
3135+
{
3136+
if (cleanup)
3137+
{
3138+
Directory.Delete(tmpDir, true);
3139+
}
3140+
}
3141+
30863142
return true;
30873143
}
30883144

@@ -3109,7 +3165,6 @@ private static bool ExportBenchEnvironmentArchive(IBenchManager man, Action<Task
31093165
ProcessMonitoring.ExitCode);
31103166
if (result.ExitCode != 0)
31113167
{
3112-
31133168
notify(new TaskError($"Creating export archive with 7zip failed with exit code {result.ExitCode}."));
31143169
return false;
31153170
}

BenchManager/BenchLib/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.22.6.0")]
36-
[assembly: AssemblyFileVersion("0.22.6.0")]
35+
[assembly: AssemblyVersion("0.23.0.0")]
36+
[assembly: AssemblyFileVersion("0.23.0.0")]

BenchSetup/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
obj
2+
bin
3+
.vs/
4+
*.suo
5+
*.user
6+
*.cache
7+
*.exe
8+
9+
/packages

BenchSetup/AssemblyInfo.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
[assembly: AssemblyTitle("benchSetup")]
5+
[assembly: AssemblyDescription("Setup application for Bench")]
6+
[assembly: AssemblyConfiguration("")]
7+
[assembly: AssemblyCompany("Tobias Kiertscher")]
8+
[assembly: AssemblyProduct("Bench")]
9+
[assembly: AssemblyCopyright("Copyright © Tobias Kiertscher 2024")]
10+
[assembly: AssemblyTrademark("")]
11+
[assembly: AssemblyCulture("")]
12+
13+
[assembly: ComVisible(false)]
14+
[assembly: Guid("da29f93f-382f-46fd-93dd-aa0ef6d87bd5")]
15+
16+
[assembly: AssemblyVersion("0.1.0.0")]
17+
[assembly: AssemblyFileVersion("0.1.0.0")]

BenchSetup/Bench.zip

148 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)