100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Use local NodeJS installation to manage Bower dependencies
Christian Bauerd56372b32af7
diff --git a/.gitignore b/.gitignoreindex 0288de323..578b8d179 100644--- a/.gitignore+++ b/.gitignore@@ -6,6 +6,7 @@ local.propertiesbuild/.gradle.vagrant+.nodebin/out/diff --git a/gradle.properties b/gradle.propertiesindex 75962d772..ad34a809e 100644--- a/gradle.properties+++ b/gradle.properties@@ -37,3 +37,5 @@ saxonHEVersion = 9.8.0-3jmxtermVersion = 1.0.0nettyVersion = 4.1.16.FinalflywaydbVersion = 4.2.0+nodePluginVersion = 1.2.0+nodeJSVersion = 8.9.0\ No newline at end of filediff --git a/project.gradle b/project.gradleindex b2148a8b1..24cffa9ee 100644--- a/project.gradle+++ b/project.gradle@@ -1,6 +1,19 @@// Common configuration applied to all projectsimport static org.apache.tools.ant.taskdefs.condition.Os.*+// Build plugins+buildscript {+ repositories {+ maven {+ url "https://plugins.gradle.org/m2/"+ }+ }++ dependencies {+ classpath "com.moowork.gradle:gradle-node-plugin:$nodePluginVersion"+ }+}+// Default repositories for dependency resolutionrepositories {mavenCentral()@@ -39,20 +52,31 @@ if(project.convention.findPlugin(JavaPluginConvention)) {// subproject, not for its children!)version = hasProperty("openremoteVersion") ? openremoteVersion : projectVersion-// Add bower tasks-task bowerPrune(type: Exec){- commandLine "bower", "prune"- standardOutput = new ByteArrayOutputStream()+// Add console NodeJS plugin configuration and tasks+apply plugin: com.moowork.gradle.node.NodePlugin+def nodeDir = "${rootDir}/.node"+// Configuration of paths is completely broken in the gradle node plugin, this approach+// is the only one that results in a predictable location for installed modules+def nodeExtDir = "${nodeDir}/ext"+node {+ download = true+ version = nodeJSVersion+ workDir = file(nodeDir)}-task bowerUpdate(type: Exec){- commandLine "bower", "update"- standardOutput = new ByteArrayOutputStream()+// Add bower tasks+task bowerInstall(type: NpmTask) {+ args = ['install', '--prefix', nodeExtDir, '-g', 'bower']}--task polymerBuild(type: Exec){- commandLine "polymer", "build"- standardOutput = new ByteArrayOutputStream()+task bowerUpdate(type: NodeTask) {+ dependsOn bowerInstall+ script = file("${nodeExtDir}/bin/bower")+ args = ['update']+}+task bowerPrune(type: NodeTask) {+ dependsOn bowerInstall+ script = file("${nodeExtDir}/bin/bower")+ args = ['prune']}// Configure Java build