refactor(leanpkg/config_vars): replace with core lib

This commit is contained in:
Sebastian Ullrich 2018-01-10 16:41:36 +01:00 committed by Leonardo de Moura
parent 5c6d15c43d
commit 3a1ede2d73
5 changed files with 9 additions and 30 deletions

View file

@ -1,20 +0,0 @@
/-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Gabriel Ebner
-/
-- This `config_vars.lean` file is automatically generated by cmake from `config_vars.lean.in`.
namespace leanpkg
namespace lean_version
def major : := @LEAN_VERSION_MAJOR@
def minor : := @LEAN_VERSION_MINOR@
def patch : := @LEAN_VERSION_PATCH@
def is_release : bool := @LEAN_VERSION_IS_RELEASE@ ≠ 0
end lean_version
end leanpkg

View file

@ -9,7 +9,7 @@ variable [io.interface]
namespace leanpkg
def upstream_git_branch :=
if lean_version.is_release then
if lean.is_release then
"lean-" ++ lean_version_string_core
else
"master"

View file

@ -3,25 +3,22 @@ Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Gabriel Ebner
-/
import leanpkg.config_vars
namespace leanpkg
open lean_version
def lean_version_string_core :=
major.repr ++ "." ++ minor.repr ++ "." ++ patch.repr
let (major, minor, patch) := lean.version in
sformat!("{major}.{minor}.{patch}")
def lean_version_string :=
if is_release then
if lean.is_release then
lean_version_string_core
else
"master"
def ui_lean_version_string :=
if is_release then
if lean.is_release then
lean_version_string_core
else
"master (" ++ lean_version_string_core ++ ")"
end leanpkg
end leanpkg

View file

@ -6,3 +6,6 @@ def lean.version : nat × nat × nat :=
def lean.githash : string :=
"@GIT_SHA1@"
def lean.is_release : bool :=
@LEAN_VERSION_IS_RELEASE@ ≠ 0

View file

@ -462,7 +462,6 @@ add_custom_target(
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../library"
)
configure_file("${LEAN_SOURCE_DIR}/../leanpkg/leanpkg/config_vars.lean.in" "${LEAN_SOURCE_DIR}/../leanpkg/leanpkg/config_vars.lean")
add_custom_target(
leanpkg ALL
COMMAND "${LEAN_SOURCE_DIR}/../bin/lean" --make ${LEAN_EXTRA_MAKE_OPTS}