mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 21:27:57 +00:00
Link java api into shared library by specifying features
This commit is contained in:
parent
d844b0f6bd
commit
4809d7d585
10
Makefile.in
10
Makefile.in
@ -53,10 +53,10 @@ SERVAL_DAEMON_OBJS = \
|
|||||||
|
|
||||||
ifeq (@HAVE_JNI_H@,yes)
|
ifeq (@HAVE_JNI_H@,yes)
|
||||||
|
|
||||||
SERVAL_DAEMON_JNI_OBJS = \
|
SERVAL_DAEMON_JNI_OBJS = $(OBJSDIR_SERVALD)/servald_jni_features.o
|
||||||
$(addprefix $(OBJSDIR_SERVALD)/, $(SERVAL_DAEMON_JNI_SOURCES:.c=.o))
|
|
||||||
|
|
||||||
SERVAL_DAEMON_OBJS += $(SERVAL_DAEMON_JNI_OBJS)
|
SERVAL_DAEMON_OBJS += \
|
||||||
|
$(addprefix $(OBJSDIR_SERVALD)/, $(SERVAL_DAEMON_JNI_SOURCES:.c=.o))
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -366,7 +366,6 @@ libservaldaemon.a: _servald.a $(LIBSODIUM_A)
|
|||||||
libservaldaemon.so: \
|
libservaldaemon.so: \
|
||||||
$(OBJSDIR_SERVALD)/servald_features.o \
|
$(OBJSDIR_SERVALD)/servald_features.o \
|
||||||
$(OBJSDIR_SERVALD)/log_output_console.o \
|
$(OBJSDIR_SERVALD)/log_output_console.o \
|
||||||
$(OBJSDIR_SERVALD)/log_output_file.o \
|
|
||||||
$(SERVAL_DAEMON_JNI_OBJS) \
|
$(SERVAL_DAEMON_JNI_OBJS) \
|
||||||
_servald.a \
|
_servald.a \
|
||||||
$(LIBSODIUM_A)
|
$(LIBSODIUM_A)
|
||||||
@ -379,7 +378,6 @@ libservaldaemon.so: \
|
|||||||
# to be pulled into the link.
|
# to be pulled into the link.
|
||||||
servald: $(OBJSDIR_SERVALD)/servald_features.o \
|
servald: $(OBJSDIR_SERVALD)/servald_features.o \
|
||||||
$(OBJSDIR_SERVALD)/log_output_console.o \
|
$(OBJSDIR_SERVALD)/log_output_console.o \
|
||||||
$(OBJSDIR_SERVALD)/log_output_file.o \
|
|
||||||
libservaldaemon.a
|
libservaldaemon.a
|
||||||
@echo LINK $@
|
@echo LINK $@
|
||||||
@$(CC) -Wall -o $@ $^ $(LDFLAGS)
|
@$(CC) -Wall -o $@ $^ $(LDFLAGS)
|
||||||
@ -393,7 +391,6 @@ ifneq ($(SWIFTC),) # Only provide Swift targets if the Swift compiler is availab
|
|||||||
# package.
|
# package.
|
||||||
servaldswift: $(srcdir)/servaldswift.swift \
|
servaldswift: $(srcdir)/servaldswift.swift \
|
||||||
$(OBJSDIR_SERVALD)/servald_features.o \
|
$(OBJSDIR_SERVALD)/servald_features.o \
|
||||||
$(OBJSDIR_SERVALD)/log_output_file.o \
|
|
||||||
libservaldaemon.a \
|
libservaldaemon.a \
|
||||||
$(SWIFT_MODULE_NAME).swiftmodule \
|
$(SWIFT_MODULE_NAME).swiftmodule \
|
||||||
libServalDNA.a
|
libServalDNA.a
|
||||||
@ -410,7 +407,6 @@ servaldwrap: $(OBJSDIR_SERVALD)/servalwrap.o
|
|||||||
@$(CC) -Wall -o $@ $^ $(LDFLAGS)
|
@$(CC) -Wall -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
serval-tests: $(OBJSDIR_SERVALD)/test_features.o \
|
serval-tests: $(OBJSDIR_SERVALD)/test_features.o \
|
||||||
$(OBJSDIR_SERVALD)/log_output_console.o \
|
|
||||||
libservaldaemon.a
|
libservaldaemon.a
|
||||||
@echo LINK $@
|
@echo LINK $@
|
||||||
@$(CC) -Wall -o $@ $^ $(LDFLAGS)
|
@$(CC) -Wall -o $@ $^ $(LDFLAGS)
|
||||||
|
@ -27,6 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||||||
#include "strbuf_helpers.h"
|
#include "strbuf_helpers.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "instance.h"
|
||||||
|
#include "feature.h"
|
||||||
|
|
||||||
|
DEFINE_FEATURE(jni_commandline);
|
||||||
|
|
||||||
static struct cli_vtable cli_vtable_jni;
|
static struct cli_vtable cli_vtable_jni;
|
||||||
|
|
||||||
@ -194,6 +198,15 @@ static int initJniTypes(JNIEnv *env)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_org_servalproject_servaldna_ServalDCommand_setInstancePath(
|
||||||
|
JNIEnv *env, jobject UNUSED(this), jobject path)
|
||||||
|
{
|
||||||
|
const char *cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||||
|
set_instance_path(cpath);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||||
|
return (jint)0;
|
||||||
|
}
|
||||||
|
|
||||||
/* JNI entry point to command line. See org.servalproject.servald.ServalD class for the Java side.
|
/* JNI entry point to command line. See org.servalproject.servald.ServalD class for the Java side.
|
||||||
JNI method descriptor: "(Ljava/util/List;[Ljava/lang/String;)I"
|
JNI method descriptor: "(Ljava/util/List;[Ljava/lang/String;)I"
|
||||||
*/
|
*/
|
||||||
|
@ -26,6 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "instance.h"
|
#include "instance.h"
|
||||||
#include "httpd.h"
|
#include "httpd.h"
|
||||||
|
#include "feature.h"
|
||||||
|
|
||||||
|
DEFINE_FEATURE(jni_server);
|
||||||
|
|
||||||
static JNIEnv *server_env=NULL;
|
static JNIEnv *server_env=NULL;
|
||||||
static jclass IJniServer= NULL;
|
static jclass IJniServer= NULL;
|
||||||
|
@ -52,6 +52,7 @@ void servald_features()
|
|||||||
|
|
||||||
USE_FEATURE(dna_helper);
|
USE_FEATURE(dna_helper);
|
||||||
USE_FEATURE(directory_client);
|
USE_FEATURE(directory_client);
|
||||||
|
USE_FEATURE(log_output_file);
|
||||||
|
|
||||||
USE_FEATURE(http_server);
|
USE_FEATURE(http_server);
|
||||||
USE_FEATURE(http_rhizome);
|
USE_FEATURE(http_rhizome);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Serval DNA JNI instance directory path
|
Serval DNA daemon features
|
||||||
Copyright (C) 2016 Flinders University
|
Copyright (C) 2016 Flinders University
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
@ -17,15 +17,10 @@ along with this program; if not, write to the Free Software
|
|||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include "feature.h"
|
||||||
#include "jni_common.h"
|
|
||||||
#include "instance.h"
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_servalproject_servaldna_ServalDCommand_setInstancePath(
|
void servald_jni_features()
|
||||||
JNIEnv *env, jobject UNUSED(this), jobject path)
|
|
||||||
{
|
{
|
||||||
const char *cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
USE_FEATURE(jni_commandline);
|
||||||
set_instance_path(cpath);
|
USE_FEATURE(jni_server);
|
||||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
|
||||||
return (jint)0;
|
|
||||||
}
|
}
|
@ -130,7 +130,6 @@ SERVAL_DAEMON_SOURCES = \
|
|||||||
SERVAL_DAEMON_JNI_SOURCES = \
|
SERVAL_DAEMON_JNI_SOURCES = \
|
||||||
jni_common.c \
|
jni_common.c \
|
||||||
jni_commandline.c \
|
jni_commandline.c \
|
||||||
jni_instance.c \
|
|
||||||
jni_server.c
|
jni_server.c
|
||||||
|
|
||||||
SERVAL_DAEMON_SWIFT_SOURCES = \
|
SERVAL_DAEMON_SWIFT_SOURCES = \
|
||||||
|
@ -26,6 +26,7 @@ void test_features()
|
|||||||
USE_FEATURE(cli_log);
|
USE_FEATURE(cli_log);
|
||||||
USE_FEATURE(cli_vomp_console);
|
USE_FEATURE(cli_vomp_console);
|
||||||
USE_FEATURE(cli_tests);
|
USE_FEATURE(cli_tests);
|
||||||
|
USE_FEATURE(log_output_console);
|
||||||
}
|
}
|
||||||
|
|
||||||
void command_cleanup() {}
|
void command_cleanup() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user