Skip to content

Commit d096dc1

Browse files
authored
Improvement to deployment installDist task (#22)
1 parent e291f58 commit d096dc1

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

deployment/build.gradle

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
apply plugin: "java-library"
22

3+
configurations {
4+
managerRuntime
5+
}
6+
37
dependencies {
48
api project(":setup")
9+
managerRuntime "io.openremote:openremote-manager:$openremoteVersion"
510
}
611

712
tasks.register('license') {
@@ -35,10 +40,14 @@ tasks.register('installDist', Copy) {
3540

3641
into("image") {
3742
from projectDir
38-
exclude "build.gradle", "Dockerfile", "build", "**/*.mbtiles", "src", "**/*.md", ".gitignore"
43+
exclude "build.gradle", "Dockerfile", "build", "**/*.mbtiles", "src", "**/*.md", ".gitignore", "**/*.encrypted"
3944
}
4045

4146
into("image/manager/extensions") {
42-
from getDeploymentJars()
47+
from configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts.collect {it.file }
48+
// Don't include deps baked into the manager docker image
49+
exclude configurations.managerRuntime.resolvedConfiguration.resolvedArtifacts.collect {it.file.name }
50+
// Don't include any ui packaged JARs (used for dev purposes only)
51+
exclude { (it.file.path.contains(".gradle") || it.file.path.contains(".m2")) && it.file.path.contains("io.openremote.ui") }
4352
}
4453
}

project.gradle

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -306,26 +306,10 @@ def getYarnInstallTask() {
306306
}
307307
}
308308

309-
// Gets the list of runtime JAR dependencies; can be used in custom project deployment installDist task to populate
310-
// extensions directory
311-
def getDeploymentJars(Project project = project) {
312-
if (project.configurations.find { it.name == "runtimeClasspath" } == null) {
313-
return []
314-
}
315-
316-
// Dependencies already part of the manager are excluded so they do not appear on the classpath twice
317-
return project.configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts
318-
.findAll { !it.file.path.contains(".gradle") && !it.file.path.contains(".m2") }
319-
.collect {
320-
println "CopyLibs Artifact: ${it.file.path}"
321-
return it.file
322-
}
323-
}
324309

325310
ext {
326311
resolveTask = this.&resolveTask
327312
getYarnInstallTask = this.&getYarnInstallTask
328-
getDeploymentJars = this.&getDeploymentJars
329313
createTSGeneratorConfigForClient = this.&createTSGeneratorConfigForClient
330314
createTSGeneratorConfigForModel = this.&createTSGeneratorConfigForModel
331315
}

0 commit comments

Comments
 (0)