Skip to content

armgit / core

Public Imported from GitHub
0

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

Updated console deployment gradle build

Rich Turner1f016c10393a
diff --git a/deployment/manager/build.gradle b/deployment/manager/build.gradle
new file mode 100644
index 000000000..376daaf0c
--- /dev/null
+++ b/deployment/manager/build.gradle
@@ -0,0 +1,28 @@
+// Checks each console directory and if it is a gradle project (i.e. has a build.gradle) this task assumes that it will
+// handle copying required files to the managerDeploymentDir itself; otherwise the entire console directory is copied.
+
+ext.isManagedConsole = {consoleDir ->
+ return findProject("consoles:${consoleDir.path}") != null
+}
+
+task copyExcludingConsoles(type: Copy) {
+ from '.'
+ exclude 'build.gradle'
+ exclude 'consoles'
+ into managerDeploymentDir
+}
+
+task installDist(type: Copy) {
+ dependsOn 'copyExcludingConsoles'
+ from 'consoles'
+ into managerDeploymentDir
+ include {
+ fileTreeElement ->
+ def consoleDir = fileTreeElement.directory && fileTreeElement.relativePath.parent == RelativePath.EMPTY_ROOT
+ // If it's a console directory check if it is self managed (i.e. has a build.gradle) if it is then don't
+ // include it
+ return !consoleDir || !isManagedConsole(fileTreeElement)
+ }
+}
+
+
diff --git a/deployment/manager/consoles/customerA/build.gradle b/deployment/manager/consoles/customerA/build.gradle
index 4cc73aee0..d4d00fb74 100644
--- a/deployment/manager/consoles/customerA/build.gradle
+++ b/deployment/manager/consoles/customerA/build.gradle
@@ -1,3 +1,6 @@
-task installDist {
+task installDist(type: Copy) {
dependsOn bowerPrune, bowerUpdate
+ from 'consoles'
+ into managerDeploymentDir
+ exclude "build.gradle", "bower.json"
}
\ No newline at end of file
diff --git a/project.gradle b/project.gradle
index b5c5c252a..49d64fe0c 100644
--- a/project.gradle
+++ b/project.gradle
@@ -1,4 +1,5 @@
// Common configuration applied to all projects
+import static org.apache.tools.ant.taskdefs.condition.Os.*
// Default repositories for dependency resolution
repositories {
@@ -86,5 +87,5 @@ ext {
resolvePath = this.&resolvePath
resolveProject = this.&resolveProject
resolveTask = this.&resolveTask
-}
-
+ managerDeploymentDir = "${resolveProject(":manager").buildDir}/install/manager/deployment"
+}
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 3a796f037..98a795383 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,10 +1,9 @@
rootProject.name = "openremote"
// Include sub-projects dynamically, every directory with a build.gradle (and no .buildignore)
-def rootDir = new File(".").canonicalPath
fileTree(dir: rootDir, include: "**/build.gradle")
.filter { it.parent != rootDir }
.filter { !file("${it.parent}/.buildignore").exists() }
.each {
- include it.parent.replace(rootDir, "").replace("\\", ":").replace("/", ":")
+ include it.parent.replace(rootDir.canonicalPath, "").replace("\\", ":").replace("/", ":")
}
\ No newline at end of file