diff options
author | Sven Gothel <[email protected]> | 2021-01-26 20:35:48 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-01-26 20:35:48 +0100 |
commit | 520335897fa99fb8bd2f718f0ace5b1beae45e70 (patch) | |
tree | 2d3a1ef182863800fc205d658f484b8bd72d5647 | |
parent | 9162302ee3408dee2db4caa671962ce36c6b3fa0 (diff) |
Adapt to jaulib changes: Jar naming convention (dash, not underscore for extras) ..; direct-bt-fat* includes jaulib-fat (standalone)
direct-bt-fat.jar is with Tinyb
direct-bt-fat2.jar is ex Tinyb (merely testing size and encapsulation)
-rw-r--r-- | .classpath | 4 | ||||
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | cmake/modules/ExtractArchiveList.cmake | 20 | ||||
-rw-r--r-- | java/manifest.txt.in | 1 | ||||
-rw-r--r-- | java/org/direct_bt/DirectBTVersion.java | 67 | ||||
-rw-r--r-- | java_fat/CMakeLists.txt | 31 | ||||
-rw-r--r-- | java_fat/manifest-fat.txt.in | 46 | ||||
-rw-r--r-- | java_fat/manifest-fat2.txt.in (renamed from java_fat/manifest.txt.in) | 19 | ||||
-rw-r--r-- | test/direct_bt/CMakeLists.txt | 8 | ||||
-rw-r--r-- | test/ieee11073/CMakeLists.txt | 7 | ||||
-rw-r--r-- | test/java/CMakeLists.txt | 14 | ||||
-rw-r--r-- | test/java/manifest.txt.in | 4 | ||||
-rw-r--r-- | test/java/test/org/direct_bt/TestEUI48.java | 6 | ||||
-rw-r--r-- | test/java/test/org/direct_bt/VersionInfo.java | 18 |
14 files changed, 205 insertions, 43 deletions
@@ -10,7 +10,7 @@ </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> - <classpathentry kind="lib" path="dist-amd64/lib/java/jaulib_fat.jar" sourcepath="dist-amd64/lib/java/jaulib_java_src.zip"/> - <classpathentry kind="lib" path="dist-amd64/lib/java/jaulib_test.jar"/> + <classpathentry kind="lib" path="/home/sven/projects/zafena/direct_bt/dist-amd64/lib/java/jaulib-fat.jar" sourcepath="dist-amd64/lib/java/jaulib-java-src.zip"/> + <classpathentry kind="lib" path="/home/sven/projects/zafena/direct_bt/dist-amd64/lib/java/jaulib-test.jar"/> <classpathentry kind="output" path="build-eclipse-amd64/"/> </classpath> diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c23ef0b..2d19b048 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,8 @@ option (BUILDJAVA "Build Java API." OFF) IF(BUILDJAVA) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/java/manifest.txt.in ${CMAKE_CURRENT_BINARY_DIR}/java/manifest.txt) - configure_file (${CMAKE_CURRENT_SOURCE_DIR}/java_fat/manifest.txt.in ${CMAKE_CURRENT_BINARY_DIR}/java_fat/manifest.txt) + configure_file (${CMAKE_CURRENT_SOURCE_DIR}/java_fat/manifest-fat.txt.in ${CMAKE_CURRENT_BINARY_DIR}/java_fat/manifest-fat.txt) + configure_file (${CMAKE_CURRENT_SOURCE_DIR}/java_fat/manifest-fat2.txt.in ${CMAKE_CURRENT_BINARY_DIR}/java_fat/manifest-fat2.txt) add_subdirectory (java) add_subdirectory (java_fat) ENDIF(BUILDJAVA) diff --git a/cmake/modules/ExtractArchiveList.cmake b/cmake/modules/ExtractArchiveList.cmake new file mode 100644 index 00000000..c6d4e448 --- /dev/null +++ b/cmake/modules/ExtractArchiveList.cmake @@ -0,0 +1,20 @@ +message(STATUS "rm -rf ${_dstdir}") +file(REMOVE_RECURSE ${_dstdir}) + +# list(LENGTH _archives len) +# message(STATUS "X1: <${_archives}>, len ${len}") + +string(REPLACE "\"" "" l1 ${_archives}) +string(REPLACE " " ";" l2 ${l1}) + +# list(LENGTH l2 len) +# message(STATUS "X2: <${l2}>, len ${len}") + +foreach(item ${l2}) + message(STATUS "unzip ${item} -> ${_dstdir}") + file(ARCHIVE_EXTRACT INPUT ${item} DESTINATION ${_dstdir}) +endforeach() + +unset(l1) +unset(l2) +unset(item) diff --git a/java/manifest.txt.in b/java/manifest.txt.in index 93482069..861b88a2 100644 --- a/java/manifest.txt.in +++ b/java/manifest.txt.in @@ -22,6 +22,7 @@ Trusted-Library: true Permissions: all-permissions Application-Library-Allowable-Codebase: * Class-Path: jaulib.jar +Main-Class: org.direct_bt.DirectBTVersion Name: org/direct_bt/ Sealed: true diff --git a/java/org/direct_bt/DirectBTVersion.java b/java/org/direct_bt/DirectBTVersion.java new file mode 100644 index 00000000..44d0a65e --- /dev/null +++ b/java/org/direct_bt/DirectBTVersion.java @@ -0,0 +1,67 @@ +/** + * Author: Sven Gothel <[email protected]> + * Copyright (c) 2021 Gothel Software e.K. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package org.direct_bt; + +import java.util.jar.Manifest; + +import org.jau.util.JauVersion; +import org.jau.util.VersionUtil; + +public class DirectBTVersion extends JauVersion { + + protected static volatile DirectBTVersion versionInfo; + + protected DirectBTVersion(final String packageName, final Manifest mf) { + super(packageName, mf); + } + + public static DirectBTVersion getInstance() { + if(null == versionInfo) { // volatile: ok + synchronized(DirectBTVersion.class) { + if( null == versionInfo ) { + final String packageNameCompileTime = "org.direct_bt"; + final String packageNameRuntime = "org.direct_bt"; + Manifest mf = VersionUtil.getManifest(DirectBTVersion.class.getClassLoader(), packageNameRuntime); + if(null != mf) { + versionInfo = new DirectBTVersion(packageNameRuntime, mf); + } else { + mf = VersionUtil.getManifest(DirectBTVersion.class.getClassLoader(), packageNameCompileTime); + versionInfo = new DirectBTVersion(packageNameCompileTime, mf); + } + } + } + } + return versionInfo; + } + + public static void main(final String args[]) { + System.err.println(VersionUtil.getPlatformInfo()); + System.err.println("Version Info:"); + System.err.println(DirectBTVersion.getInstance()); + System.err.println(""); + System.err.println("Full Manifest:"); + System.err.println(DirectBTVersion.getInstance().getFullManifestInfo(null)); + } +} diff --git a/java_fat/CMakeLists.txt b/java_fat/CMakeLists.txt index 4a641125..f29b6b09 100644 --- a/java_fat/CMakeLists.txt +++ b/java_fat/CMakeLists.txt @@ -10,10 +10,11 @@ # -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/MakeNativeJar.cmake # set(direct_bt_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt.jar CACHE FILEPATH "direct_bt jar file" FORCE) -set(direct_bt_fat_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt_fat.jar CACHE FILEPATH "direct_bt fat jar file" FORCE) -set(direct_bt_java_src_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt_java_src.zip CACHE FILEPATH "direct_bt java source file" FORCE) +set(direct_bt_fat_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt-fat.jar CACHE FILEPATH "direct_bt fat jar file" FORCE) +set(direct_bt_fat2_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt-fat2.jar CACHE FILEPATH "direct_bt fat2 jar file" FORCE) +set(direct_bt_java_src_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt-java-src.zip CACHE FILEPATH "direct_bt java source file" FORCE) -add_custom_command (OUTPUT ${direct_bt_fat_jar_file} ${direct_bt_java_src_file} +add_custom_command (OUTPUT ${direct_bt_fat_jar_file} ${direct_bt_fat2_jar_file} ${direct_bt_java_src_file} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -D_srcdir=${CMAKE_CURRENT_BINARY_DIR}/../src/direct_bt @@ -28,6 +29,20 @@ add_custom_command (OUTPUT ${direct_bt_fat_jar_file} ${direct_bt_java_src_file} -D_dstbasename=${CMAKE_SHARED_LIBRARY_PREFIX}javadirect_bt${CMAKE_SHARED_LIBRARY_SUFFIX} -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/FileCopyS2D.cmake COMMAND ${CMAKE_COMMAND} + -D _dstdir:PATH='${CMAKE_CURRENT_BINARY_DIR}/temp' + -D _archives:FILEPATH="${jaulib_fat_jar_file}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/ExtractArchiveList.cmake + COMMAND ${JAR} + --create --file ${direct_bt_fat2_jar_file} + --manifest ${CMAKE_CURRENT_BINARY_DIR}/manifest-fat2.txt + -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ jau + -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ org + -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ natives + -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ jau + -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ org + -C ${CMAKE_CURRENT_BINARY_DIR}/ natives + + COMMAND ${CMAKE_COMMAND} -D_srcdir=${CMAKE_CURRENT_BINARY_DIR}/../src/tinyb -D_dstdir=${CMAKE_CURRENT_BINARY_DIR}/natives/${OS_AND_ARCH} -D_srcbasename=${CMAKE_SHARED_LIBRARY_PREFIX}tinyb${CMAKE_SHARED_LIBRARY_SUFFIX}.${tinyb_VERSION_STRING} @@ -41,11 +56,15 @@ add_custom_command (OUTPUT ${direct_bt_fat_jar_file} ${direct_bt_java_src_file} -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/FileCopyS2D.cmake COMMAND ${JAR} --create --file ${direct_bt_fat_jar_file} - --manifest ${CMAKE_CURRENT_BINARY_DIR}/manifest.txt + --manifest ${CMAKE_CURRENT_BINARY_DIR}/manifest-fat.txt + -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ jau + -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ org + -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ natives -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ jau -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ org -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ tinyb -C ${CMAKE_CURRENT_BINARY_DIR}/ natives + COMMAND ${JAR} --create --file ${direct_bt_java_src_file} --no-manifest @@ -58,11 +77,11 @@ add_custom_command (OUTPUT ${direct_bt_fat_jar_file} ${direct_bt_java_src_file} ) add_custom_target (direct_bt_fat_jar ALL - DEPENDS ${direct_bt_fat_jar_file} ${direct_bt_java_src_file} + DEPENDS ${direct_bt_fat_jar_file} ${direct_bt_fat2_jar_file} ${direct_bt_java_src_file} ) add_dependencies(direct_bt_fat_jar jaulib_fat_jar direct_bt tinyb direct_bt_jar javadirect_bt javatinyb) -install (FILES ${direct_bt_fat_jar_file} ${direct_bt_java_src_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java) +install (FILES ${direct_bt_fat_jar_file} ${direct_bt_fat2_jar_file} ${direct_bt_java_src_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java) diff --git a/java_fat/manifest-fat.txt.in b/java_fat/manifest-fat.txt.in new file mode 100644 index 00000000..c9f0c3b5 --- /dev/null +++ b/java_fat/manifest-fat.txt.in @@ -0,0 +1,46 @@ +Manifest-Version: 1.0 +Bundle-Date: @BUILD_TSTAMP@ +Bundle-ManifestVersion: 2 +Bundle-Name: org.direct_bt +Bundle-SymbolicName: org.direct_bt +Bundle-Version: @VERSION_SHORT@ +Export-Package: org.direct_bt +Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.9))" +Package-Title: org.direct_bt +Package-Vendor: Gothel Software +Package-Version: @VERSION_SHORT@ +Specification-Title: Direct-BT Jaulib Fat +Specification-Vendor: Gothel Software +Specification-Version: @VERSION_API@ +Implementation-Title: Direct-BT Jaulib Fat (w/ TinyB) +Implementation-Vendor: Gothel Software +Implementation-Version: @VERSION@ +Implementation-Commit: @VERSION_SHA1@ +Implementation-URL: http://www.jausoft.com/ +Extension-Name: org.direct_bt +Trusted-Library: true +Permissions: all-permissions +Application-Library-Allowable-Codebase: * +Main-Class: org.direct_bt.DirectBTVersion + +Name: org/jau +Sealed: true + +Name: jau/util +Sealed: true + +Name: jau/sys +Sealed: true + +Name: jau/pkg +Sealed: true + +Name: org/direct_bt/ +Sealed: true + +Name: tinyb/dbus/ +Sealed: true + +Name: jau/direct_bt/ +Sealed: true + diff --git a/java_fat/manifest.txt.in b/java_fat/manifest-fat2.txt.in index eba8d645..46f4fd34 100644 --- a/java_fat/manifest.txt.in +++ b/java_fat/manifest-fat2.txt.in @@ -9,10 +9,10 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.9))" Package-Title: org.direct_bt Package-Vendor: Gothel Software Package-Version: @VERSION_SHORT@ -Specification-Title: Direct-BT Fat +Specification-Title: Direct-BT Jaulib Fat Specification-Vendor: Gothel Software Specification-Version: @VERSION_API@ -Implementation-Title: Direct-BT Fat (optionally with TinyB) +Implementation-Title: Direct-BT Jaulib Fat (ex TinyB) Implementation-Vendor: Gothel Software Implementation-Version: @VERSION@ Implementation-Commit: @VERSION_SHA1@ @@ -21,12 +21,21 @@ Extension-Name: org.direct_bt Trusted-Library: true Permissions: all-permissions Application-Library-Allowable-Codebase: * -Class-Path: jaulib_fat.jar +Main-Class: org.direct_bt.DirectBTVersion -Name: org/direct_bt/ +Name: org/jau +Sealed: true + +Name: jau/util +Sealed: true + +Name: jau/sys +Sealed: true + +Name: jau/pkg Sealed: true -Name: tinyb/dbus/ +Name: org/direct_bt/ Sealed: true Name: jau/direct_bt/ diff --git a/test/direct_bt/CMakeLists.txt b/test/direct_bt/CMakeLists.txt index f20c0b70..716f942d 100644 --- a/test/direct_bt/CMakeLists.txt +++ b/test/direct_bt/CMakeLists.txt @@ -15,16 +15,8 @@ set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} ) foreach( name ${TARGETS_IDIOMATIC_EXAMPLES} ) add_executable(${name} ${name}.cpp) -endforeach() - -set(ALL_EXAMPLE_TARGETS - ${TARGETS_IDIOMATIC_EXAMPLES} -) - -foreach(name ${ALL_EXAMPLE_TARGETS}) target_link_libraries(${name} direct_bt catch2) add_dependencies(${name} direct_bt catch2) add_test (NAME ${name} COMMAND ${name}) endforeach() - diff --git a/test/ieee11073/CMakeLists.txt b/test/ieee11073/CMakeLists.txt index 2ba595ae..4615b4d9 100644 --- a/test/ieee11073/CMakeLists.txt +++ b/test/ieee11073/CMakeLists.txt @@ -13,13 +13,6 @@ set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} ) foreach( name ${TARGETS_IDIOMATIC_EXAMPLES} ) add_executable(${name} ${name}.cpp) -endforeach() - -set(ALL_EXAMPLE_TARGETS - ${TARGETS_IDIOMATIC_EXAMPLES} -) - -foreach(name ${ALL_EXAMPLE_TARGETS}) target_link_libraries(${name} direct_bt catch2) add_dependencies(${name} direct_bt catch2) add_test (NAME ${name} COMMAND ${name}) diff --git a/test/java/CMakeLists.txt b/test/java/CMakeLists.txt index 9ef771d3..81f170fa 100644 --- a/test/java/CMakeLists.txt +++ b/test/java/CMakeLists.txt @@ -4,7 +4,7 @@ find_jar(JUNIT_JAR NAMES junit4 junit PATHS "/usr/share/java") -set(direct_bt_test_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt_test.jar CACHE FILEPATH "direct_bt test jar file" FORCE) +set(direct_bt_test_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt-test.jar CACHE FILEPATH "direct_bt test jar file" FORCE) file(GLOB_RECURSE TEST_JAVA_SOURCES "*.java") @@ -14,9 +14,9 @@ add_jar(direct_bt_test ${TEST_JAVA_SOURCES} INCLUDE_JARS ${jaulib_fat_jar_file} ${direct_bt_fat_jar_file} ${jaulib_test_jar_file} ${JUNIT_JAR} MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/manifest.txt - OUTPUT_NAME direct_bt_test + OUTPUT_NAME direct_bt-test ) -add_dependencies(direct_bt_test jaulib_fat_jar direct_bt_fat_jar jaulib_test) +add_dependencies(direct_bt_test direct_bt_fat_jar jaulib_test) install (FILES ${direct_bt_test_jar_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java) @@ -24,13 +24,9 @@ string( REPLACE ".java" "" TEST_JAVA_FILES2 "${TEST_JAVA_FILES}" ) string( REPLACE "/" "." BASENAMES_IDIOMATIC_EXAMPLES "${TEST_JAVA_FILES2}" ) set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} ) -set(ALL_EXAMPLE_TARGETS - ${TARGETS_IDIOMATIC_EXAMPLES} -) - -foreach(name ${ALL_EXAMPLE_TARGETS}) +foreach(name ${TARGETS_IDIOMATIC_EXAMPLES}) add_test (NAME ${name} COMMAND ${JAVA_RUNTIME} - -cp ${JUNIT_JAR}:${jaulib_fat_jar_file}:${direct_bt_fat_jar_file}:${jaulib_test_jar_file}:${direct_bt_test_jar_file} + -cp ${JUNIT_JAR}:${direct_bt_fat_jar_file}:${jaulib_test_jar_file}:${direct_bt_test_jar_file} org.junit.runner.JUnitCore ${name}) endforeach() diff --git a/test/java/manifest.txt.in b/test/java/manifest.txt.in index b3cbad8b..21590365 100644 --- a/test/java/manifest.txt.in +++ b/test/java/manifest.txt.in @@ -21,5 +21,5 @@ Extension-Name: org.direct_bt.test Trusted-Library: true Permissions: all-permissions Application-Library-Allowable-Codebase: * -Class-Path: jaulib_fat.jar direct_bt_fat.jar jaulib_test.jar -Main-Class: org.jau.util.TestVersionInfo +Class-Path: direct_bt-fat.jar jaulib-test.jar +Main-Class: test.org.direct_bt.VersionInfo diff --git a/test/java/test/org/direct_bt/TestEUI48.java b/test/java/test/org/direct_bt/TestEUI48.java index e3551665..aa9dec9a 100644 --- a/test/java/test/org/direct_bt/TestEUI48.java +++ b/test/java/test/org/direct_bt/TestEUI48.java @@ -34,16 +34,16 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import org.junit.Test; +import jau.test.junit.util.JunitTracer; + import org.direct_bt.BTException; import org.direct_bt.BTFactory; import org.direct_bt.BTManager; import org.direct_bt.EUI48; import org.direct_bt.EUI48Sub; -import org.jau.junit.util.JunitTracer; import org.junit.Assert; - import org.junit.FixMethodOrder; +import org.junit.Test; import org.junit.runners.MethodSorters; /** diff --git a/test/java/test/org/direct_bt/VersionInfo.java b/test/java/test/org/direct_bt/VersionInfo.java new file mode 100644 index 00000000..7f87f079 --- /dev/null +++ b/test/java/test/org/direct_bt/VersionInfo.java @@ -0,0 +1,18 @@ +package test.org.direct_bt; + +import java.io.IOException; + +import org.direct_bt.DirectBTVersion; +import org.jau.util.VersionUtil; + +public class VersionInfo { + public static void main(final String args[]) throws IOException { + System.err.println(VersionUtil.getPlatformInfo()); + System.err.println("Version Info:"); + System.err.println(DirectBTVersion.getInstance()); + System.err.println(""); + System.err.println("Full Manifest:"); + System.err.println(DirectBTVersion.getInstance().getFullManifestInfo(null)); + } + +} |