-
-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Native Libraries: added API version to:
- test whether native library matches the JAR (bad builds could e.g. ship a newer JAR with an older incompatible native library) - invoke a method (to get API version) to check whether native library works correctly if API version do not match, or method could not invoked correctly, disable usage of FlatLaf native library Windows and macOS binaries built and signed locally in clean workspace Linux binary built by GitHub Actions
- Loading branch information
Showing
19 changed files
with
229 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86.dll
Binary file not shown.
Binary file modified
BIN
+512 Bytes
(100%)
flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll
Binary file not shown.
Binary file modified
BIN
-512 Bytes
(97%)
flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/libflatlaf-linux-x86_64.so
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
flatlaf-natives/flatlaf-natives-linux/src/main/cpp/ApiVersion.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2024 FormDev Software GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <jni.h> | ||
#include "com_formdev_flatlaf_ui_FlatNativeLibrary.h" | ||
|
||
/** | ||
* @author Karl Tauber | ||
*/ | ||
|
||
|
||
// increase this version if changing API or functionality of native library | ||
// also update version in Java class com.formdev.flatlaf.ui.FlatNativeLinuxLibrary | ||
#define API_VERSION_LINUX 3001 | ||
|
||
|
||
//---- JNI methods ------------------------------------------------------------ | ||
|
||
extern "C" | ||
JNIEXPORT jint JNICALL Java_com_formdev_flatlaf_ui_FlatNativeLibrary_getApiVersion | ||
( JNIEnv* env, jclass cls ) | ||
{ | ||
return API_VERSION_LINUX; | ||
} |
21 changes: 21 additions & 0 deletions
21
...natives/flatlaf-natives-linux/src/main/headers/com_formdev_flatlaf_ui_FlatNativeLibrary.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...natives/flatlaf-natives-macos/src/main/headers/com_formdev_flatlaf_ui_FlatNativeLibrary.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
flatlaf-natives/flatlaf-natives-macos/src/main/objcpp/ApiVersion.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2024 FormDev Software GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <jni.h> | ||
#include "com_formdev_flatlaf_ui_FlatNativeLibrary.h" | ||
|
||
/** | ||
* @author Karl Tauber | ||
*/ | ||
|
||
|
||
// increase this version if changing API or functionality of native library | ||
// also update version in Java class com.formdev.flatlaf.ui.FlatNativeMacLibrary | ||
#define API_VERSION_MACOS 2001 | ||
|
||
|
||
//---- JNI methods ------------------------------------------------------------ | ||
|
||
extern "C" | ||
JNIEXPORT jint JNICALL Java_com_formdev_flatlaf_ui_FlatNativeLibrary_getApiVersion | ||
( JNIEnv* env, jclass cls ) | ||
{ | ||
return API_VERSION_MACOS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
flatlaf-natives/flatlaf-natives-windows/src/main/cpp/ApiVersion.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2024 FormDev Software GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <jni.h> | ||
#include "com_formdev_flatlaf_ui_FlatNativeLibrary.h" | ||
|
||
/** | ||
* @author Karl Tauber | ||
*/ | ||
|
||
|
||
// increase this version if changing API or functionality of native library | ||
// also update version in Java class com.formdev.flatlaf.ui.FlatNativeWindowsLibrary | ||
#define API_VERSION_WINDOWS 1001 | ||
|
||
|
||
//---- JNI methods ------------------------------------------------------------ | ||
|
||
extern "C" | ||
JNIEXPORT jint JNICALL Java_com_formdev_flatlaf_ui_FlatNativeLibrary_getApiVersion | ||
( JNIEnv* env, jclass cls ) | ||
{ | ||
return API_VERSION_WINDOWS; | ||
} |
21 changes: 21 additions & 0 deletions
21
...tives/flatlaf-natives-windows/src/main/headers/com_formdev_flatlaf_ui_FlatNativeLibrary.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.