You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2013/07/19 23:16:34 UTC

[1/4] git commit: Extended MesosNativeLibrary.java to load the native library from an absolute path.

Updated Branches:
  refs/heads/master 84b2ce626 -> 898e90607


Extended MesosNativeLibrary.java to load the native
library from an absolute path.

Review: https://reviews.apache.org/r/12618


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

Branch: refs/heads/master
Commit: d7e3875eb232b63a0da1dbb5c7cd80081be4ef78
Parents: 83c0d6a
Author: Vinod Kone <vi...@twitter.com>
Authored: Tue Jul 16 18:03:48 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Fri Jul 19 14:15:36 2013 -0700

----------------------------------------------------------------------
 .../org/apache/mesos/MesosNativeLibrary.java.in | 56 +++++++++-----------
 1 file changed, 26 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d7e3875e/src/java/generated/org/apache/mesos/MesosNativeLibrary.java.in
----------------------------------------------------------------------
diff --git a/src/java/generated/org/apache/mesos/MesosNativeLibrary.java.in b/src/java/generated/org/apache/mesos/MesosNativeLibrary.java.in
index 56e9772..4967072 100644
--- a/src/java/generated/org/apache/mesos/MesosNativeLibrary.java.in
+++ b/src/java/generated/org/apache/mesos/MesosNativeLibrary.java.in
@@ -20,11 +20,21 @@ package org.apache.mesos;
 
 public class MesosNativeLibrary {
   /**
-   * Attempts to load the native library if it was not previously
-   * loaded (e.g., by either {@link System.load} or {@link
-   * System.loadLibrary}).
+   * Attempts to load the native library (if it was not previously loaded)
+   * from the given path. If the path is null 'java.library.path' is used to
+   * load the library.
    */
-  public static void load() {
+  public static void load(String path) {
+    // Our JNI library will actually set 'loaded' to true once it is
+    // loaded, that way the library can get loaded by a user via
+    // 'System.load' in the event that they want to specify an
+    // absolute path and we won't try and reload the library ourselves
+    // (which would probably fail because 'java.library.path' might
+    // not be set).
+    if (loaded) {
+      return;
+    }
+
     // In some circumstances, such as when sandboxed class loaders are used,
     // the current thread's context class loader will not be able to see
     // MesosNativeLibrary (even when executing this code!).
@@ -35,39 +45,25 @@ public class MesosNativeLibrary {
         Thread.currentThread().getContextClassLoader();
     Thread.currentThread().setContextClassLoader(
         MesosNativeLibrary.class.getClassLoader());
-
     try {
-      // Our JNI library will actually set 'loaded' to true once it is
-      // loaded, that way the library can get loaded by a user via
-      // 'System.load' in the event that they want to specify an
-      // absolute path and we won't try and reload the library ourselves
-      // (which would probably fail because 'java.library.path' might
-      // not be set).
-      if (!loaded) {
-        final String MESOS_NATIVE_LIBRARY = System.getenv("MESOS_NATIVE_LIBRARY");
-        if (MESOS_NATIVE_LIBRARY != null) {
-          try {
-            System.load(MESOS_NATIVE_LIBRARY);
-          } catch (UnsatisfiedLinkError error) {
-            System.err.println("Failed to load native Mesos library at " +
-                MESOS_NATIVE_LIBRARY);
-            throw error;
-          }
-        } else {
-          try {
-            System.loadLibrary("mesos");
-          } catch (UnsatisfiedLinkError error) {
-            System.err.println("Failed to load native Mesos library from " +
-                System.getProperty("java.library.path"));
-            throw error;
-          }
-        }
+      if (path != null) {
+        System.load(path);
+      } else {
+        System.loadLibrary("mesos");
       }
+    } catch (UnsatisfiedLinkError error) {
+      System.err.println("Failed to load native Mesos library from " +
+          (path != null ? path : System.getProperty("java.library.path")));
+      throw error;
     } finally {
       Thread.currentThread().setContextClassLoader(contextClassLoader);
     }
   }
 
+  public static void load() {
+    load(System.getProperty("MESOS_NATIVE_LIBRARY"));
+  }
+
   public static final String VERSION = "@PACKAGE_VERSION@";
 
   private static boolean loaded = false;


[3/4] git commit: Updated mesos.pom to reflect graduation.

Posted by vi...@apache.org.
Updated mesos.pom to reflect graduation.

Review: https://reviews.apache.org/r/12537


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

Branch: refs/heads/master
Commit: 8333c128f0d01de7361c9c4bab7cbd666ed77e69
Parents: 84b2ce6
Author: Vinod Kone <vi...@twitter.com>
Authored: Sat Jul 13 20:49:27 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Fri Jul 19 14:15:36 2013 -0700

----------------------------------------------------------------------
 src/java/mesos.pom.in | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8333c128/src/java/mesos.pom.in
----------------------------------------------------------------------
diff --git a/src/java/mesos.pom.in b/src/java/mesos.pom.in
index 17c2e2a..b88079d 100644
--- a/src/java/mesos.pom.in
+++ b/src/java/mesos.pom.in
@@ -5,12 +5,12 @@
   <groupId>org.apache.mesos</groupId>
   <artifactId>mesos</artifactId>
   <name>mesos</name>
-  <version>@PACKAGE_VERSION@-incubating</version>
+  <version>@PACKAGE_VERSION@</version>
   <description>The Apache Mesos Java API jar.</description>
-  <url>http://incubator.apache.org/mesos</url>
+  <url>http://mesos.apache.org</url>
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/incubator/mesos</connection>
-    <url>https://svn.apache.org/repos/asf/incubator/mesos</url>
+    <connection>scm:git:https://git-wip-us.apache.org/repos/asf/mesos.git</connection>
+    <url>https://git-wip-us.apache.org/repos/asf/mesos.git</url>
   </scm>
   <!-- We inherit from the apache parent pom to use its repositories
        but since we don't use Maven as the primary build system for
@@ -23,10 +23,13 @@
   <mailingLists>
     <mailingList>
       <name>Mesos Dev List</name>
-      <subscribe>mesos-dev-subscribe@incubator.apache.org</subscribe>
-      <unsubscribe>mesos-dev-unsubscribe@incubator.apache.org</unsubscribe>
-      <post>mesos-dev@incubator.apache.org</post>
-      <archive>http://mail-archives.apache.org/mod_mbox/incubator-mesos-dev</archive>
+      <subscribe>dev-subscribe@mesos.apache.org</subscribe>
+      <unsubscribe>dev-unsubscribe@mesos.apache.org</unsubscribe>
+      <post>dev@mesos.apache.org</post>
+      <archive>http://mail-archives.apache.org/mod_mbox/mesos-dev</archive>
+      <otherArchives>
+        <otherArchive>http://mail-archives.apache.org/mod_mbox/incubator-mesos-dev</otherArchive>
+      </otherArchives>
     </mailingList>
   </mailingLists>
   <developers>


[2/4] git commit: Fixed Jenkins build to use the Mesos jar built in the repo.

Posted by vi...@apache.org.
Fixed Jenkins build to use the Mesos jar built in the repo.

Review: https://reviews.apache.org/r/12532


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

Branch: refs/heads/master
Commit: 83c0d6aac3a422543da9d07f3f76c4bc7b677161
Parents: 8333c12
Author: Vinod Kone <vi...@twitter.com>
Authored: Fri Jul 12 12:31:23 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Fri Jul 19 14:15:36 2013 -0700

----------------------------------------------------------------------
 configure.ac        |  1 +
 jenkins/Makefile.am | 29 ++++++++++++------
 jenkins/pom.xml     | 80 ------------------------------------------------
 jenkins/pom.xml.in  | 80 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 101 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/83c0d6aa/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index eca96a8..15ada8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,7 @@ AC_CONFIG_FILES([Makefile])
 AC_CONFIG_FILES([ec2/Makefile])
 AC_CONFIG_FILES([hadoop/Makefile])
 AC_CONFIG_FILES([jenkins/Makefile])
+AC_CONFIG_FILES([jenkins/pom.xml])
 AC_CONFIG_FILES([src/Makefile])
 AC_CONFIG_FILES([3rdparty/Makefile])
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/83c0d6aa/jenkins/Makefile.am
----------------------------------------------------------------------
diff --git a/jenkins/Makefile.am b/jenkins/Makefile.am
index 9f9ebf4..e9d88e5 100644
--- a/jenkins/Makefile.am
+++ b/jenkins/Makefile.am
@@ -31,20 +31,31 @@ EXTRA_DIST = pom.xml										\
 	src/main/resources/org/jenkinsci/plugins/mesos/TaskTemplate/config.jelly
 
 
-# Defines a target to build the Jenkins plugin.
+
+
+MESOS_JAR = mesos-$(PACKAGE_VERSION).jar
+
+
+$(MESOS_JAR):
+	@cd $(abs_top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) maven-install;
+
+
+# Defines a target to build the Jenkins plugin for Mesos.
 # This will create ./target/mesos.hpi that you can deploy to Jenkins.
-jenkins:
-	if test "$(top_srcdir)" != "$(top_builddir)"; then	\
-          cp -p $(srcdir)/pom.xml .;				\
-          cp -rp $(srcdir)/src .;				\
+jenkins: $(MESOS_JAR)
+	if test "$(top_srcdir)" != "$(top_builddir)"; then			\
+          cp -rp $(srcdir)/src .;						\
         fi
-	mvn install
+	mvn package
+
+
+all: jenkins
 
 
 clean-local:
-	if test "$(top_srcdir)" != "$(top_builddir)"; then	\
-          rm -f pom.xml;					\
-          rm -rf src target work;				\
+	if test "$(top_srcdir)" != "$(top_builddir)"; then		\
+          mvn clean;							\
+          rm -rf src work repo;						\
         fi
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/83c0d6aa/jenkins/pom.xml
----------------------------------------------------------------------
diff --git a/jenkins/pom.xml b/jenkins/pom.xml
deleted file mode 100644
index c8d0deb..0000000
--- a/jenkins/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.jenkins-ci.plugins</groupId>
-    <artifactId>plugin</artifactId>
-    <version>1.509.1</version><!-- which version of Jenkins is this plugin built against? -->
-  </parent>
-
-  <groupId>org.jenkins-ci.plugins</groupId>
-  <artifactId>mesos</artifactId>
-  <version>0.1-SNAPSHOT</version>
-  <packaging>hpi</packaging>
-
-  <!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
-  <repositories>
-    <repository>
-      <id>repo.jenkins-ci.org</id>
-      <url>http://repo.jenkins-ci.org/public/</url>
-    </repository>
-    <repository>
-      <id>repository.apache.org</id>
-      <url>https://repository.apache.org/content/repositories/releases</url>
-    </repository>
-
-  </repositories>
-
-  <pluginRepositories>
-    <pluginRepository>
-      <id>repo.jenkins-ci.org</id>
-      <url>http://repo.jenkins-ci.org/public/</url>
-    </pluginRepository>
-  </pluginRepositories>
-
-  <properties>
-    <!--
-      explicitly specifying the latest version here because one we get from the parent POM
-      tends to lag behind a bit
-    -->
-    <maven-hpi-plugin.version>1.95</maven-hpi-plugin.version>
-  </properties>
-
-  <!-- TODO(vinod): Use the mesos jar built from 'make maven-install' instead. -->
-  <!-- NOTE: Need to run jenkins by providing the mesos lib path. -->
-  <!-- $ MESOS_NATIVE_LIBRARY=/path/to/libmesos.dylib mvn hpi:run -->
-  <dependencies>
-      <dependency>
-          <groupId>org.apache.mesos</groupId>
-          <artifactId>mesos</artifactId>
-          <version>0.11.0-incubating</version>
-      </dependency>
-      <dependency>
-          <groupId>com.google.protobuf</groupId>
-          <artifactId>protobuf-java</artifactId>
-          <version>2.4.1</version>
-      </dependency>
-  </dependencies>
-
-  <build>
-      <plugins>
-          <plugin>
-              <groupId>org.apache.maven.plugins</groupId>
-              <artifactId>maven-dependency-plugin</artifactId>
-              <executions>
-                  <execution>
-                      <id>copy-dependencies</id>
-                      <phase>package</phase>
-                      <goals>
-                          <goal>copy-dependencies</goal>
-                      </goals>
-                      <configuration>
-                          <outputDirectory>${project.build.directory}</outputDirectory>
-                          <overWriteReleases>false</overWriteReleases>
-                          <overWriteSnapshots>true</overWriteSnapshots>
-                      </configuration>
-                  </execution>
-              </executions>
-          </plugin>
-      </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/mesos/blob/83c0d6aa/jenkins/pom.xml.in
----------------------------------------------------------------------
diff --git a/jenkins/pom.xml.in b/jenkins/pom.xml.in
new file mode 100644
index 0000000..6f76c49
--- /dev/null
+++ b/jenkins/pom.xml.in
@@ -0,0 +1,80 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.jenkins-ci.plugins</groupId>
+    <artifactId>plugin</artifactId>
+    <version>1.509.1</version><!-- which version of Jenkins is this plugin built against? -->
+  </parent>
+
+  <groupId>org.jenkins-ci.plugins</groupId>
+  <artifactId>mesos</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>hpi</packaging>
+
+  <!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
+  <repositories>
+    <repository>
+      <id>repo.jenkins-ci.org</id>
+      <url>http://repo.jenkins-ci.org/public/</url>
+    </repository>
+  </repositories>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>repo.jenkins-ci.org</id>
+      <url>http://repo.jenkins-ci.org/public/</url>
+    </pluginRepository>
+  </pluginRepositories>
+
+  <properties>
+    <!--
+      explicitly specifying the latest version here because one we get from the parent POM
+      tends to lag behind a bit
+    -->
+    <maven-hpi-plugin.version>1.95</maven-hpi-plugin.version>
+  </properties>
+
+  <!-- NOTE: Need to run jenkins by providing the mesos lib path. -->
+  <!-- $ MESOS_NATIVE_LIBRARY=/path/to/libmesos.dylib mvn hpi:run -->
+  <dependencies>
+      <dependency>
+          <groupId>org.apache.mesos</groupId>
+          <artifactId>mesos</artifactId>
+          <version>@PACKAGE_VERSION@</version>
+      </dependency>
+      <dependency>
+          <groupId>com.google.protobuf</groupId>
+          <artifactId>protobuf-java</artifactId>
+          <version>2.4.1</version>
+      </dependency>
+  </dependencies>
+
+  <build>
+      <plugins>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-dependency-plugin</artifactId>
+              <executions>
+                  <execution>
+                      <id>copy-dependencies</id>
+                      <phase>package</phase>
+                      <goals>
+                          <goal>copy-dependencies</goal>
+                      </goals>
+                      <configuration>
+                          <outputDirectory>${project.build.directory}</outputDirectory>
+                          <overWriteReleases>false</overWriteReleases>
+                          <overWriteSnapshots>true</overWriteSnapshots>
+                      </configuration>
+                  </execution>
+              </executions>
+          </plugin>
+          <plugin>
+              <artifactId>maven-compiler-plugin</artifactId>
+              <configuration>
+                  <target>1.6</target>
+              </configuration>
+          </plugin>
+      </plugins>
+  </build>
+</project>


[4/4] git commit: Fixed Jenkins to use the Mesos native library bundled with the plugin.

Posted by vi...@apache.org.
Fixed Jenkins to use the Mesos native library bundled with the plugin.

Review: https://reviews.apache.org/r/12538


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

Branch: refs/heads/master
Commit: 898e9060761dbaa27ce4acc862d184ae166c1945
Parents: d7e3875
Author: Vinod Kone <vi...@twitter.com>
Authored: Sat Jul 13 21:55:30 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Fri Jul 19 14:15:37 2013 -0700

----------------------------------------------------------------------
 jenkins/Makefile.am                                | 14 +++++++++++++-
 .../jenkinsci/plugins/mesos/JenkinsScheduler.java  | 17 +++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/898e9060/jenkins/Makefile.am
----------------------------------------------------------------------
diff --git a/jenkins/Makefile.am b/jenkins/Makefile.am
index e9d88e5..b5be92d 100644
--- a/jenkins/Makefile.am
+++ b/jenkins/Makefile.am
@@ -31,6 +31,16 @@ EXTRA_DIST = pom.xml										\
 	src/main/resources/org/jenkinsci/plugins/mesos/TaskTemplate/config.jelly
 
 
+if OS_LINUX
+  MESOS_LIBRARY = libmesos.so
+else
+  MESOS_LIBRARY = libmesos.dylib
+endif
+TARGET_LIBS_DIR = src/main/webapp
+
+
+$(MESOS_LIBRARY):
+	@cd $(abs_top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS);
 
 
 MESOS_JAR = mesos-$(PACKAGE_VERSION).jar
@@ -42,10 +52,12 @@ $(MESOS_JAR):
 
 # Defines a target to build the Jenkins plugin for Mesos.
 # This will create ./target/mesos.hpi that you can deploy to Jenkins.
-jenkins: $(MESOS_JAR)
+jenkins: $(MESOS_LIBRARY) $(MESOS_JAR)
 	if test "$(top_srcdir)" != "$(top_builddir)"; then			\
           cp -rp $(srcdir)/src .;						\
         fi
+	mkdir -p $(TARGET_LIBS_DIR) &&						\
+	cp $(abs_top_builddir)/src/.libs/$(MESOS_LIBRARY) $(TARGET_LIBS_DIR) && \
 	mvn package
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/898e9060/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
----------------------------------------------------------------------
diff --git a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
index 9166e70..b6892c0 100644
--- a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
+++ b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
@@ -8,7 +8,10 @@ import java.util.Map;
 import java.util.Queue;
 import java.util.logging.Logger;
 
+import jenkins.model.Jenkins;
+
 import org.apache.mesos.MesosSchedulerDriver;
+import org.apache.mesos.MesosNativeLibrary;
 import org.apache.mesos.Protos.CommandInfo;
 import org.apache.mesos.Protos.ExecutorID;
 import org.apache.mesos.Protos.Filters;
@@ -59,6 +62,20 @@ public class JenkinsScheduler implements Scheduler {
   }
 
   public synchronized void init() {
+    // Load the Mesos native library bundled with the plugin.
+    // TODO(vinod): Instead of loading the library here, it would
+    // be great if the plugin can dynamically set the MESOS_NATIVE_LIBRARY
+    // environment variable or java.library.path system property.
+    final String PLUGIN_DIR =
+        Jenkins.getInstance().getRootDir().getPath() + "/plugins/mesos";
+
+    String MESOS_NATIVE_LIBRARY = PLUGIN_DIR + "/libmesos.so";
+    if (System.getProperty("os.name").indexOf("Mac") >= 0) {
+      MESOS_NATIVE_LIBRARY = PLUGIN_DIR + "/libmesos.dylib";
+    }
+
+    MesosNativeLibrary.load(MESOS_NATIVE_LIBRARY);
+
     // Start the framework.
     new Thread(new Runnable() {
       @Override