mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Make before_deploy.sh work on FreeBSD
This commit is contained in:
parent
e440a7c52f
commit
9e730aacd4
@ -1,27 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
root=$(realpath "$(dirname "$0")/..")
|
root=$(realpath "$(dirname "$0")/..")
|
||||||
version=$(TZ=UTC date +v%Y%m%d)
|
version=$(TZ=UTC date +v%Y%m%d)
|
||||||
|
cd "$root/build/release"
|
||||||
|
|
||||||
case "$TRAVIS_OS_NAME" in
|
case $(uname -s) in
|
||||||
osx)
|
Darwin)
|
||||||
SO=dylib
|
libclang=(lib/clang+llvm-*/lib/libclang.dylib)
|
||||||
name=cquery-$version-x86_64-apple-darwin ;;
|
name=cquery-$version-x86_64-apple-darwin ;;
|
||||||
*)
|
FreeBSD)
|
||||||
SO=so
|
libclang=(lib/clang+llvm-*/lib/libclang.so.?)
|
||||||
|
name=cquery-$version-x86_64-unknown-freebsd10 ;;
|
||||||
|
Linux)
|
||||||
|
libclang=(lib/clang+llvm-*/lib/libclang.so.?)
|
||||||
name=cquery-$version-x86_64-unknown-linux-gnu ;;
|
name=cquery-$version-x86_64-unknown-linux-gnu ;;
|
||||||
|
*)
|
||||||
|
echo Unsupported >&2
|
||||||
|
exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
pkg=$(mktemp -d)
|
pkg=$(mktemp -d)
|
||||||
|
rsync -rtLR bin "./${libclang[0]}" ./lib/clang+llvm-*/lib/clang/*/include "$pkg/"
|
||||||
cd "$root/build/release"
|
|
||||||
rsync -rtLR bin ./lib/clang+llvm-*/lib/libclang.$SO.? ./lib/clang+llvm-*/lib/clang/*/include "$pkg/"
|
|
||||||
|
|
||||||
cd "$pkg"
|
cd "$pkg"
|
||||||
strip -s bin/cquery lib/clang+llvm*/lib/libclang.$SO.?
|
strip -s bin/cquery "${libclang[0]}"
|
||||||
if [[ $(uname) == Linux ]]; then
|
case $(uname -s) in
|
||||||
# ./bin/cquery -> $name/bin/cquery
|
Darwin)
|
||||||
tar -Jcf "$root/build/$name.tar.xz" --owner 0 --group 0 --xform "s,^\./,$name/," .
|
# FIXME
|
||||||
else
|
;;
|
||||||
tar -zcf "$root/build/$name.tar.gz" --uid 0 --gid 0 -s ",^\./,$name/," .
|
Linux)
|
||||||
fi
|
# ./bin/cquery -> $name/bin/cquery
|
||||||
|
tar -Jcf "$root/build/$name.tar.xz" --owner 0 --group 0 --xform "s,^\./,$name/," . ;;
|
||||||
|
*)
|
||||||
|
tar -Jcf "$root/build/$name.tar.xz" --uid 0 --gid 0 -s ",^\./,$name/," .
|
||||||
|
esac
|
||||||
rm -r "$pkg"
|
rm -r "$pkg"
|
||||||
|
57
src/query.cc
57
src/query.cc
@ -128,8 +128,8 @@ void AddMergeableRange(
|
|||||||
//
|
//
|
||||||
// Returns true iff |removed| or |added| are non-empty.
|
// Returns true iff |removed| or |added| are non-empty.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool ComputeDifferenceForUpdate(std::vector<T>& previous,
|
bool ComputeDifferenceForUpdate(std::vector<T>&& previous,
|
||||||
std::vector<T>& current,
|
std::vector<T>&& current,
|
||||||
std::vector<T>* removed,
|
std::vector<T>* removed,
|
||||||
std::vector<T>* added) {
|
std::vector<T>* added) {
|
||||||
// We need to sort to use std::set_difference.
|
// We need to sort to use std::set_difference.
|
||||||
@ -140,17 +140,17 @@ bool ComputeDifferenceForUpdate(std::vector<T>& previous,
|
|||||||
while (it0 != previous.end() && it1 != current.end()) {
|
while (it0 != previous.end() && it1 != current.end()) {
|
||||||
// Elements in |previous| that are not in |current|.
|
// Elements in |previous| that are not in |current|.
|
||||||
if (*it0 < *it1)
|
if (*it0 < *it1)
|
||||||
removed->push_back(*it0++);
|
removed->push_back(std::move(*it0++));
|
||||||
// Elements in |current| that are not in |previous|.
|
// Elements in |current| that are not in |previous|.
|
||||||
else if (*it1 < *it0)
|
else if (*it1 < *it0)
|
||||||
added->push_back(*it1++);
|
added->push_back(std::move(*it1++));
|
||||||
else
|
else
|
||||||
++it0, ++it1;
|
++it0, ++it1;
|
||||||
}
|
}
|
||||||
while (it0 != previous.end())
|
while (it0 != previous.end())
|
||||||
removed->push_back(*it0++);
|
removed->push_back(std::move(*it0++));
|
||||||
while (it1 != current.end())
|
while (it1 != current.end())
|
||||||
added->push_back(*it1++);
|
added->push_back(std::move(*it1++));
|
||||||
|
|
||||||
return !removed->empty() || !added->empty();
|
return !removed->empty() || !added->empty();
|
||||||
}
|
}
|
||||||
@ -464,18 +464,20 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
|||||||
// |query_name| is the name of the variable on the query type.
|
// |query_name| is the name of the variable on the query type.
|
||||||
// |index_name| is the name of the variable on the index type.
|
// |index_name| is the name of the variable on the index type.
|
||||||
// |type| is the type of the variable.
|
// |type| is the type of the variable.
|
||||||
#define PROCESS_UPDATE_DIFF(type_id, query_name, index_name, type) \
|
#define PROCESS_UPDATE_DIFF(type_id, query_name, index_name, type) \
|
||||||
{ \
|
{ \
|
||||||
/* Check for changes. */ \
|
/* Check for changes. */ \
|
||||||
std::vector<type> removed, added; \
|
std::vector<type> removed, added; \
|
||||||
auto query_previous = previous_id_map.ToQuery(previous->index_name); \
|
auto query_previous = previous_id_map.ToQuery(previous->index_name); \
|
||||||
auto query_current = current_id_map.ToQuery(current->index_name); \
|
auto query_current = current_id_map.ToQuery(current->index_name); \
|
||||||
bool did_add = ComputeDifferenceForUpdate(query_previous, query_current, \
|
bool did_add = ComputeDifferenceForUpdate(std::move(query_previous), \
|
||||||
&removed, &added); \
|
std::move(query_current), \
|
||||||
if (did_add) { \
|
&removed, &added); \
|
||||||
query_name.push_back(MergeableUpdate<type_id, type>( \
|
if (did_add) { \
|
||||||
current_id_map.ToQuery(current->id), added, removed)); \
|
query_name.push_back(MergeableUpdate<type_id, type>( \
|
||||||
} \
|
current_id_map.ToQuery(current->id), std::move(added), \
|
||||||
|
std::move(removed))); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
// File
|
// File
|
||||||
files_def_update.push_back(BuildFileDefUpdate(current_id_map, current_file));
|
files_def_update.push_back(BuildFileDefUpdate(current_id_map, current_file));
|
||||||
@ -513,7 +515,7 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
|||||||
ToQuery(current_id_map, type->def);
|
ToQuery(current_id_map, type->def);
|
||||||
if (def_update)
|
if (def_update)
|
||||||
types_def_update.push_back(
|
types_def_update.push_back(
|
||||||
QueryType::DefUpdate(type->usr, *def_update));
|
QueryType::DefUpdate(type->usr, std::move(*def_update)));
|
||||||
if (!type->derived.empty())
|
if (!type->derived.empty())
|
||||||
types_derived.push_back(
|
types_derived.push_back(
|
||||||
QueryType::DerivedUpdate(current_id_map.ToQuery(type->id),
|
QueryType::DerivedUpdate(current_id_map.ToQuery(type->id),
|
||||||
@ -537,8 +539,8 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
|||||||
if (current_remapped_def &&
|
if (current_remapped_def &&
|
||||||
previous_remapped_def != current_remapped_def &&
|
previous_remapped_def != current_remapped_def &&
|
||||||
!current_remapped_def->detailed_name.empty()) {
|
!current_remapped_def->detailed_name.empty()) {
|
||||||
types_def_update.push_back(
|
types_def_update.push_back(QueryType::DefUpdate(
|
||||||
QueryType::DefUpdate(current->usr, *current_remapped_def));
|
current->usr, std::move(*current_remapped_def)));
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCESS_UPDATE_DIFF(QueryTypeId, types_derived, derived, QueryTypeId);
|
PROCESS_UPDATE_DIFF(QueryTypeId, types_derived, derived, QueryTypeId);
|
||||||
@ -575,7 +577,7 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
|||||||
ToQuery(current_id_map, func->def);
|
ToQuery(current_id_map, func->def);
|
||||||
if (def_update)
|
if (def_update)
|
||||||
funcs_def_update.push_back(
|
funcs_def_update.push_back(
|
||||||
QueryFunc::DefUpdate(func->usr, *def_update));
|
QueryFunc::DefUpdate(func->usr, std::move(*def_update)));
|
||||||
if (!func->declarations.empty())
|
if (!func->declarations.empty())
|
||||||
funcs_declarations.push_back(QueryFunc::DeclarationsUpdate(
|
funcs_declarations.push_back(QueryFunc::DeclarationsUpdate(
|
||||||
current_id_map.ToQuery(func->id),
|
current_id_map.ToQuery(func->id),
|
||||||
@ -599,8 +601,8 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
|||||||
if (current_remapped_def &&
|
if (current_remapped_def &&
|
||||||
previous_remapped_def != current_remapped_def &&
|
previous_remapped_def != current_remapped_def &&
|
||||||
!current_remapped_def->detailed_name.empty()) {
|
!current_remapped_def->detailed_name.empty()) {
|
||||||
funcs_def_update.push_back(
|
funcs_def_update.push_back(QueryFunc::DefUpdate(
|
||||||
QueryFunc::DefUpdate(current->usr, *current_remapped_def));
|
current->usr, std::move(*current_remapped_def)));
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCESS_UPDATE_DIFF(QueryFuncId, funcs_declarations, declarations,
|
PROCESS_UPDATE_DIFF(QueryFuncId, funcs_declarations, declarations,
|
||||||
@ -631,7 +633,8 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
|||||||
[this, ¤t_id_map](IndexVar* var) {
|
[this, ¤t_id_map](IndexVar* var) {
|
||||||
optional<QueryVar::Def> def_update = ToQuery(current_id_map, var->def);
|
optional<QueryVar::Def> def_update = ToQuery(current_id_map, var->def);
|
||||||
if (def_update)
|
if (def_update)
|
||||||
vars_def_update.push_back(QueryVar::DefUpdate(var->usr, *def_update));
|
vars_def_update.push_back(
|
||||||
|
QueryVar::DefUpdate(var->usr, std::move(*def_update)));
|
||||||
if (!var->declarations.empty())
|
if (!var->declarations.empty())
|
||||||
vars_declarations.push_back(QueryVar::DeclarationsUpdate(
|
vars_declarations.push_back(QueryVar::DeclarationsUpdate(
|
||||||
current_id_map.ToQuery(var->id),
|
current_id_map.ToQuery(var->id),
|
||||||
@ -651,8 +654,8 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
|||||||
if (current_remapped_def &&
|
if (current_remapped_def &&
|
||||||
previous_remapped_def != current_remapped_def &&
|
previous_remapped_def != current_remapped_def &&
|
||||||
!current_remapped_def->detailed_name.empty())
|
!current_remapped_def->detailed_name.empty())
|
||||||
vars_def_update.push_back(
|
vars_def_update.push_back(QueryVar::DefUpdate(
|
||||||
QueryVar::DefUpdate(current->usr, *current_remapped_def));
|
current->usr, std::move(*current_remapped_def)));
|
||||||
|
|
||||||
PROCESS_UPDATE_DIFF(QueryVarId, vars_declarations, declarations,
|
PROCESS_UPDATE_DIFF(QueryVarId, vars_declarations, declarations,
|
||||||
QueryLocation);
|
QueryLocation);
|
||||||
|
10
src/query.h
10
src/query.h
@ -167,12 +167,12 @@ struct MergeableUpdate {
|
|||||||
std::vector<TValue> to_add;
|
std::vector<TValue> to_add;
|
||||||
std::vector<TValue> to_remove;
|
std::vector<TValue> to_remove;
|
||||||
|
|
||||||
MergeableUpdate(TId id, const std::vector<TValue>& to_add)
|
MergeableUpdate(TId id, std::vector<TValue>&& to_add)
|
||||||
: id(id), to_add(to_add) {}
|
: id(id), to_add(std::move(to_add)) {}
|
||||||
MergeableUpdate(TId id,
|
MergeableUpdate(TId id,
|
||||||
const std::vector<TValue>& to_add,
|
std::vector<TValue>&& to_add,
|
||||||
const std::vector<TValue>& to_remove)
|
std::vector<TValue>&& to_remove)
|
||||||
: id(id), to_add(to_add), to_remove(to_remove) {}
|
: id(id), to_add(std::move(to_add)), to_remove(std::move(to_remove)) {}
|
||||||
};
|
};
|
||||||
template <typename TVisitor, typename TId, typename TValue>
|
template <typename TVisitor, typename TId, typename TValue>
|
||||||
void Reflect(TVisitor& visitor, MergeableUpdate<TId, TValue>& value) {
|
void Reflect(TVisitor& visitor, MergeableUpdate<TId, TValue>& value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user