Skip to content

Commit 136603c

Browse files
author
Joanna May
authored
Merge pull request #5 from chickensoft-games/chore/v2.0.0
chore: update to v2.0.0
2 parents f0a27ee + 48d1f95 commit 136603c

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

Chickensoft.LogicBlocks.Generator/Chickensoft.LogicBlocks.Generator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<NoWarn>NU5128</NoWarn>
1212

1313
<Title>LogicBlocks Generator</Title>
14-
<Version>2.0.0-beta.1</Version>
14+
<Version>2.0.0</Version>
1515
<Description></Description>
1616
<Copyright>© 2023 Chickensoft Games</Copyright>
1717
<Authors>Chickensoft</Authors>

Chickensoft.LogicBlocks.Generator/src/LogicBlocksGenerator.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,11 @@ CancellationToken token
329329
var graph = implementation.Graph;
330330

331331
var transitions = new List<string>();
332-
foreach (var stateId in implementation.StatesById) {
332+
foreach (var stateId in implementation.StatesById.OrderBy(id => id.Key)) {
333333
var state = stateId.Value;
334-
foreach (var inputToStates in state.InputToStates) {
334+
foreach (var inputToStates in state.InputToStates.OrderBy(id => id.Key)) {
335335
var inputId = inputToStates.Key;
336-
foreach (var destStateId in inputToStates.Value) {
336+
foreach (var destStateId in inputToStates.Value.OrderBy(id => id)) {
337337
var dest = implementation.StatesById[destStateId];
338338
transitions.Add(
339339
$"{state.UmlId} --> " +
@@ -347,7 +347,9 @@ CancellationToken token
347347

348348
var initialStates = new List<string>();
349349

350-
foreach (var initialStateId in implementation.InitialStateIds) {
350+
foreach (
351+
var initialStateId in implementation.InitialStateIds.OrderBy(id => id)
352+
) {
351353
initialStates.Add(
352354
"[*] --> " + implementation.StatesById[initialStateId].UmlId
353355
);

Chickensoft.LogicBlocks/Chickensoft.LogicBlocks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<DebugType>portable</DebugType>
1414

1515
<Title>LogicBlocks</Title>
16-
<Version>2.0.0-beta.1</Version>
16+
<Version>2.0.0</Version>
1717
<Description>State management in a box.</Description>
1818
<Copyright>© 2023 Chickensoft</Copyright>
1919
<Authors>Chickensoft</Authors>

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,16 @@ You can find the latest version of LogicBlocks on [nuget][logic-blocks-nuget].
142142
dotnet add package Chickensoft.LogicBlocks
143143
```
144144

145-
To use the LogicBlocks source generator, add the following to your `.csproj` file. Make sure to replace `1.3.0` with the latest version of the [LogicBlocks generator from nuget][logic-blocks-gen-nuget].
145+
To use the LogicBlocks source generator, add the following to your `.csproj` file. Make sure to replace `2.0.0` with the latest version of the [LogicBlocks generator from nuget][logic-blocks-gen-nuget].
146146

147147
```xml
148-
<PackageReference Include="Chickensoft.LogicBlocks.Generator" Version="1.3.0" PrivateAssets="all" OutputItemType="analyzer" />
148+
<PackageReference Include="Chickensoft.LogicBlocks.Generator" Version="2.0.0" PrivateAssets="all" OutputItemType="analyzer" />
149+
```
150+
151+
Once you have both packages installed, you can force diagram generation with the following command in your project:
152+
153+
```sh
154+
dotnet build --no-incremental
149155
```
150156

151157
## 🙋‍♀️ How to Use LogicBlocks
@@ -417,6 +423,10 @@ Vending --> Idle : VendingCompleted
417423
@enduml
418424
```
419425

426+
> 💡 The snippet above is simplified for the sake of example. The actual generator output is a bit more verbose, but it renders the same diagram. The extra verbosity is required to identify states correctly to avoid naming collisions between nested states.
427+
>
428+
> If you want a more advanced look, check out the various `*.puml` files throughout the various packages in the LogicBlocks repository. These files are generated by the LogicBlocks Generator from the included examples and test cases that are used to verify that LogicBlocks is working as intended. Next to each `*.puml` file is a LogicBlock source file with the `[StateMachine]` attribute that informs the generator to create the diagram code. Check out the source and compare it to the diagram code to see what the generator is doing under the hood.
429+
420430
### Viewing Diagrams with PlantUML
421431

422432
You can copy and paste the generated UML into [PlantText] to generate a diagram online.

0 commit comments

Comments
 (0)