diff options
-rw-r--r-- | Changelog.md | 4 | ||||
-rw-r--r-- | cmake/scripts/buildinfo.cmake | 2 | ||||
-rw-r--r-- | cmake/templates/BuildInfo.h.in | 2 | ||||
-rw-r--r-- | docs/conf.py | 2 | ||||
-rw-r--r-- | docs/installing-solidity.rst | 23 | ||||
-rw-r--r-- | libsolidity/ast/AST.cpp | 2 | ||||
-rw-r--r-- | libsolidity/ast/AST.h | 4 | ||||
-rw-r--r-- | libsolidity/ast/ASTJsonConverter.cpp | 4 | ||||
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 2 | ||||
-rw-r--r-- | libsolidity/interface/Version.cpp | 4 | ||||
-rw-r--r-- | libsolidity/interface/Version.h | 1 |
11 files changed, 46 insertions, 4 deletions
diff --git a/Changelog.md b/Changelog.md index 2c5c37fd..1d3c47c1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ ### 0.4.9 (unreleased) +Features: + * AST: Use deterministic node identifiers. + * Metadata: Do not include platform in the version number. + ### 0.4.8 (2017-01-13) Features: diff --git a/cmake/scripts/buildinfo.cmake b/cmake/scripts/buildinfo.cmake index 8e1615f6..efbfb8fb 100644 --- a/cmake/scripts/buildinfo.cmake +++ b/cmake/scripts/buildinfo.cmake @@ -60,6 +60,8 @@ if (SOL_COMMIT_HASH AND SOL_LOCAL_CHANGES) set(SOL_COMMIT_HASH "${SOL_COMMIT_HASH}.mod") endif() +set(SOL_VERSION_COMMIT "commit.${SOL_COMMIT_HASH}") +set(SOl_VERSION_PLATFORM ETH_BUILD_PLATFORM) set(SOL_VERSION_BUILDINFO "commit.${SOL_COMMIT_HASH}.${ETH_BUILD_PLATFORM}") set(TMPFILE "${ETH_DST_DIR}/BuildInfo.h.tmp") diff --git a/cmake/templates/BuildInfo.h.in b/cmake/templates/BuildInfo.h.in index 6c16e4ac..4b35df98 100644 --- a/cmake/templates/BuildInfo.h.in +++ b/cmake/templates/BuildInfo.h.in @@ -8,3 +8,5 @@ #define ETH_BUILD_PLATFORM "@ETH_BUILD_PLATFORM@" #define SOL_VERSION_PRERELEASE "@SOL_VERSION_PRERELEASE@" #define SOL_VERSION_BUILDINFO "@SOL_VERSION_BUILDINFO@" +#define SOL_VERSION_COMMIT "@SOL_VERSION_COMMIT@" +#define SOL_VERSION_PLATFORM "@SOL_VERSION_PLATFORM@" diff --git a/docs/conf.py b/docs/conf.py index 85fc3677..e97eff3a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -49,7 +49,7 @@ master_doc = 'index' # General information about the project. project = 'Solidity' -copyright = '2016, Ethereum' +copyright = '2016-2017, Ethereum' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst index ef38705c..345780d7 100644 --- a/docs/installing-solidity.rst +++ b/docs/installing-solidity.rst @@ -119,6 +119,11 @@ you should fork Solidity and add your personal fork as a second remote: cd solidity git remote add personal git@github.com:[username]/solidity.git +Solidity has git submodules. Ensure they are properly loaded: + +.. code:: bash + + git submodule update --init --recursive Prerequisites - macOS --------------------- @@ -211,6 +216,24 @@ Alternatively, you can build for Windows on the command-line, like so: cmake --build . --config RelWithDebInfo +The version string in detail +============================ + +The Solidity version string contains four parts: +- the version number +- pre-release tag, usually set to ``develop.YYYY.MM.DD`` or ``nightly.YYYY.MM.DD`` +- commit in the format of ``commit.GITHASH`` +- platform has arbitrary number of items, containing details about the platform and compiler + +If there are local modifications, the commit will be postfixed with ``.mod``. + +These parts are combined as required by Semver, where the Solidity pre-release tag equals to the Semver pre-release +and the Solidity commit and platform combined make up the Semver build metadata. + +A relase example: ``0.4.8+commit.60cc1668.Emscripten.clang``. + +A pre-release example: ``0.4.9-nightly.2017.1.17+commit.6ecb4aa3.Emscripten.clang`` + Important information about versioning ====================================== diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index dd582e54..fcd6e38c 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -37,6 +37,8 @@ using namespace dev::solidity; ASTNode::ASTNode(SourceLocation const& _location): m_location(_location) { + static size_t id = 0; + m_id = ++id; } ASTNode::~ASTNode() diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index f72b272c..d11a246c 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -57,6 +57,9 @@ public: explicit ASTNode(SourceLocation const& _location); virtual ~ASTNode(); + /// @returns an identifier of this AST node that is unique for a single compilation run. + size_t id() const { return m_id; } + virtual void accept(ASTVisitor& _visitor) = 0; virtual void accept(ASTConstVisitor& _visitor) const = 0; template <class T> @@ -94,6 +97,7 @@ public: ///@} protected: + size_t m_id = 0; /// Annotation - is specialised in derived classes, is created upon request (because of polymorphism). mutable ASTAnnotation* m_annotation = nullptr; diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index abaad0fd..de8fde92 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -42,7 +42,7 @@ void ASTJsonConverter::addJsonNode( { Json::Value node; - node["id"] = reinterpret_cast<Json::UInt64>(&_node); + node["id"] = _node.id(); node["src"] = sourceLocationToString(_node.location()); node["name"] = _nodeName; if (_attributes.size() != 0) @@ -124,7 +124,7 @@ bool ASTJsonConverter::visit(ContractDefinition const& _node) { Json::Value linearizedBaseContracts(Json::arrayValue); for (auto const& baseContract: _node.annotation().linearizedBaseContracts) - linearizedBaseContracts.append(reinterpret_cast<Json::UInt64>(baseContract)); + linearizedBaseContracts.append(baseContract->id()); addJsonNode(_node, "ContractDefinition", { make_pair("name", _node.name()), make_pair("isLibrary", _node.isLibrary()), diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 262b91ff..61fc7728 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -713,7 +713,7 @@ string CompilerStack::createOnChainMetadata(Contract const& _contract) const Json::Value meta; meta["version"] = 1; meta["language"] = "Solidity"; - meta["compiler"]["version"] = VersionString; + meta["compiler"]["version"] = VersionStringStrict; meta["sources"] = Json::objectValue; for (auto const& s: m_sources) diff --git a/libsolidity/interface/Version.cpp b/libsolidity/interface/Version.cpp index ff66f039..0d23f9c3 100644 --- a/libsolidity/interface/Version.cpp +++ b/libsolidity/interface/Version.cpp @@ -38,6 +38,10 @@ string const dev::solidity::VersionString = (string(SOL_VERSION_PRERELEASE).empty() ? "" : "-" + string(SOL_VERSION_PRERELEASE)) + (string(SOL_VERSION_BUILDINFO).empty() ? "" : "+" + string(SOL_VERSION_BUILDINFO)); +string const dev::solidity::VersionStringStrict = + string(dev::solidity::VersionNumber) + + (string(SOL_VERSION_PRERELEASE).empty() ? "" : "-" + string(SOL_VERSION_PRERELEASE)) + + (string(SOL_VERSION_COMMIT).empty() ? "" : "+" + string(SOL_VERSION_COMMIT)); bytes dev::solidity::binaryVersion() { diff --git a/libsolidity/interface/Version.h b/libsolidity/interface/Version.h index 5b07b3f4..24c3555d 100644 --- a/libsolidity/interface/Version.h +++ b/libsolidity/interface/Version.h @@ -32,6 +32,7 @@ namespace solidity extern char const* VersionNumber; extern std::string const VersionString; +extern std::string const VersionStringStrict; /// @returns a binary form of the version string, where A.B.C-HASH is encoded such that /// the first byte is zero, the following three bytes encode A B and C (interpreted as decimals) |