Skip to content

Commit

Permalink
Merge branch 'master' into fp/default-geopoint
Browse files Browse the repository at this point in the history
* master:
  Switch to building with Xcode 14 (#6647)
  Updated release notes
  core v13.14.0
  Remap github URL to ssh to fix BAAS dependency using https:// (#6685)
  Use cross-compilers instead of CentOS image (#6559)
  Filter out external sources from Eclipse (#6682)
  Support sorting based on values from a dictionary (#5311)
  • Loading branch information
papafe committed Jun 6, 2023
2 parents 8d63d3c + 0f294cf commit 03e83fe
Show file tree
Hide file tree
Showing 31 changed files with 483 additions and 279 deletions.
20 changes: 20 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,24 @@
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<filteredResources>
<filter>
<id>1684928805201</id>
<name>external</name>
<type>30</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-catch</arguments>
</matcher>
</filter>
<filter>
<id>1684928848403</id>
<name>src/external</name>
<type>14</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-*</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@

### Fixed
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
* None.

### Breaking changes
* None.

### Compatibility
* Fileformat: Generates files with format v23. Reads and automatically upgrade from fileformat v5.

-----------

### Internals
* Prebuilt libraries for Apple platforms are now built with Xcode 14.

----------------------------------------------

# 13.14.0 Release notes

### Enhancements
* Support sort/distinct based on values from a dictionary e.g. `TRUEPREDICATE SORT(meta['age'])` (PR [#5311](https://github.com/realm/realm-core/pull/5311))

### Fixed
* Fix the query parser needs to copy list of arguments and own the memory. ([#6674](https://github.com/realm/realm-core/pull/6674), since v12.5.0)
* Fixed a potential crash when opening the realm after failing to download a fresh FLX realm during an automatic client reset ([#6494](https://github.com/realm/realm-core/issues/6494), since v12.3.0)

Expand All @@ -19,7 +40,7 @@
-----------

### Internals
* None.
* Added CMake toolchains for cross-targeting Linux x86_64, armv7, and aarch64. (PR [#6559](https://github.com/realm/realm-core/pull/6559))

----------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ endif()
# Just use -lz and let Xcode figure it out
# Emscripten does provide Zlib, but it doesn't work with find_package and is handled specially
if(NOT APPLE AND NOT EMSCRIPTEN AND NOT TARGET ZLIB::ZLIB)
if(WIN32)
realm_acquire_dependency(zlib ${DEP_WIN32_ZLIB_VERSION} ZLIB_CMAKE_INCLUDE_FILE)
if(WIN32 OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND REALM_LINUX_TOOLCHAIN))
realm_acquire_dependency(zlib ${DEP_ZLIB_VERSION} ZLIB_CMAKE_INCLUDE_FILE)
include(${ZLIB_CMAKE_INCLUDE_FILE})
elseif(ANDROID)
# On Android FindZLIB chooses the static libz over the dynamic one, but this leads to issues
Expand Down
29 changes: 17 additions & 12 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ jobWrapper {

parallelExecutors = [
buildLinuxRelease : doBuildLinux('Release'),
checkLinuxDebug : doCheckInDocker(buildOptions),
checkLinuxDebug : doCheckInDocker(buildOptions + [useToolchain : true]),
checkLinuxDebugEncrypt : doCheckInDocker(buildOptions + [useEncryption : true]),
checkLinuxRelease_4 : doCheckInDocker(buildOptions + [maxBpNodeSize: 4, buildType : 'Release']),
checkLinuxRelease_4 : doCheckInDocker(buildOptions + [maxBpNodeSize: 4, buildType : 'Release', useToolchain : true]),
checkLinuxDebug_Sync : doCheckInDocker(buildOptions + [enableSync: true, dumpChangesetTransform: true]),
checkLinuxDebugNoEncryp : doCheckInDocker(buildOptions + [enableEncryption: false]),
checkMacOsRelease_Sync : doBuildMacOs(buildOptions + [buildType: 'Release', enableSync: true]),
Expand Down Expand Up @@ -251,7 +251,7 @@ def doCheckInDocker(Map options = [:]) {
rlmNode('docker') {
getArchive()

def buildEnv = buildDockerEnv('testing.Dockerfile')
def buildEnv = buildDockerEnv('linux.Dockerfile')

def environment = environment()
environment << 'UNITTEST_XML=unit-test-report.xml'
Expand All @@ -260,6 +260,12 @@ def doCheckInDocker(Map options = [:]) {
environment << 'UNITTEST_ENCRYPT_ALL=1'
}

// We don't enable this by default, because using a toolchain with its own sysroot
// prevents CMake from finding system libraries like curl which we use in sync tests.
if (options.useToolchain) {
cmakeDefinitions += " -DCMAKE_TOOLCHAIN_FILE=\"${env.WORKSPACE}/tools/cmake/x86_64-linux-gnu.toolchain.cmake\""
}

def buildSteps = { String dockerArgs = "" ->
buildEnv.inside(dockerArgs) {
withEnv(environment) {
Expand Down Expand Up @@ -351,7 +357,7 @@ def doCheckSanity(Map options = [:]) {
"UNITTEST_SUITE_NAME=Linux-${options.buildType}",
"TSAN_OPTIONS=\"suppressions=${WORKSPACE}/test/tsan.suppress\""
]
buildDockerEnv('testing.Dockerfile').inside(privileged) {
buildDockerEnv('linux.Dockerfile').inside(privileged) {
withEnv(environment) {
try {
dir('build-dir') {
Expand Down Expand Up @@ -379,12 +385,12 @@ def doBuildLinux(String buildType) {
rlmNode('docker') {
getSourceArchive()

buildDockerEnv('packaging.Dockerfile').inside {
buildDockerEnv('linux.Dockerfile').inside {
sh """
rm -rf build-dir
mkdir build-dir
cd build-dir
cmake -DCMAKE_BUILD_TYPE=${buildType} -DREALM_NO_TESTS=1 -DREALM_VERSION="${gitDescribeVersion}" -G Ninja ..
cmake -DCMAKE_BUILD_TYPE=${buildType} -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/x86_64-linux-gnu.toolchain.cmake -DREALM_NO_TESTS=1 -DREALM_VERSION="${gitDescribeVersion}" -G Ninja ..
ninja
cpack -G TGZ
"""
Expand All @@ -410,7 +416,7 @@ def doBuildLinuxClang(String buildType) {
'CXX=clang++'
]

buildDockerEnv('testing.Dockerfile').inside {
buildDockerEnv('linux.Dockerfile').inside {
withEnv(environment) {
dir('build-dir') {
sh "cmake -D CMAKE_BUILD_TYPE=${buildType} -DREALM_NO_TESTS=1 -DREALM_VERSION=\"${gitDescribeVersion}\" -G Ninja .."
Expand Down Expand Up @@ -645,7 +651,7 @@ def doBuildMacOs(Map options = [:]) {
getArchive()

dir('build-macosx') {
withEnv(['DEVELOPER_DIR=/Applications/Xcode-13.1.app/Contents/Developer/']) {
withEnv(['DEVELOPER_DIR=/Applications/Xcode-14.app/Contents/Developer/']) {
// This is a dirty trick to work around a bug in xcode
// It will hang if launched on the same project (cmake trying the compiler out)
// in parallel.
Expand All @@ -663,7 +669,7 @@ def doBuildMacOs(Map options = [:]) {
)
}
}
withEnv(['DEVELOPER_DIR=/Applications/Xcode-13.1.app/Contents/Developer']) {
withEnv(['DEVELOPER_DIR=/Applications/Xcode-14.app/Contents/Developer']) {
runAndCollectWarnings(
parser: 'clang',
script: 'xcrun swift build',
Expand Down Expand Up @@ -706,8 +712,7 @@ def doBuildApplePlatform(String platform, String buildType, boolean test = false
rlmNode('osx') {
getArchive()

withEnv(['DEVELOPER_DIR=/Applications/Xcode-13.1.app/Contents/Developer/',
'XCODE_14_DEVELOPER_DIR=/Applications/Xcode-14.app/Contents/Developer/']) {
withEnv(['DEVELOPER_DIR=/Applications/Xcode-14.app/Contents/Developer/']) {
sh "tools/build-apple-device.sh -p '${platform}' -c '${buildType}' -v '${gitDescribeVersion}'"

if (test) {
Expand Down Expand Up @@ -778,7 +783,7 @@ def doBuildCoverage() {
rlmNode('docker') {
getArchive()

buildDockerEnv('testing.Dockerfile').inside {
buildDockerEnv('linux.Dockerfile').inside {
sh '''
mkdir build
cd build
Expand Down
13 changes: 2 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// swift-tools-version:5.5
// swift-tools-version:5.6

import PackageDescription
import Foundation

let versionStr = "13.13.0"
let versionStr = "13.14.0"
let versionPieces = versionStr.split(separator: "-")
let versionCompontents = versionPieces[0].split(separator: ".")
let versionExtra = versionPieces.count > 1 ? versionPieces[1] : ""
Expand Down Expand Up @@ -348,21 +348,12 @@ let bidExcludes: [String] = [
"wcstod64.c",
]

#if swift(>=5.7)
let platforms: [SupportedPlatform] = [
.macOS(.v10_13),
.iOS(.v11),
.tvOS(.v11),
.watchOS(.v4)
]
#else
let platforms: [SupportedPlatform] = [
.macOS(.v10_10),
.iOS(.v11),
.tvOS(.v9),
.watchOS(.v2)
]
#endif

let package = Package(
name: "RealmDatabase",
Expand Down
4 changes: 2 additions & 2 deletions dependencies.list
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PACKAGE_NAME=realm-core
VERSION=13.13.0
VERSION=13.14.0
OPENSSL_VERSION=3.0.8
WIN32_ZLIB_VERSION=1.2.13
ZLIB_VERSION=1.2.13
MDBREALM_TEST_SERVER_TAG=2023-05-05
3 changes: 3 additions & 0 deletions evergreen/install_baas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ if [[ ! -x baas_dep_binaries/jq ]]; then
cd -
fi

# Fix incompatible github path that was changed in a BAAS dependency
git config --global url."[email protected]:".insteadOf "https://github.com/"

if [[ -z "$BAAS_VERSION" ]]; then
BAAS_VERSION=$($CURL -LsS "https://realm.mongodb.com/api/private/v1.0/version" | jq -r '.backend.git_hash')
fi
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions packaging.Dockerfile

This file was deleted.

33 changes: 26 additions & 7 deletions src/realm/object-store/results.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,8 @@ TableView Results::get_tableview()
REALM_COMPILER_HINT_UNREACHABLE();
}

static std::vector<ColKey> parse_keypath(StringData keypath, Schema const& schema, const ObjectSchema* object_schema)
static std::vector<ExtendedColumnKey> parse_keypath(StringData keypath, Schema const& schema,
const ObjectSchema* object_schema)
{
auto check = [&](bool condition, const char* fmt, auto... args) {
if (!condition) {
Expand All @@ -821,25 +822,43 @@ static std::vector<ColKey> parse_keypath(StringData keypath, Schema const& schem
const char* end = keypath.data() + keypath.size();
check(begin != end, "missing property name");

std::vector<ColKey> indices;
std::vector<ExtendedColumnKey> indices;
while (begin != end) {
auto sep = std::find(begin, end, '.');
check(sep != begin && sep + 1 != end, "missing property name");
StringData key(begin, sep - begin);
std::string index;
auto begin_key = std::find(begin, sep, '[');
if (begin_key != sep) {
auto end_key = std::find(begin_key, sep, ']');
check(end_key != sep, "missing ']'");
index = std::string(begin_key + 1, end_key);
key = StringData(begin, begin_key - begin);
}
begin = sep + (sep != end);

auto prop = object_schema->property_for_public_name(key);
check(prop, "property '%1.%2' does not exist", object_schema->name, key);
check(is_sortable_type(prop->type), "property '%1.%2' is of unsupported type '%3'", object_schema->name, key,
string_for_property_type(prop->type));
if (is_dictionary(prop->type)) {
check(index.length(), "missing dictionary key");
}
else {
check(is_sortable_type(prop->type), "property '%1.%2' is of unsupported type '%3'", object_schema->name,
key, string_for_property_type(prop->type));
}
if (prop->type == PropertyType::Object)
check(begin != end, "property '%1.%2' of type 'object' cannot be the final property in the key path",
object_schema->name, key);
else
check(begin == end, "property '%1.%2' of type '%3' may only be the final property in the key path",
object_schema->name, key, prop->type_string());

indices.push_back(ColKey(prop->column_key));
if (index.length()) {
indices.emplace_back(ColKey(prop->column_key), index);
}
else {
indices.emplace_back(ColKey(prop->column_key));
}
if (prop->type == PropertyType::Object)
object_schema = &*schema.find(prop->object_type);
}
Expand All @@ -862,7 +881,7 @@ Results Results::sort(std::vector<std::pair<std::string, bool>> const& keypaths)
return sort({{{}}, {keypaths[0].second}});
}

std::vector<std::vector<ColKey>> column_keys;
std::vector<std::vector<ExtendedColumnKey>> column_keys;
std::vector<bool> ascending;
column_keys.reserve(keypaths.size());
ascending.reserve(keypaths.size());
Expand Down Expand Up @@ -937,7 +956,7 @@ Results Results::distinct(std::vector<std::string> const& keypaths) const
return distinct(DistinctDescriptor({{ColKey()}}));
}

std::vector<std::vector<ColKey>> column_keys;
std::vector<std::vector<ExtendedColumnKey>> column_keys;
column_keys.reserve(keypaths.size());
for (auto& keypath : keypaths)
column_keys.push_back(parse_keypath(keypath, m_realm->schema(), &get_object_schema()));
Expand Down
17 changes: 8 additions & 9 deletions src/realm/parser/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1504,20 +1504,19 @@ std::unique_ptr<DescriptorOrdering> DescriptorOrderingNode::visit(ParserDriver*
}
else {
bool is_distinct = cur_ordering->get_type() == DescriptorNode::DISTINCT;
std::vector<std::vector<ColKey>> property_columns;
std::vector<std::vector<ExtendedColumnKey>> property_columns;
for (auto& col_names : cur_ordering->columns) {
std::vector<ColKey> columns;
std::vector<ExtendedColumnKey> columns;
LinkChain link_chain(target);
for (size_t ndx_in_path = 0; ndx_in_path < col_names.size(); ++ndx_in_path) {
std::string path_elem = drv->translate(link_chain, col_names[ndx_in_path]);
ColKey col_key = link_chain.get_current_table()->get_column_key(path_elem);
std::string prop_name = drv->translate(link_chain, col_names[ndx_in_path].id);
ColKey col_key = link_chain.get_current_table()->get_column_key(prop_name);
if (!col_key) {
throw InvalidQueryError(
util::format("No property '%1' found on object type '%2' specified in '%3' clause",
col_names[ndx_in_path], link_chain.get_current_table()->get_class_name(),
is_distinct ? "distinct" : "sort"));
throw InvalidQueryError(util::format(
"No property '%1' found on object type '%2' specified in '%3' clause", prop_name,
link_chain.get_current_table()->get_class_name(), is_distinct ? "distinct" : "sort"));
}
columns.push_back(col_key);
columns.emplace_back(col_key, col_names[ndx_in_path].index);
if (ndx_in_path < col_names.size() - 1) {
link_chain.link(col_key);
}
Expand Down
6 changes: 2 additions & 4 deletions src/realm/parser/driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ class PostOpNode : public ParserNode {
class DescriptorNode : public ParserNode {
public:
enum Type { SORT, DISTINCT, LIMIT };
std::vector<std::vector<std::string>> columns;
std::vector<std::vector<PathElem>> columns;
std::vector<bool> ascending;
size_t limit = size_t(-1);
Type type;
Expand All @@ -554,9 +554,7 @@ class DescriptorNode : public ParserNode {
void add(PathNode* path)
{
auto& vec = columns.emplace_back();
for (PathElem& e : path->path_elems) {
vec.push_back(e.id);
}
vec = std::move(path->path_elems);
}
void add(PathNode* path, bool direction)
{
Expand Down
Loading

0 comments on commit 03e83fe

Please sign in to comment.