From 8e57e02f3ece925cdf37006a160187993c6f1cb1 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Mon, 29 Jun 2015 20:13:50 -0400 Subject: [PATCH] Split Java agent library in 3 separate jars Instead of having one .jar whose content is dependent on the configure flags used for the build, we can produce 3 separate jars whose contents will always be the same: lttng-ust-agent-common lttng-ust-agent-jul lttng-ust-agent-log4j The configure flag will now determine if the jul/log4j packages are built or not. Signed-off-by: Alexandre Montplaisir Signed-off-by: Mathieu Desnoyers --- .gitignore | 3 +- configure.ac | 3 + doc/examples/Makefile.am | 4 +- doc/examples/java-jul/Makefile | 21 ++++--- doc/examples/java-jul/run | 11 ++-- doc/examples/java-log4j/Makefile | 24 +++---- doc/examples/java-log4j/run | 11 ++-- liblttng-ust-java-agent/java/Makefile.am | 63 +------------------ .../java/lttng-ust-agent-common/Makefile.am | 36 +++++++++++ .../Manifest.txt | 0 .../org/lttng/ust/agent/LTTngAgent.java | 0 .../lttng/ust/agent/LTTngSessiondCmd2_6.java | 0 .../ust/agent/LTTngTCPSessiondClient.java | 0 .../org/lttng/ust/agent/LogFramework.java | 0 .../lttng/ust/agent/LogFrameworkSkeleton.java | 0 .../java/lttng-ust-agent-jul/Makefile.am | 41 ++++++++++++ .../java/lttng-ust-agent-jul/Manifest.txt | 8 +++ .../org/lttng/ust/agent/jul/LTTngJUL.java | 0 .../lttng/ust/agent/jul/LTTngLogHandler.java | 0 .../java/lttng-ust-agent-log4j/Makefile.am | 41 ++++++++++++ .../java/lttng-ust-agent-log4j/Manifest.txt | 8 +++ .../org/lttng/ust/agent/log4j/LTTngLog4j.java | 0 .../ust/agent/log4j/LTTngLogAppender.java | 0 23 files changed, 182 insertions(+), 92 deletions(-) create mode 100644 liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile.am rename liblttng-ust-java-agent/java/{org/lttng/ust/agent => lttng-ust-agent-common}/Manifest.txt (100%) rename liblttng-ust-java-agent/java/{ => lttng-ust-agent-common}/org/lttng/ust/agent/LTTngAgent.java (100%) rename liblttng-ust-java-agent/java/{ => lttng-ust-agent-common}/org/lttng/ust/agent/LTTngSessiondCmd2_6.java (100%) rename liblttng-ust-java-agent/java/{ => lttng-ust-agent-common}/org/lttng/ust/agent/LTTngTCPSessiondClient.java (100%) rename liblttng-ust-java-agent/java/{ => lttng-ust-agent-common}/org/lttng/ust/agent/LogFramework.java (100%) rename liblttng-ust-java-agent/java/{ => lttng-ust-agent-common}/org/lttng/ust/agent/LogFrameworkSkeleton.java (100%) create mode 100644 liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile.am create mode 100644 liblttng-ust-java-agent/java/lttng-ust-agent-jul/Manifest.txt rename liblttng-ust-java-agent/java/{ => lttng-ust-agent-jul}/org/lttng/ust/agent/jul/LTTngJUL.java (100%) rename liblttng-ust-java-agent/java/{ => lttng-ust-agent-jul}/org/lttng/ust/agent/jul/LTTngLogHandler.java (100%) create mode 100644 liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile.am create mode 100644 liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Manifest.txt rename liblttng-ust-java-agent/java/{ => lttng-ust-agent-log4j}/org/lttng/ust/agent/log4j/LTTngLog4j.java (100%) rename liblttng-ust-java-agent/java/{ => lttng-ust-agent-log4j}/org/lttng/ust/agent/log4j/LTTngLogAppender.java (100%) diff --git a/.gitignore b/.gitignore index 6b11c673..bcd0ecb9 100644 --- a/.gitignore +++ b/.gitignore @@ -54,14 +54,13 @@ tests/benchmark/bench2 # Java agent library *.class -liblttng-ust-agent*.jar +lttng-ust-agent*.jar classnoinst.stamp jni-header.stamp jul-jni-header.stamp log4j-jni-header.stamp org_lttng_ust_agent_jul_LTTngLogHandler.h org_lttng_ust_agent_log4j_LTTngLogAppender.h -liblttng-ust-java-agent/java/liblttng-ust-jul.jar # Python agent liblttng-ust-python-agent/__init__.py diff --git a/configure.ac b/configure.ac index fe85e7be..0e9886ba 100644 --- a/configure.ac +++ b/configure.ac @@ -382,6 +382,9 @@ AC_CONFIG_FILES([ liblttng-ust-java/Makefile liblttng-ust-java-agent/Makefile liblttng-ust-java-agent/java/Makefile + liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile + liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile + liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile liblttng-ust-java-agent/jni/Makefile liblttng-ust-java-agent/jni/jul/Makefile liblttng-ust-java-agent/jni/log4j/Makefile diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index 9404054d..3538ee6d 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -105,12 +105,12 @@ all-local: done; \ if [ x"$(SUBDIRS_JUL)" != x"" ]; then \ for subdir in $(SUBDIRS_JUL); do \ - (cd $(SUBDIRS_JUL) && $(MAKE) JAVA_CLASSPATH_OVERRIDE="../../../liblttng-ust-java-agent/java" JAVA_JARFILE_OVERRIDE="liblttng-ust-agent.jar" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \ + (cd $(SUBDIRS_JUL) && $(MAKE) JAVA_CLASSPATH_OVERRIDE_JUL="../../../liblttng-ust-java-agent/java/lttng-ust-agent-jul" JAVA_CLASSPATH_OVERRIDE_COMMON="../../../liblttng-ust-java-agent/java/lttng-ust-agent-common" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \ done; \ fi; \ if [ x"$(SUBDIRS_LOG4J)" != x"" ]; then \ for subdir in $(SUBDIRS_LOG4J); do \ - (cd $(SUBDIRS_LOG4J) && $(MAKE) JAVA_CLASSPATH_OVERRIDE="../../../liblttng-ust-java-agent/java" JAVA_JARFILE_OVERRIDE="liblttng-ust-agent.jar" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \ + (cd $(SUBDIRS_LOG4J) && $(MAKE) JAVA_CLASSPATH_OVERRIDE_LOG4J="../../../liblttng-ust-java-agent/java/lttng-ust-agent-log4j" JAVA_CLASSPATH_OVERRIDE_COMMON="../../../liblttng-ust-java-agent/java/lttng-ust-agent-common" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \ done; \ fi; diff --git a/doc/examples/java-jul/Makefile b/doc/examples/java-jul/Makefile index 1431b60b..154078bf 100644 --- a/doc/examples/java-jul/Makefile +++ b/doc/examples/java-jul/Makefile @@ -16,19 +16,22 @@ # This makefile is purposefully kept simple to support GNU and BSD make. # -# Default JUL jar name. -JARFILE=liblttng-ust-agent.jar +# Required JAR files for JUL +JARFILE_JUL=lttng-ust-agent-jul.jar +JARFILE_COMMON=lttng-ust-agent-common.jar -# Check if the top level makefile overrides the JUL Jar file name. -ifneq "$(JAVA_JARFILE_OVERRIDE)" "" - JARFILE=$(JAVA_JARFILE_OVERRIDE) +# Check if the top level makefile overrides the JUL Jar file's path. +ifeq "$(JAVA_CLASSPATH_OVERRIDE_JUL)" "" + CLASSPATH=/usr/local/share/java/$(JARFILE_JUL):/usr/share/java/$(JARFILE_JUL) +else + CLASSPATH=$(JAVA_CLASSPATH_OVERRIDE_JUL)/$(JARFILE_JUL) endif -# Check if the top level makefile overrides the JUL classpath. -ifeq "$(JAVA_CLASSPATH_OVERRIDE)" "" - CLASSPATH=/usr/local/share/java/$(JARFILE):/usr/share/java/$(JARFILE) +# Check if the top level makefile overrides the Common Jar file's path. +ifeq "$(JAVA_CLASSPATH_OVERRIDE_COMMON)" "" + CLASSPATH:=$(CLASSPATH):/usr/local/share/java/$(JARFILE_COMMON):/usr/share/java/$(JARFILE_COMMON) else - CLASSPATH=$(JAVA_CLASSPATH_OVERRIDE)/$(JARFILE) + CLASSPATH:=$(CLASSPATH):$(JAVA_CLASSPATH_OVERRIDE_COMMON)/$(JARFILE_COMMON) endif JFLAGS = -g diff --git a/doc/examples/java-jul/run b/doc/examples/java-jul/run index 6deb6fd8..eb340da8 100755 --- a/doc/examples/java-jul/run +++ b/doc/examples/java-jul/run @@ -7,22 +7,25 @@ # DIR=`dirname $0` -JARFILE="liblttng-ust-agent.jar" +JARFILE_COMMON="lttng-ust-agent-common.jar" +JARFILE_JUL="lttng-ust-agent-jul.jar" JAVA_OPTIONS="" cd $DIR if [ -f "$DIR/.intree" ]; then - CLASSPATH="../../../liblttng-ust-java-agent/java/$JARFILE" + CLASSPATH="../../../liblttng-ust-java-agent/java/lttng-ust-agent-common/$JARFILE_COMMON" + CLASSPATH="$CLASSPATH:../../../liblttng-ust-java-agent/java/lttng-ust-agent-jul/$JARFILE_JUL" LIBPATH="../../../liblttng-ust-java-agent/jni/jul/.libs" else - CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE" + CLASSPATH="/usr/local/share/java/$JARFILE_COMMON:/usr/share/java/$JARFILE_COMMON" + CLASSPATH="$CLASSPATH:/usr/local/share/java/$JARFILE_JUL:/usr/share/java/$JARFILE_JUL" # Use system defined java.library.path #LIBPATH="/usr/local/lib:/usr/lib" fi if [ "x$LIBPATH" != "x" ]; then - JAVA_OPTIONS="$JAVA_OPTIONS -Djava.library.path=\"$LIBPATH\"" + JAVA_OPTIONS="$JAVA_OPTIONS -Djava.library.path=$LIBPATH" fi java -classpath "$CLASSPATH:." $JAVA_OPTIONS Hello diff --git a/doc/examples/java-log4j/Makefile b/doc/examples/java-log4j/Makefile index 2c629c37..bf10fc52 100644 --- a/doc/examples/java-log4j/Makefile +++ b/doc/examples/java-log4j/Makefile @@ -16,28 +16,30 @@ # This makefile is purposefully kept simple to support GNU and BSD make. # -JFLAGS = -g - -# Default JUL jar name. -JARFILE=liblttng-ust-agent.jar +# Required JAR files for Log4j +JARFILE_LOG4J=lttng-ust-agent-log4j.jar +JARFILE_COMMON=lttng-ust-agent-common.jar # If system classpath is empty, try to guess log4j location ifeq "$(CLASSPATH)" "" CLASSPATH="/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar" endif -# Check if the top level makefile overrides the JUL Jar file name. -ifneq "$(JAVA_JARFILE_OVERRIDE)" "" - JARFILE=$(JAVA_JARFILE_OVERRIDE) +# Check if the top level makefile overrides the Log4j Jar file's path. +ifeq "$(JAVA_CLASSPATH_OVERRIDE_LOG4J)" "" + CLASSPATH:=$(CLASSPATH):/usr/local/share/java/$(JARFILE_LOG4J):/usr/share/java/$(JARFILE_LOG4J) +else + CLASSPATH:=$(CLASSPATH):$(JAVA_CLASSPATH_OVERRIDE_LOG4J)/$(JARFILE_LOG4J) endif -# Check if the top level makefile overrides the JUL classpath. -ifeq "$(JAVA_CLASSPATH_OVERRIDE)" "" - CLASSPATH:=/usr/local/share/java/$(JARFILE):/usr/share/java/$(JARFILE):$(CLASSPATH) +# Check if the top level makefile overrides the Common Jar file's path. +ifeq "$(JAVA_CLASSPATH_OVERRIDE_COMMON)" "" + CLASSPATH:=$(CLASSPATH):/usr/local/share/java/$(JARFILE_COMMON):/usr/share/java/$(JARFILE_COMMON) else - CLASSPATH:=$(JAVA_CLASSPATH_OVERRIDE)/$(JARFILE):$(CLASSPATH) + CLASSPATH:=$(CLASSPATH):$(JAVA_CLASSPATH_OVERRIDE_COMMON)/$(JARFILE_COMMON) endif +JFLAGS = -g JC = javac -classpath "$(CLASSPATH):." .SUFFIXES: .java .class .java.class: diff --git a/doc/examples/java-log4j/run b/doc/examples/java-log4j/run index 91f8f5d6..997d0bdc 100755 --- a/doc/examples/java-log4j/run +++ b/doc/examples/java-log4j/run @@ -7,7 +7,8 @@ # DIR=`dirname $0` -JARFILE="liblttng-ust-agent.jar" +JARFILE_COMMON="lttng-ust-agent-common.jar" +JARFILE_LOG4J="lttng-ust-agent-log4j.jar" JAVA_OPTIONS="" # If system classpath is empty, try to guess log4j location @@ -18,16 +19,18 @@ fi cd $DIR if [ -f "$DIR/.intree" ]; then - CLASSPATH="../../../liblttng-ust-java-agent/java/$JARFILE:$CLASSPATH" + CLASSPATH="$CLASSPATH:../../../liblttng-ust-java-agent/java/lttng-ust-agent-common/$JARFILE_COMMON" + CLASSPATH="$CLASSPATH:../../../liblttng-ust-java-agent/java/lttng-ust-agent-log4j/$JARFILE_LOG4J" LIBPATH="../../../liblttng-ust-java-agent/jni/log4j/.libs" else - CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE:$CLASSPATH" + CLASSPATH="$CLASSPATH:/usr/local/share/java/$JARFILE_COMMON:/usr/share/java/$JARFILE_COMMON" + CLASSPATH="$CLASSPATH:/usr/local/share/java/$JARFILE_LOG4J:/usr/share/java/$JARFILE_LOG4J" # Use system defined java.library.path #LIBPATH="/usr/local/lib:/usr/lib" fi if [ "x$LIBPATH" != "x" ]; then - JAVA_OPTIONS="$JAVA_OPTIONS -Djava.library.path=\"$LIBPATH\"" + JAVA_OPTIONS="$JAVA_OPTIONS -Djava.library.path=$LIBPATH" fi java -classpath "$CLASSPATH:." $JAVA_OPTIONS Hello diff --git a/liblttng-ust-java-agent/java/Makefile.am b/liblttng-ust-java-agent/java/Makefile.am index 1232d6e5..a10a393f 100644 --- a/liblttng-ust-java-agent/java/Makefile.am +++ b/liblttng-ust-java-agent/java/Makefile.am @@ -1,66 +1,9 @@ -JAVAROOT = . - -pkgpath = org/lttng/ust/agent - -jarfile_version = 1.0.0 -jarfile_manifest = $(srcdir)/$(pkgpath)/Manifest.txt -jarfile_symlink = liblttng-ust-agent.jar -jarfile = liblttng-ust-agent-$(jarfile_version).jar - -jardir = $(datadir)/java - -juljniout = ../jni/jul -log4jjniout = ../jni/log4j - -dist_noinst_JAVA = $(pkgpath)/LTTngAgent.java \ - $(pkgpath)/LTTngSessiondCmd2_6.java \ - $(pkgpath)/LTTngTCPSessiondClient.java \ - $(pkgpath)/LogFramework.java \ - $(pkgpath)/LogFrameworkSkeleton.java \ - $(pkgpath)/jul/LTTngJUL.java \ - $(pkgpath)/jul/LTTngLogHandler.java - -dist_noinst_DATA = $(jarfile_manifest) - -jar_DATA = $(jarfile) - -stamp = -classes = $(pkgpath)/*.class +SUBDIRS = lttng-ust-agent-common if BUILD_JAVA_AGENT_WITH_JUL -dist_noinst_JAVA += $(pkgpath)/jul/LTTngJUL.java \ - $(pkgpath)/jul/LTTngLogHandler.java -stamp += jul-jni-header.stamp -classes += $(pkgpath)/jul/*.class +SUBDIRS += lttng-ust-agent-jul endif if BUILD_JAVA_AGENT_WITH_LOG4J -dist_noinst_JAVA += $(pkgpath)/log4j/LTTngLog4j.java \ - $(pkgpath)/log4j/LTTngLogAppender.java -stamp += log4j-jni-header.stamp -classes += $(pkgpath)/log4j/*.class +SUBDIRS += lttng-ust-agent-log4j endif - -$(jarfile): classnoinst.stamp - $(JAR) cfm $(JARFLAGS) $@ $(jarfile_manifest) $(classes) && rm -f $(jarfile_symlink) && $(LN_S) $@ $(jarfile_symlink) - -jul-jni-header.stamp: $(dist_noinst_JAVA) - $(JAVAH) -classpath $(CLASSPATH):$(srcdir) -d $(juljniout) $(JAVAHFLAGS) org.lttng.ust.agent.jul.LTTngLogHandler && \ - echo "JUL JNI header generated" > jul-jni-header.stamp - -log4j-jni-header.stamp: $(dist_noinst_JAVA) - $(JAVAH) -classpath $(CLASSPATH):$(srcdir) -d $(log4jjniout) $(JAVAHFLAGS) org.lttng.ust.agent.log4j.LTTngLogAppender && \ - echo "Log4j JNI header generated" > log4j-jni-header.stamp - -all-local: $(stamp) - -install-data-hook: - cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) && $(LN_S) $(jarfile) $(jarfile_symlink) - -uninstall-hook: - cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) - -CLEANFILES = $(jarfile) $(pkgpath)/*.class $(pkgpath)/jul/*.class \ - $(pkgpath)/log4j/*.class jul-jni-header.stamp log4j-jni-header.stamp \ - $(juljniout)/org_lttng_ust_agent_jul_LTTngLogHandler.h \ - $(log4jjniout)/org_lttng_ust_agent_log4j_LTTngLogAppender.h diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile.am b/liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile.am new file mode 100644 index 00000000..46ac7cde --- /dev/null +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile.am @@ -0,0 +1,36 @@ +JAVAROOT = . + +pkgpath = org/lttng/ust/agent + +jarfile_version = 1.0.0 +jarfile_manifest = $(srcdir)/Manifest.txt +jarfile_symlink = lttng-ust-agent-common.jar +jarfile = lttng-ust-agent-common-$(jarfile_version).jar + + +jardir = $(datadir)/java + +dist_noinst_JAVA = $(pkgpath)/LTTngAgent.java \ + $(pkgpath)/LTTngSessiondCmd2_6.java \ + $(pkgpath)/LTTngTCPSessiondClient.java \ + $(pkgpath)/LogFramework.java \ + $(pkgpath)/LogFrameworkSkeleton.java + +dist_noinst_DATA = $(jarfile_manifest) + +jar_DATA = $(jarfile) + +classes = $(pkgpath)/*.class + +$(jarfile): + $(JAR) cfm $(JARFLAGS) $@ $(jarfile_manifest) $(classes) && rm -f $(jarfile_symlink) && $(LN_S) $@ $(jarfile_symlink) + +all-local: + +install-data-hook: + cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) && $(LN_S) $(jarfile) $(jarfile_symlink) + +uninstall-hook: + cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) + +CLEANFILES = $(jarfile) $(pkgpath)/*.class diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/Manifest.txt b/liblttng-ust-java-agent/java/lttng-ust-agent-common/Manifest.txt similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/Manifest.txt rename to liblttng-ust-java-agent/java/lttng-ust-agent-common/Manifest.txt diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngAgent.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngAgent.java similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngAgent.java rename to liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngAgent.java diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngSessiondCmd2_6.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngSessiondCmd2_6.java similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngSessiondCmd2_6.java rename to liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngSessiondCmd2_6.java diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngTCPSessiondClient.java similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java rename to liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngTCPSessiondClient.java diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LogFramework.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFramework.java similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/LogFramework.java rename to liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFramework.java diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LogFrameworkSkeleton.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFrameworkSkeleton.java similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/LogFrameworkSkeleton.java rename to liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFrameworkSkeleton.java diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile.am b/liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile.am new file mode 100644 index 00000000..b2aed8b4 --- /dev/null +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile.am @@ -0,0 +1,41 @@ +JAVAROOT = . +CLASSPATH_ENV = CLASSPATH=$(CLASSPATH):$(builddir)/../lttng-ust-agent-common/lttng-ust-agent-common.jar + +pkgpath = org/lttng/ust/agent/jul + +jarfile_version = 1.0.0 +jarfile_manifest = $(srcdir)/Manifest.txt +jarfile_symlink = lttng-ust-agent-jul.jar +jarfile = lttng-ust-agent-jul-$(jarfile_version).jar + +jardir = $(datadir)/java + +juljniout = ../../jni/jul + +dist_noinst_JAVA = $(pkgpath)/LTTngJUL.java \ + $(pkgpath)/LTTngLogHandler.java + +dist_noinst_DATA = $(jarfile_manifest) + +jar_DATA = $(jarfile) + +stamp = jul-jni-header.stamp +classes = $(pkgpath)/*.class + +$(jarfile): classnoinst.stamp + $(JAR) cfm $(JARFLAGS) $@ $(jarfile_manifest) $(classes) && rm -f $(jarfile_symlink) && $(LN_S) $@ $(jarfile_symlink) + +jul-jni-header.stamp: $(dist_noinst_JAVA) + $(JAVAH) -classpath $(CLASSPATH):$(srcdir) -d $(juljniout) $(JAVAHFLAGS) org.lttng.ust.agent.jul.LTTngLogHandler && \ + echo "JUL JNI header generated" > jul-jni-header.stamp + +all-local: $(stamp) + +install-data-hook: + cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) && $(LN_S) $(jarfile) $(jarfile_symlink) + +uninstall-hook: + cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) + +CLEANFILES = $(jarfile) $(pkgpath)/*.class jul-jni-header.stamp \ + $(juljniout)/org_lttng_ust_agent_jul_LTTngLogHandler.h diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-jul/Manifest.txt b/liblttng-ust-java-agent/java/lttng-ust-agent-jul/Manifest.txt new file mode 100644 index 00000000..4aba3600 --- /dev/null +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-jul/Manifest.txt @@ -0,0 +1,8 @@ +Name: org/lttng/ust/agent/jul/ +Specification-Title: LTTng UST Java Agent JUL Integration +Specification-Version: 1.0.0 +Specification-Vendor: LTTng Project +Implementation-Title: org.lttng.ust.agent.jul +Implementation-Version: 1.0.0 +Implementation-Vendor: LTTng Project +Class-Path: lttng-ust-agent-common.jar diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/jul/LTTngJUL.java b/liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngJUL.java similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/jul/LTTngJUL.java rename to liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngJUL.java diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/jul/LTTngLogHandler.java b/liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngLogHandler.java similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/jul/LTTngLogHandler.java rename to liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngLogHandler.java diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile.am b/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile.am new file mode 100644 index 00000000..9113f85e --- /dev/null +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile.am @@ -0,0 +1,41 @@ +JAVAROOT = . +CLASSPATH_ENV = CLASSPATH=$(CLASSPATH):$(builddir)/../lttng-ust-agent-common/lttng-ust-agent-common.jar + +pkgpath = org/lttng/ust/agent/log4j + +jarfile_version = 1.0.0 +jarfile_manifest = $(srcdir)/Manifest.txt +jarfile_symlink = lttng-ust-agent-log4j.jar +jarfile = lttng-ust-agent-log4j-$(jarfile_version).jar + +jardir = $(datadir)/java + +log4jjniout = ../../jni/log4j + +dist_noinst_JAVA = $(pkgpath)/LTTngLog4j.java \ + $(pkgpath)/LTTngLogAppender.java + +dist_noinst_DATA = $(jarfile_manifest) + +jar_DATA = $(jarfile) + +stamp = log4j-jni-header.stamp +classes = $(pkgpath)/*.class + +$(jarfile): classnoinst.stamp + $(JAR) cfm $(JARFLAGS) $@ $(jarfile_manifest) $(classes) && rm -f $(jarfile_symlink) && $(LN_S) $@ $(jarfile_symlink) + +log4j-jni-header.stamp: $(dist_noinst_JAVA) + $(JAVAH) -classpath $(CLASSPATH):$(srcdir) -d $(log4jjniout) $(JAVAHFLAGS) org.lttng.ust.agent.log4j.LTTngLogAppender && \ + echo "Log4j JNI header generated" > log4j-jni-header.stamp + +all-local: $(stamp) + +install-data-hook: + cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) && $(LN_S) $(jarfile) $(jarfile_symlink) + +uninstall-hook: + cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) + +CLEANFILES = $(jarfile) $(pkgpath)/*.class log4j-jni-header.stamp \ + $(log4jjniout)/org_lttng_ust_agent_log4j_LTTngLogAppender.h diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Manifest.txt b/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Manifest.txt new file mode 100644 index 00000000..d7b98f42 --- /dev/null +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Manifest.txt @@ -0,0 +1,8 @@ +Name: org/lttng/ust/agent/log4j/ +Specification-Title: LTTng UST Java Agent Log4J 1.x Integration +Specification-Version: 1.0.0 +Specification-Vendor: LTTng Project +Implementation-Title: org.lttng.ust.agent.log4j +Implementation-Version: 1.0.0 +Implementation-Vendor: LTTng Project +Class-Path: lttng-ust-agent-common.jar diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/log4j/LTTngLog4j.java b/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLog4j.java similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/log4j/LTTngLog4j.java rename to liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLog4j.java diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/log4j/LTTngLogAppender.java b/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLogAppender.java similarity index 100% rename from liblttng-ust-java-agent/java/org/lttng/ust/agent/log4j/LTTngLogAppender.java rename to liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLogAppender.java -- 2.34.1