diff --git a/help.txt b/help.txt index 1bd96243..21a1cbbc 100644 --- a/help.txt +++ b/help.txt @@ -1,5 +1,5 @@ -C# Script execution engine (.NET Core). Version 4.8.6.0. -Copyright (C) 2004-2020 Oleg Shilo. +C# Script execution engine (.NET Core). Version 4.8.7.0. +Copyright (C) 2004-2023 Oleg Shilo. @@ -263,7 +263,7 @@ Copyright (C) 2004-2020 Oleg Shilo. It is a convenient way of testing performance of the .NET distribution. -install/-uninstall - Sets/unsets CSSCRIPT_ROOT environment variable to the location of the script enginebeing executed. + Sets/unsets CSSCRIPT_ROOT environment variable to the location of the script engine being executed. This environment variable is required for integration of CS-Script with Notepad++,Sublime Text and some other editors, which require CS-Script installed on the host OS. This command is only supported on Windows diff --git a/src/1.build-binaries.cmd b/src/1.build-binaries.cmd index 8ebcfe7f..cb741561 100644 --- a/src/1.build-binaries.cmd +++ b/src/1.build-binaries.cmd @@ -77,7 +77,6 @@ echo Building csws.dll from %cd% echo ---------------- dotnet publish -c Release -f %target%-windows -o "..\out\Windows\win" - cd ..\CSScriptLib\src\CSScriptLib echo ---------------- echo Building CSScriptLib.dll from %cd% diff --git a/src/3.build-documentation.cmd b/src/3.build-documentation.cmd index 92881016..1412b567 100644 --- a/src/3.build-documentation.cmd +++ b/src/3.build-documentation.cmd @@ -1,17 +1,16 @@ echo off -.\src\out\Windows\css.exe -server_r:stop -.\src\out\Windows\css.exe -server:stop - -set vs_edition=Community -if exist "C:\Program Files\Microsoft Visual Studio\2022\%vs_edition%" ( - echo Visual Studio 2022 (Community) -) else ( - set vs_edition=Professional - echo Visual Studio 2022 (PRO) -) - -rd /Q /S .\CSScriptLib.Doc\help +.\out\Windows\css.exe -server_r:stop +.\out\Windows\css.exe -server:stop + +set vs_edition=undefined +if exist "C:\Program Files\Microsoft Visual Studio\2022\Community" set vs_edition=Community +if exist "C:\Program Files\Microsoft Visual Studio\2022\Professional" set vs_edition=Professional + +echo Visual Studio 2022 (%vs_edition%) + +if exist .\CSScriptLib.Doc\help rd /Q /S .\CSScriptLib.Doc\help + set msbuild="C:\Program Files\Microsoft Visual Studio\2022\%vs_edition%\MSBuild\Current\Bin\MSBuild.exe" %msbuild% ".\CSScriptLib.Doc\CSScriptLib.Doc.shfbproj" -p:Configuration=Release -t:rebuild /p:WarningLevel=0 @@ -21,3 +20,4 @@ cd ".\out\Windows" cd ..\..\ explorer .\out + diff --git a/src/CSScriptLib/src/CSScriptLib/CSScript.cs b/src/CSScriptLib/src/CSScriptLib/CSScript.cs index 3875a83f..eb4222b0 100644 --- a/src/CSScriptLib/src/CSScriptLib/CSScript.cs +++ b/src/CSScriptLib/src/CSScriptLib/CSScript.cs @@ -1,3 +1,5 @@ +// Ignore Spelling: Dirs + using System; using System.Collections.Generic; using System.Diagnostics; @@ -485,7 +487,7 @@ static internal string TypeNameForScript(Type type) string typeName = type.Name; //remove generic type suffix from name. typeName = typeName.Substring(0, typeName.IndexOf('`')); - return $"{type.Namespace}.{typeName}<{string.Join(", ",type.GenericTypeArguments.Select(TypeNameForScript))}>"; + return $"{type.Namespace}.{typeName}<{string.Join(", ", type.GenericTypeArguments.Select(TypeNameForScript))}>"; } } } \ No newline at end of file diff --git a/src/CSScriptLib/src/CSScriptLib/CSScriptLib.csproj b/src/CSScriptLib/src/CSScriptLib/CSScriptLib.csproj index e1d56ec0..f5d04b7b 100644 --- a/src/CSScriptLib/src/CSScriptLib/CSScriptLib.csproj +++ b/src/CSScriptLib/src/CSScriptLib/CSScriptLib.csproj @@ -14,7 +14,7 @@ true snupkg true - 4.8.6.0 + 4.8.7.0 Oleg Shilo CS-Script engine Class Library for .NET 5 (and higher) (C) 2018-2023 Oleg Shilo @@ -30,15 +30,16 @@ ### CLI -- Issue #345: cs-script 4.8.5 does not see cache directory on Linux -- Issue #346: cs-script 4.8.5 doesn't show information about server on Linux +- Fixed accidental ignoring of CLI arguments: `-v`, `-ver`, `-version` +- Improved CLI help formatting +- Improved build script ### CSScriptLib - no changes true - 4.8.6.0 - 4.8.6.0 + 4.8.7.0 + 4.8.7.0 MIT css_logo.png diff --git a/src/CSScriptLib/src/Client.NET-Framework (CodeDom)/Properties/AssemblyInfo.cs b/src/CSScriptLib/src/Client.NET-Framework (CodeDom)/Properties/AssemblyInfo.cs index 2ec78745..9bf8016e 100644 --- a/src/CSScriptLib/src/Client.NET-Framework (CodeDom)/Properties/AssemblyInfo.cs +++ b/src/CSScriptLib/src/Client.NET-Framework (CodeDom)/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConsoleApp1")] -[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/src/CSScriptLib/src/Client.NET-Framework (Roslyn+CodeDom)/Properties/AssemblyInfo.cs b/src/CSScriptLib/src/Client.NET-Framework (Roslyn+CodeDom)/Properties/AssemblyInfo.cs index b0cf44ba..e611eb13 100644 --- a/src/CSScriptLib/src/Client.NET-Framework (Roslyn+CodeDom)/Properties/AssemblyInfo.cs +++ b/src/CSScriptLib/src/Client.NET-Framework (Roslyn+CodeDom)/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConsoleApp2")] -[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/src/Tests.CSScriptLib/Evaluator.Roslyn.Tests.cs b/src/Tests.CSScriptLib/Evaluator.Roslyn.Tests.cs index a82cbe96..09e6dbd6 100644 --- a/src/Tests.CSScriptLib/Evaluator.Roslyn.Tests.cs +++ b/src/Tests.CSScriptLib/Evaluator.Roslyn.Tests.cs @@ -1,7 +1,3 @@ -using csscript; -using CSScripting; -using CSScriptLib; -using Microsoft.CodeAnalysis.Scripting; using System; using System.Collections.Generic; using System.Diagnostics; @@ -9,6 +5,10 @@ using System.Linq; using System.Reflection; using System.Runtime.Loader; +using Microsoft.CodeAnalysis.Scripting; +using csscript; +using CSScripting; +using CSScriptLib; using Testing; using Xunit; @@ -61,7 +61,7 @@ public void call_SuccessfulUnloadAssembly() script.GetType().Assembly.Unload(); } - private void call_FailingUnloadAssembly() + void call_FailingUnloadAssembly() { // dynamic will trigger an accidental referencing the assembly under the hood of CLR and // it will not be collected. @@ -116,29 +116,6 @@ public void use_ScriptCaching() [Fact] public void call_LoadMethod() { - var info = new CompileInfo - { - AssemblyFile = @"D:\out\asm.dll" - }; - - var asm1 = CSScript.Evaluator - .With(e => e.IsCachingEnabled = true) - .LoadFile(@"D:\out\test.cs"); - - Assembly asm2 = CSScript.Evaluator - .CompileCode(@"using System; - public class Script - { - public int Sum(int a, int b) - { - return a+b; - } - }", - info); - - // dynamic script = asm.CreateObject("*"); - // var result = script.Sum(7, 3); - dynamic script = CSScript.RoslynEvaluator .LoadMethod(@"public object func() { @@ -335,16 +312,16 @@ public void Issue_337() }; var accounting_assm2 = CSScript.Evaluator - .With(e => e.IsCachingEnabled = false) - .CompileCode(@"public class TXBase + .With(e => e.IsCachingEnabled = false) + .CompileCode(@"public class TXBase { public string TranId { get; set; } public string HashKey { get; set; } }", info); dynamic script1 = CSScript.Evaluator - .ReferenceAssembly(accounting_assm2) - .LoadCode(@"public class TXPayment + .ReferenceAssembly(accounting_assm2) + .LoadCode(@"public class TXPayment { public string Reason { get; set; } public string Test() diff --git a/src/cscs/CSExecutionClient.cs b/src/cscs/CSExecutionClient.cs index d5f486f9..a30b9ffd 100644 --- a/src/cscs/CSExecutionClient.cs +++ b/src/cscs/CSExecutionClient.cs @@ -1,12 +1,12 @@ using System; using System.Diagnostics; +using static System.Environment; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; -using CSScripting; using System.Text; -using static System.Environment; +using CSScripting; [assembly: InternalsVisibleTo("cscs.tests")] /* @@ -131,7 +131,7 @@ class AppInfo public static string appLogo => $"C# Script execution engine (.NET Core). Version {Assembly.GetExecutingAssembly().GetName().Version}.{NewLine}" + - "Copyright (C) 2004-2020 Oleg Shilo." + NewLine; + "Copyright (C) 2004-2023 Oleg Shilo." + NewLine; public static string appLogoShort => $"C# Script execution engine (.NET Core). Version{Assembly.GetExecutingAssembly().GetName().Version}.{NewLine}"; diff --git a/src/cscs/HelpProvider.cs b/src/cscs/HelpProvider.cs index 73e90ec1..61f19363 100644 --- a/src/cscs/HelpProvider.cs +++ b/src/cscs/HelpProvider.cs @@ -1,18 +1,18 @@ -using CSScripting; -using Microsoft.CodeAnalysis.Scripting; using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Drawing; +using static System.Environment; using System.IO; using System.Linq; +using static System.Net.Mime.MediaTypeNames; using System.Reflection; using System.Runtime.ConstrainedExecution; using System.Runtime.Intrinsics.X86; using System.Text; -using static System.Environment; -using static System.Net.Mime.MediaTypeNames; +using Microsoft.CodeAnalysis.Scripting; +using CSScripting; namespace csscript { @@ -26,7 +26,6 @@ internal static class AppArgs public const string help3 = "--help"; public const string question = "?"; public const string question2 = "-?"; - public const string ver = "ver"; public const string wpf = "wpf"; public const string cmd = "cmd"; public const string syntax = "syntax"; @@ -41,8 +40,9 @@ internal static class AppArgs public const string verbose = "verbose"; public const string verbose2 = "verbose2"; public const string profile = "profile"; - public const string v = "v"; public const string version = "version"; + public const string ver = "ver"; + public const string v = "v"; public const string version2 = "-version"; public const string c = "c"; public const string cd = "cd"; @@ -445,7 +445,7 @@ static AppArgs() { switch2Help[uninstall] = switch2Help[install] = new ArgInfo("-install/-uninstall", - "Sets/unsets CSSCRIPT_ROOT environment variable to the location of the script engine" + + "Sets/unsets CSSCRIPT_ROOT environment variable to the location of the script engine " + "being executed.", "This environment variable is required for integration of CS-Script with Notepad++," + "Sublime Text and some other editors, which require CS-Script installed on the host OS.", @@ -1141,13 +1141,13 @@ public static string ShowHelp(string helpType, params object[] context) { string capturedArg = map[description]; - if (capturedArg.Length > arg.Length) - map[description] = capturedArg + "|" + arg; - else - map[description] = arg + "|" + capturedArg; + // if (capturedArg.Length > arg.Length) + map[description] = capturedArg + "|" + $"-{arg}"; + // else + // map[description] = $"-{arg}" + "|" + capturedArg; } else - map[description] = arg; + map[description] = $"-{arg}"; longestArg = Math.Max(map[description].Length, longestArg); } @@ -1865,7 +1865,7 @@ public static string BuildVersionInfo(string arg) string dotNetVer = null; - if (arg == "--version") + if (arg is not null) { builder.Append($"{Assembly.GetExecutingAssembly().GetName().Version}"); } @@ -1945,7 +1945,7 @@ public static string BuildVersionInfo(string arg) builder.AppendLine(" NuGet manager: " + NuGet.NuGetExeView) .AppendLine(" NuGet cache: " + NuGet.NuGetCacheView) - .AppendLine(" Script cache: " + Runtime.CacheDir) + .AppendLine(" Script cache: " + Runtime.CacheDir) .AppendLine(" Custom commands: " + Runtime.CustomCommandsDir) .AppendLine(" Global includes: " + Runtime.GlobalIncludsDir); } diff --git a/src/cscs/Program.cs b/src/cscs/Program.cs index c806cf71..62145704 100644 --- a/src/cscs/Program.cs +++ b/src/cscs/Program.cs @@ -1,35 +1,15 @@ -using csscript; -using CSScripting; -using CSScripting.CodeDom; -using System; +using System; using System.Diagnostics; +using static System.Environment; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Xml.Linq; -using static System.Environment; - -/* - TODO: - - csc_builder - - add configurable exit on idle - - cscs - - code cleanup - - VB support - - Unify namespaces - - Migrate app settings to json - - remove old not used settings - - clean help content from unused stuff - - implement config for port number - - CSSCriptLib - - VB support - - implement config for port number -*/ +using csscript; +using CSScripting; +using CSScripting.CodeDom; namespace cscs { diff --git a/src/cscs/cscs.csproj b/src/cscs/cscs.csproj index a102578e..3a803418 100644 --- a/src/cscs/cscs.csproj +++ b/src/cscs/cscs.csproj @@ -6,7 +6,7 @@ cscs CSScripting - 4.8.6.0 + 4.8.7.0 Oleg Shilo CS-Script (C) 2004-2023 Oleg Shilo @@ -17,16 +17,17 @@ https://github.com/oleg-shilo/cs-script git C# script dynamic - 4.8.6.0 - 4.8.6.0 + 4.8.7.0 + 4.8.7.0 --- ## Changes ### CLI -- Issue #345: cs-script 4.8.5 does not see cache directory on Linux -- Issue #346: cs-script 4.8.5 doesn't show information about server on Linux +- Fixed accidental ignoring of CLI arguments: `-v`, `-ver`, `-version` +- Improved CLI help formatting +- Improved build script ### CSScriptLib diff --git a/src/cscs/dbg.cs b/src/cscs/dbg.cs index f10d2f52..5e06789b 100644 --- a/src/cscs/dbg.cs +++ b/src/cscs/dbg.cs @@ -11,13 +11,13 @@ public static class dbg_extensions { - static public T dump(this T @object, params object[] args) + public static T dump(this T @object, params object[] args) { dbg.print(@object, args); return @object; } - static public T print(this T @object, params object[] args) + public static T print(this T @object, params object[] args) { dbg.print(@object, args); return @object; @@ -65,31 +65,31 @@ public static void print(object @object, params object[] args) } //=============================== - int level = 0; + private int level = 0; - string indent = " "; + private string indent = " "; public static Action WriteLine = Console.Out.WriteLine; public static Action Write = Console.Out.Write; - void write(object @object = null) + private void write(object @object = null) { if (@object != null) Write(@object.ToString().ReplaceClrAliaces()); } - void writeLine(object @object = null) + private void writeLine(object @object = null) { write(@object); WriteLine(""); } - string Indent + private string Indent { get { return new string('0', level).Replace("0", indent); } } - string DisplayName(IEnumerable obj) + private string DisplayName(IEnumerable obj) { if (obj is Array) { @@ -113,9 +113,9 @@ string DisplayName(IEnumerable obj) } } - static public string CustomPrimitiveTypes = "Newtonsoft.Json.Linq.JValue;"; + public static string CustomPrimitiveTypes = "Newtonsoft.Json.Linq.JValue;"; - static bool isPrimitive(object obj) + private static bool isPrimitive(object obj) { if (obj == null || obj.GetType().IsPrimitive || obj is decimal || obj is string) return true; @@ -124,7 +124,7 @@ static bool isPrimitive(object obj) return false; } - void WriteObject(object obj) + private void WriteObject(object obj) { level++; if (isPrimitive(obj)) @@ -188,7 +188,7 @@ void WriteObject(object obj) level--; } - object GetMemberValue(object element, MemberInfo m) + private object GetMemberValue(object element, MemberInfo m) { FieldInfo f = m as FieldInfo; PropertyInfo p = m as PropertyInfo; @@ -208,7 +208,7 @@ object GetMemberValue(object element, MemberInfo m) return null; } - void WriteValue(object o) + private void WriteValue(object o) { if (o == null) write("{null}"); @@ -228,7 +228,7 @@ void WriteValue(object o) write("{" + o.ToString().TrimStart('{').TrimEnd('}') + "}"); } - MemberInfo[] GetMembers(object obj) + private MemberInfo[] GetMembers(object obj) { Func relevant_types = x => x.MemberType == MemberTypes.Field || x.MemberType == MemberTypes.Property; @@ -259,12 +259,12 @@ MemberInfo[] GetMembers(object obj) internal static class Extension { - static public string ReplaceWholeWord(this string text, string pattern, string replacement) + public static string ReplaceWholeWord(this string text, string pattern, string replacement) { return Regex.Replace(text, @"\b(" + pattern + @")\b", replacement); } - static public string ReplaceClrAliaces(this string text, bool hideSystemNamespace = false) + public static string ReplaceClrAliaces(this string text, bool hideSystemNamespace = false) { if (string.IsNullOrEmpty(text)) return text; diff --git a/src/css/Properties/AssemblyInfo.cs b/src/css/Properties/AssemblyInfo.cs index fc5eea7d..ed48a1ae 100644 --- a/src/css/Properties/AssemblyInfo.cs +++ b/src/css/Properties/AssemblyInfo.cs @@ -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.6.0")] -[assembly: AssemblyFileVersion("4.8.6.0")] +[assembly: AssemblyVersion("4.8.7.0")] +[assembly: AssemblyFileVersion("4.8.7.0")] diff --git a/src/csws/Properties/launchSettings.json b/src/csws/Properties/launchSettings.json index 990450d4..dfd2369a 100644 --- a/src/csws/Properties/launchSettings.json +++ b/src/csws/Properties/launchSettings.json @@ -2,8 +2,7 @@ "profiles": { "csws": { "commandName": "Project", - "commandLineArgs": "--version ver.log", - "workingDirectory": "D:\\dev\\Galos\\cs-script\\src" + "commandLineArgs": "--version ver.log" } } } \ No newline at end of file diff --git a/src/csws/csws.csproj b/src/csws/csws.csproj index 5d18b789..dc289ec6 100644 --- a/src/csws/csws.csproj +++ b/src/csws/csws.csproj @@ -7,7 +7,7 @@ csws CSScripting - 4.8.6.0 + 4.8.7.0 Oleg Shilo CS-Script (C) 2004-2022 Oleg Shilo @@ -18,16 +18,17 @@ https://github.com/oleg-shilo/cs-script git C# script dynamic - 4.8.6.0 - 4.8.6.0 + 4.8.7.0 + 4.8.7.0 --- ## Changes ### CLI -- Issue #345: cs-script 4.8.5 does not see cache directory on Linux -- Issue #346: cs-script 4.8.5 doesn't show information about server on Linux +- Fixed accidental ignoring of CLI arguments: `-v`, `-ver`, `-version` +- Improved CLI help formatting +- Improved build script ### CSScriptLib diff --git a/src/out/Windows/cscs.deps.json b/src/out/Windows/cscs.deps.json index fa2854cf..aba0b619 100644 --- a/src/out/Windows/cscs.deps.json +++ b/src/out/Windows/cscs.deps.json @@ -6,7 +6,7 @@ "compilationOptions": {}, "targets": { ".NETCoreApp,Version=v7.0": { - "cscs/4.8.6.0": { + "cscs/4.8.7.0": { "dependencies": { "Microsoft.CodeAnalysis.CSharp.Scripting": "3.10.0" }, @@ -468,7 +468,7 @@ } }, "libraries": { - "cscs/4.8.6.0": { + "cscs/4.8.7.0": { "type": "project", "serviceable": false, "sha512": "" diff --git a/src/out/Windows/csws.deps.json b/src/out/Windows/csws.deps.json index d2b577c8..6ee65abb 100644 --- a/src/out/Windows/csws.deps.json +++ b/src/out/Windows/csws.deps.json @@ -6,7 +6,7 @@ "compilationOptions": {}, "targets": { ".NETCoreApp,Version=v7.0": { - "csws/4.8.6.0": { + "csws/4.8.7.0": { "dependencies": { "Microsoft.CodeAnalysis.CSharp.Scripting": "3.10.0" }, @@ -468,7 +468,7 @@ } }, "libraries": { - "csws/4.8.6.0": { + "csws/4.8.7.0": { "type": "project", "serviceable": false, "sha512": "" diff --git a/src/out/ci/build.sh b/src/out/ci/build.sh index 456cba2c..41934216 100644 --- a/src/out/ci/build.sh +++ b/src/out/ci/build.sh @@ -1,3 +1,3 @@ cd /home/user/lnx-build -sudo chmod 775 cs-script_4.8-6/DEBIAN/p* -dpkg-deb --build cs-script_4.8-6 \ No newline at end of file +sudo chmod 775 cs-script_4.8-7/DEBIAN/p* +dpkg-deb --build cs-script_4.8-7 \ No newline at end of file diff --git a/src/release_notes.md b/src/release_notes.md index 9944a71a..250ca0bc 100644 --- a/src/release_notes.md +++ b/src/release_notes.md @@ -1,4 +1,4 @@ -# Pre-Release v4.8.6.0 +# Release v4.8.7.0 --- @@ -6,8 +6,9 @@ ### CLI -- Issue #345: cs-script 4.8.5 does not see cache directory on Linux -- Issue #346: cs-script 4.8.5 doesn't show information about server on Linux +- Fixed accidental ignoring of CLI arguments: `-v`, `-ver`, `-version` +- Improved CLI help formatting +- Improved build script ### CSScriptLib