[llvm] 4b6d9ac - Make lld cmake not compute commit revision twice

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 06:56:09 PST 2020


Author: Nico Weber
Date: 2020-01-16T09:55:36-05:00
New Revision: 4b6d9ac392613e33c61ff3f91ade6c477d8396fa

URL: https://github.com/llvm/llvm-project/commit/4b6d9ac392613e33c61ff3f91ade6c477d8396fa
DIFF: https://github.com/llvm/llvm-project/commit/4b6d9ac392613e33c61ff3f91ade6c477d8396fa.diff

LOG: Make lld cmake not compute commit revision twice

r354605 moved LLD to the unified revision handling introduced in
rL353268 / r352729 and removed uses of LLD_REPOSITORY_STRING and
LLD_REVISION_STRING.

After this change, we no longer compute the (now-unused) values
of these two variables.

Since this removes the only use of llvm/utils/GetRepositoryPath,
remove that too (it's redundant with the system added in r354605).

While here, also remove LLD_VERSION_MAJOR and LLD_VERSION_MINOR.
Their uses were removed in r285163.

Also remove LLD_VERSION from Version.inc which as far as I can
tell has been unused since the file was added in r219277.

No behavior change.

Differential Revision: https://reviews.llvm.org/D72803

Added: 
    

Modified: 
    lld/CMakeLists.txt
    lld/include/lld/Common/Version.inc.in
    llvm/utils/gn/secondary/lld/include/lld/Common/BUILD.gn

Removed: 
    llvm/utils/GetRepositoryPath


################################################################################
diff  --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 641f71c114ae..b0320ef6483f 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -130,39 +130,6 @@ string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" LLD_VERSION_MAJOR
 string(REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" LLD_VERSION_MINOR
   ${LLD_VERSION})
 
-# Determine LLD revision and repository.
-# TODO: Figure out a way to get the revision and the repository on windows.
-if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
-  execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLD_SOURCE_DIR}
-                  OUTPUT_VARIABLE LLD_REVISION)
-
-  execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLD_SOURCE_DIR}
-                  OUTPUT_VARIABLE LLD_REPOSITORY)
-  if ( LLD_REPOSITORY )
-    # Replace newline characters with spaces
-    string(REGEX REPLACE "(\r?\n)+" " " LLD_REPOSITORY ${LLD_REPOSITORY})
-    # Remove leading spaces
-    STRING(REGEX REPLACE "^[ \t\r\n]+" "" LLD_REPOSITORY "${LLD_REPOSITORY}" )
-    # Remove trailing spaces
-    string(REGEX REPLACE "(\ )+$" "" LLD_REPOSITORY ${LLD_REPOSITORY})
-  endif()
-
-  if ( LLD_REVISION )
-    # Replace newline characters with spaces
-    string(REGEX REPLACE "(\r?\n)+" " " LLD_REVISION ${LLD_REVISION})
-    # Remove leading spaces
-    STRING(REGEX REPLACE "^[ \t\r\n]+" "" LLD_REVISION "${LLD_REVISION}" )
-    # Remove trailing spaces
-    string(REGEX REPLACE "(\ )+$" "" LLD_REVISION ${LLD_REVISION})
-  endif()
-endif ()
-
-# Configure the Version.inc file.
-configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/include/lld/Common/Version.inc.in
-  ${CMAKE_CURRENT_BINARY_DIR}/include/lld/Common/Version.inc)
-
-
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
   message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite "
 "the makefiles distributed with LLVM. Please create a directory and run cmake "

diff  --git a/lld/include/lld/Common/Version.inc.in b/lld/include/lld/Common/Version.inc.in
index 2789a5c46089..5cb48a546e11 100644
--- a/lld/include/lld/Common/Version.inc.in
+++ b/lld/include/lld/Common/Version.inc.in
@@ -1,6 +1 @@
-#define LLD_VERSION @LLD_VERSION@
 #define LLD_VERSION_STRING "@LLD_VERSION@"
-#define LLD_VERSION_MAJOR @LLD_VERSION_MAJOR@
-#define LLD_VERSION_MINOR @LLD_VERSION_MINOR@
-#define LLD_REVISION_STRING "@LLD_REVISION@"
-#define LLD_REPOSITORY_STRING "@LLD_REPOSITORY@"

diff  --git a/llvm/utils/GetRepositoryPath b/llvm/utils/GetRepositoryPath
deleted file mode 100755
index 2d1122e4bc4f..000000000000
--- a/llvm/utils/GetRepositoryPath
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-usage() {
-  echo "usage: $0 <source root>"
-  echo "  Prints the source control repository path of the given source"
-  echo "  directory, the exact format of the revision string depends on the"
-  echo "  source control system. If the source control system isn't known,"
-  echo "  the output is empty and the exit code is 1."
-  exit 1
-}
-
-if [ $# != 1 ] || [ ! -d $1 ]; then
-  usage;
-fi
-
-cd $1
-if [ -d .svn ]; then
-  svn info | grep '^URL:' | cut -d: -f2-
-elif [ -f .git/svn/.metadata ]; then
-  git svn info | grep 'URL:' | cut -d: -f2-
-elif [ -d .git ]; then
-  git remote -v | grep 'fetch' | awk '{ print $2 }' | head -n1
-else
-  exit 1;
-fi
-
-exit 0

diff  --git a/llvm/utils/gn/secondary/lld/include/lld/Common/BUILD.gn b/llvm/utils/gn/secondary/lld/include/lld/Common/BUILD.gn
index 82a0923e930f..f05f0bfed2e0 100644
--- a/llvm/utils/gn/secondary/lld/include/lld/Common/BUILD.gn
+++ b/llvm/utils/gn/secondary/lld/include/lld/Common/BUILD.gn
@@ -4,13 +4,5 @@ import("//llvm/version.gni")
 write_cmake_config("version") {
   input = "Version.inc.in"
   output = "$target_gen_dir/Version.inc"
-  values = [
-    "LLD_VERSION=$llvm_version",
-    "LLD_VERSION_MAJOR=$llvm_version_major",
-    "LLD_VERSION_MINOR=$llvm_version_minor",
-
-    # FIXME: Real values for these:
-    "LLD_REVISION=",
-    "LLD_REPOSITORY=",
-  ]
+  values = [ "LLD_VERSION=$llvm_version" ]
 }


        


More information about the llvm-commits mailing list