You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jo...@apache.org on 2013/01/21 20:53:53 UTC

[3/4] git commit: KAFKA-139 cross-compile multiple Scala versions and upgrade to SBT 0.12.1 patch by Derek Chen-Becker reviewed by Joe Stein

KAFKA-139 cross-compile multiple Scala versions and upgrade to SBT 0.12.1 patch by Derek Chen-Becker reviewed by Joe Stein


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/e6aa6008
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/e6aa6008
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/e6aa6008

Branch: refs/heads/0.8
Commit: e6aa600813549ed6219ea5cfda95ecb08dc3717d
Parents: 1e011bf 241fea7
Author: Joe Stein <jo...@apache.org>
Authored: Mon Jan 21 14:41:47 2013 -0500
Committer: Joe Stein <jo...@apache.org>
Committed: Mon Jan 21 14:41:47 2013 -0500

----------------------------------------------------------------------
 .gitignore                        |    2 +
 README.md                         |   33 ++++----
 bin/run-rat.sh                    |    2 +-
 contrib/hadoop-consumer/build.sbt |    1 +
 contrib/hadoop-producer/build.sbt |    1 +
 core/build.sbt                    |   24 ++++++
 examples/build.sbt                |    3 +
 lib/apache-rat-0.8.jar            |  Bin 0 -> 1165578 bytes
 lib/sbt-launch.jar                |  Bin 920993 -> 1103618 bytes
 project/Build.scala               |  143 ++++++++++++++++++++++++++++++++
 project/build.properties          |    9 +--
 project/plugins.sbt               |    5 +
 project/plugins/Plugins.scala     |   23 -----
 13 files changed, 199 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/e6aa6008/README.md
----------------------------------------------------------------------
diff --cc README.md
index a028bce,5bb7a80..cf0d59e
--- a/README.md
+++ b/README.md
@@@ -9,31 -9,31 +9,33 @@@ It is designed to support the followin
  
  Kafka is aimed at providing a publish-subscribe solution that can handle all activity stream data and processing on a consumer-scale web site. This kind of activity (page views, searches, and other user actions) are a key ingredient in many of the social feature on the modern web. This data is typically handled by "logging" and ad hoc log aggregation solutions due to the throughput requirements. This kind of ad hoc solution is a viable solution to providing logging data to an offline analysis system like Hadoop, but is very limiting for building real-time processing. Kafka aims to unify offline and online processing by providing a mechanism for parallel load into Hadoop as well as the ability to partition real-time consumption over a cluster of machines.
  
--See our [web site](http://incubator.apache.org/kafka/) for more details on the project.
++See our [web site](http://kafka.apache.org/) for more details on the project.
  
  ## Contribution ##
  
--Kafka is a new project, and we are interested in building the community; we would welcome any thoughts or [patches](https://issues.apache.org/jira/browse/KAFKA). You can reach us [on the Apache mailing lists](http://incubator.apache.org/kafka/contact.html).
++Kafka is a new project, and we are interested in building the community; we would welcome any thoughts or [patches](https://issues.apache.org/jira/browse/KAFKA). You can reach us [on the Apache mailing lists](http://kafka.apache.org/contact.html).
  
--The Kafka code is available from svn or a read only git mirror:
-- * svn co http://svn.apache.org/repos/asf/incubator/kafka/trunk kafka
-- * git clone git://git.apache.org/kafka.git
++The Kafka code is available from:
++ * git clone http://git-wip-us.apache.org/repos/asf/kafka.git kafka
 +
- To build: 
++To contribute you can follow:
++ * https://cwiki.apache.org/confluence/display/KAFKA/Git+Workflow
  
- 1. ./sbt
- 2. update - This downloads all the dependencies for all sub projects
- 3. package - This will compile all sub projects and creates all the jars
+ To build for all supported versions of Scala: 
  
- Here are some useful sbt commands, to be executed at the sbt command prompt (./sbt) -
+ 1. ./sbt +package
  
- actions : Lists all the sbt commands and their descriptions
 -To build for a particular version of Scala (either 2.8.0 or 2.9.1): 
++To build for a particular version of Scala (either 2.8.0, 2.8.2, 2.9.1 or 2.9.2): 
  
- clean : Deletes all generated files (the target directory).
 -1. ./sbt "++ 2.8.0 package" *or* ./sbt "++ 2.9.1 package"
++1. ./sbt "++2.8.0 package" *or* ./sbt "++2.8.2 package" *or* ./sbt "++2.9.1 package" *or* ./sbt "++2.9.2 package"
+ 
+ Here are some useful sbt commands, to be executed at the sbt command prompt (./sbt). Prefixing with "++<version> " runs the
+ command for a specific Scala version, prefixing with "+" will perform the action for all versions of Scala, and no prefix
+ runs the command for the default (2.8.0) version of Scala. -
  
- clean-cache : Deletes the cache of artifacts downloaded for automatically managed dependencies.
+ tasks : Lists all the sbt commands and their descriptions
  
- clean-lib : Deletes the managed library directory.
+ clean : Deletes all generated files (the target directory).
  
  compile : Compile all the sub projects, but not create the jars
  

http://git-wip-us.apache.org/repos/asf/kafka/blob/e6aa6008/project/Build.scala
----------------------------------------------------------------------
diff --cc project/Build.scala
index 0000000,a81f191..44a55f8
mode 000000,100644..100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@@ -1,0 -1,143 +1,143 @@@
+ /**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *    http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ 
+ import sbt._
+ import Keys._
+ import java.io.File
+ 
+ import scala.xml.{Node, Elem}
+ import scala.xml.transform.{RewriteRule, RuleTransformer}
+ 
+ object KafkaBuild extends Build {
+   val commonSettings = Seq(
 -    version := "0.8.0",
 -    organization := "org.apache.kafka",
++    version := "0.8-SNAPSHOT",
++    organization := "org.apache",
+     scalacOptions ++= Seq("-deprecation", "-unchecked", "-g:none"),
 -    crossScalaVersions := Seq("2.8.0", "2.9.1", "2.9.2"),
++    crossScalaVersions := Seq("2.8.0","2.8.2", "2.9.1", "2.9.2"),
+     scalaVersion := "2.8.0",
+     javacOptions ++= Seq("-Xlint:unchecked", "-source", "1.5"),
+     parallelExecution in Test := false, // Prevent tests from overrunning each other
+     libraryDependencies ++= Seq(
+       "log4j"                 % "log4j"        % "1.2.15",
+       "net.sf.jopt-simple"    % "jopt-simple"  % "3.2",
+       "org.slf4j"             % "slf4j-simple" % "latest.release"
+     ),
+     // The issue is going from log4j 1.2.14 to 1.2.15, the developers added some features which required
+     // some dependencies on various sun and javax packages.
+     ivyXML := <dependencies>
+         <exclude module="javax"/>
+         <exclude module="jmxri"/>
+         <exclude module="jmxtools"/>
+         <exclude module="mail"/>
+         <exclude module="jms"/>
+         <dependency org="org.apache.zookeeper" name="zookeeper" rev="3.3.4">
+           <exclude org="log4j" module="log4j"/>
+           <exclude org="jline" module="jline"/>
+         </dependency>
+       </dependencies>
+   )
+ 
+   val hadoopSettings = Seq(
+     javacOptions ++= Seq("-Xlint:deprecation"),
+     libraryDependencies ++= Seq(
+       "org.apache.avro"      % "avro"               % "1.4.0",
+       "org.apache.pig"       % "pig"                % "0.8.0",
+       "commons-logging"      % "commons-logging"    % "1.0.4",
+       "org.codehaus.jackson" % "jackson-core-asl"   % "1.5.5",
+       "org.codehaus.jackson" % "jackson-mapper-asl" % "1.5.5",
+       "org.apache.hadoop"    % "hadoop-core"        % "0.20.2"
+     ),
+     ivyXML := 
+        <dependencies>
+          <exclude module="netty"/>
+          <exclude module="javax"/>
+          <exclude module="jmxri"/>
+          <exclude module="jmxtools"/>
+          <exclude module="mail"/>
+          <exclude module="jms"/>
+          <dependency org="org.apache.hadoop" name="hadoop-core" rev="0.20.2">
+            <exclude org="junit" module="junit"/>
+          </dependency>
+          <dependency org="org.apache.pig" name="pig" rev="0.8.0">
+            <exclude org="junit" module="junit"/>
+          </dependency>
+        </dependencies>
+   )
+ 
+   val coreSettings = Seq(
+     pomPostProcess := { (pom: Node) => MetricsDepAdder(ZkClientDepAdder(pom)) }
+   )
+ 
+   val runRat = TaskKey[Unit]("run-rat-task", "Runs Apache rat on Kafka")
+   val runRatTask = runRat := {
+     "bin/run-rat.sh" !
+   }
+ 
+   lazy val kafka    = Project(id = "Kafka", base = file(".")).aggregate(core, examples, contrib).settings((commonSettings ++ runRatTask): _*)
+   lazy val core     = Project(id = "core", base = file("core")).settings(commonSettings: _*).settings(coreSettings: _*)
+   lazy val examples = Project(id = "java-examples", base = file("examples")).settings(commonSettings :_*) dependsOn (core)
+   lazy val perf     = Project(id = "perf", base = file("perf")).settings((Seq(name := "kafka-perf") ++ commonSettings):_*) dependsOn (core)
+ 
+   lazy val contrib        = Project(id = "contrib", base = file("contrib")).aggregate(hadoopProducer, hadoopConsumer).settings(commonSettings :_*)
+   lazy val hadoopProducer = Project(id = "hadoop-producer", base = file("contrib/hadoop-producer")).settings(hadoopSettings ++ commonSettings: _*) dependsOn (core)
+   lazy val hadoopConsumer = Project(id = "hadoop-consumer", base = file("contrib/hadoop-consumer")).settings(hadoopSettings ++ commonSettings: _*) dependsOn (core)
+ 
+ 
+   // POM Tweaking for core:
+   def zkClientDep =
+     <dependency>
+       <groupId>zkclient</groupId>
+       <artifactId>zkclient</artifactId>
+       <version>20120522</version>
+       <scope>compile</scope>
+     </dependency>
+ 
+   def metricsDeps =
+     <dependencies>
+       <dependency>
+         <groupId>com.yammer.metrics</groupId>
+         <artifactId>metrics-core</artifactId>
+         <version>3.0.0-c0c8be71</version>
+         <scope>compile</scope>
+       </dependency>
+       <dependency>
+         <groupId>com.yammer.metrics</groupId>
+         <artifactId>metrics-annotations</artifactId>
+         <version>3.0.0-c0c8be71</version>
+         <scope>compile</scope>
+       </dependency>
+     </dependencies>
+ 
+   object ZkClientDepAdder extends RuleTransformer(new RewriteRule() {
+     override def transform(node: Node): Seq[Node] = node match {
+       case Elem(prefix, "dependencies", attribs, scope, deps @ _*) => {
+         Elem(prefix, "dependencies", attribs, scope, deps ++ zkClientDep:_*)
+       }
+       case other => other
+     }
+   })
+ 
+   object MetricsDepAdder extends RuleTransformer(new RewriteRule() {
+     override def transform(node: Node): Seq[Node] = node match {
+       case Elem(prefix, "dependencies", attribs, scope, deps @ _*) => {
+         Elem(prefix, "dependencies", attribs, scope, deps ++ metricsDeps:_*)
+       }
+       case other => other
+     }
+   })
+ 
+ }

http://git-wip-us.apache.org/repos/asf/kafka/blob/e6aa6008/project/build.properties
----------------------------------------------------------------------
diff --cc project/build.properties
index 6222624,d0f1e12..eea46f3
--- a/project/build.properties
+++ b/project/build.properties
@@@ -14,11 -14,5 +14,4 @@@
  # limitations under the License.
  #Project properties
  #Mon Feb 28 11:55:49 PST 2011
- project.name=Kafka
- sbt.version=0.7.5
- project.version=0.8.0-SNAPSHOT
- build.scala.versions=2.8.0
- contrib.root.dir=contrib
- lib.dir=lib
- target.dir=target/scala_2.8.0
- dist.dir=dist
+ sbt.version=0.12.1
 -