Skip to content
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

[Pull Request] Script Engine Integration and Functional Improvements #5

Merged
merged 16 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
17 changes: 0 additions & 17 deletions Cheese.Contract/Cheese.Contract.csproj

This file was deleted.

9 changes: 0 additions & 9 deletions Cheese.Contract/IProvider.cs

This file was deleted.

10 changes: 0 additions & 10 deletions Cheese.Contract/References/IReferencesProvider.cs

This file was deleted.

14 changes: 0 additions & 14 deletions Cheese.Flavors/Cheese.Flavors.csproj

This file was deleted.

71 changes: 0 additions & 71 deletions Cheese.Flavors/References/ReferencesProviderKitX.cs

This file was deleted.

4 changes: 4 additions & 0 deletions Cheese.Shared/Cheese.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Common.BasicHelper" Version="1.3.584.228" />
</ItemGroup>

</Project>
29 changes: 29 additions & 0 deletions Cheese.Shared/PipeLine/CoreProcess.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace Cheese.Shared.PipeLine;

public class CoreProcess
{
/// <summary>
/// The root path of current project, if not in any cheese project, you get null
/// </summary>
public string? ProjectRootPath { get; set; }

/// <summary>
/// Where cheese startup
/// For example:
/// $ cd */xxx
/// $ cheese ...
/// Then, `StartupPath` will be "*/xxx"
/// </summary>
public string? StartupPath { get; set; }

/// <summary>
/// The absolute path for `.cheese` folder in current project
/// If not in any cheese project, you get null
/// </summary>
public string? CheeseDataPath { get; set; }

/// <summary>
/// Basic information for current repo/project
/// </summary>
public RepoInfo? RepoInfo { get; set; }
}
6 changes: 6 additions & 0 deletions Cheese.Shared/RepoInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Cheese.Shared;

public class RepoInfo
{

}
28 changes: 28 additions & 0 deletions Cheese.UnitTests/Cheese.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="NUnit" Version="3.14.0"/>
<PackageReference Include="NUnit.Analyzers" Version="3.9.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>
</ItemGroup>

<ItemGroup>
<Using Include="NUnit.Framework"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Cheese\Cheese.csproj" />
</ItemGroup>

</Project>
26 changes: 26 additions & 0 deletions Cheese.UnitTests/Utils/Cheese/ScriptHostTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Cheese.Utils.General;

namespace Cheese.UnitTests.Utils.Cheese;

[TestFixture]
[TestOf(typeof(ScriptHost))]
public class ScriptHostTest
{
[Test]
public void NamespaceAccessibilityTest()
{
const string code = """
using Cheese.Utils.General;

ConsoleHelper.Instance.WriteLine("Test");

return "Done";
""";

var task = ScriptHost.Instance.ExecuteCodesAsync(code, false);

task.Wait();

Assert.That(task.Result, Is.EqualTo("Done"));
}
}
18 changes: 6 additions & 12 deletions Cheese.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cheese", "Cheese\Cheese.csproj", "{09A0DDB2-6C74-4D82-847A-305CCEBB65C5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cheese.Flavors", "Cheese.Flavors\Cheese.Flavors.csproj", "{E6A73E46-3F80-46A6-825B-13031323FB2D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cheese.Contract", "Cheese.Contract\Cheese.Contract.csproj", "{3DBE6ABF-ACF7-4499-A4D0-BE98D31DFA61}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cheese.Shared", "Cheese.Shared\Cheese.Shared.csproj", "{D78E8C97-0107-4A7F-9566-2DFF092E6048}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cheese.UnitTests", "Cheese.UnitTests\Cheese.UnitTests.csproj", "{CD298668-B6AB-4166-A537-94316F947BC9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -24,17 +22,13 @@ Global
{09A0DDB2-6C74-4D82-847A-305CCEBB65C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09A0DDB2-6C74-4D82-847A-305CCEBB65C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09A0DDB2-6C74-4D82-847A-305CCEBB65C5}.Release|Any CPU.Build.0 = Release|Any CPU
{E6A73E46-3F80-46A6-825B-13031323FB2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6A73E46-3F80-46A6-825B-13031323FB2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6A73E46-3F80-46A6-825B-13031323FB2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6A73E46-3F80-46A6-825B-13031323FB2D}.Release|Any CPU.Build.0 = Release|Any CPU
{3DBE6ABF-ACF7-4499-A4D0-BE98D31DFA61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DBE6ABF-ACF7-4499-A4D0-BE98D31DFA61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DBE6ABF-ACF7-4499-A4D0-BE98D31DFA61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DBE6ABF-ACF7-4499-A4D0-BE98D31DFA61}.Release|Any CPU.Build.0 = Release|Any CPU
{D78E8C97-0107-4A7F-9566-2DFF092E6048}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D78E8C97-0107-4A7F-9566-2DFF092E6048}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D78E8C97-0107-4A7F-9566-2DFF092E6048}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D78E8C97-0107-4A7F-9566-2DFF092E6048}.Release|Any CPU.Build.0 = Release|Any CPU
{CD298668-B6AB-4166-A537-94316F947BC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD298668-B6AB-4166-A537-94316F947BC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD298668-B6AB-4166-A537-94316F947BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD298668-B6AB-4166-A537-94316F947BC9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
11 changes: 5 additions & 6 deletions Cheese/Cheese.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@
</PropertyGroup>

<ItemGroup>
<None Include="..\README.md" Pack="True" PackagePath="\"/>
<None Include="icon.png" Pack="True" PackagePath="\"/>
<None Include="..\README.md" Pack="True" PackagePath="\" />
<None Include="icon.png" Pack="True" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1"/>
<PackageReference Include="Common.BasicHelper" Version="1.3.584.228"/>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Csharpell.Core" Version="0.5.335.689" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Cheese.Contract\Cheese.Contract.csproj" />
<ProjectReference Include="..\Cheese.Flavors\Cheese.Flavors.csproj" />
<ProjectReference Include="..\Cheese.Shared\Cheese.Shared.csproj" />
</ItemGroup>

Expand Down
21 changes: 0 additions & 21 deletions Cheese/Options/I18nOptions.cs

This file was deleted.

21 changes: 0 additions & 21 deletions Cheese/Options/InitializeOptions.cs

This file was deleted.

11 changes: 7 additions & 4 deletions Cheese/Options/Options.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Cheese.Utils.Cheese;
using Cheese.Utils.General;
using CommandLine;

namespace Cheese.Options;
Expand All @@ -7,9 +7,12 @@ public class Options
{
[Option("verbose", HelpText = "More details will be printed out.")]
public bool Verbose { get; set; }

[Option("dry-run", HelpText = "Display what the command will do instead of executing directly.")]
public bool DryRun { get; set; }

[Option("fail-fast", Default = false, HelpText = "When any operation failed, exit and return non-zero")]
public bool FailFast { get; set; }
}

public static class OptionsExtensions
Expand All @@ -28,7 +31,7 @@ public static Options Execute(this Options options)

"""
);

return options;
}
}
}
23 changes: 0 additions & 23 deletions Cheese/Options/PublishOptions.cs

This file was deleted.

Loading
Loading