Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ name: Tests
# runs it as it is; a module calls it and is checked out into modules/ of a checkout of the core.
#
# Windows with the Visual Studio the native toolset asks for (Shared/Build/Stellar.Native.props), C++/CLI included.
#
# By itself only on the way into master; on any other branch by hand (Run workflow).

on:
workflow_dispatch:
push:
branches: [develop, master]
branches: [master]
pull_request:
branches: [master]
workflow_call:

permissions:
Expand Down
4 changes: 2 additions & 2 deletions Docs/Architecture/Sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ them, but Rider shows an item written in a project file as a file of the project
The SDK version is pinned once, in `global.json`, not in every project:

```json
{ "msbuild-sdks": { "Stellar.Sdk": "0.4.1" } }
{ "msbuild-sdks": { "Stellar.Sdk": "0.4.2" } }
```

The SDK itself comes from the local feed through `NuGet.config`. `stellar project new` and `stellar modules new`
Expand Down Expand Up @@ -136,7 +136,7 @@ NuGet cache: the next restore of a game takes the new ones.
| Target | Task | Result | Switch (`=false`) |
|---|---|---|---|
| `StellarResolveProject` | `ResolveStellarProject` | Parses `.stellar.project`, selects assets | `StellarEnableAssets` for the assets |
| `StellarCompileResources` | `CompileStellarResources` | `resources/**/*.sres` in the output | `StellarEnableResourceCompilation` |
| `StellarCompileResources` | `CompileStellarResources` | `Resources/**/*.sres` in the output | `StellarEnableResourceCompilation` |
| `StellarGenerateRuntimeConfiguration` | `GenerateRuntimeConfiguration` | `{Project}.stellar.runtime.config.json` | `StellarEnableRuntimeConfiguration` |
| `StellarGenerateLauncher` | `GenerateStellarLauncher` | The `Main` of an executable module | `StellarEnableLauncher` |

Expand Down
10 changes: 10 additions & 0 deletions Docs/Engine/GitPolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ git switch develop
git pull --ff-only
```

A pull request into `develop` waits for the marks and the CLA, not for the tests: they run by themselves only for
`master`. Test on your machine (`scripts/build.ps1`, `stellar modules build <module> --tests`), and to test a branch on
the server start it by hand, for example after several merges into `develop`: *Actions → Tests → Run workflow*, or

```powershell
gh workflow run tests.yml --ref develop
```

The button appears once the workflow is in `master`.

More commits on the same task before the merge: `git commit` and `git push`, the pull request takes them by itself.

Always a **merge commit**, never a squash or a rebase: those make other commits out of the same changes, and `develop`
Expand Down
25 changes: 25 additions & 0 deletions Docs/Engine/Versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,31 @@ After `v1.0.0`:

---

## 8. Versions of Components

Every component (`Shared/Build/Stellar.Versions.props`, `*.stellar.module`) has a version of its own. What counts is the
version of the last release, the one on `master`:

| Since the last release | Version |
|---|---|
| nothing that matters to others: formatting, tests, documentation | stays |
| the first compatible change | `Y` is raised, once: `0.10.0` → `0.10.1` |
| more compatible changes | stays: they go into the version that is raised already |
| a breaking change | `X` is raised, once, instead of `Y`: `0.10.1` → `0.11.0` |
| more changes of any kind after it | stays |

A change is breaking for a component when what uses it does not work with the new one as it is. A component that did not
change is raised only if it does not work with the old version of what it depends on. The orchestra takes `X` when any of
its components does, or when a module enters it.

Before raising, compare:

```powershell
git show origin/master:Shared/Build/Stellar.Versions.props
```

---

Also see:
- [GitPolicy.md](GitPolicy.md)
- [CONTRIBUTING.md](../../CONTRIBUTING.md)
Expand Down
2 changes: 1 addition & 1 deletion Docs/Formats/ProjectFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ and `.idea` are never searched.
| `Assets.Include` | Files copied to the output as they are |
| `Assets.Embedded` | Files embedded into the assembly. They win over `Include` |
| `Assets.Exclude` | Files removed from both lists |
| `Resources.Include` | Files compiled into `.sres` containers, in `resources/` of the output |
| `Resources.Include` | Files compiled into `.sres` containers, in `Resources/` of the output |
| `Resources.Compilers` | Assemblies with additional resource compilers |
| `Localizations.IndexFiles` | Index files. The culture is the file name before `.stellar.loc.index` |
| `Runtime` | The settings of the runtime ([Runtime](../Architecture/Runtime.md#settings)), and free-form values for modules. They reach `RuntimeConfiguration.Settings`: strings as they are, other values as JSON text |
Expand Down
38 changes: 35 additions & 3 deletions Docs/Migration-0.11.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,51 @@ number because the logging module enters it.
| Component | 0.10 | 0.11 | Why |
|---|---|---|---|
| Orchester | 0.10.0 | 0.11.0 | The logging module, and the file system published by its module |
| Kernel | 0.10.0 | 0.10.1 | Compatible: a color of `LoggerFormat.Default` |
| Kernel | 0.10.0 | 0.10.1 | Compatible: `Folders`; a color of `LoggerFormat.Default` |
| FileSystem | 0.9.0 | 0.11.0 | It publishes itself and mounts the folders of the engine |
| Runtime | 0.10.0 | 0.10.1 | Compatible: settings of the command line reach modules |
| Stellar.Tools | 0.3.2 | 0.3.3 | Compatible: marks; a module is packed before its tests |
| `stellar` (CLI) | 0.2.3 | 0.2.4 | Compatible: `stellar marks` |
| Core, Stellar.Sdk, P/Invoke exports | 0.10.0, 0.4.1, 3.1 | the same | Nothing changed |
| Stellar.Sdk | 0.4.1 | 0.4.2 | Compatible: compiled resources go into `Resources` |
| Core, P/Invoke exports | 0.10.0, 3.1 | the same | Nothing changed |

Build the engine again and install it (`scripts/build.ps1 -Configuration Release -Install`). `global.json` stays.
Build the engine again and install it (`scripts/build.ps1 -Configuration Release -Install`). `global.json` pins an exact version of
Stellar.Sdk, so change `0.4.1` to `0.4.2` in that of every solution:

```json
{ "msbuild-sdks": { "Stellar.Sdk": "0.4.2" } }
```

## Resources

Compiled resources lie in `Resources` next to the application, not `resources`: only a system that tells case apart sees
the difference.

## Settings

`RuntimeConfiguration.Settings` holds the settings of the project and those of the command line
(`--stellar:Name=Value`), which win; names are in any case. Before, a module saw those of the project only.

## File system

`Stellar.FileSystem` publishes `IFileSystem` by itself and mounts the folders of the engine. Code names them through
`Folders`, so it needs neither `Environment.GetFolderPath` nor the names of the domains:

| `Folders` | Domain | Where |
|---|---|---|
| `App` | `app://` | the folder of the application, read-only |
| `Assets` | `assets://` | `Assets` of it, read-only; the setting `AssetsFolder` moves it |
| `Resources` | `resources://` | `Resources` of it, read-only; the setting `ResourcesFolder` moves it |
| `AppData.Roaming` | `user://` | `<AppData>/<company>/<project>` |
| `AppData.Local` | `local://` | the same in the local data of the user |
| `AppData.LocalLow` | `locallow://` | the same in the low local data |
| `Temp` | `temp://` | the same in the temporary files |

The company is `Starlet` when the project names none; a project without a name has none of the last four. They are
created by the first write. Full paths of the machine, to mount domains of your own: `Stellar.FileSystem.SystemFolders`.

A cancelled or failed atomic write leaves the file as it was.

## Logging

When the module that published the logger stops, the runtime goes back to the error output: what fails after it is
Expand Down
41 changes: 41 additions & 0 deletions Kernel/src/Managed/Stellar.Kernel/FileSystem/Folders.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
namespace Stellar.Kernel.FileSystem;

/// <summary>
/// The folders of the engine, as paths of its domains: what a game names instead of locations of the machine.
/// </summary>
/// <remarks>
/// <para><c>Folders.AppData.Roaming.Combine("saves/slot1.json")</c> is <c>user://saves/slot1.json</c>. These are names
/// only, the same in every engine instance: where each lies is up to the file system of that instance.</para>
/// <para>The module Stellar.FileSystem mounts them when the engine starts. <see cref="Assets"/> and
/// <see cref="Resources"/> are there if the application has such folders, <see cref="AppData"/> and
/// <see cref="Temp"/> if it has a name.</para>
/// </remarks>
public static class Folders
{
/// <summary>Gets the folder of the application, read-only.</summary>
public static FilePath App { get; } = FilePath.Root("app");

/// <summary>Gets the assets of the application, read-only.</summary>
public static FilePath Assets { get; } = FilePath.Root("assets");

/// <summary>Gets the compiled resources of the application, read-only.</summary>
public static FilePath Resources { get; } = FilePath.Root("resources");

/// <summary>Gets the folder for files that may disappear once the application stops.</summary>
public static FilePath Temp { get; } = FilePath.Root("temp");

/// <summary>
/// The folders of the application among the data of the user.
/// </summary>
public static class AppData
{
/// <summary>Gets the data that follows the user from machine to machine: settings, saves.</summary>
public static FilePath Roaming { get; } = FilePath.Root("user");

/// <summary>Gets the data of this machine: caches, logs.</summary>
public static FilePath Local { get; } = FilePath.Root("local");

/// <summary>Gets the data of this machine a process with few rights may write.</summary>
public static FilePath LocalLow { get; } = FilePath.Root("locallow");
}
}
15 changes: 9 additions & 6 deletions SDK/src/MSBuild/Stellar.Sdk.Tasks/CompileStellarResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global

using System.Collections.Generic;
using System.IO;
using System.Linq;

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

using Stellar.Tools.Environment;
using Stellar.Tools.Projects;
using Stellar.Tools.Resources;
Expand Down Expand Up @@ -36,21 +39,21 @@ public sealed class CompileStellarResources
/// <inheritdoc/>
protected override void Run()
{
var project = StellarProject.Load(ConfigurationFile);
var sources = ProjectFileResolver.Resolve(project).Resources;
StellarProject project = StellarProject.Load(ConfigurationFile);
IReadOnlyList<ProjectFile> sources = ProjectFileResolver.Resolve(project).Resources;

var compilers = ResourceCompilerRegistry.CreateDefault();

if (!string.IsNullOrEmpty(StellarRoot))
compilers.AddFromDirectory(new StellarInstallation(StellarRoot).ResourceCompilers, this);

foreach (var assembly in project.Configuration.Resources?.Compilers ?? [])
foreach (string assembly in project.Configuration.Resources?.Compilers ?? [])
compilers.AddFrom(Path.Combine(project.Directory, assembly), this);

var outputRoot = Path.GetFullPath(Path.Combine(project.Directory, OutputDirectory))
string outputRoot = Path.GetFullPath(Path.Combine(project.Directory, OutputDirectory))
.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);

var result = new ResourcePipeline(compilers, this).Compile(sources, outputRoot);
ResourcePipelineResult result = new ResourcePipeline(compilers, this).Compile(sources, outputRoot);

Log.LogMessage(MessageImportance.High, $"Resource compilation result: " +
$"UpToDate - {result.UpToDate}, " +
Expand All @@ -61,7 +64,7 @@ protected override void Run()
.Select(output =>
{
var item = new TaskItem(output);
item.SetMetadata("Link", Path.Combine("resources", output.Substring(outputRoot.Length + 1)));
item.SetMetadata("Link", Path.Combine("Resources", output.Substring(outputRoot.Length + 1)));
item.SetMetadata("CopyToOutputDirectory", "PreserveNewest");
return (ITaskItem)item;
})
Expand Down
2 changes: 1 addition & 1 deletion Shared/Build/Stellar.Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<StellarCoreVersion>0.10.0</StellarCoreVersion>
<StellarRuntimeVersion>0.10.1</StellarRuntimeVersion>
<StellarToolsVersion>0.3.3</StellarToolsVersion>
<StellarSdkVersion>0.4.1</StellarSdkVersion>
<StellarSdkVersion>0.4.2</StellarSdkVersion>
<StellarCliVersion>0.2.4</StellarCliVersion>

<!-- Default version of the engine modules (Stellar.Engine and High-Level Modules) -->
Expand Down
5 changes: 4 additions & 1 deletion Shared/Templates/Modules/Managed/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Tests

# The module built and tested on the core, by the workflow of the core.
# By itself only on the way into master; on any other branch by hand (Run workflow).

on:
workflow_dispatch:
push:
branches: [develop, master]
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"allowPrerelease": false
},
"msbuild-sdks": {
"Stellar.Sdk": "0.4.1"
"Stellar.Sdk": "0.4.2"
}
}
Loading