From faa65adcb9ec7f334829a5a63712cd3ffd59f975 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 Jun 2024 18:35:44 +0200 Subject: [PATCH 1/3] try to build the examples --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..91619bc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: Build the examples + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install default JDK + run: sudo apt-get update && sudo apt-get install -y default-jdk + + - name: Set JAVA_HOME environment variable + run: echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed 's:/bin/java::')" >> $GITHUB_ENV + + - name: Verify JAVA_HOME + run: echo $JAVA_HOME + + - name: Build examples + run: | + make examples From f6d934566c6cd87533dd0e6de0aa49b474efab7c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 Jun 2024 18:42:44 +0200 Subject: [PATCH 2/3] adjust the example to make sure that the test passes --- examples/bytebuffer/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/bytebuffer/main.cpp b/examples/bytebuffer/main.cpp index 2745cec..0606965 100644 --- a/examples/bytebuffer/main.cpp +++ b/examples/bytebuffer/main.cpp @@ -31,8 +31,8 @@ int main(){ JavaVM* jvm = create_vm(); ByteBufferSync *plop = new ByteBufferSync(jvm); double arr[2]={2.2, 42}; - byte arr2[2]={1, 2}; - long long arrL[2]={2.2, 42}; + signed char arr2[2] = {1, 2}; + long long arrL[2]={2, 42}; plop->bar(jvm, arr, 2, arrL, 2, arr2, 2); int size = 0; From 79fb7abd8f1f9d1dd2877eef9920bc4b6cb91877 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 Jun 2024 18:42:49 +0200 Subject: [PATCH 3/3] remove trailing spaces --- examples/basic_example/main.cpp | 20 ++++++++++---------- examples/bug_disable_return/main.cpp | 20 ++++++++++---------- examples/bug_no_param_int_array/main.cpp | 20 ++++++++++---------- examples/bytebuffer/main.cpp | 2 +- examples/example1/main.cpp | 20 ++++++++++---------- examples/example2/main.cpp | 20 ++++++++++---------- examples/example3/main.cpp | 20 ++++++++++---------- examples/example4/main.cpp | 20 ++++++++++---------- examples/example5/main.cpp | 18 +++++++++--------- examples/inherit/main.cpp | 18 +++++++++--------- examples/inherit/showcase.cpp | 2 +- 11 files changed, 90 insertions(+), 90 deletions(-) diff --git a/examples/basic_example/main.cpp b/examples/basic_example/main.cpp index b1615fb..c5e4454 100644 --- a/examples/basic_example/main.cpp +++ b/examples/basic_example/main.cpp @@ -6,20 +6,20 @@ # Sylvestre LEDRU - -This software is a computer program whose purpose is to generate C++ wrapper +This software is a computer program whose purpose is to generate C++ wrapper for Java objects/methods. This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, +abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". +"http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited -liability. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -28,9 +28,9 @@ that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. @@ -43,7 +43,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; @@ -52,7 +52,7 @@ JavaVM* create_vm() { options[1].optionString = const_cast("-Xcheck:jni"); args.options = options; args.ignoreUnrecognized = JNI_FALSE; - + JNI_CreateJavaVM(&jvm, (void **)&env, &args); return jvm; } @@ -64,5 +64,5 @@ int main(){ JavaVM* jvm = create_vm(); MyComplexClass *testOfMyClass = new MyComplexClass(jvm); cout << "My Computation: " << testOfMyClass->myVeryComplexComputation(1.2,80) << endl; - return 0; + return 0; } diff --git a/examples/bug_disable_return/main.cpp b/examples/bug_disable_return/main.cpp index d844784..9d97a92 100644 --- a/examples/bug_disable_return/main.cpp +++ b/examples/bug_disable_return/main.cpp @@ -6,20 +6,20 @@ # Sylvestre LEDRU - -This software is a computer program whose purpose is to generate C++ wrapper +This software is a computer program whose purpose is to generate C++ wrapper for Java objects/methods. This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, +abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". +"http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited -liability. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -28,9 +28,9 @@ that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. @@ -43,7 +43,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; @@ -52,7 +52,7 @@ JavaVM* create_vm() { options[1].optionString = const_cast("-Xcheck:jni"); args.options = options; args.ignoreUnrecognized = JNI_FALSE; - + JNI_CreateJavaVM(&jvm, (void **)&env, &args); return jvm; } @@ -64,5 +64,5 @@ int main(){ JavaVM* jvm = create_vm(); Plop *plop = new Plop(jvm); cout << "Does nothing. It is just to test the bug." << endl; - return 0; + return 0; } diff --git a/examples/bug_no_param_int_array/main.cpp b/examples/bug_no_param_int_array/main.cpp index 0def1e9..a87eecb 100644 --- a/examples/bug_no_param_int_array/main.cpp +++ b/examples/bug_no_param_int_array/main.cpp @@ -6,20 +6,20 @@ # Sylvestre LEDRU - -This software is a computer program whose purpose is to generate C++ wrapper +This software is a computer program whose purpose is to generate C++ wrapper for Java objects/methods. This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, +abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". +"http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited -liability. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -28,9 +28,9 @@ that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. @@ -43,7 +43,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; @@ -52,7 +52,7 @@ JavaVM* create_vm() { options[1].optionString = const_cast("-Xcheck:jni"); args.options = options; args.ignoreUnrecognized = JNI_FALSE; - + JNI_CreateJavaVM(&jvm, (void **)&env, &args); return jvm; } @@ -64,5 +64,5 @@ int main(){ JavaVM* jvm = create_vm(); Bar *plop = new Bar(jvm); cout << "Does nothing" << endl; - return 0; + return 0; } diff --git a/examples/bytebuffer/main.cpp b/examples/bytebuffer/main.cpp index 0606965..55e8e93 100644 --- a/examples/bytebuffer/main.cpp +++ b/examples/bytebuffer/main.cpp @@ -9,7 +9,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; diff --git a/examples/example1/main.cpp b/examples/example1/main.cpp index eead2f9..979d3ff 100644 --- a/examples/example1/main.cpp +++ b/examples/example1/main.cpp @@ -6,20 +6,20 @@ # Sylvestre LEDRU - -This software is a computer program whose purpose is to generate C++ wrapper +This software is a computer program whose purpose is to generate C++ wrapper for Java objects/methods. This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, +abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". +"http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited -liability. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -28,9 +28,9 @@ that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. @@ -43,7 +43,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; @@ -52,7 +52,7 @@ JavaVM* create_vm() { options[1].optionString = const_cast("-Xcheck:jni"); args.options = options; args.ignoreUnrecognized = JNI_FALSE; - + JNI_CreateJavaVM(&jvm, (void **)&env, &args); return jvm; } @@ -72,5 +72,5 @@ int main(){ plop->doNothingPleaseButDisplay(23); cout << "Hashcode of my two strings " << plop->giveMeTheHashCodePlease(const_cast("plop"), const_cast("plop2")) << endl; cout << "Inverse my boolean. True becomes : " << plop->workingWithBoolean(true) << endl << "False becomes : " << plop->workingWithBoolean(false) << endl;; - return 0; + return 0; } diff --git a/examples/example2/main.cpp b/examples/example2/main.cpp index e776ccf..a1aa529 100644 --- a/examples/example2/main.cpp +++ b/examples/example2/main.cpp @@ -3,20 +3,20 @@ # Sylvestre LEDRU - -This software is a computer program whose purpose is to generate C++ wrapper +This software is a computer program whose purpose is to generate C++ wrapper for Java objects/methods. This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, +abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". +"http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited -liability. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -25,9 +25,9 @@ that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. @@ -43,7 +43,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; @@ -89,9 +89,9 @@ int main(){ bool arrayOfBool[]={true, false, true, true}; bool *boolReturned = plop->dealingWithBooleans(arrayOfBool, 4); - + for (int i=0; i < 4; i++){ cout << "Value " << i << " : " << boolReturned[i] << " (was " << arrayOfBool[i] << ")" << endl; } - return 0; + return 0; } diff --git a/examples/example3/main.cpp b/examples/example3/main.cpp index 30c3ee0..bb789db 100644 --- a/examples/example3/main.cpp +++ b/examples/example3/main.cpp @@ -3,20 +3,20 @@ # Sylvestre LEDRU - -This software is a computer program whose purpose is to generate C++ wrapper +This software is a computer program whose purpose is to generate C++ wrapper for Java objects/methods. This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, +abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". +"http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited -liability. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -25,9 +25,9 @@ that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. @@ -45,7 +45,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; @@ -75,7 +75,7 @@ int main(){ cout << "Exception caught:" << endl; try { int myIntsWithExceptionCatched = plop->getIntFromArrayOfSizeThree(22); - + }catch(GiwsException::JniException e) { cout << "getJavaDescription: " << e.getJavaDescription() << endl; cout << "getJavaStackTrace: " << e.getJavaStackTrace() << endl; @@ -99,5 +99,5 @@ int main(){ int myIntsWithException = plop->getIntFromArrayOfSizeThree(223); cout << "Value from the Java with good pos : " << myInts < -This software is a computer program whose purpose is to generate C++ wrapper +This software is a computer program whose purpose is to generate C++ wrapper for Java objects/methods. This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, +abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". +"http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited -liability. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -25,9 +25,9 @@ that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. @@ -43,7 +43,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; @@ -80,7 +80,7 @@ int main(){ cout << "String from Java [" << i << "," << j << "] : " << myString[i][j] <getMatrixInts(&lenRow, &lenCol); cout << "From Java [0,0] : " << myInts[0][0] <displayMatrixOfString(sendToJava,2,2); - return 0; + return 0; } diff --git a/examples/example5/main.cpp b/examples/example5/main.cpp index a52fc86..53ebda3 100644 --- a/examples/example5/main.cpp +++ b/examples/example5/main.cpp @@ -3,20 +3,20 @@ # Sylvestre LEDRU - -This software is a computer program whose purpose is to generate C++ wrapper +This software is a computer program whose purpose is to generate C++ wrapper for Java objects/methods. This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, +abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". +"http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited -liability. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -25,9 +25,9 @@ that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. @@ -43,7 +43,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; @@ -65,5 +65,5 @@ int main(){ MyObject::doSomething(jvm, (char*)"Hello World !!"); - return 0; + return 0; } diff --git a/examples/inherit/main.cpp b/examples/inherit/main.cpp index 1490128..7e74a17 100644 --- a/examples/inherit/main.cpp +++ b/examples/inherit/main.cpp @@ -3,20 +3,20 @@ # Sylvestre LEDRU - -This software is a computer program whose purpose is to generate C++ wrapper +This software is a computer program whose purpose is to generate C++ wrapper for Java objects/methods. This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, +abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". +"http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited -liability. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -25,9 +25,9 @@ that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. @@ -43,7 +43,7 @@ JavaVM* create_vm() { JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; - + /* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */ args.version = JNI_VERSION_1_4; @@ -74,5 +74,5 @@ int main(){ cout << "==========" << endl; cout << "Return of fatherMethod: " << sonSecond->fatherMethod() << endl; - return 0; + return 0; } diff --git a/examples/inherit/showcase.cpp b/examples/inherit/showcase.cpp index 2236e4b..de38880 100644 --- a/examples/inherit/showcase.cpp +++ b/examples/inherit/showcase.cpp @@ -13,5 +13,5 @@ class Son : public Father { int main(){ Son *son = new Son(); - return 0; + return 0; }