Skip to content

Commit decc1a6

Browse files
committed
Fix unitypackage DLLs is getting stripped
1 parent 432d869 commit decc1a6

File tree

1 file changed

+40
-5
lines changed

1 file changed

+40
-5
lines changed

src/BitMono.Unity/Editor/PackageExporter.cs

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ namespace BitMono.Editor
1010
{
1111
public static class PackageExporter
1212
{
13+
private static bool _verboseLogging;
14+
15+
[MenuItem("BitMono/Test Export Package")]
16+
public static void TestExportPackage()
17+
{
18+
// Set test values for local testing
19+
Environment.SetEnvironmentVariable("VERSION", "test");
20+
Environment.SetEnvironmentVariable("UNITY_VERSION", Application.unityVersion);
21+
22+
Debug.Log("=== BitMono Package Export Test ===");
23+
_verboseLogging = true;
24+
ExportPackage();
25+
_verboseLogging = false;
26+
}
27+
1328
public static void ExportPackage()
1429
{
1530
try
@@ -58,7 +73,8 @@ public static void ExportPackage()
5873
if (File.Exists(assetPath))
5974
{
6075
assetsToInclude.Add(assetPath);
61-
Debug.Log($"Including: {assetPath}");
76+
if (_verboseLogging)
77+
Debug.Log($"Including: {assetPath}");
6278
}
6379
else
6480
{
@@ -73,9 +89,24 @@ public static void ExportPackage()
7389
.Where(f => !f.EndsWith(".meta"))
7490
.Select(f => f.Replace(Application.dataPath, "Assets").Replace("\\", "/"))
7591
.ToArray();
76-
92+
7793
assetsToInclude.AddRange(cliFiles);
78-
Debug.Log($"Including {cliFiles.Length} files from BitMono.CLI folder");
94+
var dllCount = cliFiles.Count(f => f.EndsWith(".dll"));
95+
Debug.Log($"Including {cliFiles.Length} files from BitMono.CLI folder ({dllCount} DLLs)");
96+
97+
// Verbose: list individual DLLs for debugging
98+
if (_verboseLogging)
99+
{
100+
var dllFiles = cliFiles.Where(f => f.EndsWith(".dll")).ToArray();
101+
foreach (var dll in dllFiles.Take(10))
102+
{
103+
Debug.Log($" - {Path.GetFileName(dll)}");
104+
}
105+
if (dllFiles.Length > 10)
106+
{
107+
Debug.Log($" ... and {dllFiles.Length - 10} more DLLs");
108+
}
109+
}
79110
}
80111
else
81112
{
@@ -88,9 +119,13 @@ public static void ExportPackage()
88119
EditorApplication.Exit(1);
89120
return;
90121
}
91-
122+
92123
Debug.Log($"Total assets to export: {assetsToInclude.Count}");
93-
124+
125+
// Refresh the AssetDatabase to ensure all newly copied files are imported
126+
// This is critical for CLI DLLs that are copied during CI before export
127+
AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
128+
94129
AssetDatabase.ExportPackage(
95130
assetsToInclude.ToArray(),
96131
outputPath,

0 commit comments

Comments
 (0)