1 .PHONY
: validate-versions reset-versions
5 # usage $(call ValidateVersionTemplate (name,MAKEFILE VAR,repo name))
6 # usage $(call ValidateVersionTemplate (mono,MONO,mono))
8 define ValidateVersionTemplate
9 #$(eval REPOSITORY_$(2):=$(shell test -z $(3) && echo $(1) || echo "$(3)"))
10 #$(eval DIRECTORY_$(2):=$(shell python versions.py get-dir $(1)))
11 #$(eval DIRECTORY_$(2):=$(shell test -z $(DIRECTORY_$(2)) && echo $(1) || echo $(DIRECTORY_$(2))))
12 #$(eval MODULE_$(2):=$(shell python versions.py get-url $(1)))
13 #$(eval NEEDED_$(2)_VERSION:=$(shell python versions.py get-rev $(1)))
14 #$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python versions.py get-remote-branch $(1)))
16 #$(eval $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD ))
18 #$(eval NEEDED_$(2)_BRANCH:=$(word 2, $(subst /, ,$($(2)_BRANCH_AND_REMOTE))))
19 #$(eval NEEDED_$(2)_REMOTE:=$(word 1, $(subst /, ,$($(2)_BRANCH_AND_REMOTE))))
20 #$(eval $(2)_BRANCH:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git symbolic-ref --short HEAD 2>/dev/null))
23 @if
test x
$$(IGNORE_
$(2)_VERSION
) = "x"; then \
24 if
test ! -d
$($(2)_PATH
); then \
25 if
test x
$$(RESET_VERSIONS
) != "x"; then \
26 $(MAKE
) reset-
$(1) || exit
1; \
28 echo
"Your $(1) checkout is missing, please run 'make reset-$(1)'"; \
29 touch .validate-versions-failure
; \
32 if
test "x$($(2)_VERSION)" != "x$(NEEDED_$(2)_VERSION)" ; then \
33 if
test x
$$(RESET_VERSIONS
) != "x"; then \
34 $(MAKE
) reset-
$(1) || exit
1; \
36 echo
"Your $(1) version is out of date, please run 'make reset-$(1)' (found $($(2)_VERSION), expected $(NEEDED_$(2)_VERSION))"; \
37 test -z
"$(BUILD_REVISION)" ||
$(MAKE
) test-
$(1); \
38 touch .validate-versions-failure
; \
40 elif
test "x$($(2)_BRANCH)" != "x$(NEEDED_$(2)_BRANCH)" ; then \
41 if
test x
$$(RESET_VERSIONS
) != "x"; then \
42 test -z
"$(BUILD_REVISION)" ||
$(MAKE
) test-
$(1); \
43 $(MAKE
) reset-
$(1) || exit
1; \
45 echo
"Your $(1) branch is out of date, please run 'make reset-$(1)' (found $($(2)_BRANCH), expected $(NEEDED_$(2)_BRANCH))"; \
46 touch .validate-versions-failure
; \
54 @echo
" REPOSITORY_$(2)=$(REPOSITORY_$(2))"
55 @echo
" DIRECTORY_$(2)=$(DIRECTORY_$(2))"
56 @echo
" MODULE_$(2)=$(MODULE_$(2))"
57 @echo
" NEEDED_$(2)_VERSION=$(NEEDED_$(2)_VERSION)"
58 @echo
" $(2)_VERSION=$($(2)_VERSION)"
59 @echo
" $(2)_BRANCH_AND_REMOTE=$($(2)_BRANCH_AND_REMOTE)"
60 @echo
" NEEDED_$(2)_BRANCH=$(NEEDED_$(2)_BRANCH)"
61 @echo
" NEEDED_$(2)_REMOTE=$(NEEDED_$(2)_REMOTE)"
62 @echo
" $(2)_BRANCH=$($(2)_BRANCH)"
63 @echo
" $(2)_PATH=$($(2)_PATH) => $(abspath $($(2)_PATH))"
66 @if
test -d
$($(2)_PATH
); then \
67 if
! (cd
$($(2)_PATH
) && git show
$(NEEDED_
$(2)_VERSION
) >/dev
/null
2>&1 && git log
-1 $(NEEDED_
$(2)_REMOTE
) >/dev
/null
2>&1) ; then \
68 echo
"*** git fetch `basename $$($(2)_PATH)`" && (cd
$($(2)_PATH
) && git fetch
); \
71 echo
"*** git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2))" && (cd
`dirname $($(2)_PATH)` && git clone
$(MODULE_
$(2)) --recursive
$(DIRECTORY_
$(2)) || exit
1 ); \
73 @if
test x
$$(IGNORE_
$(2)_VERSION
) = "x"; then \
74 echo
"*** [$(1)] git checkout -f" $(NEEDED_
$(2)_BRANCH
) && (cd
$($(2)_PATH
) ; git checkout
-f
$(NEEDED_
$(2)_BRANCH
) || git checkout
-f
-b
$($(2)_BRANCH_AND_REMOTE
)); \
75 echo
"*** [$(1)] git reset --hard $(NEEDED_$(2)_VERSION)" && (cd
$($(2)_PATH
) && git reset
--hard
$(NEEDED_
$(2)_VERSION
)); \
77 @echo
"*** [$(1)] git submodule update --init --recursive" && (cd
$($(2)_PATH
) && git submodule update
--init
--recursive
)
80 @printf
"*** %-16s %-45s %s (%s)\n" "$(DIRECTORY_$(2))" "$(MODULE_$(2))" "$(NEEDED_$(2)_VERSION)" "$(NEEDED_$(2)_BRANCH)"
82 .PHONY
: validate-
$(1) reset-
$(1) print-
$(1)
84 reset-versions
:: reset-
$(1)
85 validate-versions
:: Validate-
$(1)
86 print-versions
:: print-
$(1)
90 $(eval
$(call ValidateVersionTemplate
,roslyn
,ROSLYN
))
91 $(eval
$(call ValidateVersionTemplate
,coreclr
,CORECLR
))
92 $(eval
$(call ValidateVersionTemplate
,ms-test-suite
,MSTESTSUITE
))
97 @if
test -e .validate-versions-failure
; then \
98 rm .validate-versions-failure
; \
99 echo One or more modules needs update
; \
102 echo All dependent modules up to date
; \
106 @
$(MAKE
) validate-versions RESET_VERSIONS
=1
109 @if
[ "$(REV)" = "" ]; then echo
"Usage: make bump-version-$* REV=<ref>"; exit
1; fi
110 python versions.py set-rev
$* $(REV
)
111 @if
[ "$(COMMIT)" = "1" ]; then echo
"[acceptance-tests] Bump $* to pick up $(REV)." | git commit
-F
- $(CONFIG
); fi
114 @if
[ "$(BRANCH)" = "" ]; then echo
"Usage: make bump-branch-$* BRANCH=<branch> REMOTE_BRANCH=<remote branch>"; exit
1; fi
115 @if
[ "$(REMOTE_BRANCH)" == "" ]; then echo
"Usage: make bump-branch-$* BRANCH=<branch> REMOTE_BRANCH=<remote branch>"; exit
1; fi
116 python versions.py set-branch
$* $(BRANCH
)
117 python versions.py set-remote-branch
$* $(REMOTE_BRANCH
)
118 @if
[ "$(COMMIT)" = "1" ]; then echo
"[acceptance-tests] Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit
-F
- $(CONFIG
); fi
120 __bump-current-version-
%:
121 REV
=$(shell cd
$(ACCEPTANCE_TESTS_PATH
)/$* && git log
-1 --pretty
=format
:%H
); \
122 python versions.py set-rev
$* $$REV; \
123 if
[ "$(COMMIT)" = "1" ]; then echo
"[acceptance-tests] Bump $* to pick up $$REV:" | git commit
-F
- $(CONFIG
); fi
125 # Bump the given submodule to the revision given by the REV make variable
126 # If COMMIT is 1, commit the change
127 bump-roslyn
: __bump-version-roslyn
128 bump-coreclr
: __bump-version-coreclr
129 bump-ms-test-suite
: __bump-version-ms-test-suite
131 # Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables
132 # If COMMIT is 1, commit the change
133 bump-branch-roslyn
: __bump-branch-roslyn
134 bump-branch-coreclr
: __bump-branch-coreclr
135 bump-branch-ms-test-suite
: __bump-branch-ms-test-suite
137 # Bump the given submodule to its current GIT version
138 # If COMMIT is 1, commit the change
139 bump-current-roslyn
: __bump-current-version-roslyn
140 bump-current-coreclr
: __bump-current-version-coreclr
141 bump-current-ms-test-suite
: __bump-current-version-ms-test-suite
144 $(MAKE
) bump-roslyn COMMIT
=1
147 $(MAKE
) bump-coreclr COMMIT
=1
149 commit-bump-ms-test-suite
:
150 $(MAKE
) bump-ms-test-suite COMMIT
=1
152 commit-bump-current-roslyn
:
153 $(MAKE
) bump-current-roslyn COMMIT
=1
155 commit-bump-current-coreclr
:
156 $(MAKE
) bump-current-coreclr COMMIT
=1
158 commit-bump-current-ms-test-suite
:
159 $(MAKE
) bump-current-ms-test-suite COMMIT
=1