Skip to content

Commit

Permalink
support DllName
Browse files Browse the repository at this point in the history
  • Loading branch information
kitUIN committed Jul 4, 2024
1 parent 675c29d commit a7ef9ae
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ShadowPluginLoader.Tool/Assets/build/Plugin.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>
<!-- Read Meta Data Then Convert To PluginJsonFile Before Build -->
<Target Name="ReadMetaData" BeforeTargets="BeforeBuild">
<Exec Command="dotnet $(ToolExeFile) 1 $(ProjectDir) $(MSBuildProjectFile) &quot;$(PluginMeta)&quot;"
<Exec Command="dotnet $(ToolExeFile) 1 $(ProjectDir) $(MSBuildProjectFile) &quot;$(PluginMeta)&quot; $(AssemblyName)"
ConsoleToMSBuild="True"/>
</Target>

Expand Down
5 changes: 3 additions & 2 deletions ShadowPluginLoader.Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class Program
{
// public static string DirPath = Environment.CurrentDirectory;
private static readonly string[] ArgNames0 = { "Method", "ExportMetaFile", "OutputPath" };
private static readonly string[] ArgNames1 = { "Method", "ProjectPath", "CsprojPath" ,"PluginMeta"};
private static readonly string[] ArgNames1 = { "Method", "ProjectPath", "CsprojPath" ,"PluginMeta", "DllName"};
private static readonly string[] ArgNames2 = { "Method", "OutputPath", "ExcludesFile",
"zipPath","zipName","zipExt","Configuration", "defaultExclude"};

Expand Down Expand Up @@ -53,7 +53,8 @@ private static int Main(string[] args)
{
throw new Exception("Missing <PluginMeta> in <PropertyGroup>(.csproj)");
}
ReadMetaMethod.Read(projectPath, csproj, pluginMeta);
var dllName = args[4]; // DllName
ReadMetaMethod.Read(projectPath, csproj, pluginMeta,dllName);
}
else if (method == "2")
{
Expand Down
11 changes: 7 additions & 4 deletions ShadowPluginLoader.Tool/ReadMetaMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ private static JsonArray LoadDependencies(XmlNode root)
_ => throw new Exception($"Not Support Type: {type}")
};
}
private static void CheckJsonRequired(JsonNode json, XmlNode root, XmlNode propertyGroup)
private static void CheckJsonRequired(JsonNode json, XmlNode root, XmlNode propertyGroup,string dllName)
{
var res = new JsonObject();
var res = new JsonObject
{
["DllName"] = dllName
};
var required = json["Required"]!.AsArray();
var properties = json["Properties"]!.AsObject();
foreach (var n in required)
Expand Down Expand Up @@ -165,7 +168,7 @@ private static void CheckJsonRequired(JsonNode json, XmlNode root, XmlNode prope
SavePluginJson(res);
}

public static void Read(string projectPath, string csproj,string meta)
public static void Read(string projectPath, string csproj,string meta, string dllName)
{
_projectPath = projectPath;
var json = GetDefineJson();
Expand All @@ -177,6 +180,6 @@ public static void Read(string projectPath, string csproj,string meta)
var pluginMetaRoot = pluginMeta.DocumentElement;
if (root is null) return;
if (pluginMetaRoot is null) return;
CheckJsonRequired(json, root, pluginMetaRoot);
CheckJsonRequired(json, root, pluginMetaRoot, dllName);
}
}
2 changes: 1 addition & 1 deletion ShadowPluginLoader.Tool/ShadowPluginLoader.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<IncludeBuildOutput>false</IncludeBuildOutput>
<NoWarn>NU5128;NU5129</NoWarn>

<Version>1.0.5.1</Version>
<Version>1.0.6.1</Version>
<PackageId>ShadowPluginLoader.Tool</PackageId>
<Owner>kitUIN</Owner>
<Authors>kitUIN</Authors>
Expand Down

0 comments on commit a7ef9ae

Please sign in to comment.