geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasonhu...@apache.org
Subject incubator-geode git commit: Modified build to find geode jars and not need geode to be in local repo Added logic to detect buildRoot from gradle.properties from geode project Build target output directory will use buildRoot as it's base directory
Date Wed, 02 Sep 2015 18:11:48 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-178 [created] 9c6b36fc1


Modified build to find geode jars and not need geode to be in local repo
Added logic to detect buildRoot from gradle.properties from geode project
Build target output directory will use buildRoot as it's base directory


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/9c6b36fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/9c6b36fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/9c6b36fc

Branch: refs/heads/feature/GEODE-178
Commit: 9c6b36fc127f128ca0de7a73b761035c4dc09347
Parents: 0c13b4d
Author: Jason Huynh <huynhja@gmail.com>
Authored: Wed Sep 2 11:10:42 2015 -0700
Committer: Jason Huynh <huynhja@gmail.com>
Committed: Wed Sep 2 11:10:42 2015 -0700

----------------------------------------------------------------------
 .../project/Dependencies.scala                  | 13 +++--
 .../project/GemFireSparkBuild.scala             | 32 +++++++----
 gemfire-spark-connector/project/Settings.scala  | 56 ++++++++++++++++----
 3 files changed, 78 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9c6b36fc/gemfire-spark-connector/project/Dependencies.scala
----------------------------------------------------------------------
diff --git a/gemfire-spark-connector/project/Dependencies.scala b/gemfire-spark-connector/project/Dependencies.scala
index 25a64f1..fe042cc 100644
--- a/gemfire-spark-connector/project/Dependencies.scala
+++ b/gemfire-spark-connector/project/Dependencies.scala
@@ -6,7 +6,9 @@ object Dependencies {
   object Compile {
     val sparkStreaming = "org.apache.spark" %% "spark-streaming" % "1.3.0" 
     val sparkSql = "org.apache.spark" %% "spark-sql" % "1.3.0"
-    val gemfire = "org.apache.geode" % "gemfire-core" % "1.0.0-incubating-SNAPSHOT" excludeAll(ExclusionRule(organization
= "org.jboss.netty") )
+   // val gemfire = "org.apache.geode" % "gemfire-core" % "1.0.0-incubating-SNAPSHOT" excludeAll(ExclusionRule(organization
= "org.jboss.netty") )
+    val log4jApi = "org.apache.logging.log4j" % "log4j-api" % "2.3"
+    val log4jCore = "org.apache.logging.log4j" % "log4j-core" % "2.3"
   }
 
   object Test {
@@ -21,9 +23,12 @@ object Dependencies {
 
   val unitTests = Seq(scalaTest, mockito, junit, novoCode)
 
-  val connector = unitTests ++ Seq(sparkStreaming, sparkSql, gemfire)
+  //val connector = unitTests ++ Seq(sparkStreaming, sparkSql, gemfire)
+  val connector = unitTests ++ Seq(sparkStreaming, sparkSql, log4jApi, log4jCore)
 
-  val functions = Seq(gemfire, junit)
+  //val functions = Seq(gemfire, junit)
+  val functions = Seq(junit, log4jCore, log4jApi)
  
-  val demos = Seq(sparkStreaming, sparkSql, gemfire)
+  //val demos = Seq(sparkStreaming, sparkSql, gemfire)
+  val demos = Seq(sparkStreaming, sparkSql, log4jCore, log4jApi)
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9c6b36fc/gemfire-spark-connector/project/GemFireSparkBuild.scala
----------------------------------------------------------------------
diff --git a/gemfire-spark-connector/project/GemFireSparkBuild.scala b/gemfire-spark-connector/project/GemFireSparkBuild.scala
index 32101b9..178da3b 100644
--- a/gemfire-spark-connector/project/GemFireSparkBuild.scala
+++ b/gemfire-spark-connector/project/GemFireSparkBuild.scala
@@ -7,33 +7,44 @@ object GemFireSparkConnectorBuild extends Build {
   import Settings._
   import Dependencies._ 
 
+  lazy val connectorRoot = baseDirectory in ThisBuild
+
+  lazy val geodeCodeSettings = Seq( 
+    geodeBaseDirectory := connectorRoot.value /".."
+  ) ++ buildSettings
+  
   lazy val root = Project(
     id = "root", 
     base =file("."), 
     aggregate = Seq(gemfireFunctions, gemfireSparkConnector,demos),
-    settings = commonSettings ++ Seq( 
+    settings = commonSettings ++ geodeCodeSettings ++ Seq( 
      name := "GemFire Connector for Apache Spark",
      publishArtifact :=  false,
      publishLocal := { },
-     publish := { }
+     publish := { },
+     target := outputDir.value /"target"
     )
   )
  
   lazy val gemfireFunctions = Project(
     id = "gemfire-functions",
     base = file("gemfire-functions"),
-    settings = commonSettings ++ Seq(libraryDependencies ++= Dependencies.functions,
+    settings = functionSettings ++ geodeCodeSettings ++ Seq(libraryDependencies ++= Dependencies.functions,
       resolvers ++= gfcResolvers,
-      description := "Required GemFire Functions to be deployed onto the GemFire Cluster
before using the GemFire Spark Connector"
+      target := outputDir.value /"gemfire-functions/target",
+      description := "Required GemFire Functions to be deployed onto the GemFire Cluster
before using the GemFire Spark Connector" ++{ printf("JASON :" + target.value)
+     "HAHA"
+    }
     )
   ).configs(IntegrationTest)
   
   lazy val gemfireSparkConnector = Project(
     id = "gemfire-spark-connector",
     base = file("gemfire-spark-connector"),
-    settings = gfcSettings ++ Seq(libraryDependencies ++= Dependencies.connector,
+    settings = gfcSettings ++ geodeCodeSettings ++Seq(libraryDependencies ++= Dependencies.connector,
       resolvers ++= gfcResolvers,
-      description := "A library that exposes GemFire regions as Spark RDDs, writes Spark
RDDs to GemFire regions, and executes OQL queries from Spark Applications to GemFire"
+      description := "A library that exposes GemFire regions as Spark RDDs, writes Spark
RDDs to GemFire regions, and executes OQL queries from Spark Applications to GemFire",
+      target := outputDir.value /"gemfire-spark-connector/target"
     )
   ).dependsOn(gemfireFunctions).configs(IntegrationTest)
 
@@ -44,16 +55,19 @@ object GemFireSparkConnectorBuild extends Build {
   lazy val demos = Project ( 
     id = "gemfire-spark-demos",
     base = demoPath,
-    settings = demoSettings,
+    settings = demoSettings ++ geodeCodeSettings ++ Seq(
+      target := outputDir.value /"gemfire-spark-demos/target" 
+    ),
     aggregate = Seq(basicDemos)
   )
  
   lazy val basicDemos = Project (
     id = "basic-demos",
     base = demoPath / "basic-demos",
-    settings = demoSettings ++ Seq(libraryDependencies ++= Dependencies.demos,
+    settings = demoSettings ++ geodeCodeSettings ++ Seq(libraryDependencies ++= Dependencies.demos,
       resolvers ++= gfcResolvers,
-      description := "Sample applications that demonstrates functionality of the GemFire
Spark Connector"
+      description := "Sample applications that demonstrates functionality of the GemFire
Spark Connector",
+      target := outputDir.value /"gemfire-spark-demos/basic-demos/target" 
     )
   ).dependsOn(gemfireSparkConnector)
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9c6b36fc/gemfire-spark-connector/project/Settings.scala
----------------------------------------------------------------------
diff --git a/gemfire-spark-connector/project/Settings.scala b/gemfire-spark-connector/project/Settings.scala
index 6d0a8bb..3450cb6 100644
--- a/gemfire-spark-connector/project/Settings.scala
+++ b/gemfire-spark-connector/project/Settings.scala
@@ -1,6 +1,8 @@
 import sbt._
 import sbt.Keys._
+import scala.collection.JavaConverters._
 import org.scalastyle.sbt.ScalastylePlugin
+import java.util.Properties
 
 object Settings extends Build {
    
@@ -10,25 +12,59 @@ object Settings extends Build {
     scalaVersion := "2.10.4",
     organization := "io.pivotal.gemfire.spark",
     organizationHomepage := Some(url("http://www.pivotal.io/"))
-  ) 
+  )
+
+  lazy val geodeBaseDirectory = settingKey[File]("Output of geode build")
+  lazy val buildProperties = settingKey[Map[String,String]]("Geode Build Properties")
+  lazy val geodeBuildTargetDirectory = settingKey[File]("Geode Output Directory")
+  lazy val outputDir = settingKey[File]("Connector Output Directory")
+
+  lazy val buildSettings = Seq( 
+    buildProperties := {
+      val props = new Properties()
+      IO.load(props, geodeBaseDirectory.value /"gradle.properties")
+      props.asScala.toMap
+    },
+    geodeBuildTargetDirectory := file(if (buildProperties.value.getOrElse("buildRoot", "").trim.isEmpty)
geodeBaseDirectory.value.getAbsolutePath else buildProperties.value.get("buildRoot").get),
+    outputDir := geodeBuildTargetDirectory.value / "gemfire-spark-connector" 
+  )
 
   lazy val gfcResolvers = Seq(
-   //"GemStone Official Release" at "http://dist.gemstone.com/maven/release",
   "Repo for JLine" at "http://repo.springsource.org/libs-release",
   "Local Maven" at Path.userHome.asFile.toURI.toURL + ".m2/repository"
-  //"Apache Repository" at "https://repository.apache.org/content/repositories/releases/",
-  // "Akka Repository" at "http://repo.akka.io/releases/",
-  // "Spray Repository" at "http://repo.spray.cc/"
-  //"Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
   )
 
-
+  val functionSettings = commonSettings ++ inConfig(Compile)(Defaults.compileSettings) ++
Seq(unmanagedJars in Compile ++= {
+    val gcore = geodeBuildTargetDirectory.value / "gemfire-core"
+    val baseDirectories = (baseDirectory.value / "../lib") +++ (gcore / "build" / "libs"
) 
+    val customJars = (baseDirectories ** "*.jar") 
+    customJars.classpath
+  })
+  
   val gfcITSettings = inConfig(IntegrationTest)(Defaults.itSettings) ++
-    Seq(parallelExecution in IntegrationTest := false, fork in IntegrationTest := true)
+    Seq(parallelExecution in IntegrationTest := false, fork in IntegrationTest := true) ++
Seq(unmanagedJars in IntegrationTest ++= {
+    val geode = geodeBuildTargetDirectory.value
+    val baseDirectories = (baseDirectory.value / "../lib") +++ (geode)
+    val customJars = (baseDirectories ** "*.jar") +++ (geode ** "/build/libs/*.jar")
+    customJars.classpath
+  })
 
-  val gfcCompileSettings = inConfig(Compile)(Defaults.compileSettings) ++ Seq(unmanagedSourceDirectories
in Compile += baseDirectory.value /"../gemfire-functions/src")
 
-  val gfcSettings = commonSettings ++ gfcITSettings ++ gfcCompileSettings 
+  val gfcCompileSettings = inConfig(Compile)(Defaults.compileSettings) ++ Seq(unmanagedSourceDirectories
in Compile += baseDirectory.value /"../gemfire-functions/src") ++ Seq(unmanagedJars in Compile
++= {
+    val gcore = geodeBuildTargetDirectory.value /"gemfire-core"
+    val baseDirectories = (baseDirectory.value / "../lib") +++ (gcore / "build" / "libs"
)
+    val customJars = (baseDirectories ** "*.jar")
+    customJars.classpath
+  })
+  
+  val testSettings = inConfig(Test)(Defaults.testSettings) ++ Seq(unmanagedJars in Test ++=
{
+    val geode = geodeBuildTargetDirectory.value
+    val baseDirectories = (baseDirectory.value / "../lib") +++ (geode)
+    val customJars = (baseDirectories ** "*.jar") +++ (geode ** "/build/libs/*.jar")
+    customJars.classpath
+  })
+
+  val gfcSettings = commonSettings ++ gfcITSettings ++ gfcCompileSettings  ++ testSettings
 
   val demoSettings = commonSettings ++ Seq(
       scoverage.ScoverageSbtPlugin.ScoverageKeys.coverageExcludedPackages := ".*"


Mime
View raw message