Skip to content

Commit

Permalink
Merge pull request #7 from opencollab/ci
Browse files Browse the repository at this point in the history
try to build the examples
  • Loading branch information
sylvestre authored Jun 18, 2024
2 parents 4885817 + 79fb7ab commit d1b23ec
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 92 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 10 additions & 10 deletions examples/basic_example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
#
Sylvestre LEDRU - <sylvestre.ledru@inria.fr> <sylvestre@ledru.info>
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
Expand All @@ -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.
Expand All @@ -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;

Expand All @@ -52,7 +52,7 @@ JavaVM* create_vm() {
options[1].optionString = const_cast<char*>("-Xcheck:jni");
args.options = options;
args.ignoreUnrecognized = JNI_FALSE;

JNI_CreateJavaVM(&jvm, (void **)&env, &args);
return jvm;
}
Expand All @@ -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;
}
20 changes: 10 additions & 10 deletions examples/bug_disable_return/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
#
Sylvestre LEDRU - <sylvestre.ledru@inria.fr> <sylvestre@ledru.info>
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
Expand All @@ -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.
Expand All @@ -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;

Expand All @@ -52,7 +52,7 @@ JavaVM* create_vm() {
options[1].optionString = const_cast<char*>("-Xcheck:jni");
args.options = options;
args.ignoreUnrecognized = JNI_FALSE;

JNI_CreateJavaVM(&jvm, (void **)&env, &args);
return jvm;
}
Expand All @@ -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;
}
20 changes: 10 additions & 10 deletions examples/bug_no_param_int_array/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
#
Sylvestre LEDRU - <sylvestre.ledru@inria.fr> <sylvestre@ledru.info>
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
Expand All @@ -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.
Expand All @@ -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;

Expand All @@ -52,7 +52,7 @@ JavaVM* create_vm() {
options[1].optionString = const_cast<char*>("-Xcheck:jni");
args.options = options;
args.ignoreUnrecognized = JNI_FALSE;

JNI_CreateJavaVM(&jvm, (void **)&env, &args);
return jvm;
}
Expand All @@ -64,5 +64,5 @@ int main(){
JavaVM* jvm = create_vm();
Bar *plop = new Bar(jvm);
cout << "Does nothing" << endl;
return 0;
return 0;
}
6 changes: 3 additions & 3 deletions examples/bytebuffer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
20 changes: 10 additions & 10 deletions examples/example1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
#
Sylvestre LEDRU - <sylvestre.ledru@inria.fr> <sylvestre@ledru.info>
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
Expand All @@ -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.
Expand All @@ -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;

Expand All @@ -52,7 +52,7 @@ JavaVM* create_vm() {
options[1].optionString = const_cast<char*>("-Xcheck:jni");
args.options = options;
args.ignoreUnrecognized = JNI_FALSE;

JNI_CreateJavaVM(&jvm, (void **)&env, &args);
return jvm;
}
Expand All @@ -72,5 +72,5 @@ int main(){
plop->doNothingPleaseButDisplay(23);
cout << "Hashcode of my two strings " << plop->giveMeTheHashCodePlease(const_cast<char*>("plop"), const_cast<char*>("plop2")) << endl;
cout << "Inverse my boolean. True becomes : " << plop->workingWithBoolean(true) << endl << "False becomes : " << plop->workingWithBoolean(false) << endl;;
return 0;
return 0;
}
20 changes: 10 additions & 10 deletions examples/example2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
#
Sylvestre LEDRU - <sylvestre.ledru@inria.fr> <sylvestre@ledru.info>
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
Expand All @@ -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.
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}
Loading

0 comments on commit d1b23ec

Please sign in to comment.