Skip to content

Commit

Permalink
refactor versioning (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand authored Feb 4, 2022
1 parent a5adeb1 commit 95dcc5e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/conan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: conan

on:
push:
branches:
- master
tags:
- v*

Expand All @@ -29,5 +27,7 @@ jobs:
- name: checkout
uses: actions/checkout@v2

- run: conan create conanfile.py -s compiler.libcxx=libstdc++11 --build missing
- run: echo "VERSION=${GITHUB_REF_NAME:1}" >> $GITHUB_ENV

- run: conan create conanfile.py odrcore/${VERSION}@ -s compiler.libcxx=libstdc++11 --build missing
- run: conan upload odrcore -r odr-conan-repo -c
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
cmake_minimum_required(VERSION 3.12.4)

file(READ "VERSION" VERSION)

project(odr
VERSION ${VERSION}
LANGUAGES C CXX
)
set(CMAKE_CXX_STANDARD 17)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Replaces legacy projects [OpenDocument.java](https://github.com/andiwand/OpenDoc
Potential test files: https://file-examples.com/

## [Documentation](docs/README.md)

## Version

Versions and history are tracked on [GitHub](https://github.com/opendocument-app/OpenDocument.core).
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

10 changes: 3 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from conans import ConanFile, CMake, tools
import os
from conans import ConanFile, CMake


class OpenDocumentCoreConan(ConanFile):
Expand All @@ -20,7 +19,7 @@ class OpenDocumentCoreConan(ConanFile):
"fPIC": True,
}

exports_sources = ["cli/*", "cmake/*", "include/*", "src/*", "CMakeLists.txt", "VERSION"]
exports_sources = ["cli/*", "cmake/*", "include/*", "src/*", "CMakeLists.txt"]

requires = ["pugixml/1.11", "cryptopp/8.5.0", "miniz/2.1.0", "nlohmann_json/3.10.4",
"vincentlaucsb-csv-parser/2.1.3", "uchardet/0.0.7"]
Expand All @@ -29,14 +28,11 @@ class OpenDocumentCoreConan(ConanFile):

_cmake = None

def set_version(self):
# TODO capture commit and dirty state
self.version = tools.load(os.path.join(self.recipe_folder, "VERSION"))

def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["CMAKE_PROJECT_VERSION"] = self.version
self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared
self._cmake.definitions["ODR_TEST"] = False
self._cmake.configure()
Expand Down
2 changes: 1 addition & 1 deletion test/src/open_document_reader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace odr::internal;
using namespace odr::test;

TEST(OpenDocumentReader, version) {
EXPECT_FALSE(OpenDocumentReader::version().empty());
EXPECT_TRUE(OpenDocumentReader::version().empty());
}

TEST(OpenDocumentReader, commit) {
Expand Down

0 comments on commit 95dcc5e

Please sign in to comment.