Skip to content

Commit

Permalink
# Release v4.8.25.0
Browse files Browse the repository at this point in the history
---

## Changes

### CLI

- Improved  `-list` CLI switch
  Added kill all option `css -list kill all`

### CSScriptLib
- no changes
  • Loading branch information
oleg-shilo committed Dec 26, 2024
1 parent 8980481 commit eb4bdda
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 87 deletions.
2 changes: 1 addition & 1 deletion src/1.build-binaries.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ cd ..\CSScriptLib\src\CSScriptLib
echo ----------------
echo Building CSScriptLib.dll from %cd%
echo ----------------
dotnet build -c Release
dotnet build -c Release CSScriptLib.csproj

cd ..\..\..

Expand Down
1 change: 1 addition & 0 deletions src/BuildServer/out/build.runtimeconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"version": "9.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
Expand Down
15 changes: 6 additions & 9 deletions src/CSScriptLib/src/CSScriptLib/CSScriptLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>4.8.24.0</Version>
<Version>4.8.25.0</Version>
<Authors>Oleg Shilo</Authors>
<Description>CS-Script engine Class Library for .NET 5 (and higher)</Description>
<Copyright>(C) 2018-2023 Oleg Shilo</Copyright>
Expand All @@ -30,18 +30,15 @@

### CLI

- #400: Timeout in CI/CD script
- Assorted nuget support improvements triggered by #400
- removed doc zip files to not to upset WinDefender
- removed unnecessary nuget restore step for adding package dll's location to the search dir. It was adding no value since search dirs play no role in nuget related scenarios.
- Now nuget restore and asembly lookup are both respecting `CSSCRIPT_NUGET_PACKAGES` nvar. Previously only lookup did. Triggered by #400.
- Improved `-list` CLI switch
Added kill all option `css -list kill all`

### CSScriptLib
- no changes</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<AssemblyVersion>4.8.24.0</AssemblyVersion>
<FileVersion>4.8.24.0</FileVersion>
<PackageVersion>4.8.24.0</PackageVersion>
<AssemblyVersion>4.8.25.0</AssemblyVersion>
<FileVersion>4.8.25.0</FileVersion>
<PackageVersion>4.8.25.0</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>css_logo.png</PackageIcon>
<SignAssembly>True</SignAssembly>
Expand Down
9 changes: 3 additions & 6 deletions src/chocolatey/cs-script.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>cs-script</id>
<version>4.8.24.0</version>
<version>4.8.25.0</version>
<title>CS-Script</title>
<authors>Oleg Shilo</authors>
<owners>Oleg Shilo</owners>
Expand Down Expand Up @@ -30,11 +30,8 @@

### CLI

- #400: Timeout in CI/CD script
- Assorted nuget support improvements triggered by #400
- removed doc zip files to not to upset WinDefender
- removed unnecessary nuget restore step for adding package dll's location to the search dir. It was adding no value since search dirs play no role in nuget related scenarios.
- Now nuget restore and asembly lookup are both respecting `CSSCRIPT_NUGET_PACKAGES` nvar. Previously only lookup did. Triggered by #400.
- Improved `-list` CLI switch
Added kill all option `css -list kill all`

### CSScriptLib
- no changes</releaseNotes>
Expand Down
17 changes: 1 addition & 16 deletions src/cscs/BuildServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ string get_response()
{
exitCode = 1;
return "Build server output is in unexpected format. The compiler exit code is not available.\n" +
"Try to restart the build server with 'css -server:stop' followed by 'css -server:start'.";
"Try to restart the build server with 'css -server:stop' followed by 'css -server:start'.";
}

exitCode = int.Parse(responseItems[0]);
Expand Down Expand Up @@ -271,21 +271,6 @@ public static void ReportExit()
File.Delete(pidFile);
}

// public static void KillAllInstances()
// {
// if (Directory.Exists(build_server_active_instances))
// foreach (string activeServer in Directory.GetFiles(build_server_active_instances, "*.pid"))
// {
// var proc = GetProcess(int.Parse(Path.GetFileNameWithoutExtension(activeServer)));
// try
// {
// proc?.Kill();
// File.Delete(activeServer);
// }
// catch { }
// }
// }

public static void ListenToRequests(int? port)
{
var serverSocket = new TcpListener(IPAddress.Loopback, port ?? serverPort);
Expand Down
5 changes: 3 additions & 2 deletions src/cscs/CSExecutionClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static void SetEncoding(string encoding)
catch { }
}

public static void OnStart()
public static void OnStart(params string[] args)
{
//work around of nasty Win7x64 problem.
//http://superuser.com/questions/527728/cannot-resolve-windir-cannot-modify-path-or-path-being-reset-on-boot
Expand All @@ -204,7 +204,8 @@ public static void OnStart()

Utils.ProcessNewEncoding = ProcessNewEncoding;

Task.Run(Runtime.LogScriptProcess);
if (args.Any(a => CSSUtils.Args.Same(a, AppArgs.ls, AppArgs.list)))
Task.Run(Runtime.LogScriptProcess);

ProcessNewEncoding(null);

Expand Down
27 changes: 15 additions & 12 deletions src/cscs/HelpProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ static AppArgs()
switch1Help[co] = new ArgInfo("-co:<options>",
"Passes compiler options directly to the language compiler (e.g. csc.exe or dotnet.exe).",
"Note, some compiler options may not be compatible if they are passed to the wrong compiler " +
"executable (see compiler documentation). Though the fundamental switches like `/platform:*` are converted by CS-Script" +
"int compatible version between csc.exe and dotnet.exe.",
"executable (see compiler documentation). Though the fundamental switches like `/platform:*` are converted by CS-Script " +
"into compatible version between csc.exe and dotnet.exe.",
"(e.g. `-co:/d:TRACE` pass `/d:TRACE` option to C# compiler",
" or `-co:/platform:x86` to produce Win32 executable)");
switch1Help[engine] =
switch1Help[ng] = new ArgInfo("-ng|-engine:<csc|dotnet|roslyn>]",
switch1Help[ng] = new ArgInfo("-ng|-engine:<csc|dotnet|roslyn>",
"Forces compilation to be done by one of the supported .NET engines.",
" ",
"`dotnet` - ${<==}dotnet.exe compiler; this is the most versatile compilation engine though " +
Expand Down Expand Up @@ -352,8 +352,8 @@ static AppArgs()
" ",
"```",
"(e.g. " + AppInfo.AppName + " -engine:dotnet sample.cs",
" " + AppInfo.AppName + " -ng:csc sample.cs)",
" " + AppInfo.AppName + " -ng:roslyn-inproc sample.cs)",
" " + AppInfo.AppName + " -ng:csc sample.cs",
" " + AppInfo.AppName + " -ng:roslyn-inproc sample.cs",
" " + AppInfo.AppName + " -ng:roslyn sample.cs)",
"```");
switch1Help[sample] =
Expand Down Expand Up @@ -394,9 +394,9 @@ static AppArgs()
"#r -> <\\r>",
"#'' -> \" ",
"'' -> \" ",
"#`` -> \" ",
"`n -> <\\n>",
"`r -> <\\r>",
"#`` -> \" ",
"`n -> <\\n>",
"`r -> <\\r>",
"`` -> \" ",
"```"
);
Expand Down Expand Up @@ -425,7 +425,7 @@ static AppArgs()
" ",
" void Main()",
" {",
" Console.WriteLine(\"Hello World!\";",
" Console.WriteLine(\"Hello World!\");",
" }",
" ",
"```",
Expand Down Expand Up @@ -670,11 +670,14 @@ static AppArgs()
switch2Help[cmd] = new ArgInfo("-commands|-cmd",
"Prints list of supported commands (arguments) as well as the custom commands defined by user.");
switch2Help[ls] =
switch2Help[list] = new ArgInfo("-list|-ls [kill|k]",
"Prints list of all currently running scripts. The current process is marked in the list with the '*' prefix in the process id (PID).",
switch2Help[list] = new ArgInfo("-list|-ls [<kill|k> | <kill-all|ka>",
"Prints list of all currently running scripts.",
"If script execution tracking is undesirable you can disable it by setting " +
$"{Runtime.DisableCSScriptProcessTrackingEnvar} environment variable to a non empty value.",
" kill|k - ${<==}Allow user to terminate any running script.");
" kill|k - ${<==}Allow user to select and user to select and terminate any running script.",
" * - ${<==}Terminate all running scripts when 'kill' option is used.",
" ${<==}(e.g. " + AppInfo.AppName + " -list kill * ).");

miscHelp["file"] = new ArgInfo("file",
"Specifies name of a script file to be run.");
miscHelp["params"] = new ArgInfo("params",
Expand Down
2 changes: 1 addition & 1 deletion src/cscs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static int Main(string[] args)
else if (serverCommand == "-server:remove") Globals.RemoveBuildServer();
else if (serverCommand == "-servers:start") { Globals.StartRoslynBuildServer(); Globals.StartBuildServer(); }
else if (serverCommand == "-servers:stop") { CSScripting.Roslyn.BuildServer.Stop(); Globals.StopBuildServer(); }
else if (serverCommand == "-kill") { CSScripting.Roslyn.BuildServer.Stop(); Globals.StopBuildServer(); }
else if (serverCommand == "-kill") { CSScripting.Roslyn.BuildServer.Stop(); Globals.StopBuildServer(); CSExecutor.Command("list", "kill", "*"); }
else if (serverCommand == "-server_r:start") Globals.StartRoslynBuildServer();
else if (serverCommand == "-server_r:stop") CSScripting.Roslyn.BuildServer.Stop();
else if (serverCommand == "-server_r:start_inproc") CSScripting.Roslyn.BuildServer.Start(); // this command is invisible for users and only used to allow async start of teh server
Expand Down
3 changes: 1 addition & 2 deletions src/cscs/Utils/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ internal static ((string index, int pid)[] scripts, string view) GetScriptProces
builder.AppendLine($"----------------------------");
foreach ((int pid, string args) in Runtime.GetScriptProcesses().OrderByDescending(x => x.pid == currentProcId))
{
var current = pid == currentProcId ? "*" : " ";
builder.AppendLine($"{current}{++i:D2} | {pid:D10} | {args}");
builder.AppendLine($"{++i:D2} | {pid:D10} | {args}");
result.Add((i.ToString(), pid));
}

Expand Down
2 changes: 1 addition & 1 deletion src/cscs/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ static internal int ParseAppArgs(this IScriptExecutor executor, string[] args)
}
else if (Args.Same(arg, AppArgs.ls, AppArgs.list)) // -ls -list
{
executor.InteractiveCommand(AppArgs.list, nextArg);
executor.InteractiveCommand(AppArgs.list, nextArg, secondNextArg);
CLIExitRequest.Throw();
}
else if (Args.ParseValuedArg(arg, AppArgs.s, AppArgs.sample, out argValue)) // -s:<C# version>
Expand Down
13 changes: 5 additions & 8 deletions src/cscs/cscs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>cscs</AssemblyName>
<RootNamespace>CSScripting</RootNamespace>
<StartupObject />
<Version>4.8.24.0</Version>
<Version>4.8.25.0</Version>
<Authors>Oleg Shilo</Authors>
<Product>CS-Script</Product>
<Copyright>(C) 2004-2023 Oleg Shilo</Copyright>
Expand All @@ -16,19 +16,16 @@
<RepositoryUrl>https://github.com/oleg-shilo/cs-script</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>C# script dynamic</PackageTags>
<AssemblyVersion>4.8.24.0</AssemblyVersion>
<FileVersion>4.8.24.0</FileVersion>
<AssemblyVersion>4.8.25.0</AssemblyVersion>
<FileVersion>4.8.25.0</FileVersion>
<PackageReleaseNotes>---

## Changes

### CLI

- #400: Timeout in CI/CD script
- Assorted nuget support improvements triggered by #400
- removed doc zip files to not to upset WinDefender
- removed unnecessary nuget restore step for adding package dll's location to the search dir. It was adding no value since search dirs play no role in nuget related scenarios.
- Now nuget restore and asembly lookup are both respecting `CSSCRIPT_NUGET_PACKAGES` nvar. Previously only lookup did. Triggered by #400.
- Improved `-list` CLI switch
Added kill all option `css -list kill all`

### CSScriptLib
- no changes</PackageReleaseNotes>
Expand Down
50 changes: 37 additions & 13 deletions src/cscs/csscript.cli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Reflection;
using System.Text;
using CSScripting;
using static CSScripting.CSSUtils;

namespace csscript
{
Expand Down Expand Up @@ -252,7 +253,9 @@ public void ShowHelp(string helpType, params object[] context)
/// <summary>
/// Prints CS-Script specific C# syntax help info.
/// </summary>
public void InteractiveCommand(string cmdType, params object[] context)
public void InteractiveCommand(string cmdType, params object[] context) => Command(cmdType, context);

public static void Command(string cmdType, params object[] context)
{
switch (cmdType)
{
Expand All @@ -267,23 +270,44 @@ public void InteractiveCommand(string cmdType, params object[] context)
{
var result = Runtime.GetScriptProcessLog();

Console.WriteLine(result.view);
if (context.Contains("kill") || context.Contains("-kill") || context.Contains("k"))
if (result.scripts.IsEmpty())
{
Console.WriteLine("No running scripts found.");
}
else
{
Console.WriteLine("Enter index of the script you want to terminate or 'X' to exit: ");
var userInput = Console.ReadLine().ToLower();
if (userInput != "x")
if (context.Contains("kill") || context.Contains("-kill") || context.Contains("k"))
{
var pid = result.scripts.FirstOrDefault(x => x.index == userInput).pid;
if (pid != 0)
try
if (context.Contains("*"))
{
foreach (var pid in result.scripts.Select(x => x.pid).Where(x => x != 0))
try { Process.GetProcessById(pid).Kill(); }
catch { }
}
else
{
if (result.scripts.Any())
{
Process.GetProcessById(pid).Kill();
Console.WriteLine(result.view);
Console.WriteLine("Enter index of the script process you want to terminate or '*' to terminate them all:");
var userInput = Console.ReadLine().ToLower();
if (userInput != "x")
{
var pid = result.scripts.FirstOrDefault(x => x.index == userInput).pid;
if (pid != 0)
try
{
Process.GetProcessById(pid).Kill();
}
catch { }
else
Console.WriteLine("Invalid user input.");
}
}
catch { }
else
Console.WriteLine("Invalid user input.");
}
}
else
Console.WriteLine(result.view);
}
}
break;
Expand Down
4 changes: 2 additions & 2 deletions src/css/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.8.24.0")]
[assembly: AssemblyFileVersion("4.8.24.0")]
[assembly: AssemblyVersion("4.8.25.0")]
[assembly: AssemblyFileVersion("4.8.25.0")]
13 changes: 5 additions & 8 deletions src/csws/csws.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>CSScripting</RootNamespace>
<StartupObject />
<Version>4.8.24.0</Version>
<Version>4.8.25.0</Version>
<Authors>Oleg Shilo</Authors>
<Product>CS-Script</Product>
<Copyright>(C) 2004-2022 Oleg Shilo</Copyright>
Expand All @@ -19,19 +19,16 @@
<RepositoryUrl>https://github.com/oleg-shilo/cs-script</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>C# script dynamic</PackageTags>
<AssemblyVersion>4.8.24.0</AssemblyVersion>
<FileVersion>4.8.24.0</FileVersion>
<AssemblyVersion>4.8.25.0</AssemblyVersion>
<FileVersion>4.8.25.0</FileVersion>
<PackageReleaseNotes>---

## Changes

### CLI

- #400: Timeout in CI/CD script
- Assorted nuget support improvements triggered by #400
- removed doc zip files to not to upset WinDefender
- removed unnecessary nuget restore step for adding package dll's location to the search dir. It was adding no value since search dirs play no role in nuget related scenarios.
- Now nuget restore and asembly lookup are both respecting `CSSCRIPT_NUGET_PACKAGES` nvar. Previously only lookup did. Triggered by #400.
- Improved `-list` CLI switch
Added kill all option `css -list kill all`

### CSScriptLib
- no changes</PackageReleaseNotes>
Expand Down
Loading

0 comments on commit eb4bdda

Please sign in to comment.