Skip to content

Commit 269da8e

Browse files
committed
[ECO-4285] Updated package.cake and io.ably.nuspec
- Updated cake script to handle deltacodec merge for netframework, iOS and android - Updated tools.cake, made params quote safe - Added explicit dependencies for each target in io.ably.nuspec
1 parent c4581ce commit 269da8e

File tree

6 files changed

+97
-60
lines changed

6 files changed

+97
-60
lines changed

cake-build/helpers/test-execution.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public class TestExecutionHelper
106106
public FilePathCollection FindTestAssemblies(string projectRelativePath, string pattern = "IO.Ably.Tests.*.dll")
107107
{
108108
var projectPath = _paths.Src.Combine(projectRelativePath);
109-
var searchPath = projectPath.Combine("bin/Release").FullPath + "/" + pattern;
109+
var searchPath = projectPath.Combine("bin/Release").Combine(pattern).FullPath;
110110
var testAssemblies = _context.GetFiles(searchPath);
111111

112112
if (!testAssemblies.Any())

cake-build/helpers/tools.cake

Lines changed: 68 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ public class ILRepackHelper
3030
var exitCode = _context.StartProcess(ilRepackPath.FullPath, new ProcessSettings
3131
{
3232
Arguments = new ProcessArgumentBuilder()
33-
.Append($"/lib:{sourcePath.FullPath}")
33+
.Append($"/lib:\"{sourcePath.FullPath}\"")
3434
.Append("/targetplatform:v4")
3535
.Append("/internalize")
36-
.Append($"/attr:{targetDll.FullPath}")
37-
.Append($"/keyfile:{rootDir.CombineWithFilePath("IO.Ably.snk").FullPath}")
36+
.Append($"/attr:\"{targetDll.FullPath}\"")
37+
.Append($"/keyfile:\"{rootDir.CombineWithFilePath("IO.Ably.snk").FullPath}\"")
3838
.Append("/parallel")
39-
.Append($"/out:{outputDll.FullPath}")
40-
.Append(targetDll.FullPath)
41-
.Append(jsonNetDll.FullPath)
39+
.Append($"/out:\"{outputDll.FullPath}\"")
40+
.Append($"\"{targetDll.FullPath}\"")
41+
.Append($"\"{jsonNetDll.FullPath}\"")
4242
});
4343

4444
if (exitCode != 0)
@@ -60,7 +60,7 @@ public class ILRepackHelper
6060
var targetDll = outputPath.CombineWithFilePath("IO.Ably.dll");
6161
var docsFile = outputPath.CombineWithFilePath("IO.Ably.xml");
6262
var deltaCodecDll = sourcePath.CombineWithFilePath("IO.Ably.DeltaCodec.dll");
63-
var tempOutputDll = outputPath.CombineWithFilePath("IO.Ably.merged.dll");
63+
var tempInputDll = outputPath.CombineWithFilePath("IO.Ably.temp.dll");
6464

6565
if (!_context.FileExists(deltaCodecDll))
6666
{
@@ -80,30 +80,72 @@ public class ILRepackHelper
8080
var rootDir = _context.MakeAbsolute(_context.Directory("../"));
8181
var ilRepackPath = rootDir.CombineWithFilePath("tools/ilrepack.exe");
8282

83-
// Merge DeltaCodec into the existing IO.Ably.dll
84-
var exitCode = _context.StartProcess(ilRepackPath.FullPath, new ProcessSettings
83+
// Copy target DLL to temp location to avoid input/output conflict
84+
_context.CopyFile(targetDll, tempInputDll);
85+
86+
// Backup PDB and config files
87+
var targetPdb = outputPath.CombineWithFilePath("IO.Ably.pdb");
88+
var tempInputPdb = outputPath.CombineWithFilePath("IO.Ably.temp.pdb");
89+
if (_context.FileExists(targetPdb))
8590
{
86-
Arguments = new ProcessArgumentBuilder()
87-
.Append($"/lib:{sourcePath.FullPath}")
88-
.Append($"/lib:{outputPath.FullPath}")
89-
.Append("/targetplatform:v4")
90-
.Append("/internalize")
91-
.Append($"/attr:{targetDll.FullPath}")
92-
.Append($"/keyfile:{rootDir.CombineWithFilePath("IO.Ably.snk").FullPath}")
93-
.Append("/parallel")
94-
.Append($"/out:{tempOutputDll.FullPath}")
95-
.Append(targetDll.FullPath)
96-
.Append(deltaCodecDll.FullPath)
97-
});
91+
_context.CopyFile(targetPdb, tempInputPdb);
92+
}
9893

99-
if (exitCode != 0)
94+
var targetConfig = outputPath.CombineWithFilePath("IO.Ably.dll.config");
95+
var tempInputConfig = outputPath.CombineWithFilePath("IO.Ably.temp.dll.config");
96+
if (_context.FileExists(targetConfig))
10097
{
101-
throw new Exception($"ILRepack failed with exit code {exitCode}");
98+
_context.CopyFile(targetConfig, tempInputConfig);
10299
}
103100

104-
// Replace original with merged version
105-
_context.DeleteFile(targetDll);
106-
_context.MoveFile(tempOutputDll, targetDll);
101+
try
102+
{
103+
// Merge DeltaCodec into IO.Ably.dll (output directly with correct name)
104+
var exitCode = _context.StartProcess(ilRepackPath.FullPath, new ProcessSettings
105+
{
106+
Arguments = new ProcessArgumentBuilder()
107+
.Append($"/lib:\"{sourcePath.FullPath}\"")
108+
.Append($"/lib:\"{outputPath.FullPath}\"")
109+
.Append("/targetplatform:v4")
110+
.Append("/internalize")
111+
.Append($"/attr:\"{tempInputDll.FullPath}\"")
112+
.Append($"/keyfile:\"{rootDir.CombineWithFilePath("IO.Ably.snk").FullPath}\"")
113+
.Append("/parallel")
114+
.Append($"/out:\"{targetDll.FullPath}\"")
115+
.Append($"\"{tempInputDll.FullPath}\"")
116+
.Append($"\"{deltaCodecDll.FullPath}\"")
117+
});
118+
119+
if (exitCode != 0)
120+
{
121+
throw new Exception($"ILRepack failed with exit code {exitCode}");
122+
}
123+
}
124+
finally
125+
{
126+
// Clean up temp files
127+
if (_context.FileExists(tempInputDll))
128+
{
129+
_context.DeleteFile(tempInputDll);
130+
}
131+
if (_context.FileExists(tempInputPdb))
132+
{
133+
_context.DeleteFile(tempInputPdb);
134+
}
135+
if (_context.FileExists(tempInputConfig))
136+
{
137+
_context.DeleteFile(tempInputConfig);
138+
}
139+
}
140+
141+
// Clean up DeltaCodec files from output path since they're now merged
142+
var deltaCodecFiles = _context.GetFiles(outputPath.Combine("IO.Ably.DeltaCodec.*").FullPath);
143+
144+
foreach (var file in deltaCodecFiles)
145+
{
146+
_context.DeleteFile(file);
147+
_context.Information($"Cleaned up: {file.GetFilename()}");
148+
}
107149

108150
_context.Information($"✓ DeltaCodec merged into {targetDll}");
109151
}

cake-build/helpers/utils.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void RestoreSolution(FilePath solutionPath)
3636
// On macOS/Linux, use nuget command (installed via mono)
3737
StartProcess("nuget", new ProcessSettings
3838
{
39-
Arguments = $"restore {solutionPath.FullPath} -Verbosity quiet"
39+
Arguments = $"restore \"{solutionPath.FullPath}\" -Verbosity quiet"
4040
});
4141
}
4242
}

cake-build/tasks/package.cake

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Task("_Package_Merge_JsonNet")
5151
}
5252

5353
var binPath = projectPath.Combine("bin/Release");
54-
var packagedPath = binPath.Combine("packaged");
54+
var packagedPath = binPath.Combine("Packaged");
5555

5656
if (!DirectoryExists(binPath))
5757
{
@@ -61,8 +61,8 @@ Task("_Package_Merge_JsonNet")
6161

6262
Information($"Processing {project}...");
6363

64-
// Copy all IO.Ably* files to packaged folder
65-
var ablyFiles = GetFiles(binPath.FullPath + "/IO.Ably*");
64+
// Copy all IO.Ably* files to Packaged folder
65+
var ablyFiles = GetFiles(binPath.Combine("IO.Ably*").FullPath);
6666
EnsureDirectoryExists(packagedPath);
6767
CopyFiles(ablyFiles, packagedPath);
6868

@@ -96,7 +96,7 @@ Task("_Package_Merge_DeltaCodec")
9696
}
9797

9898
var binPath = projectPath.Combine("bin/Release");
99-
var packagedPath = binPath.Combine("packaged");
99+
var packagedPath = binPath.Combine("Packaged");
100100

101101
if (!DirectoryExists(packagedPath))
102102
{
@@ -107,29 +107,6 @@ Task("_Package_Merge_DeltaCodec")
107107
Information($"Merging DeltaCodec for {project}...");
108108
ilRepackHelper.MergeDeltaCodec(binPath, packagedPath);
109109
}
110-
111-
// Modern platforms (.NET Standard, .NET 6, .NET 7)
112-
var netStandardProject = paths.Src.Combine("IO.Ably.NETStandard20");
113-
114-
if (DirectoryExists(netStandardProject))
115-
{
116-
var targetFrameworks = new[] { "netstandard2.0", "net6.0", "net7.0" };
117-
118-
foreach (var framework in targetFrameworks)
119-
{
120-
var binPath = netStandardProject.Combine($"bin/Release/{framework}");
121-
122-
if (!DirectoryExists(binPath))
123-
{
124-
Warning($"Bin directory not found for {framework}, skipping...");
125-
continue;
126-
}
127-
128-
Information($"Merging DeltaCodec for {framework}...");
129-
// For .NET Standard, merge in-place (no separate packaged folder)
130-
ilRepackHelper.MergeDeltaCodec(binPath, binPath);
131-
}
132-
}
133110
});
134111

135112
Task("_Package_Create_NuGet")
@@ -257,7 +234,7 @@ Task("_Package_Unity")
257234
Information("Cloning unity-packager repository...");
258235
StartProcess("git", new ProcessSettings
259236
{
260-
Arguments = "clone https://github.com/ably-forks/unity-packager.git -b v1.0.0 unity-packager",
237+
Arguments = $"clone https://github.com/ably-forks/unity-packager.git -b v1.0.0 \"{unityPackagerPath.FullPath}\"",
261238
WorkingDirectory = paths.Root
262239
});
263240
}
@@ -273,8 +250,8 @@ Task("_Package_Unity")
273250
Information("Building Unity package...");
274251
StartProcess("dotnet", new ProcessSettings
275252
{
276-
Arguments = $"run --project {unityPackagerProject.FullPath} " +
277-
$"-project unity -output {outputPath.FullPath} -dir Assets/Ably",
253+
Arguments = $"run --project \"{unityPackagerProject.FullPath}\" " +
254+
$"-project \"{paths.Root.Combine("unity").FullPath}\" -output \"{outputPath.FullPath}\" -dir Assets/Ably",
278255
WorkingDirectory = paths.Root
279256
});
280257

nuget/io.ably.nuspec

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,28 @@
1414
<copyright>©2022 Ably</copyright>
1515
<language />
1616
<dependencies>
17-
<group>
17+
<group targetFramework="net46">
18+
<dependency id="System.Threading.Channels" version="4.6.0" />
19+
</group>
20+
<group targetFramework="monoandroid">
21+
<dependency id="System.Threading.Channels" version="4.6.0" />
22+
</group>
23+
<group targetFramework="Xamarin.iOS">
24+
<dependency id="System.Threading.Channels" version="4.6.0" />
25+
</group>
26+
<group targetFramework="monotouch">
1827
<dependency id="System.Threading.Channels" version="4.6.0" />
1928
</group>
2029
<group targetFramework="netstandard2.0">
30+
<dependency id="System.Threading.Channels" version="4.6.0" />
31+
<dependency id="Newtonsoft.Json" version="9.0.1" />
32+
</group>
33+
<group targetFramework="net6.0">
34+
<dependency id="System.Threading.Channels" version="4.6.0" />
35+
<dependency id="Newtonsoft.Json" version="9.0.1" />
36+
</group>
37+
<group targetFramework="net7.0">
38+
<dependency id="System.Threading.Channels" version="4.6.0" />
2139
<dependency id="Newtonsoft.Json" version="9.0.1" />
2240
</group>
2341
</dependencies>

src/IO.Ably.Shared/Realtime/ChannelMessageProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public Task<bool> MessageReceived(ProtocolMessage protocolMessage, RealtimeState
9898
if (channel.State != ChannelState.Attached)
9999
{
100100
Logger.Warning(
101-
$"Channel #{channel.Name} is currently in #{channel.State} state. Messages received in this state are ignored. Ignoring ${protocolMessage.Messages?.Length ?? 0} messages");
101+
$"Channel #{channel.Name} is currently in #{channel.State} state. Messages received in this state are ignored. Ignoring {protocolMessage.Messages?.Length ?? 0} messages");
102102
return TaskConstants.BooleanTrue;
103103
}
104104

0 commit comments

Comments
 (0)