Skip to content

Commit

Permalink
Merge branch 'c-v0.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
greenrobot committed Jun 23, 2023
2 parents e5c976d + 3024d90 commit 8a6791f
Show file tree
Hide file tree
Showing 14 changed files with 917 additions and 119 deletions.
29 changes: 21 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
stages:
- gatekeeper
- test

.test:
stage: test
script:
- ./build/ci.sh

test:linux:x64:old:
.test:linux:x64:
extends: .test
tags: [ x64, linux, docker ]
image: golang:$GOVERSION

gatekeeper-test:
extends: .test:linux:x64
stage: gatekeeper
variables:
GOVERSION: '1.17'

test:linux:x64:old:
extends: .test:linux:x64
parallel:
matrix:
- GOVERSION: [ '1.11.4', '1.12' ]
Expand All @@ -15,17 +28,15 @@ test:linux:x64:old:
- rm go.sum # issues with checksum mismatch, if anyone still uses old Go, they may need to delete go.sum

test:linux:x64:
extends: .test
tags: [ x64, linux, docker ]
image: golang:$GOVERSION
extends: .test:linux:x64
parallel:
matrix:
- GOVERSION: [ '1.13', '1.14', '1.15', '1.16', '1.17' ]
- GOVERSION: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20' ]

test:linux:ARMv7hf:
# TODO Not working on shell runner (e.g. with default (old) version): investigate and find a working setup
.test:linux:ARMv7hf:
extends: .test
image: golang
tags: [ armv7hf, linux, docker ]
tags: [ armv7hf, linux, shell ]
variables:
BUILD_ARGS: -test.short

Expand All @@ -36,10 +47,12 @@ test:linux:aarch64:
BUILD_ARGS: -test.short

test:mac:x64:
allow_failure: true # TODO Investigate and fix
extends: .test
tags: [ x64, mac, go ]

test:win:x64:
allow_failure: true # TODO gcc not found
extends: .test
tags: [ x64, windows, go ]
before_script:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ id, err := box.Put(&Person{ FirstName: "Joe", LastName: "Green" })
Want details? **[Read the docs](https://golang.objectbox.io/)** or
**[check out the API reference](https://godoc.org/github.com/objectbox/objectbox-go/objectbox)**.

Latest release: [v1.6.1 (2022-01-27)](https://golang.objectbox.io/)
Latest release: [v1.7.0 (2023-06-23)](https://golang.objectbox.io/)

## Table of Contents:
- [High-performance Golang database](#high-performance-golang-database)
Expand Down
2 changes: 1 addition & 1 deletion build/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cd "${script_dir}/.." # move to project root dir

args="$@"

bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-c/main/download.sh) --quiet --sync 0.15.1
bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-c/main/download.sh) --quiet --sync 0.18.1
export CGO_LDFLAGS="-L$(pwd -P)/lib -Wl,-rpath -Wl,$(pwd -P)/lib"

if [[ "$(uname)" == MINGW* ]]; then
Expand Down
43 changes: 37 additions & 6 deletions build/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,44 @@ set -eu
script_dir=$( cd "$(dirname "$0")" ; pwd -P )
cd "${script_dir}/.." # move to project root dir

unformatted_files=$(gofmt -l .)
if [[ ${unformatted_files} ]]; then
echo "Some files are not formatted properly. You can use \`gofmt -l -w .\` to fix them:"
printf "%s\n" "${unformatted_files}"
exit 1
go_version=$(go version)
echo $go_version
if [[ $go_version == *go1.17.* ]]; then # Keep in sync with our CI gatekeeper job; TODO update to latest
# gofmt is version specific, so only run this for our reference version for development
echo "Reference Go version found for gofmt; checking source format..."
echo "******** Testing: gofmt ********"
unformatted_files=$(gofmt -l .)
if [[ ${unformatted_files} ]]; then
echo "Some files are not formatted properly. You can use \`gofmt -l -w .\` to fix them:"
printf "%s\n" "${unformatted_files}"
exit 1
fi
else
echo "The found Go version is not our reference for gofmt; skipping source format check"
fi

go vet ./...
echo "******** Testing: go vet ********"
set +e
go_vet_result=$(go 2>&1 vet ./...)
go_vet_rc=$?
set -e

echo "$go_vet_result"
go_vet_result_lines=$(echo "$go_vet_result" | wc -l)
if [ $go_vet_rc -ne 0 ]; then
if [[ $go_vet_result_lines == 2 && $go_vet_result == *objectbox/c-callbacks.go*possible\ misuse\ of\ unsafe.Pointer* ]]; then
echo "Ignoring known false positive of go vet"
go_vet_rc=0
else
echo "go vet failed ($go_vet_rc)"
# Fail later because we want to run tests for now too; was: exit $go_vet_rc
fi
fi

echo "******** Testing: go test ********"
go test "$@" ./...

if [ $go_vet_rc -ne 0 ]; then
echo "go vet failed ($go_vet_rc)"
exit $go_vet_rc
fi
2 changes: 1 addition & 1 deletion install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $ErrorActionPreference = "Stop"
# Configure supported HTTPS protocols
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls

$libVersion = '0.15.1'
$libVersion = '0.18.1'
$libVariant = 'objectbox' # or 'objectbox-sync'
$downloadDir = 'download'
$extractedLibDir = "$downloadDir\objectbox-$libVersion"
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

cLibVersion=0.15.1
cLibVersion=0.18.1
os=$(uname)
cLibArgs="$*"

Expand Down
2 changes: 1 addition & 1 deletion objectbox/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (builder *Builder) BuildOrError() (*ObjectBox, error) {
}

if builder.maxSizeInKb != nil {
C.obx_opt_max_db_size_in_kb(cOptions, C.size_t(*builder.maxSizeInKb))
C.obx_opt_max_db_size_in_kb(cOptions, C.uint64_t(*builder.maxSizeInKb))
}

if builder.maxReaders != nil {
Expand Down
5 changes: 3 additions & 2 deletions objectbox/c-callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ var cCallbackMutex sync.Mutex
var cCallbackMap = make(map[cCallbackId]cCallable)

// The result is actually not a memory pointer, just a number. That's also how it's used in cCallbackLookup().
func (cbId cCallbackId) cPtrArg() C.uintptr_t {
return C.uintptr_t(cbId)
func (cbId cCallbackId) cPtr() unsafe.Pointer {
//goland:noinspection GoVetUnsafePointer
return unsafe.Pointer(uintptr(cbId))
}

// Returns the next cCallbackId in a sequence (NOT checking its availability), skipping zero.
Expand Down
Loading

0 comments on commit 8a6791f

Please sign in to comment.