Skip to content

Commit 054b85b

Browse files
committed
8210283: Support git as an SCM alternative in the build
Removes forest handling of SCM ids Reviewed-by: andrew
1 parent 26e7033 commit 054b85b

File tree

5 files changed

+239
-30
lines changed

5 files changed

+239
-30
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/build/
2+
/dist/
3+
/.idea/
4+
nbproject/private/
5+
/webrev
6+
/.src-rev
7+
/.jib/
8+
.DS_Store
9+
.metadata/
10+
.recommenders/
11+
test/nashorn/script/external
12+
test/nashorn/lib
13+
NashornProfile.txt
14+
**/JTreport/**
15+
**/JTwork/**

common/autoconf/basics.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
827827
fi
828828
BASIC_PATH_PROGS(READELF, [readelf greadelf])
829829
BASIC_PATH_PROGS(HG, hg)
830+
BASIC_PATH_PROGS(GIT, git)
830831
BASIC_PATH_PROGS(STAT, stat)
831832
BASIC_PATH_PROGS(TIME, time)
832833
# Check if it's GNU time

common/autoconf/generated-configure.sh

Lines changed: 190 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,7 @@ DSYMUTIL
865865
IS_GNU_TIME
866866
TIME
867867
STAT
868+
GIT
868869
HG
869870
READELF
870871
LDD
@@ -1180,6 +1181,7 @@ ZIP
11801181
LDD
11811182
READELF
11821183
HG
1184+
GIT
11831185
STAT
11841186
TIME
11851187
DSYMUTIL
@@ -2073,6 +2075,7 @@ Some influential environment variables:
20732075
LDD Override default value for LDD
20742076
READELF Override default value for READELF
20752077
HG Override default value for HG
2078+
GIT Override default value for GIT
20762079
STAT Override default value for STAT
20772080
TIME Override default value for TIME
20782081
DSYMUTIL Override default value for DSYMUTIL
@@ -4400,7 +4403,7 @@ VS_SDK_PLATFORM_NAME_2017=
44004403
#CUSTOM_AUTOCONF_INCLUDE
44014404

44024405
# Do not change or remove the following line, it is needed for consistency checks:
4403-
DATE_WHEN_GENERATED=1625670527
4406+
DATE_WHEN_GENERATED=1639134107
44044407

44054408
###############################################################################
44064409
#
@@ -18240,6 +18243,192 @@ $as_echo "$tool_specified" >&6; }
1824018243

1824118244

1824218245

18246+
# Publish this variable in the help.
18247+
18248+
18249+
if test "x$GIT" = x; then
18250+
# The variable is not set by user, try to locate tool using the code snippet
18251+
for ac_prog in git
18252+
do
18253+
# Extract the first word of "$ac_prog", so it can be a program name with args.
18254+
set dummy $ac_prog; ac_word=$2
18255+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
18256+
$as_echo_n "checking for $ac_word... " >&6; }
18257+
if ${ac_cv_path_GIT+:} false; then :
18258+
$as_echo_n "(cached) " >&6
18259+
else
18260+
case $GIT in
18261+
[\\/]* | ?:[\\/]*)
18262+
ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
18263+
;;
18264+
*)
18265+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
18266+
for as_dir in $PATH
18267+
do
18268+
IFS=$as_save_IFS
18269+
test -z "$as_dir" && as_dir=.
18270+
for ac_exec_ext in '' $ac_executable_extensions; do
18271+
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
18272+
ac_cv_path_GIT="$as_dir/$ac_word$ac_exec_ext"
18273+
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
18274+
break 2
18275+
fi
18276+
done
18277+
done
18278+
IFS=$as_save_IFS
18279+
18280+
;;
18281+
esac
18282+
fi
18283+
GIT=$ac_cv_path_GIT
18284+
if test -n "$GIT"; then
18285+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
18286+
$as_echo "$GIT" >&6; }
18287+
else
18288+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
18289+
$as_echo "no" >&6; }
18290+
fi
18291+
18292+
18293+
test -n "$GIT" && break
18294+
done
18295+
18296+
else
18297+
# The variable is set, but is it from the command line or the environment?
18298+
18299+
# Try to remove the string !GIT! from our list.
18300+
try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!GIT!/}
18301+
if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
18302+
# If it failed, the variable was not from the command line. Ignore it,
18303+
# but warn the user (except for BASH, which is always set by the calling BASH).
18304+
if test "xGIT" != xBASH; then
18305+
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of GIT from the environment. Use command line variables instead." >&5
18306+
$as_echo "$as_me: WARNING: Ignoring value of GIT from the environment. Use command line variables instead." >&2;}
18307+
fi
18308+
# Try to locate tool using the code snippet
18309+
for ac_prog in git
18310+
do
18311+
# Extract the first word of "$ac_prog", so it can be a program name with args.
18312+
set dummy $ac_prog; ac_word=$2
18313+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
18314+
$as_echo_n "checking for $ac_word... " >&6; }
18315+
if ${ac_cv_path_GIT+:} false; then :
18316+
$as_echo_n "(cached) " >&6
18317+
else
18318+
case $GIT in
18319+
[\\/]* | ?:[\\/]*)
18320+
ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
18321+
;;
18322+
*)
18323+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
18324+
for as_dir in $PATH
18325+
do
18326+
IFS=$as_save_IFS
18327+
test -z "$as_dir" && as_dir=.
18328+
for ac_exec_ext in '' $ac_executable_extensions; do
18329+
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
18330+
ac_cv_path_GIT="$as_dir/$ac_word$ac_exec_ext"
18331+
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
18332+
break 2
18333+
fi
18334+
done
18335+
done
18336+
IFS=$as_save_IFS
18337+
18338+
;;
18339+
esac
18340+
fi
18341+
GIT=$ac_cv_path_GIT
18342+
if test -n "$GIT"; then
18343+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
18344+
$as_echo "$GIT" >&6; }
18345+
else
18346+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
18347+
$as_echo "no" >&6; }
18348+
fi
18349+
18350+
18351+
test -n "$GIT" && break
18352+
done
18353+
18354+
else
18355+
# If it succeeded, then it was overridden by the user. We will use it
18356+
# for the tool.
18357+
18358+
# First remove it from the list of overridden variables, so we can test
18359+
# for unknown variables in the end.
18360+
CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
18361+
18362+
# Check if the provided tool contains a complete path.
18363+
tool_specified="$GIT"
18364+
tool_basename="${tool_specified##*/}"
18365+
if test "x$tool_basename" = "x$tool_specified"; then
18366+
# A command without a complete path is provided, search $PATH.
18367+
{ $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool GIT=$tool_basename" >&5
18368+
$as_echo "$as_me: Will search for user supplied tool GIT=$tool_basename" >&6;}
18369+
# Extract the first word of "$tool_basename", so it can be a program name with args.
18370+
set dummy $tool_basename; ac_word=$2
18371+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
18372+
$as_echo_n "checking for $ac_word... " >&6; }
18373+
if ${ac_cv_path_GIT+:} false; then :
18374+
$as_echo_n "(cached) " >&6
18375+
else
18376+
case $GIT in
18377+
[\\/]* | ?:[\\/]*)
18378+
ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
18379+
;;
18380+
*)
18381+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
18382+
for as_dir in $PATH
18383+
do
18384+
IFS=$as_save_IFS
18385+
test -z "$as_dir" && as_dir=.
18386+
for ac_exec_ext in '' $ac_executable_extensions; do
18387+
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
18388+
ac_cv_path_GIT="$as_dir/$ac_word$ac_exec_ext"
18389+
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
18390+
break 2
18391+
fi
18392+
done
18393+
done
18394+
IFS=$as_save_IFS
18395+
18396+
;;
18397+
esac
18398+
fi
18399+
GIT=$ac_cv_path_GIT
18400+
if test -n "$GIT"; then
18401+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
18402+
$as_echo "$GIT" >&6; }
18403+
else
18404+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
18405+
$as_echo "no" >&6; }
18406+
fi
18407+
18408+
18409+
if test "x$GIT" = x; then
18410+
as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
18411+
fi
18412+
else
18413+
# Otherwise we believe it is a complete path. Use it as it is.
18414+
{ $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool GIT=$tool_specified" >&5
18415+
$as_echo "$as_me: Will use user supplied tool GIT=$tool_specified" >&6;}
18416+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GIT" >&5
18417+
$as_echo_n "checking for GIT... " >&6; }
18418+
if test ! -x "$tool_specified"; then
18419+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
18420+
$as_echo "not found" >&6; }
18421+
as_fn_error $? "User supplied tool GIT=$tool_specified does not exist or is not executable" "$LINENO" 5
18422+
fi
18423+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
18424+
$as_echo "$tool_specified" >&6; }
18425+
fi
18426+
fi
18427+
fi
18428+
18429+
18430+
18431+
1824318432
# Publish this variable in the help.
1824418433

1824518434

common/autoconf/spec.gmk.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ READELF:=@READELF@
578578
EXPR:=@EXPR@
579579
FILE:=@FILE@
580580
HG:=@HG@
581+
GIT:=@GIT@
581582
OBJCOPY:=@OBJCOPY@
582583
SETFILE:=@SETFILE@
583584
XATTR:=@XATTR@

make/common/MakeBase.gmk

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -293,40 +293,43 @@ define ListPathsSafelyNow
293293

294294
endef
295295

296-
# The source ids can come from the Mercurial repository, or in the files
297-
# $(HGTIP_FILENAME) which contains the id but is also positioned in the same
298-
# directory as the original $(HGDIR) directory.
299-
# These should not be := assignments, only used from the root Makefile.
300-
HG_VERSION = $(shell $(HG) version 2> /dev/null)
301-
HG_DIRECTORY=.hg
302-
HGTIP_FILENAME=.hgtip
303-
HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO
304-
REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \
305-
$(shell $(CD) $(SRC_ROOT) ; ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \
306-
$(LS) $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \
307-
2> /dev/null)))))
308-
309-
# Emit the repo:id pairs to $@
296+
# The source ids can come from the SCM, or in the files
297+
# $(SCM_TIP_FILENAME) which contains the id but is also positioned in the same
298+
# directory as the original $(SCM_DIR) directory.
299+
ifneq ($(and $(HG), $(wildcard $(TOPDIR)/.hg)), )
300+
SCM := hg
301+
SCM_VERSION := $(shell $(HG) version 2> /dev/null)
302+
SCM_DIR :=.hg
303+
SCM_TIP_FILENAME := .hgtip
304+
ID_COMMAND := $(PRINTF) "hg:%s" "$$( $(HG) id -i)"
305+
else ifneq ($(and $(GIT), $(wildcard $(TOPDIR)/.git)), )
306+
SCM := git
307+
SCM_VERSION := $(shell $(GIT) version 2> /dev/null)
308+
SCM_DIR :=.git
309+
SCM_TIP_FILENAME := .gittip
310+
ID_COMMAND := $(PRINTF) "git:%s%s" \
311+
"$$( $(GIT) log -n1 --format=%H | cut -c1-12)" \
312+
"$$(if test -n "$$( $(GIT) status --porcelain)"; then printf '+'; fi)"
313+
endif
314+
SCM_TIP_FILECMD := $(PRINTF) "$(SCM):%s" \
315+
"$$( $(CAT) $(SCM_TIP_FILENAME) )"
316+
317+
318+
# Emit the scm:id pair to $@
310319
define GetSourceTips
311320
$(CD) $(SRC_ROOT) ; \
312-
for i in $(REPO_LIST) IGNORE ; do \
313-
if [ "$${i}" = "IGNORE" ] ; then \
314-
continue; \
315-
elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \
316-
$(PRINTF) " %s:%s" \
317-
"$${i}" `$(HG) id -i --repository $${i}` ; \
318-
elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \
319-
$(PRINTF) " %s:%s" \
320-
"$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \
321-
fi; \
322-
done >> $@
321+
if [ -d $(SCM_DIR) -a "$(SCM_VERSION)" != "" ] ; then \
322+
$(ID_COMMAND) >> $@ ; \
323+
elif [ -f $(SCM_TIP_FILENAME) ] ; then \
324+
$(SCM_TIP_FILECMD) >> $@ ; \
325+
fi;
323326
$(PRINTF) "\n" >> $@
324327
endef
325328

326-
# Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
327-
define CreateHgTip
328-
$(HG) id -i --repository $1' > $1/$(HGTIP_FILENAME); \
329-
$(ECHO) $1/$(HGTIP_FILENAME)
329+
# Create the SCM_TIP_FILENAME file
330+
define CreateScmTip
331+
$(ID_COMMAND) > $(SCM_TIP_FILENAME); \
332+
$(ECHO) $(SCM_TIP_FILENAME)
330333
endef
331334

332335
define SetupLogging

0 commit comments

Comments
 (0)