Skip to content

Windows build #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
851a4ea
Groovyify cmake properties handling
chris-allan Jun 1, 2020
4e15458
Add capability to set cmake generator and architecture
chris-allan Jun 1, 2020
386e66b
Switch build phase to cmake
chris-allan Jun 1, 2020
6cbbb61
Expand native library search paths for cmake/Windows
chris-allan Jun 1, 2020
7fc393d
Add AppVeyor build
chris-allan Jun 1, 2020
27dbcf4
MSVC requires explicit cast
chris-allan Jun 1, 2020
58d4a9d
Set the object export environment correctly
chris-allan Jun 1, 2020
134ae62
Run tests on AppVeyor
chris-allan Jun 1, 2020
84cbf26
JAR paths always use UNIX path separators (Windows compat)
chris-allan Jun 1, 2020
68a8a85
Use correct path separators and delimiters for Windows
chris-allan Jun 1, 2020
e2acea1
Also load Intel Thread Building Blocks library (Windows compat)
chris-allan Jun 1, 2020
a9fc264
Config File/URI usage refactoring (Windows compat)
chris-allan Jun 1, 2020
53c00c8
Clean up ObjectTest (Windows compat)
chris-allan Jun 1, 2020
074f96b
Clean up HeterogeneousSparseTest (Windows compat)
chris-allan Jun 1, 2020
6cf5b73
Clean up MultiRangeQueryTest (Windows compat)
chris-allan Jun 1, 2020
5df7c0d
Clean up QueryTest (Windows compat)
chris-allan Jun 1, 2020
821d027
Clean up Quickstart*Test (Windows compat)
chris-allan Jun 1, 2020
37cf9cc
Clean up VFSTest (Windows compat)
chris-allan Jun 1, 2020
c3b32a4
Upgrade to Gradle 6.4.1
chris-allan Jun 1, 2020
11eb8e9
Fix segfault on Windows and possible memory leak
chris-allan Jun 1, 2020
d79ecda
Set max heap size
chris-allan Jun 1, 2020
2170c49
More information if assertion fails
chris-allan Jun 2, 2020
5124838
Resource closure during tests
chris-allan Jun 2, 2020
4a676a4
Try waiting slightly longer to pass on CI
chris-allan Jun 2, 2020
734a804
Try slightly different resource close semantics
chris-allan Jun 2, 2020
063a1fb
System.currentTimeMillis() is already UTC
chris-allan Jun 2, 2020
1cafcf4
Try waiting after not before
chris-allan Jun 2, 2020
05520c2
Gradle 7 compat
chris-allan Jun 2, 2020
a1c1e35
Test NativeLibLoader functions correctly
chris-allan Jun 2, 2020
a95248e
Refactor NativeLibLoader to use a folder based workflow (Windows compat)
chris-allan Jun 2, 2020
686fcc4
Set CLASSPATH separately with globbing
chris-allan Jun 2, 2020
8085f4b
Ensure buildDir presence in Gradle
chris-allan Jun 2, 2020
f1413ef
More verbosity when running tests
chris-allan Jun 2, 2020
1abbc5d
Try waiting a second before and a second after
chris-allan Jun 2, 2020
b7633bc
Update Google Java Style plugin
chris-allan Jun 2, 2020
29781f6
Make formatting conform to Google Java Style
chris-allan Jun 2, 2020
7654e98
Add constructor for time-travelling without encryption
chris-allan Jun 3, 2020
90e6f14
Adjust test cases to use explicit timestamps
chris-allan Jun 3, 2020
a40e3ef
Try with default max heap
chris-allan Jun 3, 2020
a973cc6
Revert "Try with default max heap"
chris-allan Jun 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ build/*
.project
.settings
bin/
/.gradle/
/build/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ install:

script:
- ./gradlew checkFormat
- ./gradlew test
- ./gradlew --info test

# Upload to sonatype oss for master snapshots
after_success:
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ add_library(tiledbjni SHARED
src/main/c/custom/tiledb_custom.cxx
)

target_compile_definitions(tiledbjni PRIVATE -DTILEDB_CORE_OBJECTS_EXPORTS)
target_include_directories(tiledbjni
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/swig"
Expand Down
19 changes: 19 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 0.2.7.{build}

image: Visual Studio 2019
platform:
- x64

build: off

build_script:
- gradlew assemble

test_script:
- gradlew --info test
# Check that the NativeLibLoader functions correctly
- ps: $(ls build\libs\tiledb-java-*.jar | % {$Env:CLASSPATH += $_.FullName + ";"})
- ps: java examples.io.tiledb.java.api.TileDBVersion

artifacts:
- path: 'build\libs\*'
99 changes: 47 additions & 52 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'java'
id 'java-library'
id 'idea'
id 'maven-publish'
id 'signing'
Expand Down Expand Up @@ -41,90 +41,85 @@ sourceSets {
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
testImplementation 'junit:junit:4.12'
}

def String getProjectProperty(String propertyName)
{
String property = null
if (hasProperty(propertyName))
{
property = this.properties[propertyName]
task cmakeTask(type: Exec) {
doFirst {
mkdir buildDir
}
return property
}

task cmakeTask(type: Exec) {
workingDir = buildDir
executable = 'cmake'
List<String> buildArgs = new ArrayList<String>()
buildArgs.add("..")
String tiledb_git_repo = getProjectProperty('TILEDB_GIT_REPOSITORY')
String tiledb_git_tag = getProjectProperty('TILEDB_GIT_TAG')
String tiledb_verbose = getProjectProperty('TILEDB_VERBOSE')
String tiledb_s3 = getProjectProperty('TILEDB_S3')
String tiledb_hdfs = getProjectProperty('TILEDB_HDFS')
String tiledb_serialization = getProjectProperty('TILEDB_SERIALIZATION')
if (tiledb_git_repo != null) {
buildArgs.add("-DTILEDB_GIT_REPOSITORY=" + tiledb_git_repo)
}
if (tiledb_git_tag != null) {
buildArgs.add("-DTILEDB_GIT_TAG=" + tiledb_git_tag)
}
if (tiledb_verbose != null) {
buildArgs.add("-DTILEDB_VERBOSE=" + tiledb_verbose)
}
if (tiledb_s3 != null) {
buildArgs.add("-DTILEDB_S3=" + tiledb_s3)
}
if (tiledb_hdfs != null) {
buildArgs.add("-DTILEDB_HDFS=" + tiledb_hdfs)
}
if (tiledb_serialization != null) {
buildArgs.add("-DTILEDB_SERIALIZATION=" + tiledb_serialization)
def buildArgs = [".."]
if (project.properties.TILEDB_CMAKE_GENERATOR) {
buildArgs << "-G" << project.properties.TILEDB_CMAKE_GENERATOR
}
if (project.properties.TILEDB_CMAKE_ARCHITECTURE) {
buildArgs << "-A" << project.properties.TILEDB_CMAKE_ARCHITECTURE
}
[
"TILEDB_GIT_REPOSITORY",
"TILEDB_GIT_TAG",
"TILEDB_VERBOSE",
"TILEDB_S3",
"TILEDB_HDFS",
"TILEDB_SERIALIZATION"
].each { v ->
if (project.hasProperty(v)) {
buildArgs << "-D${v}=${project.property(v)}"
}
}
args buildArgs
}

task makeTask(type: Exec) {
task cmakeBuildTask(type: Exec) {
workingDir = buildDir
executable = 'make'
args "-j${Runtime.getRuntime().availableProcessors()}"
}
makeTask.dependsOn(cmakeTask)

task makeInstallTask(type: Exec) {
workingDir = new File(buildDir, "tiledb_jni")
executable = 'make'
args 'install'
executable = 'cmake'
args "--build", ".", "--config", "release"
}
makeInstallTask.dependsOn(makeTask)
cmakeBuildTask.dependsOn(cmakeTask)

assemble.dependsOn(makeInstallTask)
assemble.dependsOn(cmakeBuildTask)

task generateJNI(type: Exec) {
workingDir = buildDir
executable = "../generate_tiledb_jni"
}

import org.apache.tools.ant.taskdefs.condition.Os
test {
systemProperty "java.library.path", "$buildDir/install/lib/"
useJUnit()

maxHeapSize = '1G'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you find that we needed to set the maxHeapSize in your environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did, but that was before I refactored a lot of the resource handling into try-with-resources blocks and when I had a lot of tests failing. I'll push a commit without and we'll see if that passes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without maxHeapSize = '1G', fails with an OOM:

I can roll a40e3ef back or we can try something else if you'd like.


if (Os.isFamily(Os.FAMILY_WINDOWS)) {
systemProperty "java.library.path", "$buildDir\\install\\bin;$buildDir\\tiledb_jni\\Release"
} else {
systemProperty "java.library.path", "$buildDir/install/lib:$buildDir/install/lib64:$buildDir/tiledb_jni"
}

testLogging {
showStandardStreams = true
}
}

jar {
into(new File('lib', osdetector.classifier).toString()) {
// Linux and macOS
from file("$buildDir/install/lib/${System.mapLibraryName("tiledb")}")
from file("$buildDir/install/lib/${System.mapLibraryName("tiledbjni")}")
from file("$buildDir/install/lib64/${System.mapLibraryName("tiledb")}")
from file("$buildDir/install/lib64/${System.mapLibraryName("tiledbjni")}")
from file("$buildDir/tiledb_jni/${System.mapLibraryName("tiledbjni")}")
// Windows
from file("$buildDir/install/bin/${System.mapLibraryName("tbb")}")
from file("$buildDir/install/bin/${System.mapLibraryName("tiledb")}")
from file("$buildDir/tiledb_jni/Release/${System.mapLibraryName("tiledbjni")}")
}


manifest {
attributes("Implementation-Title": "Gradle",
"Implementation-Version": version)
"Implementation-Version": archiveVersion)
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ pluginManagement {
}
}
}
enableFeaturePreview('STABLE_PUBLISHING')
rootProject.name = 'tiledb-java'
14 changes: 9 additions & 5 deletions src/main/c/custom/tiledb_custom.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ extern "C" {
jintArray jresult = jenv->NewIntArray(sz);
if (!jresult)
return NULL;
jenv->SetIntArrayRegion(jresult, 0, sz, arr);
jenv->SetIntArrayRegion(jresult, 0, sz, (jint*) arr);
return jresult;
}

Expand Down Expand Up @@ -844,7 +844,8 @@ extern "C" {
for(int i = 0; i<sz; i++){
short_arr[i] = (jshort)arr[i];
}
jenv->ReleaseShortArrayElements(jresult, short_arr, 0);
jenv->SetShortArrayRegion(jresult, 0, sz, short_arr);
delete short_arr;
return jresult;
}

Expand Down Expand Up @@ -894,7 +895,8 @@ extern "C" {
for(int i = 0; i<sz; i++){
int_arr[i] = (jint)arr[i];
}
jenv->ReleaseIntArrayElements(jresult, int_arr, 0);
jenv->SetIntArrayRegion(jresult, 0, sz, int_arr);
delete int_arr;
return jresult;
}

Expand All @@ -921,7 +923,8 @@ extern "C" {
for(int i = 0; i<sz; i++){
long_arr[i] = (jlong)arr[i];
}
jenv->ReleaseLongArrayElements(jresult, long_arr, 0);
jenv->SetLongArrayRegion(jresult, 0, sz, long_arr);
delete long_arr;
return jresult;
}

Expand Down Expand Up @@ -949,7 +952,8 @@ extern "C" {
for(int i = 0; i<sz; i++){
long_arr[i] = (jlong)arr[i];
}
jenv->ReleaseLongArrayElements(jresult, long_arr, 0);
jenv->SetLongArrayRegion(jresult, 0, sz, long_arr);
delete long_arr;
return jresult;
}

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/io/tiledb/java/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
package io.tiledb.java.api;

import io.tiledb.libtiledb.*;

import java.io.File;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -115,7 +117,7 @@ public Config(URI uri) throws TileDBError {
throw new TileDBError(
"Config can an only read from a local file scheme URI (file://), got: " + uri);
}
init(uri.getPath());
init(new File(uri).getAbsolutePath());
}

/**
Expand Down Expand Up @@ -298,7 +300,7 @@ public void saveToFile(URI uri) throws TileDBError {
throw new TileDBError(
"Config can an only save to a local file scheme URI (file://), got: " + uri);
}
saveToFile(uri.getPath());
saveToFile(new File(uri).getAbsolutePath());
}

private void next(SWIGTYPE_p_tiledb_config_iter_t iterp) throws TileDBError {
Expand Down
Loading