From 7120731766a3086dc0a7258de9f7fdb3292b91a1 Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Wed, 12 Aug 2020 17:41:34 -0400 Subject: [PATCH] Bug 521515: Generate JNI header files as part of build Change-Id: Ia92da44f964e1934b2c32d2536f3ec27c03d5d59 --- README.md | 7 +++++ ...{PTY.h => org_eclipse_cdt_utils_pty_PTY.h} | 4 +-- ...rg_eclipse_cdt_utils_pty_PTYInputStream.h} | 4 +++ ...g_eclipse_cdt_utils_pty_PTYOutputStream.h} | 2 ++ ...> org_eclipse_cdt_utils_spawner_Spawner.h} | 17 ---------- ...se_cdt_utils_spawner_SpawnerInputStream.h} | 21 +++---------- ...e_cdt_utils_spawner_SpawnerOutputStream.h} | 17 ---------- .../native_src/unix/io.c | 4 +-- .../native_src/unix/pty.c | 2 +- .../native_src/unix/ptyio.c | 4 +-- .../native_src/unix/spawner.c | 2 +- .../native_src/win/Win32ProcessEx.c | 2 +- .../native_src/win/iostream.c | 2 +- .../native_src/win/raise.c | 2 +- .../native_src/win/spawner.c | 2 +- core/org.eclipse.cdt.core.native/pom.xml | 29 ++++++++++++++++++ .../os/win32/x86_64/spawner.dll | Bin 331062 -> 331062 bytes .../os/win32/x86_64/starter.exe | Bin 398414 -> 398414 bytes releng/scripts/check_code_cleanliness.sh | 8 +++++ 19 files changed, 66 insertions(+), 63 deletions(-) rename core/org.eclipse.cdt.core.native/native_src/include/{PTY.h => org_eclipse_cdt_utils_pty_PTY.h} (86%) rename core/org.eclipse.cdt.core.native/native_src/include/{PTYInputStream.h => org_eclipse_cdt_utils_pty_PTYInputStream.h} (76%) rename core/org.eclipse.cdt.core.native/native_src/include/{PTYOutputStream.h => org_eclipse_cdt_utils_pty_PTYOutputStream.h} (87%) rename core/org.eclipse.cdt.core.native/native_src/include/{Spawner.h => org_eclipse_cdt_utils_spawner_Spawner.h} (73%) rename core/org.eclipse.cdt.core.native/native_src/include/{SpawnerInputStream.h => org_eclipse_cdt_utils_spawner_SpawnerInputStream.h} (67%) rename core/org.eclipse.cdt.core.native/native_src/include/{SpawnerOutputStream.h => org_eclipse_cdt_utils_spawner_SpawnerOutputStream.h} (58%) diff --git a/README.md b/README.md index 461ce4a4965..d68c38841ef 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/core/org.eclipse.cdt.core.native/native_src/include/PTY.h b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_pty_PTY.h similarity index 86% rename from core/org.eclipse.cdt.core.native/native_src/include/PTY.h rename to core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_pty_PTY.h index d73d5c00e16..e9a84b41e06 100644 --- a/core/org.eclipse.cdt.core.native/native_src/include/PTY.h +++ b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_pty_PTY.h @@ -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 diff --git a/core/org.eclipse.cdt.core.native/native_src/include/PTYInputStream.h b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_pty_PTYInputStream.h similarity index 76% rename from core/org.eclipse.cdt.core.native/native_src/include/PTYInputStream.h rename to core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_pty_PTYInputStream.h index 7767be6bd8c..2cb2f30a98f 100644 --- a/core/org.eclipse.cdt.core.native/native_src/include/PTYInputStream.h +++ b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_pty_PTYInputStream.h @@ -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 diff --git a/core/org.eclipse.cdt.core.native/native_src/include/PTYOutputStream.h b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_pty_PTYOutputStream.h similarity index 87% rename from core/org.eclipse.cdt.core.native/native_src/include/PTYOutputStream.h rename to core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_pty_PTYOutputStream.h index fb28491060e..5053b595440 100644 --- a/core/org.eclipse.cdt.core.native/native_src/include/PTYOutputStream.h +++ b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_pty_PTYOutputStream.h @@ -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 diff --git a/core/org.eclipse.cdt.core.native/native_src/include/Spawner.h b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_Spawner.h similarity index 73% rename from core/org.eclipse.cdt.core.native/native_src/include/Spawner.h rename to core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_Spawner.h index 2608be657dd..49d912a2963 100644 --- a/core/org.eclipse.cdt.core.native/native_src/include/Spawner.h +++ b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_Spawner.h @@ -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 /* Header for class org_eclipse_cdt_utils_spawner_Spawner */ diff --git a/core/org.eclipse.cdt.core.native/native_src/include/SpawnerInputStream.h b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_SpawnerInputStream.h similarity index 67% rename from core/org.eclipse.cdt.core.native/native_src/include/SpawnerInputStream.h rename to core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_SpawnerInputStream.h index 6ecf61b96a4..c98afe971fe 100644 --- a/core/org.eclipse.cdt.core.native/native_src/include/SpawnerInputStream.h +++ b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_SpawnerInputStream.h @@ -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 /* 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 diff --git a/core/org.eclipse.cdt.core.native/native_src/include/SpawnerOutputStream.h b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_SpawnerOutputStream.h similarity index 58% rename from core/org.eclipse.cdt.core.native/native_src/include/SpawnerOutputStream.h rename to core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_SpawnerOutputStream.h index 5491f3f91c6..9c5ab1671ff 100644 --- a/core/org.eclipse.cdt.core.native/native_src/include/SpawnerOutputStream.h +++ b/core/org.eclipse.cdt.core.native/native_src/include/org_eclipse_cdt_utils_spawner_SpawnerOutputStream.h @@ -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 /* Header for class org_eclipse_cdt_utils_spawner_SpawnerOutputStream */ diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/io.c b/core/org.eclipse.cdt.core.native/native_src/unix/io.c index 03dc08d4827..5ee22f8cf06 100644 --- a/core/org.eclipse.cdt.core.native/native_src/unix/io.c +++ b/core/org.eclipse.cdt.core.native/native_src/unix/io.c @@ -14,8 +14,8 @@ *******************************************************************************/ #include #include -#include -#include +#include +#include #include /* Header for class _org_eclipse_cdt_utils_spawner_SpawnerInputStream */ diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/pty.c b/core/org.eclipse.cdt.core.native/native_src/unix/pty.c index edb87661eb5..096815a71ca 100644 --- a/core/org.eclipse.cdt.core.native/native_src/unix/pty.c +++ b/core/org.eclipse.cdt.core.native/native_src/unix/pty.c @@ -13,7 +13,7 @@ * Wind River Systems, Inc. *******************************************************************************/ #include -#include "PTY.h" +#include "org_eclipse_cdt_utils_pty_PTY.h" #include "openpty.h" /* diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/ptyio.c b/core/org.eclipse.cdt.core.native/native_src/unix/ptyio.c index e022db11f99..98ab38eb43a 100644 --- a/core/org.eclipse.cdt.core.native/native_src/unix/ptyio.c +++ b/core/org.eclipse.cdt.core.native/native_src/unix/ptyio.c @@ -13,8 +13,8 @@ *******************************************************************************/ #include #include -#include -#include +#include +#include #include /* Header for class _org_eclipse_cdt_utils_pty_PTYInputStream */ diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c b/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c index 3968e2a91c4..f9b91534c75 100644 --- a/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c +++ b/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c @@ -21,7 +21,7 @@ #include #include "exec0.h" -#include +#include #define DEBUGIT 0 diff --git a/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c b/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c index 433c06f1174..44209ee0e6f 100644 --- a/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c +++ b/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c @@ -24,7 +24,7 @@ #include #include -#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 diff --git a/core/org.eclipse.cdt.core.native/native_src/win/iostream.c b/core/org.eclipse.cdt.core.native/native_src/win/iostream.c index 19aca37ccb5..50ff9849188 100644 --- a/core/org.eclipse.cdt.core.native/native_src/win/iostream.c +++ b/core/org.eclipse.cdt.core.native/native_src/win/iostream.c @@ -21,7 +21,7 @@ #include #include -#include "Spawner.h" +#include "org_eclipse_cdt_utils_spawner_Spawner.h" //#define READ_REPORT diff --git a/core/org.eclipse.cdt.core.native/native_src/win/raise.c b/core/org.eclipse.cdt.core.native/native_src/win/raise.c index b908b159d0b..ac6b9eb449e 100644 --- a/core/org.eclipse.cdt.core.native/native_src/win/raise.c +++ b/core/org.eclipse.cdt.core.native/native_src/win/raise.c @@ -18,7 +18,7 @@ #include #include -#include "Spawner.h" +#include "org_eclipse_cdt_utils_spawner_Spawner.h" extern void JNICALL ThrowByName(JNIEnv *env, const char *name, const char *msg); diff --git a/core/org.eclipse.cdt.core.native/native_src/win/spawner.c b/core/org.eclipse.cdt.core.native/native_src/win/spawner.c index ba3e27f2c44..f82e913af67 100644 --- a/core/org.eclipse.cdt.core.native/native_src/win/spawner.c +++ b/core/org.eclipse.cdt.core.native/native_src/win/spawner.c @@ -19,7 +19,7 @@ #include #include -#include "Spawner.h" +#include "org_eclipse_cdt_utils_spawner_Spawner.h" CRITICAL_SECTION cs; diff --git a/core/org.eclipse.cdt.core.native/pom.xml b/core/org.eclipse.cdt.core.native/pom.xml index 02bc3bf9137..5c042f643ac 100644 --- a/core/org.eclipse.cdt.core.native/pom.xml +++ b/core/org.eclipse.cdt.core.native/pom.xml @@ -104,5 +104,34 @@ + + jniheaders + + + + maven-compiler-plugin + 3.8.1 + + + headers + process-resources + + + -h + ${project.basedir}/native_src/include + + 11 + 11 + UTF-8 + + + compile + + + + + + + diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll index 179f3b1c88a4b771399b8c2c9f396f2376cf6e7c..45c8789beb0b4efa029938d2ce18ec70387b48ed 100755 GIT binary patch delta 45 xcmdlsOJv(DkqI44ho(>L@?)w_-*`(a70793OKWFKV+3L*AZFgqmd0YR900Mq5Xt}m delta 45 xcmdlsOJv(DkqI44!Tb}u{Fvs1ZM>zG3gk4irM0uAF#<6Y5HoLQOJgxu4gh=44(tE` diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe index 26fffc7f53ac477412afcbd3e40f0ede75eb1bfd..7d6b4f8df595c408846f59974078361dcbd9a0a2 100755 GIT binary patch delta 39 xcmV+?0NDS|s2I+u7?6kp!k3YXP6C5Cf!c-I0fpKEh1vs!+60B#1-04+bQ5>s5*Gjf delta 39 xcmV+?0NDS|s2I+u7?6kpQxB1fP689Kf!c-I0fpKEh1vs!+60B#1-04+bQ4>@5hwrv diff --git a/releng/scripts/check_code_cleanliness.sh b/releng/scripts/check_code_cleanliness.sh index 09dcd2c66f4..f90da7bf465 100755 --- a/releng/scripts/check_code_cleanliness.sh +++ b/releng/scripts/check_code_cleanliness.sh @@ -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