Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Updates structurizr-client dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbrowndotje committed Jul 22, 2023
1 parent 0a23eae commit 8bbdcf7
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 44 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ repositories {
}

dependencies {
api 'com.structurizr:structurizr-client:1.24.1'
api 'com.structurizr:structurizr-import:1.4.1'
api 'com.structurizr:structurizr-client:1.25.0'

testImplementation 'org.codehaus.groovy:groovy-jsr223:3.0.16'
testImplementation 'org.jetbrains.kotlin:kotlin-scripting-jsr223:1.7.22'
Expand All @@ -27,7 +27,7 @@ targetCompatibility = 11

description = 'Structurizr DSL'
group = 'com.structurizr'
version = '1.30.4'
version = '1.31.0'

test {
useJUnitPlatform()
Expand Down
3 changes: 2 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

## (unreleased to Maven Central)
## 1.31.0 (25th July 2023)

- Adds support for passing parameters to external scripts.
- Updates dependencies.

## 1.30.4 (17th July 2023)

Expand Down
28 changes: 0 additions & 28 deletions src/main/java/com/structurizr/dsl/AbstractViewParser.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
package com.structurizr.dsl;

import com.structurizr.Workspace;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.text.DecimalFormat;
import java.text.NumberFormat;

abstract class AbstractViewParser extends AbstractParser {

private static final Log log = LogFactory.getLog(AbstractViewParser.class);

protected String generateViewKey(Workspace workspace, String prefix) {
NumberFormat format = new DecimalFormat("000");
int counter = 1;
String key = prefix + "-" + format.format(counter);

while (hasViewWithKey(workspace, key)) {
counter++;
key = prefix + "-" + format.format(counter);
}

log.warn(key + " is an automatically generated view key - you will likely lose manual layout information when using automatically generated view keys.");
return key;
}

protected boolean hasViewWithKey(Workspace workspace, String key) {
return workspace.getViews().getViews().stream().anyMatch(view -> view.getKey().equals(key));
}

}
2 changes: 1 addition & 1 deletion src/main/java/com/structurizr/dsl/ComponentViewParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ComponentView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/structurizr/dsl/ContainerViewParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ContainerView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/structurizr/dsl/CustomViewParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CustomView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/structurizr/dsl/DeploymentViewParser.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.structurizr.dsl;

import com.structurizr.Workspace;
import com.structurizr.model.DeploymentNode;
import com.structurizr.model.Element;
import com.structurizr.model.SoftwareSystem;
import com.structurizr.view.DeploymentView;
Expand Down Expand Up @@ -53,7 +52,7 @@ DeploymentView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand All @@ -68,7 +67,7 @@ DeploymentView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/structurizr/dsl/DynamicViewParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ DynamicView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand All @@ -61,7 +61,7 @@ DynamicView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand All @@ -71,7 +71,7 @@ DynamicView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/structurizr/dsl/FilteredViewParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ FilteredView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/structurizr/dsl/ImageViewParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ImageView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ SystemContextView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SystemLandscapeView parse(DslContext context, Tokens tokens) {
if (tokens.includes(KEY_INDEX)) {
key = tokens.get(KEY_INDEX);
} else {
key = generateViewKey(workspace, VIEW_TYPE);
key = workspace.getViews().generateViewKey(VIEW_TYPE);
}
validateViewKey(key);

Expand Down

0 comments on commit 8bbdcf7

Please sign in to comment.