Skip to content

armgit / core

Public Imported from GitHub
0

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

Improved build with shared project setup and fixed archive names

Christian Bauer4fa052dd0b13
diff --git a/build.gradle b/build.gradle
index c631564a4..cbcc25105 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,24 +1,3 @@
allprojects {
-
- repositories {
- mavenLocal()
- mavenCentral()
- jcenter()
- maven {
- url "https://oss.sonatype.org/content/repositories/snapshots/"
- }
- maven {
- url "http://m2repo.openremote.com/content/groups/public/"
- }
- }
-
- apply from: "${findProject(":openremote") != null ? project(":openremote").projectDir : rootDir}/functions.gradle"
- apply plugin: "eclipse"
-
- version = projectVersion
-
- tasks.withType(JavaCompile) {
- sourceCompatibility = "1.8"
- // Don't even try to disable deprecation/unsafe warnings of javac, it will not work...
- }
+ apply from: "${findProject(":openremote") != null ? project(":openremote").projectDir : rootDir}/project.gradle"
}
diff --git a/functions.gradle b/functions.gradle
deleted file mode 100644
index e09107f3b..000000000
--- a/functions.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Prefix path with ":openremote" if this project is running as a subproject.
- */
-def resolveProject(String path) {
- project(findProject(":openremote") != null ? ":openremote" + path : path)
-}
-
-/**
- * Prefix path with ":openremote" if this project is running as a subproject.
- */
-def resolveTask(String path) {
- tasks.getByPath(findProject(":openremote") != null ? ":openremote" + path : path)
-}
-
-ext {
- resolveProject = this.&resolveProject
- resolveTask = this.&resolveTask
-}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index f4d989d25..45cfdaf85 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-projectVersion = 3.0-SNAPSHOT
+openremoteVersion = 3.0-SNAPSHOT
jaxrsSpecVersion = 1.0.0.Final
javaxAnnotationsVersion = 1.0.0.Final
diff --git a/project.gradle b/project.gradle
new file mode 100644
index 000000000..89768b4d3
--- /dev/null
+++ b/project.gradle
@@ -0,0 +1,57 @@
+// Common configuration applied to all projects
+
+// Default repositories for dependency resolution
+repositories {
+ 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"
+
+// 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
+
+// Configure Java build
+plugins.withType(JavaPlugin).whenPluginAdded {
+
+ // Use Java 8
+ tasks.withType(JavaCompile) {
+ sourceCompatibility = "1.8"
+ // TODO Tyring to disable compiler warnings, none of this crap works
+ // options.compilerArgs += ["-XDignore.symbol.file", "-Xdoclint:none", "-Xlint:none", "-nowarn"]
+ // options.fork = true
+ // options.forkOptions.executable = 'javac'
+ }
+
+ // JAR/ZIP base name is the fully qualified subproject name
+ archivesBaseName = "${rootProject.name}${path.replaceAll(":", "-")}"
+}
+
+// Helper functions for project/task resolution when the main
+// repo is checked out as a git submodule and therefore a subproject
+def resolvePath(String path) {
+ findProject(":openremote") != null ? ":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
+}