Skip to content

armgit / core

Public Imported from GitHub
0

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

Gradle updates: Added standard copyLibs task

Rich Turner9d620c31a559
diff --git a/project.gradle b/project.gradle
index f93807457..2fc3b230c 100644
--- a/project.gradle
+++ b/project.gradle
@@ -223,7 +223,7 @@ task npmPublish(type: Exec){
dependsOn getYarnInstallTask()
commandLine npmCommand("npm"), "publish"
}
-task npmServeProduction(type: Exec){
+task npmServeProduction(type: Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("npm"), "run", "serveProduction"
}
@@ -233,6 +233,23 @@ task tscWatch(type: Exec) {
commandLine npmCommand("npx"), "tsc", "-b", "--watch"
}
+// A task for copying a custom java projects libs that aren't part of the manager dependencies
+task copyLibs {
+ doLast {
+
+ if (project.configurations.find { it.name == "runtimeClasspath" } != null) {
+ // 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 = resolveProject(":manager").configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts
+ def customLibs = project.configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts.findAll { dep -> excludeDependencies.find { it == dep } == null && dep.name != "openremote-manager" }.collect { it.file }
+ copy {
+ from customLibs
+ into "${project.buildDir}/image/manager/extensions"
+ }
+ }
+ }
+}
+
// Configure Java build
plugins.withType(JavaPlugin).whenPluginAdded {