From bf38a76d9dc3449278127dc335e3a513f553979c Mon Sep 17 00:00:00 2001 From: Sergei Lebedev Date: Mon, 27 Jun 2016 18:03:23 +0300 Subject: [PATCH] A quick-bugfix release which solves the issue with loading native speedups from JAR files --- CHANGES | 8 ++++++++ README.md | 8 ++++---- gradle.properties | 2 +- src/main/kotlin/org/jetbrains/bio/viktor/Loader.kt | 4 ++-- src/main/kotlin/org/jetbrains/bio/viktor/StridedVector.kt | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 597ad82..0fa5778 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,14 @@ viktor Changelog Here you can see the full list of changes between each viktor release. +Version 0.3.1 +------------- + +Bugfix release, released on June 27th 2016 + +- Fixed loading native libraries from the JAR file. +- Fixed error handling on unsupported architectures. + Version 0.3.0 ------------- diff --git a/README.md b/README.md index a84a85e..da312ad 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ repositories { } dependencies { - compile 'org.jetbrains.bio:viktor:0.3.0' + compile 'org.jetbrains.bio:viktor:0.3.1' } ``` @@ -72,7 +72,7 @@ No extra configuration is required for running the tests from Gradle $ ./gradlew test ``` -However, you might need to alter `java.library.path` to run the tests from +However, you might need to alter `java.library.path` to run the tests from the IDE. The following Java command line option should work for IDEA ```bash @@ -85,10 +85,10 @@ Publishing You can do it with a one-liner ```bash -./gradlew clean assemble generatePomFileForMavenJavaPublication bintrayUpload +./gradlew clean assemble generatePomFileForMavenJavaPublication bintrayUpload ``` -Make sure to set Bintray credentials (see API key section +Make sure to set Bintray credentials (see API key section [here](https://bintray.com/profile/edit)) in `$HOME/.gradle/gradle.properties`. ``` diff --git a/gradle.properties b/gradle.properties index 999312b..6787d7a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=0.3.0 +version=0.3.1 org.gradle.configureondemand=true org.gradle.parallel=true diff --git a/src/main/kotlin/org/jetbrains/bio/viktor/Loader.kt b/src/main/kotlin/org/jetbrains/bio/viktor/Loader.kt index de4e450..823b3d3 100644 --- a/src/main/kotlin/org/jetbrains/bio/viktor/Loader.kt +++ b/src/main/kotlin/org/jetbrains/bio/viktor/Loader.kt @@ -8,7 +8,7 @@ class ResourceLibrary(private val name: String) { @Suppress("unchecked_cast") fun install() { val resource = System.mapLibraryName(name) - val inputStream = ResourceLibrary::class.java.getResourceAsStream(resource) + val inputStream = ResourceLibrary::class.java.getResourceAsStream("/$resource") if (inputStream != null) { val libraryPath = LIBRARY_DIR.resolve(resource) Files.copy(inputStream, libraryPath, REPLACE_EXISTING) @@ -67,7 +67,7 @@ internal object Loader { useNative = true } } - } catch (e: Exception) { + } catch (e: UnsatisfiedLinkError) { System.err.println(listOf( "Native SIMD optimization of vector operations is not available.", "Fallback Kotlin implementation will be used instead.").joinToString("\n")) diff --git a/src/main/kotlin/org/jetbrains/bio/viktor/StridedVector.kt b/src/main/kotlin/org/jetbrains/bio/viktor/StridedVector.kt index 209cbc9..f1e2a41 100644 --- a/src/main/kotlin/org/jetbrains/bio/viktor/StridedVector.kt +++ b/src/main/kotlin/org/jetbrains/bio/viktor/StridedVector.kt @@ -30,7 +30,7 @@ fun DoubleArray.asStrided(offset: Int = 0, size: Int = this.size): StridedVector * * [1, 4] * - * Vectors with `stride` equal to 1 are caled called *dense*. The + * Vectors with `stride` equal to 1 are called called *dense*. The * distinction is important because some of the operations can be * significantly optimized for dense vectors. *