Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Improvement to deployment installDist task (#1734)

Rich Turner246511a47e60
diff --git a/deployment/build.gradle b/deployment/build.gradle
index 0e49d3baf..4af814236 100644
--- a/deployment/build.gradle
+++ b/deployment/build.gradle
@@ -6,10 +6,10 @@ configurations {
dependencies {
api project(":setup")
- managerRuntime(project(path: ':manager', configuration: 'runtime'))
+ managerRuntime project(':manager')
}
-task license {
+tasks.register('license') {
doLast {
def toConcatenate = files("${rootDir}/LICENSE.txt")
def outputFileName = "${buildDir}/image/manager/app/LICENSE.txt"
@@ -24,8 +24,9 @@ task license {
}
}
-task installDist(type: Copy) {
- dependsOn (parent.getTasksByName('installDist', true).findAll {
+tasks.register('installDist', Copy) {
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+ dependsOn(parent.getTasksByName('installDist', true).findAll {
// Don't create circular dependency or depend on built in openremote submodule apps
it.project != project && !it.project.path.startsWith(":openremote:ui:app")
})
@@ -40,6 +41,10 @@ task installDist(type: Copy) {
}
into("image/manager/extensions") {
- from getDeploymentJars()
+ from configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts.collect {it.file }
+ // Don't include deps baked into the manager docker image
+ exclude configurations.managerRuntime.resolvedConfiguration.resolvedArtifacts.collect {it.file.name }
+ // Don't include any ui packaged JARs (used for dev purposes only)
+ exclude { (it.file.path.contains(".gradle") || it.file.path.contains(".m2")) && it.file.path.contains("io.openremote.ui") }
}
}
diff --git a/project.gradle b/project.gradle
index 29edf01d5..32236e60c 100644
--- a/project.gradle
+++ b/project.gradle
@@ -202,25 +202,6 @@ def getYarnInstallTask() {
resolveTask(":yarnInstall")
}
-// Gets the list of runtime JAR dependencies; can be used in custom project deployment installDist task to populate
-// extensions directory
-def getDeploymentJars(Project project = project, String excludeConfigName = 'managerRuntime') {
- if (project.configurations.find { it.name == excludeConfigName } == null) {
- return []
- }
-
- // Get all dependencies that are already part of the openremote manager and exclude these from the libs dir
- // otherwise they will appear on the classpath twice (once in manager app dir and then again in extensions)
- def excludeDependencies = project.configurations.getByName(excludeConfigName).resolvedConfiguration.resolvedArtifacts
-
- return project.configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts
- .findAll { dep -> excludeDependencies.find { it == dep } == null && dep.name != "openremote-manager" }
- .collect {
- println "CopyLibs Artifact: ${it.file.path}"
- return it.file
- }
-}
-
/**
* This defines reusable config for the typescript generator plugin
*/
@@ -338,7 +319,6 @@ ext {
resolveProject = this.&resolveProject
resolveTask = this.&resolveTask
getYarnInstallTask = this.&getYarnInstallTask
- getDeploymentJars = this.&getDeploymentJars
createTSGeneratorConfigForClient = this.&createTSGeneratorConfigForClient
createTSGeneratorConfigForModel = this.&createTSGeneratorConfigForModel
}