Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
FROM eclipse-temurin:21.0.7_6-jre-noble

RUN apt-get update && apt-get install -y unzip && apt install -y graphviz && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y libarchive-tools && apt install -y graphviz && rm -rf /var/lib/apt/lists/*

COPY build/distributions/structurizr-cli.zip /tmp

RUN unzip /tmp/structurizr-cli.zip -d /usr/local/structurizr-cli && chmod +x /usr/local/structurizr-cli/structurizr.sh
ARG APPDIR=/usr/local/structurizr-cli

WORKDIR /usr/local/structurizr
RUN <<EOF
mkdir -p $APPDIR
bsdtar -xf /tmp/structurizr-cli.zip -C $APPDIR --strip-components 1
EOF

ENTRYPOINT ["/usr/local/structurizr-cli/structurizr.sh"]
WORKDIR "$APPDIR"

ENTRYPOINT ["bin/structurizr-cli"]
67 changes: 39 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
plugins {
id 'java'
id 'application'
}

defaultTasks 'clean', 'build', 'getDeps', 'buildZip'
defaultTasks 'clean', 'assemble', 'distZip'

description = 'Structurizr CLI'
group = 'com.structurizr'
version = ''

sourceCompatibility = 17
targetCompatibility = 17
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

repositories {
mavenCentral()
Expand Down Expand Up @@ -44,12 +47,45 @@ test {
useJUnitPlatform()
}

def command(String... command) {
try {
return providers.exec {
commandLine command
}.standardOutput.asText.get().trim()
}
catch (e) {
e.printStackTrace();
return "";
}
}

def getVersionName = { ->
command 'git', 'describe', '--tags', '--dirty'
}

def getTimestamp = { ->
command 'date', '--utc', '+%FT%H:%M:%SZ'
}

sourceSets.main.resources {
srcDirs = ['src/main/resources']
include 'build.properties'
include 'static.zip'
}

processResources {
filesMatching('**/*.properties') {
filter { line ->
line.replaceAll('@BUILD_NUMBER@', getVersionName())
.replaceAll('@BUILD_DATE@', getTimestamp())
}
}
}

application {
mainClass = 'com.structurizr.cli.StructurizrCliApplication'
}

jar {
manifest {
attributes(
Expand All @@ -58,28 +94,3 @@ jar {
)
}
}

task getDeps(type: Copy) {
from configurations.default
into 'build/dependencies'
}

task buildZip(type: Zip) {
from ('build/libs/') {
include 'structurizr-cli*.jar'
into 'lib'
}
from ('build/dependencies') {
include '*.jar'
into 'lib'
}
from ('.') {
include 'README.md'
include 'docs/*'
include 'docs/images/*'
}
from ('etc') {
include 'structurizr.sh'
include 'structurizr.bat'
}
}
4 changes: 0 additions & 4 deletions etc/structurizr.bat

This file was deleted.

19 changes: 0 additions & 19 deletions etc/structurizr.sh

This file was deleted.

9 changes: 1 addition & 8 deletions src/main/java/com/structurizr/cli/util/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ public class Version {

private static final String BUILD_VERSION_KEY = "build.number";
private static final String BUILD_TIMESTAMP_KEY = "build.timestamp";
private static final String GIT_COMMIT_KEY = "git.commit";

private static String version = "";
private static Date buildTimestamp = new Date();
private static String gitCommit;

static {
try {
Expand All @@ -25,7 +23,6 @@ public class Version {
buildProperties.load(in);
version = buildProperties.getProperty(BUILD_VERSION_KEY);
buildTimestamp = format.parse(buildProperties.getProperty(BUILD_TIMESTAMP_KEY));
gitCommit = buildProperties.getProperty(GIT_COMMIT_KEY);
in.close();
}
} catch (Exception e) {
Expand All @@ -41,8 +38,4 @@ public Date getBuildTimestamp() {
return buildTimestamp;
}

public String getGitCommit() {
return gitCommit;
}

}
}
4 changes: 2 additions & 2 deletions src/main/resources/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
build.number=2023.12.29.0
build.timestamp=2023-12-29T13:33:22Z
build.number=@BUILD_NUMBER@
build.timestamp=@BUILD_DATE@