From 7ce7d3e74c7e2de4514e4763bc88323dad214235 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 15 Dec 2016 14:03:31 +0100 Subject: [PATCH 01/20] Update develop version. --- CMakeLists.txt | 2 +- Changelog.md | 2 ++ docs/conf.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee66eebd4..ecd857adf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.4.7") +set(PROJECT_VERSION "0.4.8") project(solidity VERSION ${PROJECT_VERSION}) # Let's find our dependencies diff --git a/Changelog.md b/Changelog.md index 096c72d48..9faf0f8e5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,5 @@ +### 0.4.8 (unreleased) + ### 0.4.7 (2016-12-15) Features: diff --git a/docs/conf.py b/docs/conf.py index 2bc79fd9f..ecabbb861 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -56,9 +56,9 @@ copyright = '2016, Ethereum' # built documents. # # The short X.Y version. -version = '0.4.7' +version = '0.4.8' # The full version, including alpha/beta/rc tags. -release = '0.4.7-develop' +release = '0.4.8-develop' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 31564d94b1f565f8ab9b6d7b7e673febace12643 Mon Sep 17 00:00:00 2001 From: Michael Coblenz Date: Mon, 19 Dec 2016 15:08:18 -0500 Subject: [PATCH 02/20] Fixed misleading typo "now possible" should instead read "not possible." --- docs/control-structures.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 0802c0851..f59be2fea 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -208,7 +208,7 @@ Creating Contracts via ``new`` A contract can create a new contract using the ``new`` keyword. The full code of the contract being created has to be known and, thus, recursive -creation-dependencies are now possible. +creation-dependencies are not possible. :: From 4b3f147e65a16a19410c379698cba08318d118ef Mon Sep 17 00:00:00 2001 From: Michael Coblenz Date: Tue, 20 Dec 2016 13:48:01 -0500 Subject: [PATCH 03/20] Clarified support for recursive creation. --- docs/control-structures.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/control-structures.rst b/docs/control-structures.rst index f59be2fea..b57c12f86 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -207,8 +207,8 @@ Creating Contracts via ``new`` ============================== A contract can create a new contract using the ``new`` keyword. The full -code of the contract being created has to be known and, thus, recursive -creation-dependencies are not possible. +code of the contract being created has to be known; though recursive +creation-dependencies are possible, cyclic dependencies are not. :: From 5148de3ed714d99c93676174131cbcfd29c25753 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Wed, 21 Dec 2016 19:27:31 -0300 Subject: [PATCH 04/20] Fix mapping syntax in docs --- docs/types.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/types.rst b/docs/types.rst index 069a91905..6b67e6840 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -765,7 +765,7 @@ assigning it to a local variable, as in Mappings ======== -Mapping types are declared as ``mapping _KeyType => _ValueType``. +Mapping types are declared as ``mapping(_KeyType => _ValueType)``. Here ``_KeyType`` can be almost any type except for a mapping, a dynamically sized array, a contract, an enum and a struct. ``_ValueType`` can actually be any type, including mappings. From c163a219de96c2ad3f5b8f5e9a473924df742f46 Mon Sep 17 00:00:00 2001 From: Michael Coblenz Date: Thu, 22 Dec 2016 10:35:58 -0500 Subject: [PATCH 05/20] Corrected explanation per discussion. --- docs/control-structures.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/control-structures.rst b/docs/control-structures.rst index b57c12f86..6c0b0f279 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -207,8 +207,8 @@ Creating Contracts via ``new`` ============================== A contract can create a new contract using the ``new`` keyword. The full -code of the contract being created has to be known; though recursive -creation-dependencies are possible, cyclic dependencies are not. +code of the contract being created has to be known in advance, so recursive +creation-dependencies are not possible. :: From 2a7b01982c2b49399b9ee0dd89c7827af28c6280 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Sat, 24 Dec 2016 13:00:11 -0300 Subject: [PATCH 06/20] Fix StorageLocation position for ArrayTypeName rule in grammar --- docs/grammar.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index d15fbaf7c..7bb45bba9 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -38,7 +38,7 @@ TypeNameList = '(' ( TypeName (',' TypeName )* )? ')' VariableDeclaration = TypeName Identifier TypeName = ElementaryTypeName | Identifier StorageLocation? | Mapping | ArrayTypeName | FunctionTypeName Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')' -ArrayTypeName = TypeName StorageLocation? '[' Expression? ']' +ArrayTypeName = TypeName '[' Expression? ']' StorageLocation? FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )* ( 'returns' TypeNameList )? StorageLocation = 'memory' | 'storage' From 507525be5f3fec5860d226010beea6550373fd0b Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Sat, 24 Dec 2016 13:10:51 -0300 Subject: [PATCH 07/20] Fix NumberLiteral rule for hex numbers --- docs/grammar.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index 7bb45bba9..5fac96a1c 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -90,13 +90,16 @@ MemberAccess = Expression '.' Identifier IndexAccess = Expression '[' Expression? ']' BooleanLiteral = 'true' | 'false' -NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)? +NumberLiteral = ( HexNumber | DecimalNumber ) (' ' NumberUnit)? NumberUnit = 'wei' | 'szabo' | 'finney' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' HexLiteral = 'hex' ('"' ([0-9a-fA-F]{2})* '"' | '\'' ([0-9a-fA-F]{2})* '\'') StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"' Identifier = [a-zA-Z_] [a-zA-Z_0-9]* +HexNumber = '0x' [0-9a-fA-F]+ +DecimalNumber = [0-9]+ + ElementaryTypeName = 'address' | 'bool' | 'string' | 'var' | Int | Uint | Byte | Fixed | Ufixed From 890a8818b5455eb067b5ee2ed6c9d32623c0c94c Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Mon, 26 Dec 2016 22:57:00 -0300 Subject: [PATCH 08/20] Add unimplemented functions to grammar --- docs/grammar.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index 5fac96a1c..c9f7f4482 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -23,7 +23,7 @@ StructDefinition = 'struct' Identifier '{' ModifierDefinition = 'modifier' Identifier ParameterList? Block FunctionDefinition = 'function' Identifier? ParameterList ( FunctionCall | Identifier | 'constant' | 'payable' | 'external' | 'public' | 'internal' | 'private' )* - ( 'returns' ParameterList )? Block + ( 'returns' ParameterList )? ( ';' | Block ) EventDefinition = 'event' Identifier IndexedParameterList 'anonymous'? ';' EnumValue = Identifier From 28550ac9ff52237ac2c9cf1919dd3adac017eca0 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Tue, 27 Dec 2016 23:08:57 -0300 Subject: [PATCH 09/20] Add UserDefinedTypeName to grammar.txt --- docs/grammar.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index c9f7f4482..f18ef2f3a 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -14,7 +14,7 @@ ContractDefinition = ( 'contract' | 'library' ) Identifier ContractPart = StateVariableDeclaration | UsingForDeclaration | StructDefinition | ModifierDefinition | FunctionDefinition | EventDefinition | EnumDefinition -InheritanceSpecifier = Identifier ( '(' Expression ( ',' Expression )* ')' )? +InheritanceSpecifier = UserDefinedTypeName ( '(' Expression ( ',' Expression )* ')' )? StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' )? Identifier ('=' Expression)? ';' UsingForDeclaration = 'using' Identifier 'for' ('*' | TypeName) ';' @@ -36,7 +36,15 @@ TypeNameList = '(' ( TypeName (',' TypeName )* )? ')' // semantic restriction: mappings and structs (recursively) containing mappings // are not allowed in argument lists VariableDeclaration = TypeName Identifier -TypeName = ElementaryTypeName | Identifier StorageLocation? | Mapping | ArrayTypeName | FunctionTypeName + +TypeName = ElementaryTypeName + | UserDefinedTypeName StorageLocation? + | Mapping + | ArrayTypeName + | FunctionTypeName + +UserDefinedTypeName = Identifier ( '.' Identifier )* + Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')' ArrayTypeName = TypeName '[' Expression? ']' StorageLocation? FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )* From 1f80dbb39a69eb3be94111d190aa8511990fa951 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Wed, 28 Dec 2016 12:53:40 -0300 Subject: [PATCH 10/20] Add missing right-hand side expression for shifts --- docs/grammar.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index c9f7f4482..5965d1f6c 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -69,7 +69,7 @@ Expression = | Expression '**' Expression | Expression ('*' | '/' | '%') Expression | Expression ('+' | '-') Expression - | Expression ('<<' | '>>') + | Expression ('<<' | '>>') Expression | Expression '&' Expression | Expression '^' Expression | Expression '|' Expression From 6955b8f7b9040c66edb0666b1e4c36f1ba997ed5 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Wed, 28 Dec 2016 17:32:10 -0300 Subject: [PATCH 11/20] Remove wrong syntax highlighting in docs --- docs/miscellaneous.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst index 4a9dad873..378c3c969 100644 --- a/docs/miscellaneous.rst +++ b/docs/miscellaneous.rst @@ -570,3 +570,4 @@ Language Grammar ================ .. literalinclude:: grammar.txt + :language: none From 2d60990238898620739281827692c3adc247a9cc Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Fri, 30 Dec 2016 13:52:08 +0100 Subject: [PATCH 12/20] libevmasm: OpPop() optimization keeps the source location fixes #1521 --- libevmasm/PeepholeOptimiser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp index b96b02950..923ffa67d 100644 --- a/libevmasm/PeepholeOptimiser.cpp +++ b/libevmasm/PeepholeOptimiser.cpp @@ -120,7 +120,7 @@ struct OpPop: SimplePeepholeOptimizerMethod if (instructionInfo(instr).ret == 1 && !instructionInfo(instr).sideEffects) { for (int j = 0; j < instructionInfo(instr).args; j++) - *_out = Instruction::POP; + *_out = {Instruction::POP, _op.location()}; return true; } } From 04af994bf5cc5f286e68c7164e41a4bb7a27dfec Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Tue, 27 Dec 2016 15:29:25 -0300 Subject: [PATCH 13/20] Add parsers and grammars to documentation --- docs/index.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 9bee15154..cb79687b9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -87,6 +87,15 @@ Solidity Tools * `evmdis `_ EVM Disassembler that performs static analysis on the bytecode to provide a higher level of abstraction than raw EVM operations. +Third-Party Solidity Parsers and Grammars +----------------------------------------- + +* `solidity-parser `_ + Solidity parser for JavaScript + +* `Solidity Grammar for ANTLR 4 `_ + Solidity grammar for the ANTLR 4 parser generator + Language Documentation ---------------------- From 82b9797428ce3bed3e7c8864ae183bd0432bd644 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Tue, 27 Dec 2016 16:10:09 -0300 Subject: [PATCH 14/20] Add ElementaryTypeNameExpression to grammar.txt --- docs/grammar.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index c9f7f4482..1dbd620a1 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -82,7 +82,12 @@ Expression = | Expression? (',' Expression) | PrimaryExpression -PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | HexLiteral | StringLiteral +PrimaryExpression = Identifier + | BooleanLiteral + | NumberLiteral + | HexLiteral + | StringLiteral + | ElementaryTypeNameExpression FunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( ( '.' Identifier ) | ( '[' Expression ']' ) )* '(' Expression? ( ',' Expression )* ')' NewExpression = 'new' Identifier @@ -100,6 +105,8 @@ Identifier = [a-zA-Z_] [a-zA-Z_0-9]* HexNumber = '0x' [0-9a-fA-F]+ DecimalNumber = [0-9]+ +ElementaryTypeNameExpression = ElementaryTypeName + ElementaryTypeName = 'address' | 'bool' | 'string' | 'var' | Int | Uint | Byte | Fixed | Ufixed From c014448397e4810fe28461d8dc5d54ba1cd376a4 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Mon, 2 Jan 2017 16:55:29 +0100 Subject: [PATCH 15/20] doc: rephrase the case when two remapping keys are applicable Fixes #1536 --- docs/layout-of-source-files.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst index 17ac8c6f4..dff48be31 100644 --- a/docs/layout-of-source-files.rst +++ b/docs/layout-of-source-files.rst @@ -96,8 +96,8 @@ Use in Actual Compilers When the compiler is invoked, it is not only possible to specify how to discover the first element of a path, but it is possible to specify path prefix remappings so that e.g. ``github.com/ethereum/dapp-bin/library`` is remapped to -``/usr/local/dapp-bin/library`` and the compiler will read the files from there. If -remapping keys are prefixes of each other, the longest is tried first. This +``/usr/local/dapp-bin/library`` and the compiler will read the files from there. +If multiple remappings can be applied, the one with the longest key is tried first. This allows for a "fallback-remapping" with e.g. ``""`` maps to ``"/usr/local/include/solidity"``. Furthermore, these remappings can depend on the context, which allows you to configure packages to From 96ca706353f94b60c7e356f11aa7466a15eca33d Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Fri, 2 Dec 2016 12:03:39 +0100 Subject: [PATCH 16/20] test: add a test case for #1286 --- test/libsolidity/SolidityEndToEndTest.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 94d4fb7f6..d85395240 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2770,6 +2770,28 @@ BOOST_AUTO_TEST_CASE(event_no_arguments) BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit()"))); } +BOOST_AUTO_TEST_CASE(event_access_through_base_name) +{ + char const* sourceCode = R"( + contract A { + event x(); + } + contract B is A { + function f() returns (uint) { + A.x(); + return 1; + } + } + )"; + compileAndRun(sourceCode); + callContractFunction("f()"); + BOOST_REQUIRE_EQUAL(m_logs.size(), 1); + BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); + BOOST_CHECK(m_logs[0].data.empty()); + BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1); + BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("x()"))); +} + BOOST_AUTO_TEST_CASE(event_anonymous) { char const* sourceCode = R"( From 6a312233fcbaf9b7ec7b7088719a3be724ea228b Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Wed, 26 Oct 2016 13:08:00 +0200 Subject: [PATCH 17/20] ast, codegen: enable accessing events through contract names. Fixes #1286 --- Changelog.md | 3 ++ libsolidity/ast/AST.cpp | 3 ++ libsolidity/codegen/ExpressionCompiler.cpp | 42 +++++++++++++++++----- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9faf0f8e5..a82e8744d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ ### 0.4.8 (unreleased) +BugFixes: + * Type checker, code generator: enable access to events of base contracts' names. + ### 0.4.7 (2016-12-15) Features: diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 3cd1dfbea..78d8949ca 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -217,6 +217,9 @@ vector const& ContractDefinition::inheritableMembers() const for (EnumDefinition const* e: definedEnums()) addInheritableMember(e); + + for (EventDefinition const* e: events()) + addInheritableMember(e); } return *m_inheritableMembers; } diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index a7fb8408c..3922da881 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -908,19 +908,43 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) solAssert(_memberAccess.annotation().type, "_memberAccess has no type"); if (auto funType = dynamic_cast(_memberAccess.annotation().type.get())) { - if (funType->location() != FunctionType::Location::Internal) - { - _memberAccess.expression().accept(*this); - m_context << funType->externalIdentifier(); - } - else + switch (funType->location()) { + case FunctionType::Location::Internal: // We do not visit the expression here on purpose, because in the case of an // internal library function call, this would push the library address forcing // us to link against it although we actually do not need it. - auto const* function = dynamic_cast(_memberAccess.annotation().referencedDeclaration); - solAssert(!!function, "Function not found in member access"); - utils().pushCombinedFunctionEntryLabel(*function); + if (auto const* function = dynamic_cast(_memberAccess.annotation().referencedDeclaration)) + utils().pushCombinedFunctionEntryLabel(*function); + else + solAssert(false, "Function not found in member access"); + break; + case FunctionType::Location::Event: + if (!dynamic_cast(_memberAccess.annotation().referencedDeclaration)) + solAssert(false, "event not found"); + // no-op, because the parent node will do the job + break; + case FunctionType::Location::External: + case FunctionType::Location::Creation: + case FunctionType::Location::DelegateCall: + case FunctionType::Location::CallCode: + case FunctionType::Location::Send: + case FunctionType::Location::Bare: + case FunctionType::Location::BareCallCode: + case FunctionType::Location::BareDelegateCall: + _memberAccess.expression().accept(*this); + m_context << funType->externalIdentifier(); + break; + case FunctionType::Location::Log0: + case FunctionType::Location::Log1: + case FunctionType::Location::Log2: + case FunctionType::Location::Log3: + case FunctionType::Location::Log4: + case FunctionType::Location::ECRecover: + case FunctionType::Location::SHA256: + case FunctionType::Location::RIPEMD160: + default: + solAssert(false, "unsupported member function"); } } else if (dynamic_cast(_memberAccess.annotation().type.get())) From 941b5fd928899f3d1b3f2cd14c008deb6825d807 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 3 Jan 2017 13:58:54 +0100 Subject: [PATCH 18/20] Require stable nodejs for deployment. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2160d1758..820125cfa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,6 +71,7 @@ matrix: dist: trusty sudo: required compiler: gcc + node_js: stable services: - docker before_install: From e45510d02ff0c543038802359d4920b3e500d517 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 4 Jan 2017 13:21:41 +0100 Subject: [PATCH 19/20] Create source tarballs for releases. --- .travis.yml | 51 ++++++++++---------------------- scripts/create_source_tarball.sh | 35 ++++++++++++++++++++++ 2 files changed, 50 insertions(+), 36 deletions(-) create mode 100755 scripts/create_source_tarball.sh diff --git a/.travis.yml b/.travis.yml index 820125cfa..a50674c1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,11 +26,13 @@ language: cpp branches: - # We need to whitelist the branches which we want to have "push" automation. + # We need to whitelist the branches which we want to have "push" automation, + # this includes tags (which are treated as branches by travis). # Pull request automation is not constrained to this set of branches. only: - develop - release + - /^v[0-9]/ matrix: include: # Ubuntu 14.04 LTS "Trusty Tahr" @@ -142,7 +144,6 @@ cache: install: - test $TRAVIS_INSTALL_DEPS != On || ./scripts/install_deps.sh - echo -n "$TRAVIS_COMMIT" > commit_hash.txt - - test "$TRAVIS_PULL_REQUESTS" != "false" || test "$TRAVIS_BRANCH" != release || echo -n > prerelease.txt # this is a proper release before_script: - test $TRAVIS_EMSCRIPTEN != On || ./scripts/build_emscripten.sh - test $TRAVIS_RELEASE != On || (mkdir -p build @@ -150,7 +151,8 @@ before_script: && cmake .. -DCMAKE_BUILD_TYPE=$TRAVIS_BUILD_TYPE && make -j2 && cd .. - && ./scripts/release.sh $ZIP_SUFFIX ) + && ./scripts/release.sh $ZIP_SUFFIX + && ./scripts/create_source_tarball.sh ) script: - test $TRAVIS_DOCS != On || ./scripts/docs.sh @@ -191,43 +193,20 @@ deploy: - release # This is the deploy target for the native build (Linux and macOS) - # which generates ZIPs per commit. We are in agreement that - # generating ZIPs per commit for the develop branch is probably - # just noise, so we only run this deployment target on 'release'. - # - # Unlike the Appveyor GitHub Releases target, the support in TravisCI - # seemingly doesn't provide a means for passing a description, tag, etc. - # In practice, we are letting the Appveyor CI do all that stuff, and - # then this deployment flow just seems to find that most recent tag, - # and just add our Linux and macOS ZIPs into the same tag, which is - # what we want to happen. But is very accidental and brittle-looking. - # - # The 'skip_cleanup' stops the workspace being cleaned out prior to - # generation of the artifacts. Strange that we should explicitly - # need to do that, but we do. - # - # Tokens in TravisCI can be generated a few different ways. Bob had - # success using the 'travis' gem, and then using that gem to - # create/edit this .travis.yml file, and then cut-and-pasting the - # good bits back out of what it generated. The gem changes all the - # whitespace and deletes comments, so cannot be used as-is. But - # it does generate an appropriate auth token. - # - # TODO - I do not know if the api_key below which work correctly - # for ethereum/solidity. I suspect not, for the same reason as - # my auth token does not work for Appveyor. I don't have enough - # permissions to enable this myself. Christian should be able to. - # - # See https://docs.travis-ci.com/user/deployment/releases - # See https://blog.travis-ci.com/2013-01-28-token-token-token/ - # See https://github.com/ethereum/webthree-umbrella/issues/658 + # which generates ZIPs per commit and the source tarball. # + # This runs for each tag that is created and adds the corresponding files. - provider: releases api_key: secure: PWH37xVBCF0XiSjl+eH7XIdkrfxZXjzvqF4PiBOnD3VnFz+odrdnIwBmCeBYTHTWF8efpp8fmzWJk2UVq1JcpyZiC+SVxO8dx91W2ia1a+wKrEQuDgkUrZBkl5IQNCv0QS81DDQhliyZEaYh8wHO/7RReyMpGpw2U2u85WkFiZ+LdlHEZPfzUeh9lxQ9n8qwFL8Rja+Q05d4cQ8zaVEtofJJT4T6DUWhc3TzuxDYxOmjwg37rC9CkGSLn6VadSh8b3j5R0SZupFsAEvBL/imBLP9r9ewoo7o4p6By3jwiIgH9yNg7LM618xbffcNaYF/KtLBi9uPHfqF7hRD4PlECz+D0PR78nQItOX5HKm1QMg5kCnghRVCA0IVjpV5fiYQnMLM7dCRv34I5b3zLpa69wQ/GLYB2FViqNUfvPeiZTEeIJ2OmATlFx8AH2JoqpY1XJknWb35+vMfa8LSiJJW++SLWeV+ncC92hrvyZ1cy3trepRRZIfyYepxHifnfdWMkddQUJk5b2WS5Fy/TJLZNPeombnpvRhUC38dsYItarKeXTc6k4oADCEDZ2rgGIcEiqRxXV11Y5xHJekLDWzUs+YJNcCuL4pnAP//LOnbnH2w9rLpwhQYSl0anCd097NivAXQJXO2JI/byIYz1kiCVQWnW6EM8+72mLOklf/Qr8k= - file: $TRAVIS_BUILD_DIR/solidity-$ZIP_SUFFIX.zip + + overwrite: true + file_glob: true + file: + - $TRAVIS_BUILD_DIR/solidity*.zip + - $TRAVIS_BUILD_DIR/solidity*tar.gz skip_cleanup: true on: - repo: ethereum/solidity - branch: release + all_branches: true + tags: true condition: $TRAVIS_RELEASE == On diff --git a/scripts/create_source_tarball.sh b/scripts/create_source_tarball.sh new file mode 100755 index 000000000..350f6b4d2 --- /dev/null +++ b/scripts/create_source_tarball.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env sh +# + +set -e + +REPO_ROOT="$(dirname "$0")"/.. +( + cd "$REPO_ROOT" + version=`grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")"? CMakeLists.txt` + commithash=`git rev-parse --short=8 HEAD` + committimestamp=`git show --format=%ci HEAD | head -n 1` + commitdate=`git show --format=%ci HEAD | head -n 1 | cut - -b1-10 | sed -e 's/-0?/./' | sed -e 's/-0?/./'` + + # file exists and has zero size -> not a prerelease + if [ -e prerelease.txt -a ! -s prerelease.txt ] + then + versionstring="$version" + else + versionstring="$version-develop-$commitdate-$commithash" + fi + + TEMPDIR=$(mktemp -d) + SOLDIR="$TEMPDIR/solidity_$versionstring/" + mkdir "$SOLDIR" + # Store the current source + git checkout-index -a --prefix="$SOLDIR" + git submodule foreach 'git checkout-index -a --prefix="'"$SOLDIR"'/$path/"' + # Store the commit hash + echo "$commithash" > "$SOLDIR/commit_hash.txt" + # Add dependencies + mkdir -p "$SOLDIR/deps/downloads/" 2>/dev/null || true + wget -O "$SOLDIR/deps/downloads/jsoncpp-1.7.7.tar.gz" https://github.com/open-source-parsers/jsoncpp/archive/1.7.7.tar.gz + tar czf "$REPO_ROOT/solidity_$versionstring.tar.gz" -C "$TEMPDIR" "solidity_$versionstring" + rm -r "$TEMPDIR" +) From 1cecaab9b68ce627185dca3efe793f4af949ad2b Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 9 Jan 2017 12:14:01 +0100 Subject: [PATCH 20/20] Replace `` by $(). --- scripts/create_source_tarball.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/create_source_tarball.sh b/scripts/create_source_tarball.sh index 350f6b4d2..1f78e12c3 100755 --- a/scripts/create_source_tarball.sh +++ b/scripts/create_source_tarball.sh @@ -6,10 +6,9 @@ set -e REPO_ROOT="$(dirname "$0")"/.. ( cd "$REPO_ROOT" - version=`grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")"? CMakeLists.txt` - commithash=`git rev-parse --short=8 HEAD` - committimestamp=`git show --format=%ci HEAD | head -n 1` - commitdate=`git show --format=%ci HEAD | head -n 1 | cut - -b1-10 | sed -e 's/-0?/./' | sed -e 's/-0?/./'` + version=$(grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")"? CMakeLists.txt) + commithash=$(git rev-parse --short=8 HEAD) + commitdate=$(git show --format=%ci HEAD | head -n 1 | cut - -b1-10 | sed -e 's/-0?/./' | sed -e 's/-0?/./') # file exists and has zero size -> not a prerelease if [ -e prerelease.txt -a ! -s prerelease.txt ]