#93: local file includes can be activated via command line argument -DRELATIVE_INCLUDE="."

Update github workflow that local files are used
pull/107/head
KIRCHSTH 5 years ago
parent 0129f67cfe
commit d799a4c5d5

@ -19,7 +19,7 @@ jobs:
- name: Process diagrams
uses: Timmy/plantuml-action@v1
with:
args: '-v percy -o _parsed'
args: '-v percy -o _parsed -DRELATIVE_INCLUDE="."'
- name: Upload
run: npx percy upload percy/_parsed
env:

@ -1,6 +1,9 @@
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
' uncomment the following line and comment the first to use locally
' !include C4_Container.puml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!include https://raw.githubu!if %variable_exists("RELATIVE_INCLUDE")
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!endif
' Scope: A single container.
' Primary elements: Components within the container in scope.

@ -0,0 +1,88 @@
!if %variable_exists("RELATIVE_INCLUDE")
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml
!else
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Container.puml
!endif
' Scope: A single container.
' Primary elements: Components within the container in scope.
' Supporting elements: Containers (within the software system in scope) plus people and software systems directly connected to the components.
' Intended audience: Software architects and developers.
' Colors
' ##################################
!global $COMPONENT_FONT_COLOR = "#000000"
!global $COMPONENT_BG_COLOR = "#85BBF0"
!global $COMPONENT_BORDER_COLOR = "#78A8D8"
!global $EXTERNAL_COMPONENT_BG_COLOR = "#CCCCCC"
!global $EXTERNAL_COMPONENT_BORDER_COLOR = "#BFBFBF"
' Styling
' ##################################
UpdateSkinparamsAndLegendEntry("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COMPONENT_BORDER_COLOR)
UpdateSkinparamsAndLegendEntry("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $EXTERNAL_COMPONENT_BORDER_COLOR)
' Layout
' ##################################
SetDefaultLegendEntries("person\nsystem\ncontainer\ncomponent\nexternal_person\nexternal_system\nexternal_container\nexternal_component")
!procedure LAYOUT_WITH_LEGEND()
hide stereotype
legend right
|<color:$LEGEND_TITLE_COLOR>**Legend**</color> |
|<$PERSON_BG_COLOR> person |
|<$SYSTEM_BG_COLOR> system |
|<$CONTAINER_BG_COLOR> container |
|<$COMPONENT_BG_COLOR> component |
|<$EXTERNAL_PERSON_BG_COLOR> external person |
|<$EXTERNAL_SYSTEM_BG_COLOR> external system |
|<$EXTERNAL_CONTAINER_BG_COLOR> external container |
|<$EXTERNAL_COMPONENT_BG_COLOR> external component |
endlegend
!endprocedure
' Elements
' ##################################
!function $getComponent($label, $techn, $descr, $sprite)
!if ($descr == "") && ($sprite == "")
!return '=='+$label+'\n//<size:'+$TECHN_FONT_SIZE+'>['+$techn+']</size>//'
!endif
!if ($descr == "") && ($sprite != "")
!return '<$'+$sprite+'>\n=='+$label+'\n//<size:'+$TECHN_FONT_SIZE+'>['+$techn+']</size>//'
!endif
!if ($descr != "") && ($sprite == "")
!return '=='+$label+'\n//<size:'+$TECHN_FONT_SIZE+'>['+$techn+']</size>//\n\n '+$descr
!endif
!if ($descr != "") && ($sprite != "")
!return '<$'+$sprite+'>\n=='+$label+'\n//<size:'+$TECHN_FONT_SIZE+'>['+$techn+']</size>//\n\n '+$descr
!endif
!endfunction
!unquoted procedure Component($alias, $label, $techn, $descr="", $sprite="", $tags="")
rectangle "$getComponent($label, $techn, $descr, $sprite)" $toStereos("component",$tags) as $alias
!endprocedure
!unquoted procedure ComponentDb($alias, $label, $techn, $descr="", $sprite="", $tags="")
database "$getComponent($label, $techn, $descr, $sprite)" $toStereos("component",$tags) as $alias
!endprocedure
!unquoted procedure ComponentQueue($alias, $label, $techn, $descr="", $sprite="", $tags="")
queue "$getComponent($label, $techn, $descr, $sprite)" $toStereos("component",$tags) as $alias
!endprocedure
!unquoted procedure Component_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")
rectangle "$getComponent($label, $techn, $descr, $sprite)" $toStereos("external_component",$tags) as $alias
!endprocedure
!unquoted procedure ComponentDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")
database "$getComponent($label, $techn, $descr, $sprite)" $toStereos("external_component",$tags) as $alias
!endprocedure
!unquoted procedure ComponentQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")
queue "$getComponent($label, $techn, $descr, $sprite)" $toStereos("external_component",$tags) as $alias
!endprocedure

@ -1,6 +1,9 @@
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
' uncomment the following line and comment the first to use locally
' !include C4_Context.puml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!include https://raw.githubu!if %variable_exists("RELATIVE_INCLUDE")
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Context.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
!endif
' Scope: A single software system.
' Primary elements: Containers within the software system in scope.

@ -1,6 +1,9 @@
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml
' uncomment the following line and comment the first to use locally
' !include C4.puml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!include https://raw.githubu!if %variable_exists("RELATIVE_INCLUDE")
!include %get_variable_value("RELATIVE_INCLUDE")/C4.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml
!endif
' Scope: A single software system.
' Primary elements: The software system in scope.

@ -1,6 +1,9 @@
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
' uncomment the following line and comment the first to use locally
' !include C4_Container.puml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!include https://raw.githubu!if %variable_exists("RELATIVE_INCLUDE")
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!endif
' Styling
' ##################################

@ -1,6 +1,9 @@
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
' uncomment the following line and comment the first to use locally
' !include C4_Component.puml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!include https://raw.githubu!if %variable_exists("RELATIVE_INCLUDE")
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Component.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
!endif
' Scope: Interactions in an enterprise, software system or container.
' Primary and supporting elements: Depends on the diagram scope -

@ -18,17 +18,12 @@ C4-PlantUML includes macros, stereotypes, and other goodies (like VSCode Snippet
At the top of your C4 PlantUML `.puml` file, you need to include the `C4_Context.puml`, `C4_Container.puml` or `C4_Component.puml` file found in the `root` of this repo.
To be independent of any internet connectivity, you can also download the files found in the `root` and reference it locally with
To be independent of any internet connectivity, you can also download the files found in the `root` and activate the relative include with additional command line argument `-DRELATIVE_INCLUDE="."`
```c#
!include path/to/C4.puml
!include path/to/C4_Context.puml
!include path/to/C4_Container.puml
!include path/to/C4_Component.puml
java -jar plantuml.jar -DRELATIVE_INCLUDE="." ...
```
Just remember to change the `!include` statements at the top of the files.
If you want to use the always up-to-date version in this repo, use the following:
```c#

@ -1,8 +1,10 @@
@startuml
!include ./../C4_Component.puml
!include ./../C4_Container.puml
!include ./../C4_Context.puml
!include ./../C4.puml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include ./../C4_Component.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
!endif
LAYOUT_WITH_LEGEND()

@ -1,7 +1,10 @@
@startuml
!include ./../C4_Container.puml
!include ./../C4_Context.puml
!include ./../C4.puml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include ./../C4_Container.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!endif
LAYOUT_TOP_DOWN()
'LAYOUT_AS_SKETCH()

@ -1,7 +1,10 @@
@startuml "bigbankplc"
!include ./../C4_Container.puml
!include ./../C4_Context.puml
!include ./../C4.puml
@startuml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include ./../C4_Container.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!endif
skinparam wrapWidth 200
skinparam maxMessageSize 200
@ -10,7 +13,6 @@ LAYOUT_TOP_DOWN()
'LAYOUT_AS_SKETCH()
LAYOUT_WITH_LEGEND()
Person(customer, Customer, "A customer")
System_Boundary(c1, "Customer Information") {

@ -1,13 +1,15 @@
@startuml "techtribesjs"
!include ./../C4_Container.puml
!include ./../C4_Context.puml
!include ./../C4.puml
@startuml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include ./../C4_Container.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!endif
LAYOUT_TOP_DOWN()
'LAYOUT_AS_SKETCH()
LAYOUT_WITH_LEGEND()
Person_Ext(anonymous_user, "Anonymous User")
Person(aggregated_user, "Aggregated User")
Person(administration_user, "Administration User")

@ -1,6 +1,10 @@
@startuml
!include ./../C4_Context.puml
!include ./../C4.puml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include ./../C4_Context.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
!endif
'LAYOUT_TOP_DOWN()
'LAYOUT_AS_SKETCH()

@ -1,6 +1,10 @@
@startuml
!include ./../C4_Context.puml
!include ./../C4.puml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include ./../C4_Context.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
!endif
LAYOUT_WITH_LEGEND()

@ -1,6 +1,10 @@
@startuml "enterprise"
!include ./../C4_Context.puml
!include ./../C4.puml
@startuml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include ./../C4_Context.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
!endif
LAYOUT_TOP_DOWN()
'LAYOUT_AS_SKETCH()

Loading…
Cancel
Save