Skip to content

Commit

Permalink
Merge branch 'develop' into feature/auto
Browse files Browse the repository at this point in the history
  • Loading branch information
larryk85 authored Feb 1, 2019
2 parents d38fefe + ce2e35f commit ebc146b
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 84 deletions.
58 changes: 33 additions & 25 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,31 +87,31 @@ steps:
# UNIT TESTING
- wait

- command: | # High Sierra Unit Tests
echo "--- :arrow_down: Downloading build directory" && \
buildkite-agent artifact download "build.tar.gz" . --step ":darwin: High Sierra Build" && \
tar -zxf build.tar.gz && \
echo "+++ :microscope: Running unit tests on macOS High Sierra" && \
cd build && \
ctest -V
label: ":darwin: High Sierra Unit Tests"
agents:
role: "macos-tester"
os: "high-sierra"
timeout: 120
# - command: | # High Sierra Unit Tests
# echo "--- :arrow_down: Downloading build directory" && \
# buildkite-agent artifact download "build.tar.gz" . --step ":darwin: High Sierra Build" && \
# tar -zxf build.tar.gz && \
# echo "+++ :microscope: Running unit tests on macOS High Sierra" && \
# cd build && \
# ctest -V
# label: ":darwin: High Sierra Unit Tests"
# agents:
# role: "macos-tester"
# os: "high-sierra"
# timeout: 120

- command: | # Mojave Unit Tests
echo "--- :arrow_down: Downloading build directory" && \
buildkite-agent artifact download "build.tar.gz" . --step ":darwin: Mojave Build" && \
tar -zxf build.tar.gz && \
echo "+++ :microscope: Running unit tests on macOS Mojave" && \
cd build && \
ctest -V
label: ":darwin: Mojave Unit Tests"
agents:
role: "tester"
os: "mojave"
timeout: 120
# - command: | # Mojave Unit Tests
# echo "--- :arrow_down: Downloading build directory" && \
# buildkite-agent artifact download "build.tar.gz" . --step ":darwin: Mojave Build" && \
# tar -zxf build.tar.gz && \
# echo "+++ :microscope: Running unit tests on macOS Mojave" && \
# cd build && \
# ctest -V
# label: ":darwin: Mojave Unit Tests"
# agents:
# role: "tester"
# os: "mojave"
# timeout: 120

- command: | # Ubuntu 18.04 Unit Tests
echo "--- :arrow_down: Downloading build directory" && \
Expand Down Expand Up @@ -293,16 +293,24 @@ steps:
docker-credential-gcr configure-docker && \
echo "--- :hammer_and_wrench: BUILDING BUILD IMAGE" && \
cd docker/dev && \
docker build -t eosio/cdt:latest -t eosio/cdt:$BUILDKITE_COMMIT . && \
[[ "$BUILDKITE_TAG" == "" ]] && docker build -t eosio/cdt:latest -t eosio/cdt:$BUILDKITE_COMMIT -t eosio/cdt:$BUILDKITE_BRANCH -t eosio/cdt:$BUILDKITE_TAG . || docker build -t eosio/cdt:latest -t eosio/cdt:$BUILDKITE_COMMIT -t eosio/cdt:$BUILDKITE_BRANCH . && \
docker tag eosio/cdt:$BUILDKITE_COMMIT gcr.io/b1-automation-dev/eosio/cdt:$BUILDKITE_COMMIT && \
docker tag eosio/cdt:$BUILDKITE_BRANCH gcr.io/b1-automation-dev/eosio/cdt:$BUILDKITE_BRANCH && \
[[ "$BUILDKITE_TAG" == "" ]] && docker tag eosio/cdt:$BUILDKITE_TAG gcr.io/b1-automation-dev/eosio/cdt:$BUILDKITE_TAG || : && \
docker tag eosio/cdt:latest gcr.io/b1-automation-dev/eosio/cdt:latest && \
echo "--- :hand: PUSHING DOCKER IMAGES" && \
docker push gcr.io/b1-automation-dev/eosio/cdt:$BUILDKITE_COMMIT && \
docker push gcr.io/b1-automation-dev/eosio/cdt:$BUILDKITE_BRANCH && \
[[ "$BUILDKITE_TAG" == "" ]] && docker push gcr.io/b1-automation-dev/eosio/cdt:$BUILDKITE_TAG || : && \
docker push gcr.io/b1-automation-dev/eosio/cdt:latest && \
echo "--- :thought_balloon: TRASHING OLD IMAGES" && \
docker rmi eosio/cdt:$BUILDKITE_COMMIT && \
docker rmi eosio/cdt:$BUILDKITE_BRANCH && \
[[ "$BUILDKITE_TAG" == "" ]] && docker rmi eosio/cdt:$BUILDKITE_TAG || : && \
docker rmi eosio/cdt:latest && \
docker rmi gcr.io/b1-automation-dev/eosio/cdt:$BUILDKITE_COMMIT && \
docker rmi gcr.io/b1-automation-dev/eosio/cdt:$BUILDKITE_BRANCH && \
[[ "$BUILDKITE_TAG" == "" ]] && docker rmi gcr.io/b1-automation-dev/eosio/cdt:$BUILDKITE_TAG || : && \
docker rmi gcr.io/b1-automation-dev/eosio/cdt:latest
label: "Docker Build Builder"
agents:
Expand Down
37 changes: 0 additions & 37 deletions docs/guides/basic-usage.md

This file was deleted.

7 changes: 4 additions & 3 deletions docs/guides/cmake.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#### CMakeLists.txt
# CMake

## CMake Configuration
To compile an EOSIO smart contract with CMake you'll need a CMake file. The new `eosio-init` tool can be used to generate the directory structure stub .hpp/.cpp files and subsequent cmake files. Or the template `CMakeLists.txt` in the examples folder is a good boilerplate for manual usage.

For example:
Expand Down Expand Up @@ -31,8 +33,7 @@ public:
EOSIO_DISPATCH( test, (testact) )
```

### CMake Macros
## CMake Macros
- `add_contract` is used to build your smart contract and generate an ABI, the first parameter is the contract name, the second is the cmake target name, and the rest are the CPP files needed to build the contract.
- `target_ricardian_directory` can be used to add the directory where your ricardian contracts live to a specific cmake target.
- (new for native tester) `add_native_library` and `add_native_executable` CMake macros have been added (these are a drop in replacement for add_library and add_executable).

4 changes: 2 additions & 2 deletions libraries/eosiolib/fixed_bytes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace eosio {
template<typename Word, size_t NumWords,
typename Enable = typename std::enable_if<std::is_integral<Word>::value &&
!std::is_same<Word, bool>::value &&
sizeof(Word) < sizeof(word_t)>::type >
std::less<size_t>{}( sizeof(Word), sizeof(word_t))>::type >
fixed_bytes(const std::array<Word, NumWords>& arr)
{
static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(Word)) * sizeof(Word),
Expand All @@ -153,7 +153,7 @@ namespace eosio {
template<typename Word, size_t NumWords,
typename Enable = typename std::enable_if<std::is_integral<Word>::value &&
!std::is_same<Word, bool>::value &&
sizeof(Word) < sizeof(word_t)>::type >
std::less<size_t>{}( sizeof(Word), sizeof(word_t))>::type >
fixed_bytes(const Word(&arr)[NumWords])
{
static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(Word)) * sizeof(Word),
Expand Down
3 changes: 1 addition & 2 deletions libraries/eosiolib/simple_malloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace eosio {
volatile uintptr_t heap_base = 0; // linker places this at address 0
heap = align(*(char**)heap_base, 8);
last_ptr = heap;

next_page = CURRENT_MEMORY;
pp = 1004;
}

char* operator()(size_t sz, uint8_t align_amt=8) {
Expand All @@ -54,7 +54,6 @@ namespace eosio {
char* last_ptr;
size_t offset;
size_t next_page;
size_t pp;
};
dsmalloc _dsmalloc;
} // ns eosio
Expand Down
4 changes: 3 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ add_test(name_tests ${CMAKE_BINARY_DIR}/tests/unit/name_tests)
add_test(rope_tests ${CMAKE_BINARY_DIR}/tests/unit/rope_tests)
add_test(print_tests ${CMAKE_BINARY_DIR}/tests/unit/print_tests)
add_test(system_tests ${CMAKE_BINARY_DIR}/tests/unit/system_tests)
add_test(integration_tests ${CMAKE_BINARY_DIR}/tests/integration/integration_tests)
if (eosio_FOUND)
add_test(integration_tests ${CMAKE_BINARY_DIR}/tests/integration/integration_tests)
endif()
9 changes: 3 additions & 6 deletions tools/abigen/eosio-abigen.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class abigen : public generation_utils {
void add_variant( const clang::QualType& t ) {
abi_variant var;
auto pt = llvm::dyn_cast<clang::ElaboratedType>(t.getTypePtr());
auto tst = llvm::dyn_cast<clang::TemplateSpecializationType>(pt->desugar().getTypePtr());
auto tst = llvm::dyn_cast<clang::TemplateSpecializationType>(pt ? pt->desugar().getTypePtr() : t.getTypePtr());
var.name = get_type(t);
for (int i=0; i < tst->getNumArgs(); ++i)
var.types.push_back(translate_type(get_template_argument( t, i ).getAsType()));
Expand Down Expand Up @@ -291,11 +291,8 @@ class abigen : public generation_utils {
std::string generate_json_comment() {
std::stringstream ss;
ss << "This file was generated with eosio-abigen.";
ss << " DO NOT EDIT ";
auto t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
ss << std::ctime(&t);
auto output = ss.str();
return output.substr(0, output.length()-1); // remove the newline character
ss << " DO NOT EDIT";
return ss.str();
}

ojson struct_to_json( const abi_struct& s ) {
Expand Down
14 changes: 6 additions & 8 deletions tools/include/eosio/gen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,12 @@ struct generation_utils {
std::string ret = tst->getTemplateName().getAsTemplateDecl()->getName().str()+"_";
for (int i=0; i < tst->getNumArgs(); ++i) {
auto arg = get_template_argument(type,i);
if (arg.getAsExpr()) {
auto ce = llvm::dyn_cast<clang::CastExpr>(arg.getAsExpr());
if (ce) {
auto il = llvm::dyn_cast<clang::IntegerLiteral>(ce->getSubExpr());
ret += std::to_string(il->getValue().getLimitedValue());
if ( i < tst->getNumArgs()-1 )
ret += "_";
}
if (auto ce = arg.getKind() == clang::TemplateArgument::ArgKind::Expression
? llvm::dyn_cast<clang::CastExpr>(arg.getAsExpr()) : nullptr) {
auto il = llvm::dyn_cast<clang::IntegerLiteral>(ce->getSubExpr());
ret += std::to_string(il->getValue().getLimitedValue());
if ( i < tst->getNumArgs()-1 )
ret += "_";
}
else {
ret += translate_type(get_template_argument( type, i ).getAsType());
Expand Down
3 changes: 3 additions & 0 deletions tools/init/eosio-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ int main(int argc, const char **argv) {

cl::ParseCommandLineOptions(argc, argv, std::string("eosio-proj"));
try {
if (!std::regex_match(project_name, std::regex("^[_a-zA-Z][_a-zA-Z0-9]*$"))) {
throw std::runtime_error("ERROR: invalid identifier: " + project_name + " (ensure that it is a valid C++ identifier)");
}
llvm::SmallString<128> rp;
std::string path = output_dir;
if (path.empty())
Expand Down

0 comments on commit ebc146b

Please sign in to comment.