8T4 / c4sharp

C4Sharp (C4S) is a .net library for building C4 Model diagrams.
MIT License
260 stars 35 forks source link

c4scli does NOT create png files #58

Open marcosecurity opened 1 month ago

marcosecurity commented 1 month ago

Hi, I created your sample Internetbanking project like the following: public class ContainerDiagramSample : ContainerDiagram { protected override string Title => "Container diagram for Internet Banking System";

protected override IEnumerable<Structure> Structures => new Structure[]
{
    Person.None | Boundary.External 
                | ("Customer", "Personal Banking Customer", "A customer of the bank, with personal bank accounts."),

    SoftwareSystem.None | ("BankingSystem", "Internet Banking System", 
        "Allows customers to view information about their bank accounts, and make payments."),

    SoftwareSystem.None | Boundary.External 
                        | ("MailSystem", "E-mail system", "The internal Microsoft Exchange e-mail system."),

    Bound("c1", "Internet Banking",
        Container.None | (WebApplication, "WebApp", "WebApp", "C#, WebApi", 
            "Delivers the static content and the Internet banking SPA"),

        Container.None | (Spa, "Spa", "Spa", "JavaScript, Angular", 
            "Delivers the static content and the Internet banking SPA"),

        Container.None | (Mobile, "MobileApp", "Mobile App", "C#, Xamarin", 
            "Provides a mobile banking experience"),

        Container.None | (Database, "SqlDatabase", "SqlDatabase", "SQL Database", 
            "Stores user registration information, hashed auth credentials, access logs, etc."),   

        Container.None | (Queue, "RabbitMQ", "RabbitMQ", "RabbitMQ", 
            "Stores user registration information, hashed auth credentials, access logs, etc."),

        Container.None | (Api, "BackendApi", "BackendApi", "Dotnet, Docker Container", 
            "Provides Internet banking functionality via API.")
    )
};

protected override IEnumerable<Relationship> Relationships => new[]
{
    this["Customer"] > this["WebApp"] | ("Uses", "HTTPS"),
    this["Customer"] > this["Spa"] | ("Uses", "HTTPS"),
    this["Customer"] > this["MobileApp"] | "Uses",

    this["WebApp"] > this["Spa"] | "Delivers" | Position.Neighbor,
    this["Spa"] > this["BackendApi"] | ("Uses", "async, JSON/HTTPS"),
    this["MobileApp"] > this["BackendApi"] | ("Uses", "async, JSON/HTTPS"),
    this["SqlDatabase"] < this["BackendApi"] | ("Uses", "async, JSON/HTTPS") | Position.Neighbor,
    this["RabbitMQ"] < this["BackendApi"] | ("Uses", "async, JSON"),

    this["Customer"] < this["MailSystem"] | "Sends e-mails to",
    this["MailSystem"] < this["BackendApi"] | ("Sends e-mails using", "sync, SMTP"),
    this["BackendApi"] > this["BankingSystem"] | ("Uses", "sync/async, XML/HTTPS") | Position.Neighbor
};
using C4Sharp.Diagrams;
using C4Sharp.Diagrams.Plantuml;
using C4Sharp.Diagrams.Themes;
using ModelDiagrams.Diagrams;

private static void Main()
{
    var diagrams = new Diagram[]
    {
        new ContextDiagram { ... },
        new ContainerDiagram { ... },
        new ComponentDiagram { ... },
        new DeploymentDiagram { ... },
        new EnterpriseDiagram { ... },
    };

    new PlantumlSession()
        .UseDiagramImageBuilder() // To generate PNG Files
        .UseDiagramSvgImageBuilder() // To generate SVG Files
        .UseStandardLibraryBaseUrl() // To use C4-Planguml Library from their github
        .Export(diagrams);
}

} Put that Programs.cs in a csproj and create a .sln file. I ran: c4scli build InternetBankingSystem_1.0.sln -o . and I obtained: **Running dotnet build dotnet build complete Starting analysis Solution analysis is completed Generating C4 diagram in: .\c4

C4 diagram PNG files

C4 diagram SVG files

C4 diagram MD files

C4 diagram PUML files**

but only the .puml files were created in the .c4s folder, with no images in c4 folder, that remains empty.

I'm under Windows 11, with c4sharp.7.0.189 and c4scli.3.0.189 installed.

Do I miss something?

yanjustino commented 1 month ago

Please, verify if in your Windows you have the Java Runtime installed. It's a dependency to build images by Plantuml engine.