Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAVA/BUILD: Fix make dist and jar install #4640

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SUBDIRS = \
src/tools/info \
src/tools/perf \
src/tools/profile \
bindings/java \
test/apps \
test/examples

Expand All @@ -46,11 +47,6 @@ if HAVE_MPICC
SUBDIRS += test/mpi
endif

if HAVE_JAVA
SUBDIRS += bindings/java/src/main/native
endif

EXTRA_DIST += bindings/java
EXTRA_DIST += contrib/configure-devel
EXTRA_DIST += contrib/configure-release
EXTRA_DIST += contrib/configure-prof
Expand Down
18 changes: 18 additions & 0 deletions bindings/java/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright (C) Mellanox Technologies Ltd. 2020. ALL RIGHTS RESERVED.
#
# See file LICENSE for terms.
#

EXTRA_DIST = \
src/main/java \
src/test \
checkstyle.xml \
pom.xml.in \
README.md

SUBDIRS = \
src/main/native

clean-local:
-rm -rf resources
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: new line

36 changes: 24 additions & 12 deletions bindings/java/src/main/native/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@

if HAVE_JAVA

topdir=$(abs_top_builddir)
java_build_dir=$(builddir)/build-java
javadir=$(top_srcdir)/bindings/java
MVNCMD=$(MVN) -B -T 1C -f $(topdir)/bindings/java/pom.xml -Dmaven.repo.local=$(java_build_dir)/.deps \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
jardir = $(libdir)
topdir = $(abs_top_builddir)
java_build_dir = $(builddir)/build-java
jarfile = $(java_build_dir)/jucx-@VERSION@.jar
javadir = $(top_srcdir)/bindings/java

MVNCMD = $(MVN) -B -T 1C -f \
$(topdir)/bindings/java/pom.xml \
-Dmaven.repo.local=$(java_build_dir)/.deps \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

JUCX_GENERATED_H_FILES = org_openucx_jucx_ucp_UcpConstants.h \
org_openucx_jucx_ucp_UcpContext.h \
Expand All @@ -24,25 +29,29 @@ JUCX_GENERATED_H_FILES = org_openucx_jucx_ucp_UcpConstants.h \

BUILT_SOURCES = $(JUCX_GENERATED_H_FILES)

MOSTLYCLEANFILES = $(JUCX_GENERATED_H_FILES) native_headers.stamp
STAMP_FILE = native_headers.stamp

MOSTLYCLEANFILES = $(JUCX_GENERATED_H_FILES) $(STAMP_FILE)

#
# Create a timestamp file to avoid regenerating header files every time
# See https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html
#
native_headers.stamp: \
$(STAMP_FILE): \
$(javadir)/src/main/java/org/openucx/jucx/ucs/*.java \
$(javadir)/src/main/java/org/openucx/jucx/ucp/*.java
$(MVNCMD) compile native:javah
touch native_headers.stamp
touch $(STAMP_FILE)

$(JUCX_GENERATED_H_FILES): native_headers.stamp
$(JUCX_GENERATED_H_FILES): $(STAMP_FILE)

lib_LTLIBRARIES = libjucx.la

libjucx_la_CPPFLAGS = -I$(JDK)/include -I$(JDK)/include/linux \
-I$(topdir)/src -I$(top_srcdir)/src

noinst_HEADERS = jucx_common_def.h

libjucx_la_SOURCES = context.cc \
endpoint.cc \
jucx_common_def.cc \
Expand All @@ -63,12 +72,15 @@ libjucx_la_LIBADD = $(topdir)/src/ucs/libucs.la \
libjucx_la_DEPENDENCIES = Makefile.am Makefile.in Makefile

# Compile Java source code and pack to jar
package:
$(jarfile):
$(MVNCMD) package -DskipTests

package : $(jarfile)

.PHONY: package

# Maven install phase
install-data-hook: package
cp -fp $(java_build_dir)/jucx-@VERSION@.jar $(DESTDIR)@libdir@
jar_DATA = $(jarfile)

# Remove all compiled Java files
clean-local:
Expand Down
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,9 @@ AC_CONFIG_FILES([
test/apps/sockaddr/Makefile
test/examples/Makefile
test/mpi/Makefile
bindings/java/src/main/native/Makefile
bindings/java/Makefile
bindings/java/pom.xml
bindings/java/src/main/native/Makefile
])
AC_CONFIG_FILES([test/mpi/run_mpi.sh], [chmod a+x test/mpi/run_mpi.sh])
Expand Down