Skip to content

Commit 5e2c8d5

Browse files
committed
简化逻辑
1 parent e272abf commit 5e2c8d5

File tree

3 files changed

+66
-64
lines changed

3 files changed

+66
-64
lines changed

unity/test/dotnet/Src/WrapperGenerator/WrapperGenerate.cs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using Puerts;
99
using System.Collections.Generic;
1010
using System;
11+
using System.IO;
12+
using System.Text;
1113

1214
[Configure]
1315
public class WrapperGenConfig
@@ -87,13 +89,24 @@ public class PuerGen
8789
{
8890
public static void Main()
8991
{
90-
Puerts.Editor.Generator.FileExporter.ExportWrapper(
91-
TxtLoader.PathToBinDir("../../../Src/StaticWrapper/"),
92-
new TxtLoader()
93-
);
94-
Puerts.Editor.Generator.FileExporter.GenRegisterInfo(
95-
TxtLoader.PathToBinDir("../../../Src/StaticWrapper/"),
96-
new TxtLoader()
97-
);
92+
var outDir = TxtLoader.PathToBinDir("../../../Src/StaticWrapper/");
93+
Directory.CreateDirectory(outDir);
94+
using (StreamWriter textWriter = new StreamWriter(Path.Combine(outDir, "RegisterInfo_Gen.cs"), false, Encoding.UTF8))
95+
{
96+
textWriter.Write(@"namespace PuertsStaticWrap
97+
{
98+
#if !PUERTS_GENERAL
99+
[UnityEngine.Scripting.Preserve]
100+
#endif
101+
public static class PuerRegisterInfo_Gen
102+
{
103+
public static void AddRegisterInfoGetterIntoJsEnv(Puerts.JsEnv jsEnv)
104+
{
105+
}
106+
}
107+
}
108+
");
109+
textWriter.Flush();
110+
}
98111
}
99112
}
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
/*
2-
* Tencent is pleased to support the open source community by making Puerts available.
3-
* Copyright (C) 2020 Tencent. All rights reserved.
4-
* Puerts is licensed under the BSD 3-Clause License, except for the third-party components listed in the file 'LICENSE' which may be subject to their corresponding license terms.
5-
* This file is subject to the terms and conditions defined in file 'LICENSE', which is part of this source code package.
6-
*/
7-
using System.IO;
8-
using System.Text;
9-
10-
namespace Puerts.Editor
11-
{
12-
namespace Generator
13-
{
14-
public class FileExporter
15-
{
16-
public static void ExportWrapper(string saveTo, ILoader loader = null)
17-
{
18-
}
19-
20-
public static void GenRegisterInfo(string outDir, ILoader loader = null)
21-
{
22-
using (StreamWriter textWriter = new StreamWriter(Path.Combine(outDir, "RegisterInfo_Gen.cs"), false, Encoding.UTF8))
23-
{
24-
textWriter.Write(@"namespace PuertsStaticWrap
25-
{
26-
#if !PUERTS_GENERAL
27-
[UnityEngine.Scripting.Preserve]
28-
#endif
29-
public static class PuerRegisterInfo_Gen
30-
{
31-
public static void AddRegisterInfoGetterIntoJsEnv(Puerts.JsEnv jsEnv)
32-
{
33-
}
34-
}
35-
}
36-
");
37-
textWriter.Flush();
38-
}
39-
40-
#if UNITY_2020_1_OR_NEWER && !PUERTS_GENERAL
41-
PuertsIl2cpp.Editor.Generator.CSharpFileExporter.GenExtensionMethodInfos(outDir);
42-
#endif
43-
}
44-
}
45-
}
1+
/*
2+
* Tencent is pleased to support the open source community by making Puerts available.
3+
* Copyright (C) 2020 Tencent. All rights reserved.
4+
* Puerts is licensed under the BSD 3-Clause License, except for the third-party components listed in the file 'LICENSE' which may be subject to their corresponding license terms.
5+
* This file is subject to the terms and conditions defined in file 'LICENSE', which is part of this source code package.
6+
*/
7+
using System.IO;
8+
using System.Text;
9+
10+
namespace Puerts.Editor
11+
{
12+
namespace Generator
13+
{
14+
public class FileExporter
15+
{
16+
public static void ExportWrapper(string saveTo, ILoader loader = null)
17+
{
18+
}
19+
20+
public static void GenRegisterInfo(string outDir, ILoader loader = null)
21+
{
22+
using (StreamWriter textWriter = new StreamWriter(Path.Combine(outDir, "RegisterInfo_Gen.cs"), false, Encoding.UTF8))
23+
{
24+
textWriter.Write(@"namespace PuertsStaticWrap
25+
{
26+
#if !PUERTS_GENERAL
27+
[UnityEngine.Scripting.Preserve]
28+
#endif
29+
public static class PuerRegisterInfo_Gen
30+
{
31+
public static void AddRegisterInfoGetterIntoJsEnv(Puerts.JsEnv jsEnv)
32+
{
33+
}
34+
}
35+
}
36+
");
37+
textWriter.Flush();
38+
}
39+
40+
#if UNITY_2020_1_OR_NEWER && !PUERTS_GENERAL
41+
PuertsIl2cpp.Editor.Generator.CSharpFileExporter.GenExtensionMethodInfos(outDir);
42+
#endif
43+
}
44+
}
45+
}
4646
}

unity/upms/core/Editor/Src/Generator/IL2Cpp/UnityMenu.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,6 @@ public static void ClearAll()
3434
AssetDatabase.Refresh();
3535
}
3636
}
37-
38-
//[MenuItem(PUERTS_MENU_PREFIX + "/Generate/RegisterInfo", false, 7)]
39-
public static void GenRegisterInfo()
40-
{
41-
var start = DateTime.Now;
42-
var saveTo = Puerts.Configure.GetCodeOutputDirectory();
43-
Directory.CreateDirectory(saveTo);
44-
//FileExporter.GenRegisterInfo(saveTo);
45-
Debug.Log("finished! use " + (DateTime.Now - start).TotalMilliseconds + " ms Outputed to " + saveTo);
46-
AssetDatabase.Refresh();
47-
}
4837
}
4938
}
5039
}

0 commit comments

Comments
 (0)