1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +02:00

Bug 521515: Generate JNI header files as part of build

Change-Id: Ia92da44f964e1934b2c32d2536f3ec27c03d5d59
This commit is contained in:
Jonah Graham 2020-08-12 17:41:34 -04:00
parent ba24afc3a4
commit 7120731766
19 changed files with 66 additions and 63 deletions

View file

@ -76,6 +76,11 @@ mvn generate-resources -DuseSimrelRepo -f build/org.eclipse.cdt.meson.docs -Preg
mvn generate-resources -DuseSimrelRepo -f build/org.eclipse.cdt.autotools.docs -PregenHelp
```
#### jniheaders
The `jniheaders` profile can be used on the core/org.eclipse.cdt.core.native to rebuild the
header files for JNI natives. See also `native` property below.
### Properties
There are a number of properties (-D to mvn) to control the behaviour of the build. Refer to the
@ -145,3 +150,5 @@ An additional tip is to set the following in `.gitconfig` to allow you to diff `
textconv = objdump -x
binary = true
```
See also `jniheaders` profile above.

View file

@ -26,10 +26,10 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size
/*
* Class: org_eclipse_cdt_utils_pty_PTY
* Method: exec2
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILjava/lang/String;IZ)I
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;Ljava/lang/String;IZ)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jintArray, jstring, jint, jboolean);
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jobjectArray, jstring, jint, jboolean);
/*
* Class: org_eclipse_cdt_utils_pty_PTY

View file

@ -9,6 +9,10 @@ extern "C" {
#endif
#undef org_eclipse_cdt_utils_pty_PTYInputStream_MAX_SKIP_BUFFER_SIZE
#define org_eclipse_cdt_utils_pty_PTYInputStream_MAX_SKIP_BUFFER_SIZE 2048L
#undef org_eclipse_cdt_utils_pty_PTYInputStream_DEFAULT_BUFFER_SIZE
#define org_eclipse_cdt_utils_pty_PTYInputStream_DEFAULT_BUFFER_SIZE 8192L
#undef org_eclipse_cdt_utils_pty_PTYInputStream_MAX_BUFFER_SIZE
#define org_eclipse_cdt_utils_pty_PTYInputStream_MAX_BUFFER_SIZE 2147483639L
/*
* Class: org_eclipse_cdt_utils_pty_PTYInputStream
* Method: read0

View file

@ -7,6 +7,8 @@
#ifdef __cplusplus
extern "C" {
#endif
#undef org_eclipse_cdt_utils_pty_PTYOutputStream_EOT
#define org_eclipse_cdt_utils_pty_PTYOutputStream_EOT 4L
/*
* Class: org_eclipse_cdt_utils_pty_PTYOutputStream
* Method: write0

View file

@ -1,20 +1,3 @@
/*******************************************************************************
* Copyright (c) 2002, 2020 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* QNX Software Systems - initial API and implementation
*
* Spawner.h
*
* This is a part of JNI implementation of spawner
*******************************************************************************/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_eclipse_cdt_utils_spawner_Spawner */

View file

@ -1,20 +1,3 @@
/*******************************************************************************
* Copyright (c) 2002, 2020 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* QNX Software Systems - initial API and implementation
*
* SpawnerInputStream.h
*
* This is a part of JNI implementation of spawner
*******************************************************************************/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_eclipse_cdt_utils_spawner_SpawnerInputStream */
@ -26,6 +9,10 @@ extern "C" {
#endif
#undef org_eclipse_cdt_utils_spawner_SpawnerInputStream_MAX_SKIP_BUFFER_SIZE
#define org_eclipse_cdt_utils_spawner_SpawnerInputStream_MAX_SKIP_BUFFER_SIZE 2048L
#undef org_eclipse_cdt_utils_spawner_SpawnerInputStream_DEFAULT_BUFFER_SIZE
#define org_eclipse_cdt_utils_spawner_SpawnerInputStream_DEFAULT_BUFFER_SIZE 8192L
#undef org_eclipse_cdt_utils_spawner_SpawnerInputStream_MAX_BUFFER_SIZE
#define org_eclipse_cdt_utils_spawner_SpawnerInputStream_MAX_BUFFER_SIZE 2147483639L
/*
* Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
* Method: read0

View file

@ -1,20 +1,3 @@
/*******************************************************************************
* Copyright (c) 2002, 2020 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* QNX Software Systems - initial API and implementation
*
* SpawnerOutputStream.h
*
* This is a part of JNI implementation of spawner
*******************************************************************************/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_eclipse_cdt_utils_spawner_SpawnerOutputStream */

View file

@ -14,8 +14,8 @@
*******************************************************************************/
#include <jni.h>
#include <stdio.h>
#include <SpawnerInputStream.h>
#include <SpawnerOutputStream.h>
#include <org_eclipse_cdt_utils_spawner_SpawnerInputStream.h>
#include <org_eclipse_cdt_utils_spawner_SpawnerOutputStream.h>
#include <unistd.h>
/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerInputStream */

View file

@ -13,7 +13,7 @@
* Wind River Systems, Inc.
*******************************************************************************/
#include <sys/ioctl.h>
#include "PTY.h"
#include "org_eclipse_cdt_utils_pty_PTY.h"
#include "openpty.h"
/*

View file

@ -13,8 +13,8 @@
*******************************************************************************/
#include <jni.h>
#include <stdio.h>
#include <PTYInputStream.h>
#include <PTYOutputStream.h>
#include <org_eclipse_cdt_utils_pty_PTYInputStream.h>
#include <org_eclipse_cdt_utils_pty_PTYOutputStream.h>
#include <unistd.h>
/* Header for class _org_eclipse_cdt_utils_pty_PTYInputStream */

View file

@ -21,7 +21,7 @@
#include <jni.h>
#include "exec0.h"
#include <Spawner.h>
#include <org_eclipse_cdt_utils_spawner_Spawner.h>
#define DEBUGIT 0

View file

@ -24,7 +24,7 @@
#include <windows.h>
#include <jni.h>
#include "Spawner.h"
#include "org_eclipse_cdt_utils_spawner_Spawner.h"
#define PIPE_SIZE 512 // Size of pipe buffer
#define MAX_CMD_SIZE 2049 // Initial size of command line

View file

@ -21,7 +21,7 @@
#include <jni.h>
#include <windows.h>
#include "Spawner.h"
#include "org_eclipse_cdt_utils_spawner_Spawner.h"
//#define READ_REPORT

View file

@ -18,7 +18,7 @@
#include <jni.h>
#include <windows.h>
#include "Spawner.h"
#include "org_eclipse_cdt_utils_spawner_Spawner.h"
extern void JNICALL ThrowByName(JNIEnv *env, const char *name, const char *msg);

View file

@ -19,7 +19,7 @@
#include <tchar.h>
#include <windows.h>
#include "Spawner.h"
#include "org_eclipse_cdt_utils_spawner_Spawner.h"
CRITICAL_SECTION cs;

View file

@ -104,5 +104,34 @@
</plugins>
</build>
</profile>
<profile>
<id>jniheaders</id>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<id>headers</id>
<phase>process-resources</phase>
<configuration>
<compilerArgs>
<arg>-h</arg>
<arg>${project.basedir}/native_src/include</arg>
</compilerArgs>
<source>11</source>
<target>11</target>
<encoding>UTF-8</encoding>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -105,6 +105,14 @@ done
##
# Make sure that natives are up to date
##
echo "Rebuilding JNI headers to make sure they match source"
logfile=jni-header.log
if ! ${MVN:-mvn} -B -V process-resources -DuseSimrelRepo -P jniheaders -f core/org.eclipse.cdt.core.native >${logfile} 2>&1; then
echo "Rebuilding of JNI headers failed. The log (${logfile}) is part of the artifacts of the build"
exit 1
fi
for p in native/org.eclipse.cdt.native.serial/native_src core/org.eclipse.cdt.core.native/native_src; do
echo "Rebuilding $p natives to make sure they match source"
logfile=make-natives-${p//\//-}.log