Skip to content

Commit e6cfcfb

Browse files
author
Unity Technologies
committed
com.unity.services.cloudcode@2.7.1
## [2.7.1] - 2024-06-10 ### Added - A MessageBytesReceived callback has been added to the available subscription event callbacks - Adding service registration to the core services registry - Adding service access through the core services registry (`UnityServices.Instance.GetCloudCodeService()`) - Added a button to browse your files when choosing a path for a Cloud Code Module ### Changed - The MessageReceived callback will no longer be fired upon receiving bytes via the event subscription ### Fixed - Bindings generation is broken when ILogger dependency injection is used - Cloud Code modules now cleans up compilation artifacts after deploying or generating bindings - Cloud Code runtime timeout increased to 30 seconds - Moved create Cloud Code Asset menu items under "Services"
1 parent bebb660 commit e6cfcfb

58 files changed

Lines changed: 3582 additions & 119 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ All notable changes to this package will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [2.7.1] - 2024-06-10
8+
9+
### Added
10+
- A MessageBytesReceived callback has been added to the available subscription event callbacks
11+
- Adding service registration to the core services registry
12+
- Adding service access through the core services registry (`UnityServices.Instance.GetCloudCodeService()`)
13+
- Added a button to browse your files when choosing a path for a Cloud Code Module
14+
15+
### Changed
16+
- The MessageReceived callback will no longer be fired upon receiving bytes via the event subscription
17+
18+
### Fixed
19+
- Bindings generation is broken when ILogger dependency injection is used
20+
- Cloud Code modules now cleans up compilation artifacts after deploying or generating bindings
21+
- Cloud Code runtime timeout increased to 30 seconds
22+
- Moved create Cloud Code Asset menu items under "Services"
23+
724
## [2.6.2] - 2024-05-03
825

926
### Added

Documentation~/Authoring/cloud_code_modules.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ For example, if your reference file is called `test_module.ccmr`, your default s
133133

134134
You can deploy modules through the Deployment window. You can also deploy automatically when you enter the Play mode in the Unity Editor.
135135

136+
By default, the deployment is based on the `Release` build configuration of your solution. This configuration should avoid including extra content such as test projects to reduce the size. To learn more on build configurations, visit [Rider](https://www.jetbrains.com/help/rider/Build_Configurations.html) or [Visual Studio](https://learn.microsoft.com/en-us/visualstudio/ide/understanding-build-configurations?view=vs-2022)'s documentation.
137+
136138
Check the [Deployment package manual](https://docs.unity3d.com/Packages/com.unity.services.deployment@latest) for more information .
137139

138140
You can verify the deployment is successful by calling the module endpoints. The template module contains a default endpoint called `SayHello`.

Documentation~/Authoring/cloud_code_scripts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Creation
44

5-
Right-click on the `Project Window` then select `Create > Cloud Code Js Script` to create a Cloud Code Script.
5+
Right-click on the `Project Window` then select `Create > Services > Cloud Code Js Script` to create a Cloud Code Script.
66

77
## Parameters
88

Documentation~/Authoring/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ becomes a simple task.
3333

3434
### Create Scripts
3535

36-
Right-click on the `Project Window` then select `Create > Cloud Code Js Script` to create a Cloud Code Script.
36+
Right-click on the `Project Window` then select `Create > Services > Cloud Code Js Script` to create a Cloud Code Script.
3737

3838
The Deployment Window automatically detects these files to be deployed at a later time.
3939

@@ -53,7 +53,7 @@ For the best experience please make sure that you have NodeJS installed and that
5353

5454
### Create C# Modules
5555

56-
Right-click on the `Project Window` then select `Create > Cloud Code C# Module Reference` to create a Cloud Code Module Reference.
56+
Right-click on the `Project Window` then select `Create > Services > Cloud Code C# Module Reference` to create a Cloud Code Module Reference.
5757

5858
The Deployment Window automatically detects these files to be generated then deployed at a later time.
5959

-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
2.5 KB
Binary file not shown.
Binary file not shown.

Editor/Authoring/Core/Deployment/ModuleGeneration/ModuleBuilder.cs

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System;
21
using System.IO;
32
using System.Threading;
43
using System.Threading.Tasks;
54
using Unity.Services.CloudCode.Authoring.Editor.Core.Deployment.ModuleGeneration.Exceptions;
5+
using Unity.Services.CloudCode.Authoring.Editor.Core.IO;
66
using Unity.Services.CloudCode.Authoring.Editor.Core.Model;
77
using Unity.Services.DeploymentApi.Editor;
88

@@ -13,15 +13,18 @@ class ModuleBuilder : IModuleBuilder
1313
readonly ISolutionPublisher m_SolutionPublisher;
1414
readonly IModuleProjectRetriever m_ProjectRetriever;
1515
readonly IModuleZipper m_ModuleZipper;
16+
readonly IFileSystem m_FileSystem;
1617

1718
public ModuleBuilder(
1819
ISolutionPublisher solutionPublisher,
1920
IModuleProjectRetriever projectRetriever,
20-
IModuleZipper moduleZipper)
21+
IModuleZipper moduleZipper,
22+
IFileSystem fileSystem)
2123
{
2224
m_SolutionPublisher = solutionPublisher;
2325
m_ProjectRetriever = projectRetriever;
2426
m_ModuleZipper = moduleZipper;
27+
m_FileSystem = fileSystem;
2528
}
2629

2730
public async Task CreateCloudCodeModuleFromSolution(
@@ -32,13 +35,33 @@ public async Task CreateCloudCodeModuleFromSolution(
3235
var tempFolderPath = Path.Combine(Path.GetTempPath(), slnName);
3336
var slnOutputPath = Path.Combine(tempFolderPath, "module-compilation");
3437

35-
if (!SetAndValidateEntryProject(deploymentItem))
36-
return;
38+
try
39+
{
40+
await ClearModuleCompilationFolder(slnOutputPath);
41+
42+
if (!SetAndValidateEntryProject(deploymentItem))
43+
return;
3744

38-
if (!await Publish(deploymentItem, slnOutputPath, cancellationToken) || cancellationToken.IsCancellationRequested)
45+
if (!await Publish(deploymentItem, slnOutputPath, cancellationToken) ||
46+
cancellationToken.IsCancellationRequested)
47+
return;
48+
49+
await Zip(deploymentItem, slnOutputPath, tempFolderPath, cancellationToken);
50+
}
51+
finally
52+
{
53+
await ClearModuleCompilationFolder(slnOutputPath);
54+
}
55+
}
56+
57+
async Task ClearModuleCompilationFolder(string slnOutputPath)
58+
{
59+
if (!m_FileSystem.DirectoryExists(slnOutputPath))
60+
{
3961
return;
62+
}
4063

41-
await Zip(deploymentItem, slnOutputPath, tempFolderPath, cancellationToken);
64+
await m_FileSystem.DeleteDirectory(slnOutputPath, true);
4265
}
4366

4467
bool SetAndValidateEntryProject(IModuleItem deploymentItem)

Editor/Authoring/Deployment/GenerateSolutionCommand.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ public static Task GenerateSolution(CloudCodeModuleReference ccmr, CancellationT
7171
Path.GetDirectoryName(targetPath),
7272
Path.GetFileNameWithoutExtension(targetPath), cancellationToken);
7373

74-
if (generationTask.IsCompletedSuccessfully)
74+
generationTask.ContinueWith(generation =>
7575
{
76-
m_Logger.Log($"Solution {solutionName} generated successfully.");
77-
}
76+
if (generation.IsCompletedSuccessfully)
77+
{
78+
m_Logger.Log($"Solution '{solutionName}' generated successfully.");
79+
}
80+
}, cancellationToken);
7881
}
7982

8083
return generationTask;

0 commit comments

Comments
 (0)