From 76a76a9fd9e6b910cfe6b05c2133ea0b134acdf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Graus?= Date: Wed, 15 Mar 2023 17:00:46 +0100 Subject: [PATCH 1/3] Anpassen der publish Profile. Hebung der Nugets. --- .../CompiledHandlebars.Core.Cli.csproj | 10 +++++----- CompiledHandlebars.Cli2/Program.cs | 1 + .../PublishProfiles/FolderProfile.pubxml | 16 ---------------- .../Properties/PublishProfiles/linux.pubxml | 18 ++++++++++++++++++ .../Properties/PublishProfiles/windows.pubxml | 18 ++++++++++++++++++ .../Properties/launchSettings.json | 7 ++++++- CompiledHandlebars.sln | 16 ++++++++-------- Compiler/CompiledHandlebars.Compiler.csproj | 8 ++++---- 8 files changed, 60 insertions(+), 34 deletions(-) delete mode 100644 CompiledHandlebars.Cli2/Properties/PublishProfiles/FolderProfile.pubxml create mode 100644 CompiledHandlebars.Cli2/Properties/PublishProfiles/linux.pubxml create mode 100644 CompiledHandlebars.Cli2/Properties/PublishProfiles/windows.pubxml diff --git a/CompiledHandlebars.Cli2/CompiledHandlebars.Core.Cli.csproj b/CompiledHandlebars.Cli2/CompiledHandlebars.Core.Cli.csproj index 7de9b2f..11d993d 100644 --- a/CompiledHandlebars.Cli2/CompiledHandlebars.Core.Cli.csproj +++ b/CompiledHandlebars.Cli2/CompiledHandlebars.Core.Cli.csproj @@ -11,14 +11,14 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/CompiledHandlebars.Cli2/Program.cs b/CompiledHandlebars.Cli2/Program.cs index c81d99b..e579f1f 100644 --- a/CompiledHandlebars.Cli2/Program.cs +++ b/CompiledHandlebars.Cli2/Program.cs @@ -161,6 +161,7 @@ private static void CompileProject(CompilerOptions options) try { AnalyzerManager manager = new AnalyzerManager(); + IProjectAnalyzer analyzer = manager.GetProject(options.ProjectFile); workspace = analyzer.GetWorkspace(); project = workspace.CurrentSolution.Projects.ElementAt(0); diff --git a/CompiledHandlebars.Cli2/Properties/PublishProfiles/FolderProfile.pubxml b/CompiledHandlebars.Cli2/Properties/PublishProfiles/FolderProfile.pubxml deleted file mode 100644 index 22dc206..0000000 --- a/CompiledHandlebars.Cli2/Properties/PublishProfiles/FolderProfile.pubxml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Debug - x64 - D:\hbc - FileSystem - netcoreapp3.1 - linux-x64 - false - True - - \ No newline at end of file diff --git a/CompiledHandlebars.Cli2/Properties/PublishProfiles/linux.pubxml b/CompiledHandlebars.Cli2/Properties/PublishProfiles/linux.pubxml new file mode 100644 index 0000000..3387865 --- /dev/null +++ b/CompiledHandlebars.Cli2/Properties/PublishProfiles/linux.pubxml @@ -0,0 +1,18 @@ + + + + + Release + x64 + C:\D\hbc\linux + FileSystem + net7.0 + linux-x64 + false + false + + en + + \ No newline at end of file diff --git a/CompiledHandlebars.Cli2/Properties/PublishProfiles/windows.pubxml b/CompiledHandlebars.Cli2/Properties/PublishProfiles/windows.pubxml new file mode 100644 index 0000000..42ab987 --- /dev/null +++ b/CompiledHandlebars.Cli2/Properties/PublishProfiles/windows.pubxml @@ -0,0 +1,18 @@ + + + + + Release + Any CPU + C:\D\hbc\windows + FileSystem + net7.0 + win-x64 + false + false + true + en + + \ No newline at end of file diff --git a/CompiledHandlebars.Cli2/Properties/launchSettings.json b/CompiledHandlebars.Cli2/Properties/launchSettings.json index 6d1a1c9..eec448e 100644 --- a/CompiledHandlebars.Cli2/Properties/launchSettings.json +++ b/CompiledHandlebars.Cli2/Properties/launchSettings.json @@ -2,7 +2,12 @@ "profiles": { "CompiledHandlebars.Cli2": { "commandName": "Project", - "commandLineArgs": "-c -d -f -eC:\\dev\\sw.git\\StiftungWarentest.Website\\node_modules -eC:\\dev\\sw.git\\StiftungWarentest.Website\\assets C:\\dev\\sw.git\\StiftungWarentest.Website\\StiftungWarentest.Website.csproj" + "commandLineArgs": "-c -d -eC:\\dev\\Repos\\StiftungWarentest.Web\\StiftungWarentest.Website\\node_modules -eC:\\dev\\Repos\\StiftungWarentest.Web\\StiftungWarentest.Website\\assets C:\\dev\\Repos\\StiftungWarentest.Web\\StiftungWarentest.Website\\StiftungWarentest.Website.csproj" + }, + "WSL": { + "commandName": "WSL2", + "distributionName": "", + "commandLineArgs": "CompiledHandlebars.Core.Cli.dll -c -d -e/mnt/c/dev/Repos/StiftungWarentest.Web/StiftungWarentest.Website/node_modules -e/mnt/c/dev/Repos/StiftungWarentest.Web/StiftungWarentest.Website/assets /mnt/c/dev/Repos/StiftungWarentest.Web/StiftungWarentest.Website/StiftungWarentest.Website.csproj" } } } \ No newline at end of file diff --git a/CompiledHandlebars.sln b/CompiledHandlebars.sln index 43e3b8c..8ed7147 100644 --- a/CompiledHandlebars.sln +++ b/CompiledHandlebars.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30611.23 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompiledHandlebars.Compiler", "Compiler\CompiledHandlebars.Compiler.csproj", "{55E767E0-44F0-4297-9A00-7211B424BE03}" EndProject @@ -19,14 +19,14 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {55E767E0-44F0-4297-9A00-7211B424BE03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {55E767E0-44F0-4297-9A00-7211B424BE03}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55E767E0-44F0-4297-9A00-7211B424BE03}.Debug|Any CPU.ActiveCfg = Debug|x64 + {55E767E0-44F0-4297-9A00-7211B424BE03}.Debug|Any CPU.Build.0 = Debug|x64 {55E767E0-44F0-4297-9A00-7211B424BE03}.Debug|x64.ActiveCfg = Debug|x64 {55E767E0-44F0-4297-9A00-7211B424BE03}.Debug|x64.Build.0 = Debug|x64 {55E767E0-44F0-4297-9A00-7211B424BE03}.Debug|x86.ActiveCfg = Debug|Any CPU {55E767E0-44F0-4297-9A00-7211B424BE03}.Debug|x86.Build.0 = Debug|Any CPU - {55E767E0-44F0-4297-9A00-7211B424BE03}.Release|Any CPU.ActiveCfg = Release|Any CPU - {55E767E0-44F0-4297-9A00-7211B424BE03}.Release|Any CPU.Build.0 = Release|Any CPU + {55E767E0-44F0-4297-9A00-7211B424BE03}.Release|Any CPU.ActiveCfg = Release|x64 + {55E767E0-44F0-4297-9A00-7211B424BE03}.Release|Any CPU.Build.0 = Release|x64 {55E767E0-44F0-4297-9A00-7211B424BE03}.Release|x64.ActiveCfg = Release|x64 {55E767E0-44F0-4297-9A00-7211B424BE03}.Release|x64.Build.0 = Release|x64 {55E767E0-44F0-4297-9A00-7211B424BE03}.Release|x86.ActiveCfg = Release|Any CPU @@ -39,8 +39,8 @@ Global {A3B28E61-F74A-4156-BD99-0FD46E475EDF}.Debug|x86.Build.0 = Debug|Any CPU {A3B28E61-F74A-4156-BD99-0FD46E475EDF}.Release|Any CPU.ActiveCfg = Release|Any CPU {A3B28E61-F74A-4156-BD99-0FD46E475EDF}.Release|Any CPU.Build.0 = Release|Any CPU - {A3B28E61-F74A-4156-BD99-0FD46E475EDF}.Release|x64.ActiveCfg = Release|Any CPU - {A3B28E61-F74A-4156-BD99-0FD46E475EDF}.Release|x64.Build.0 = Release|Any CPU + {A3B28E61-F74A-4156-BD99-0FD46E475EDF}.Release|x64.ActiveCfg = Release|x64 + {A3B28E61-F74A-4156-BD99-0FD46E475EDF}.Release|x64.Build.0 = Release|x64 {A3B28E61-F74A-4156-BD99-0FD46E475EDF}.Release|x86.ActiveCfg = Release|Any CPU {A3B28E61-F74A-4156-BD99-0FD46E475EDF}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection diff --git a/Compiler/CompiledHandlebars.Compiler.csproj b/Compiler/CompiledHandlebars.Compiler.csproj index 5321713..e9f021c 100644 --- a/Compiler/CompiledHandlebars.Compiler.csproj +++ b/Compiler/CompiledHandlebars.Compiler.csproj @@ -28,13 +28,13 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + From 147c33f3294bc34d754cf7ec36cb2066e1a5ee3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Graus?= Date: Wed, 5 Apr 2023 16:16:37 +0200 Subject: [PATCH 2/3] =?UTF-8?q?pdbs=20f=C3=BCrs=20debuggen=20im=20wsl=20ak?= =?UTF-8?q?tiviert,=20l=C3=B6st=20auch=20gleich=20das=20analyse=20Problem?= =?UTF-8?q?=20beim=20Suchen=20der=20ModelTokens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CompiledHandlebars.Cli2/Program.cs | 29 ++++++++++++++++---- Compiler/CompiledHandlebars.Compiler.csproj | 6 ++++ Compiler/Introspection/RoslynIntrospector.cs | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/CompiledHandlebars.Cli2/Program.cs b/CompiledHandlebars.Cli2/Program.cs index e579f1f..113ed87 100644 --- a/CompiledHandlebars.Cli2/Program.cs +++ b/CompiledHandlebars.Cli2/Program.cs @@ -10,6 +10,8 @@ using System.Linq; using Buildalyzer.Workspaces; using Buildalyzer; +using Buildalyzer.Environment; +using Microsoft.Extensions.Logging; namespace CompiledHandlebars.Core.Cli { @@ -149,6 +151,9 @@ private static void PrintUnknownExtension(string ext) private static void CompileProject(CompilerOptions options) { Console.WriteLine($"Loading project '{options.ProjectFile}'..."); + //string x = Console.ReadLine(); + Stopwatch sw = new Stopwatch(); + sw.Start(); var properties = new Dictionary() { { "AdditionalFileItemNames", "none" } }; @@ -158,19 +163,33 @@ private static void CompileProject(CompilerOptions options) List handlebarsFiles; if (options.NetCoreProject) { + StringWriter log = new StringWriter(); try { - AnalyzerManager manager = new AnalyzerManager(); + AnalyzerManagerOptions analyzerOptions = new AnalyzerManagerOptions + { + LogWriter = log + }; + AnalyzerManager manager = new AnalyzerManager(analyzerOptions); IProjectAnalyzer analyzer = manager.GetProject(options.ProjectFile); + workspace = analyzer.GetWorkspace(); + //ILogger logger = manager.LoggerFactory?.CreateLogger(); + //workspace = new AdhocWorkspace(); + //workspace.WorkspaceChanged += (sender, args) => logger?.LogDebug($"Workspace changed: {args.Kind.ToString()}{System.Environment.NewLine}"); + //workspace.WorkspaceFailed += (sender, args) => logger?.LogError($"Workspace failed: {args.Diagnostic}{System.Environment.NewLine}"); + //analyzer.Build(new EnvironmentOptions() { Restore = true }).FirstOrDefault().AddToWorkspace(workspace); + project = workspace.CurrentSolution.Projects.ElementAt(0); - Console.WriteLine("Ok!"); + sw.Stop(); + Console.WriteLine($"Ok! {sw.Elapsed}"); + Console.WriteLine($"Log: {log.ToString()}"); handlebarsFiles = new DirectoryInfo(Path.GetDirectoryName(Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), options.ProjectFile)))).GetFiles("*.hbs", SearchOption.AllDirectories).Where(f => ShouldCompileFile(f.FullName, options)).Select(f => f.FullName).ToList(); } catch (Exception ex) { - Console.WriteLine($"Following errors occured: {Environment.NewLine}{ex}"); + Console.WriteLine($"Following errors occured: {Environment.NewLine}{ex} - {log.ToString()}"); throw; } } @@ -275,7 +294,7 @@ private static void CompileSolution(CompilerOptions options) if (handlebarsFiles.Count > 0) anyHbsFilesFound = true; } - + if (handlebarsFiles.Any()) { workspace = CompileHandlebarsFiles(project, workspace, handlebarsFiles, options); @@ -420,7 +439,7 @@ private static Workspace CompileHandlebarsFiles(Project project, Workspace works private static void PrintError(HandlebarsException error) { - Console.Error.WriteLine($"Compilation failed: {error.Message}"); + Console.Error.WriteLine($"*** Compilation failed: {error.Message}"); } /// diff --git a/Compiler/CompiledHandlebars.Compiler.csproj b/Compiler/CompiledHandlebars.Compiler.csproj index e9f021c..45d39f4 100644 --- a/Compiler/CompiledHandlebars.Compiler.csproj +++ b/Compiler/CompiledHandlebars.Compiler.csproj @@ -24,6 +24,12 @@ true true + + portable + + + portable + diff --git a/Compiler/Introspection/RoslynIntrospector.cs b/Compiler/Introspection/RoslynIntrospector.cs index 6f975fe..f39538c 100644 --- a/Compiler/Introspection/RoslynIntrospector.cs +++ b/Compiler/Introspection/RoslynIntrospector.cs @@ -68,7 +68,7 @@ private Compilation GetCompilationForProject(Project proj) Compilation comp; if (proj.TryGetCompilation(out comp)) return comp; - else return proj.GetCompilationAsync().Result; + else return proj.GetCompilationAsync().GetAwaiter().GetResult(); } public INamedTypeSymbol GetTypeSymbol(string fullTypeName) From d3a8f124c44b4f8a7a4ebcff5370f31ead04b512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Graus?= Date: Thu, 13 Apr 2023 13:15:38 +0200 Subject: [PATCH 3/3] doku --- CompiledHandlebars.Cli2/Properties/PublishProfiles/linux.pubxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CompiledHandlebars.Cli2/Properties/PublishProfiles/linux.pubxml b/CompiledHandlebars.Cli2/Properties/PublishProfiles/linux.pubxml index 3387865..1b4d141 100644 --- a/CompiledHandlebars.Cli2/Properties/PublishProfiles/linux.pubxml +++ b/CompiledHandlebars.Cli2/Properties/PublishProfiles/linux.pubxml @@ -12,7 +12,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. linux-x64 false false - + en \ No newline at end of file