Skip to content

Commit

Permalink
8210283: Support git as an SCM alternative in the build
Browse files Browse the repository at this point in the history
Removes forest handling of SCM ids

Reviewed-by: andrew
  • Loading branch information
erikj79 committed Sep 7, 2018
1 parent 26e7033 commit 054b85b
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 30 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/build/
/dist/
/.idea/
nbproject/private/
/webrev
/.src-rev
/.jib/
.DS_Store
.metadata/
.recommenders/
test/nashorn/script/external
test/nashorn/lib
NashornProfile.txt
**/JTreport/**
**/JTwork/**
1 change: 1 addition & 0 deletions common/autoconf/basics.m4
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
fi
BASIC_PATH_PROGS(READELF, [readelf greadelf])
BASIC_PATH_PROGS(HG, hg)
BASIC_PATH_PROGS(GIT, git)
BASIC_PATH_PROGS(STAT, stat)
BASIC_PATH_PROGS(TIME, time)
# Check if it's GNU time
Expand Down
191 changes: 190 additions & 1 deletion common/autoconf/generated-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ DSYMUTIL
IS_GNU_TIME
TIME
STAT
GIT
HG
READELF
LDD
Expand Down Expand Up @@ -1180,6 +1181,7 @@ ZIP
LDD
READELF
HG
GIT
STAT
TIME
DSYMUTIL
Expand Down Expand Up @@ -2073,6 +2075,7 @@ Some influential environment variables:
LDD Override default value for LDD
READELF Override default value for READELF
HG Override default value for HG
GIT Override default value for GIT
STAT Override default value for STAT
TIME Override default value for TIME
DSYMUTIL Override default value for DSYMUTIL
Expand Down Expand Up @@ -4400,7 +4403,7 @@ VS_SDK_PLATFORM_NAME_2017=
#CUSTOM_AUTOCONF_INCLUDE

# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1625670527
DATE_WHEN_GENERATED=1639134107

###############################################################################
#
Expand Down Expand Up @@ -18240,6 +18243,192 @@ $as_echo "$tool_specified" >&6; }



# Publish this variable in the help.


if test "x$GIT" = x; then
# The variable is not set by user, try to locate tool using the code snippet
for ac_prog in git
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_GIT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $GIT in
[\\/]* | ?:[\\/]*)
ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_GIT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

;;
esac
fi
GIT=$ac_cv_path_GIT
if test -n "$GIT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
$as_echo "$GIT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


test -n "$GIT" && break
done

else
# The variable is set, but is it from the command line or the environment?

# Try to remove the string !GIT! from our list.
try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!GIT!/}
if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
# If it failed, the variable was not from the command line. Ignore it,
# but warn the user (except for BASH, which is always set by the calling BASH).
if test "xGIT" != xBASH; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of GIT from the environment. Use command line variables instead." >&5
$as_echo "$as_me: WARNING: Ignoring value of GIT from the environment. Use command line variables instead." >&2;}
fi
# Try to locate tool using the code snippet
for ac_prog in git
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_GIT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $GIT in
[\\/]* | ?:[\\/]*)
ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_GIT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

;;
esac
fi
GIT=$ac_cv_path_GIT
if test -n "$GIT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
$as_echo "$GIT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


test -n "$GIT" && break
done

else
# If it succeeded, then it was overridden by the user. We will use it
# for the tool.

# First remove it from the list of overridden variables, so we can test
# for unknown variables in the end.
CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"

# Check if the provided tool contains a complete path.
tool_specified="$GIT"
tool_basename="${tool_specified##*/}"
if test "x$tool_basename" = "x$tool_specified"; then
# A command without a complete path is provided, search $PATH.
{ $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool GIT=$tool_basename" >&5
$as_echo "$as_me: Will search for user supplied tool GIT=$tool_basename" >&6;}
# Extract the first word of "$tool_basename", so it can be a program name with args.
set dummy $tool_basename; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_GIT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $GIT in
[\\/]* | ?:[\\/]*)
ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_GIT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

;;
esac
fi
GIT=$ac_cv_path_GIT
if test -n "$GIT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
$as_echo "$GIT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


if test "x$GIT" = x; then
as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
fi
else
# Otherwise we believe it is a complete path. Use it as it is.
{ $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool GIT=$tool_specified" >&5
$as_echo "$as_me: Will use user supplied tool GIT=$tool_specified" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GIT" >&5
$as_echo_n "checking for GIT... " >&6; }
if test ! -x "$tool_specified"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
as_fn_error $? "User supplied tool GIT=$tool_specified does not exist or is not executable" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
$as_echo "$tool_specified" >&6; }
fi
fi
fi




# Publish this variable in the help.


Expand Down
1 change: 1 addition & 0 deletions common/autoconf/spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ READELF:=@READELF@
EXPR:=@EXPR@
FILE:=@FILE@
HG:=@HG@
GIT:=@GIT@
OBJCOPY:=@OBJCOPY@
SETFILE:=@SETFILE@
XATTR:=@XATTR@
Expand Down
61 changes: 32 additions & 29 deletions make/common/MakeBase.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -293,40 +293,43 @@ define ListPathsSafelyNow

endef

# The source ids can come from the Mercurial repository, or in the files
# $(HGTIP_FILENAME) which contains the id but is also positioned in the same
# directory as the original $(HGDIR) directory.
# These should not be := assignments, only used from the root Makefile.
HG_VERSION = $(shell $(HG) version 2> /dev/null)
HG_DIRECTORY=.hg
HGTIP_FILENAME=.hgtip
HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO
REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \
$(shell $(CD) $(SRC_ROOT) ; ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \
$(LS) $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \
2> /dev/null)))))

# Emit the repo:id pairs to $@
# The source ids can come from the SCM, or in the files
# $(SCM_TIP_FILENAME) which contains the id but is also positioned in the same
# directory as the original $(SCM_DIR) directory.
ifneq ($(and $(HG), $(wildcard $(TOPDIR)/.hg)), )
SCM := hg
SCM_VERSION := $(shell $(HG) version 2> /dev/null)
SCM_DIR :=.hg
SCM_TIP_FILENAME := .hgtip
ID_COMMAND := $(PRINTF) "hg:%s" "$$( $(HG) id -i)"
else ifneq ($(and $(GIT), $(wildcard $(TOPDIR)/.git)), )
SCM := git
SCM_VERSION := $(shell $(GIT) version 2> /dev/null)
SCM_DIR :=.git
SCM_TIP_FILENAME := .gittip
ID_COMMAND := $(PRINTF) "git:%s%s" \
"$$( $(GIT) log -n1 --format=%H | cut -c1-12)" \
"$$(if test -n "$$( $(GIT) status --porcelain)"; then printf '+'; fi)"
endif
SCM_TIP_FILECMD := $(PRINTF) "$(SCM):%s" \
"$$( $(CAT) $(SCM_TIP_FILENAME) )"


# Emit the scm:id pair to $@
define GetSourceTips
$(CD) $(SRC_ROOT) ; \
for i in $(REPO_LIST) IGNORE ; do \
if [ "$${i}" = "IGNORE" ] ; then \
continue; \
elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \
$(PRINTF) " %s:%s" \
"$${i}" `$(HG) id -i --repository $${i}` ; \
elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \
$(PRINTF) " %s:%s" \
"$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \
fi; \
done >> $@
if [ -d $(SCM_DIR) -a "$(SCM_VERSION)" != "" ] ; then \
$(ID_COMMAND) >> $@ ; \
elif [ -f $(SCM_TIP_FILENAME) ] ; then \
$(SCM_TIP_FILECMD) >> $@ ; \
fi;
$(PRINTF) "\n" >> $@
endef

# Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
define CreateHgTip
$(HG) id -i --repository $1' > $1/$(HGTIP_FILENAME); \
$(ECHO) $1/$(HGTIP_FILENAME)
# Create the SCM_TIP_FILENAME file
define CreateScmTip
$(ID_COMMAND) > $(SCM_TIP_FILENAME); \
$(ECHO) $(SCM_TIP_FILENAME)
endef

define SetupLogging
Expand Down

0 comments on commit 054b85b

Please sign in to comment.