-
Notifications
You must be signed in to change notification settings - Fork 36
Add plugin support for other templates languages #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 22 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
1f1cac7
Command line refactoring.
sarahelsaig 9eb4f21
Add -p/--plugin command line option.
sarahelsaig a8d4f00
Add Microsoft.CodeAnalysis.CSharp.Scripting package.
sarahelsaig f3420df
Add CSX plugin support.
sarahelsaig c172b43
Some documentation.
sarahelsaig aeaa3bd
Access bug fix.
sarahelsaig 31224e0
Add sample and test.
sarahelsaig 11b7fd5
Fix spacing.
sarahelsaig e7c2a10
Fix test name.
sarahelsaig 8716a94
Fix test for Windows.
sarahelsaig bd6cfd5
Fix warning NU1507: There are 2 package sources defined in your confi…
sarahelsaig d634380
Move ProcessPluginsAsync logic into the PluginHelper class in the Abs…
sarahelsaig 132d4f4
Revert unnecessary nuget source name change.
sarahelsaig e4abfa7
Fix spacing.
sarahelsaig 07798dc
prevent index out of range exception
sarahelsaig 9cf8265
Minor code cleanup.
sarahelsaig 857c41f
Add online plugin support as suggested by @sebastienros.
sarahelsaig f6e0443
Try out online referencing.
sarahelsaig 1517c35
Try out online referencing.
sarahelsaig 4654924
Add support for importing DLLs with a relative path.
sarahelsaig 3a30702
Move PluginHelper to the main project instead of Abstractions
sarahelsaig bb7aa16
Improve tip wording.
sarahelsaig af5a94a
Update README.md
sarahelsaig 85448b9
Merge remote-tracking branch 'origin/main' into plugin
sarahelsaig 20ecc7d
Post-merge rewrite.
sarahelsaig 1c03367
fix pluralization.
sarahelsaig 284e8b3
bug fix
sarahelsaig ffac438
Delete src/OrchardCoreContrib.PoExtractor/GetCliOptionsResult.cs
hishamco 9ec159c
Update test/OrchardCoreContrib.PoExtractor.Tests/PluginTests.cs
sarahelsaig dd927ad
Merge remote-tracking branch 'origin/main' into plugin
sarahelsaig fa7ec12
Add missing partial to type.
sarahelsaig c5ba5db
Update src/OrchardCoreContrib.PoExtractor/PluginHelper.cs
sarahelsaig 935a85e
Update naming convention in CSX and documentation.
sarahelsaig 04f6630
Simplify referencing assemblies in PluginHelper.ProcessPluginsAsync().
sarahelsaig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<!-- Ignore global configuration --> | ||
<clear /> | ||
<add key="NuGet" value="https://api.nuget.org/v3/index.json" /> | ||
<add key="OrchardCore" value="https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json" /> | ||
</packageSources> | ||
</configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace OrchardCoreContrib.PoExtractor; | ||
|
||
public class GetCliOptionsResult | ||
{ | ||
public string Language { get; set; } | ||
public string TemplateEngine { get; set; } | ||
public string SingleOutputFile { get; set; } | ||
public IList<string> Plugins { get; set; } = new List<string>(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Reflection; | ||
using Microsoft.CodeAnalysis.CSharp.Scripting; | ||
using Microsoft.CodeAnalysis.Scripting; | ||
|
||
namespace OrchardCoreContrib.PoExtractor; | ||
|
||
public static class PluginHelper | ||
{ | ||
public static async Task ProcessPluginsAsync( | ||
IList<string> plugins, | ||
List<IProjectProcessor> projectProcessors, | ||
List<string> projectFiles, | ||
IEnumerable<Assembly> assemblies) | ||
{ | ||
var sharedOptions = ScriptOptions.Default.AddReferences(assemblies); | ||
|
||
foreach (var plugin in plugins) | ||
{ | ||
string code; | ||
ScriptOptions options; | ||
|
||
if (plugin.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
code = await new HttpClient().GetStringAsync(plugin); | ||
options = sharedOptions.WithFilePath(Path.Join( | ||
Environment.CurrentDirectory, | ||
Path.GetFileName(new Uri(plugin).AbsolutePath))); | ||
} | ||
else | ||
{ | ||
code = await File.ReadAllTextAsync(plugin); | ||
options = sharedOptions.WithFilePath(Path.GetFullPath(plugin)); | ||
} | ||
|
||
await CSharpScript.EvaluateAsync(code, options, new PluginContext(projectProcessors, projectFiles)); | ||
} | ||
} | ||
|
||
public record PluginContext(List<IProjectProcessor> projectProcessors, List<string> projectFiles); | ||
sarahelsaig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.