Skip to content

armgit / core

Public Imported from GitHub
0

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

Undo those delete again !

Eric Bariauxcccd1811089a
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 000000000..cbcc25105
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,3 @@
+allprojects {
+ apply from: "${findProject(":openremote") != null ? project(":openremote").projectDir : rootDir}/project.gradle"
+}
diff --git a/project.gradle b/project.gradle
new file mode 100644
index 000000000..bb46a88cd
--- /dev/null
+++ b/project.gradle
@@ -0,0 +1,161 @@
+// Common configuration applied to all projects
+import static org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS
+import static org.apache.tools.ant.taskdefs.condition.Os.isFamily
+
+// Build plugins
+buildscript {
+ repositories {
+ maven {
+ url "https://plugins.gradle.org/m2/"
+ }
+ }
+}
+
+// Give test projects more memory (Gradle 5 reduced this to 512MB)
+subprojects {
+ tasks.withType(Test) {
+ maxHeapSize = "2g"
+ }
+}
+
+// Default repositories for dependency resolution
+repositories {
+ maven {
+ url = "https://repo.osgeo.org/repository/release/"
+ }
+ mavenCentral()
+ jcenter()
+ maven {
+ url "https://oss.sonatype.org/content/repositories/snapshots/"
+ }
+ maven {
+ url "http://m2repo.openremote.com/content/groups/public/"
+ }
+}
+
+// Eclipse needs help
+apply plugin: "eclipse"
+
+// Intellij needs help
+apply plugin: 'idea'
+// Use the same output directories in IDE as in gradle
+idea {
+ module {
+ outputDir file('build/classes/main')
+ testOutputDir file('build/classes/test')
+ excludeDirs += file(".node")
+ excludeDirs += file("node_modules")
+ excludeDirs += file("dist")
+ excludeDirs += file("build")
+ }
+}
+
+// Helper functions for project/task resolution when the main
+// repo is checked out as a git submodule and therefore a subproject
+def isCustomProject() {
+ findProject(":openremote") != null
+}
+
+def resolvePath(String path) {
+ isCustomProject() ? ":openremote" + path : path
+}
+
+def resolveProject(String path) {
+ project(resolvePath(path))
+}
+
+def resolveTask(String path) {
+ tasks.getByPath(resolvePath(path))
+}
+
+ext {
+ resolvePath = this.&resolvePath
+ resolveProject = this.&resolveProject
+ resolveTask = this.&resolveTask
+ isCustomProject = this.&isCustomProject
+}
+
+if (project.convention.findPlugin(JavaPluginConvention)) {
+ // Change the output directory for the main and test source sets back to the old path
+ sourceSets.main.java.outputDir = new File(buildDir, "classes/main")
+ sourceSets.test.java.outputDir = new File(buildDir, "classes/test")
+}
+
+// Configure versions in gradle.properties (putting a gradle.properties file
+// in a subproject only overrides root properties of same name for the actual
+// subproject, not for its children!)
+version = hasProperty("openremoteVersion") ? openremoteVersion : projectVersion
+
+// Add UI tasks
+ext.npmCommand = {
+ cmd ->
+ isFamily(FAMILY_WINDOWS) ? "${cmd}.cmd" : cmd
+}
+
+// Add yarn tasks
+task yarnInstall(type: Exec){
+ commandLine npmCommand("yarn"), "install"
+}
+task yarnInstallForce(type: Exec){
+ commandLine npmCommand("yarn"), "install", "--force"
+}
+
+// Add npm tasks
+task npmInstall(type: Exec){
+ commandLine npmCommand("npm"), "install"
+}
+task npmClean(type: Exec){
+ dependsOn tasks.getByPath(":yarnInstall")
+ commandLine npmCommand("npm"), "run-script", "clean"
+}
+task npmBuild(type: Exec){
+ mustRunAfter npmClean
+ dependsOn tasks.getByPath(":yarnInstall")
+ commandLine npmCommand("npm"), "run-script", "build"
+}
+task npmTest(type: Exec){
+ dependsOn tasks.getByPath(":yarnInstall")
+ commandLine npmCommand("npm"), "run-script", "test"
+}
+task npmServe(type: Exec){
+ dependsOn tasks.getByPath(":yarnInstall")
+ commandLine npmCommand("npm"), "run-script", "serve"
+}
+task npmPrepare(type: Exec){
+ dependsOn tasks.getByPath(":yarnInstall")
+ commandLine npmCommand("npm"), "run-script", "prepublishOnly"
+}
+task npmPublish(type: Exec){
+ dependsOn tasks.getByPath(":yarnInstall")
+ commandLine npmCommand("npm"), "publish"
+}
+task npmServeProduction(type: Exec){
+ dependsOn tasks.getByPath(":yarnInstall")
+ commandLine npmCommand("npm"), "run-script", "serveProduction"
+}
+
+// Add typescript tasks
+task tscWatch(type: Exec) {
+ commandLine npmCommand("npx"), "tsc", "-b", "--watch"
+}
+
+// Configure Java build
+plugins.withType(JavaPlugin).whenPluginAdded {
+
+ // Use Java 8
+ tasks.withType(JavaCompile) {
+ sourceCompatibility = "1.8"
+ targetCompatibility = "1.8"
+ def warnLogFile = file("$buildDir/${name}Warnings.log")
+ logging.addStandardErrorListener(new StandardOutputListener() {
+ void onOutput(CharSequence output) {
+ warnLogFile << output
+ }
+ })
+ options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"]
+ options.encoding = 'UTF-8'
+ }
+
+ // JAR/ZIP base name is the fully qualified subproject name
+ archivesBaseName = "${rootProject.name}${path.replaceAll(":", "-")}"
+}
\ No newline at end of file