Skip to content

Commit e0e2795

Browse files
committed
ok we're ready
1 parent abb6fcc commit e0e2795

4 files changed

Lines changed: 93 additions & 33 deletions

File tree

.github/workflows/dotnet_build_release.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [windows-latest, ubuntu-latest, macos-latest]
15-
arch: [x64, x86]
15+
arch: [x64, x86, arm64]
1616
exclude:
1717
- os: macos-latest
1818
arch: x86
19+
- os: windows-latest
20+
arch: arm64
1921

2022
steps:
2123
# Checkout the repo
@@ -34,9 +36,8 @@ jobs:
3436
if: matrix.os != 'windows-latest'
3537
run: dotnet build RedSeaMarkupLanguage.sln -c Release -p:Platform=${{ matrix.arch }}
3638

37-
# to uncomment if I add unit testing
38-
#- name: Run tests
39-
# run: dotnet test ./RSML.Tests/RSML.Tests.csproj --no-build
39+
- name: Run tests
40+
run: dotnet test ./RSML.Tests/RSML.Tests.csproj --no-build
4041

4142
- name: Pack & push to NuGet
4243
if: github.event_name == 'push' && matrix.os == 'windows-latest' && matrix.arch == 'x64'
@@ -55,26 +56,28 @@ jobs:
5556
5657
- name: Publish CLI archives (Windows)
5758
if: matrix.os == 'windows-latest' && matrix.arch == 'x64'
59+
shell: pwsh
5860
run: |
5961
dotnet publish ./RSML.CLI/RSML.CLI.csproj -c Release -r win-${{ matrix.arch }} --self-contained true -o publish
60-
6162
cd publish
6263
Compress-Archive -Path * -DestinationPath ../RSML.CLI-windows-latest-${{ matrix.arch }}.zip
6364
tar -czf ../RSML.CLI-windows-latest-${{ matrix.arch }}.tar.gz *
6465
cd ..
65-
shell: pwsh
6666
6767
- name: Publish CLI archives (Linux and MacOS)
6868
if: matrix.os != 'windows-latest'
69+
shell: bash
6970
run: |
70-
dotnet publish ./RSML.CLI/RSML.CLI.csproj -c Release -r ${{ matrix.os == 'ubuntu-latest' && 'linux-x64' || 'osx-x64' }} --self-contained true -o publish
71-
71+
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
72+
RID="${{ matrix.os == 'ubuntu-latest' && 'linux-arm64' || 'osx-arm64' }}"
73+
else
74+
RID="${{ matrix.os == 'ubuntu-latest' && 'linux-x64' || 'osx-x64' }}"
75+
fi
76+
dotnet publish ./RSML.CLI/RSML.CLI.csproj -c Release -r $RID --self-contained true -o publish
7277
cd publish
7378
zip -r ../RSML.CLI-${{ matrix.os }}-${{ matrix.arch }}.zip .
7479
tar -czf ../RSML.CLI-${{ matrix.os }}-${{ matrix.arch }}.tar.gz .
7580
cd ..
76-
77-
# maybe build docs here???
7881
7982
- name: Upload CLI artifacts (Windows)
8083
if: matrix.os == 'windows-latest' && matrix.arch == 'x64'
@@ -120,7 +123,6 @@ jobs:
120123
files: |
121124
./release-assets/**/**/*.zip
122125
./release-assets/**/**/*.tar.gz
123-
./release-assets/**/**/*.nupkg
124126
env:
125127
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126128

README.md

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,52 @@
1111

1212
> The modern fork of [MF's Crossroad](https://github.com/MF366-Coding/MFRoad) we're sure you'll love.
1313
14-
<hr />
14+
---
1515

16-
## Coming Soon*er*: RSML v2.0.0
17-
> [!NOTE]
18-
> RSML v2.0.0 is coming first as a `prerelease`. To be exact, this will be `prerelease8` with no native interop support
19-
> yet.
16+
## RSML v2.0.0 is here. What's next?
17+
- [ ] Finishing a stable version of `RSML.Native`
18+
- [ ] Creating a Python package for RSML
19+
- [ ] Creating documentation
2020

21-
**Red Sea Markup Language v2.0.0** is currently **in the making** and will be a huge release, bringing native binding
22-
support into the table _(this also means AOT "friendliness")_, which will let you use RSML in Python, Go, Rust _(if
23-
you're about that)_, wherever you want, really _(that supports native interop)_.
21+
---
2422

25-
RSML v2.0.0 will also improve the current API **a lot**, as v1.0.5 still has its fair share of issues, not to
26-
mention [RSML for Python](https://github.com/OceanApocalypseStudios/RSML.Python)'s ones.
23+
## CLI v2.0.0: An Improved Experience
24+
The CLI now has a **lot** more power. You can evaluate and tokenize RSML directly from the commandline and adjust things like what machine it's evaluating for, via JSON.
25+
26+
---
27+
28+
## Shells and JSON (CLI Issue)
29+
We encountered issues with JSON parsing via commandline arguments in certain shells, where even escaping quotes failed.
30+
31+
We present the solutions to said issues here.
32+
33+
Speaking of JSON, the schema for **local-machine parsing** can be found [**here**](https://oceanapocalypsestudios.org/schemas/rsml_cli_machine_schema.json).
34+
35+
### Bash
36+
Bash did not present any issues.
37+
38+
```bash
39+
./RSML.CLI.exe evaluate -m "{ \"processor\": { \"architecture\": \"arm64\" } }"
40+
```
41+
42+
### PowerShell
43+
PowerShell presented a weird issue, where the quotes enveloping the property names seemed to vanish. Even escaping or introducing a here-string failed.
44+
45+
The solution was a weird one, since usually escaping via `""` is done on CMD only.
46+
47+
```powershell
48+
.\RSML.CLI.exe evaluate -m '{ ""test"": ""value"" }'
49+
```
50+
51+
### CMD
52+
The CMD did not present any issues.
53+
54+
```batch
55+
.\RSML.CLI.exe evaluate -m "{ ""test"": ""value"" }"
56+
```
57+
58+
---
2759

28-
<hr />
2960

3061
## See Also
3162
<ul>

RSML.CLI/Helpers/LocalMachineOutput.cs

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,47 @@ public static LocalMachine FromJson(string? json)
140140

141141
using var document = JsonDocument.Parse(json);
142142

143-
var system = document.RootElement.GetProperty("system");
144-
string? sysName = system.GetProperty("name").GetString();
145-
int sysVersion = system.GetProperty("version").GetInt32();
143+
string? systemName = null!;
144+
int systemVersion = -1;
146145

147-
var linuxDistro = document.RootElement.GetProperty("linuxDistro");
148-
string? distroName = linuxDistro.GetProperty("name").GetString();
149-
string? distroFamily = linuxDistro.GetProperty("family").GetString();
146+
string? distroName = null!;
147+
string? distroFamily = null!;
150148

151-
string? procArch = document.RootElement.GetProperty("processor").GetProperty("architecture").GetString();
149+
string? processorArchitecture = null!;
152150

153-
if (sysName == "linux")
154-
return new(distroName, distroFamily, procArch, sysVersion);
151+
if (document.RootElement.TryGetProperty("system", out var system))
152+
{
155153

156-
return new(sysName, procArch, sysVersion);
154+
if (system.TryGetProperty("name", out var systemNameProperty))
155+
systemName = systemNameProperty.GetString();
156+
157+
if (system.TryGetProperty("version", out var systemVersionProperty) && systemVersionProperty.TryGetInt32(out systemVersion)) { }
158+
159+
}
160+
161+
if (document.RootElement.TryGetProperty("linuxDistro", out var linuxDistro))
162+
{
163+
164+
if (linuxDistro.TryGetProperty("name", out var distroNameProperty))
165+
distroName = distroNameProperty.GetString();
166+
167+
if (linuxDistro.TryGetProperty("family", out var distroFamilyProperty))
168+
distroFamily = distroFamilyProperty.GetString();
169+
170+
}
171+
172+
if (document.RootElement.TryGetProperty("processor", out var processor))
173+
{
174+
175+
if (processor.TryGetProperty("architecture", out var processorArchitectureProperty))
176+
processorArchitecture = processorArchitectureProperty.GetString();
177+
178+
}
179+
180+
if (systemName is not null && systemName.Equals("linux", StringComparison.OrdinalIgnoreCase))
181+
return new(distroName, distroFamily, processorArchitecture, systemVersion);
182+
183+
return new(systemName, processorArchitecture, systemVersion);
157184

158185
}
159186

RSML/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ internal static unsafe bool IsAsciiEqualsIgnoreCase(this ReadOnlyMemory<char> ch
175175
internal static bool IsAsciiEqualsIgnoreCase(this ReadOnlyMemory<char> chars, ImmutableArray<ReadOnlyMemory<char>> arr)
176176
{
177177

178-
// i want performance, not linq ass
178+
// I want performance, not linq ass
179179
// ReSharper disable once ForCanBeConvertedToForeach
180180
// ReSharper disable once LoopCanBeConvertedToQuery
181181
for (int i = 0; i < arr.Length; i++)

0 commit comments

Comments
 (0)