Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Expunge use of CONFIGURATIONS (Continuation) #2353

Merged
merged 1 commit into from
Oct 30, 2018

Conversation

luhenry
Copy link
Contributor

@luhenry luhenry commented Oct 29, 2018

There were some leftovers of useless $(CONFIGURATION)

@luhenry luhenry requested a review from jonpryor October 29, 2018 21:24
Makefile Outdated
@@ -167,20 +167,20 @@ TPN_LICENSE_FILES = $(shell grep -h '<LicenseFile>' external/*.tpnitems src/*.tp
| sed -E 's,<LicenseFile>(.*)</LicenseFile>,\1,g;s,.\(MSBuildThisFileDirectory\),$(topdir)/external/,g' \
| tr \\ / )

# Usage: $(call CREATE_THIRD_PARTY_NOTICES,configuration,path,licenseType,includeExternalDeps,includeBuildDeps)
# Usage: $(call CREATE_THIRD_PARTY_NOTICES_RULE,path,licenseType,includeExternalDeps,includeBuildDeps)
define CREATE_THIRD_PARTY_NOTICES_RULE
prepare-tpn:: $(2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that spot. $(2) -> $(1)

Makefile Outdated
@@ -167,20 +167,20 @@ TPN_LICENSE_FILES = $(shell grep -h '<LicenseFile>' external/*.tpnitems src/*.tp
| sed -E 's,<LicenseFile>(.*)</LicenseFile>,\1,g;s,.\(MSBuildThisFileDirectory\),$(topdir)/external/,g' \
| tr \\ / )

# Usage: $(call CREATE_THIRD_PARTY_NOTICES,configuration,path,licenseType,includeExternalDeps,includeBuildDeps)
# Usage: $(call CREATE_THIRD_PARTY_NOTICES_RULE,path,licenseType,includeExternalDeps,includeBuildDeps)
define CREATE_THIRD_PARTY_NOTICES_RULE
prepare-tpn:: $(2)

$(2) $(topdir)/$(2): build-tools/ThirdPartyNotices/ThirdPartyNotices.csproj \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that spot. $(2) -> $(1)

Makefile Outdated
@@ -102,9 +102,9 @@ prepare-external:
git submodule update --init --recursive
nuget restore $(SOLUTION)
nuget restore Xamarin.Android-Tests.sln
(cd external/xamarin-android-tools && make prepare CONFIGURATION=$(CONFIGURATION))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you changing this line?

I believe that this is "implicitly" problematic. Consider the following two makefiles:

A.mk:

CONFIGURATION=Foo

all:
	make -f B.mk all

B.mk:

CONFIGURATION=Default

all:
	@echo CONFIGURATION=$(CONFIGURATION)

The intention is that A.mk "controls" B.mk, as A.mk invokes B.mk in its all target. However, if no $(CONFIGURATION) value is specified, which value does B.mk print: the one in B.mk, or the one in A.mk?

$ make -f A.mk
make -f B.mk all
CONFIGURATION=Default

It uses the default value in B.mk. Meaning A.mk is not in control; defaults are left at the discretion of B.mk.

If we do override on the command line, things work as intended, but it's the default case which doesn't:

$ make -f A.mk CONFIGURATION=NewConfig
make -f B.mk all
CONFIGURATION=NewConfig

We're in a similar situation here where Makefile is A.mk, and external/Java.Interop/Makefile is B.mk: If/when $(CONFIGURATION) is not explicitly overridden on the command line -- which will presumably happen a majority of the time -- then external/Java.Interop/Makefile will use the default $(CONFIGURATION) value specified in external/Java.Interop/Makefile, not Makefile.

This is fine now, as both Makefile and external/Java.Interop/Makefile have the same default $(CONFIGURATION) value, but if that changes in the future, things can become inconsistent.

I thus believe/assert that it is safer to always override $(CONFIGURATION), as is currently done, so that Makefile is always in control.

There were some leftovers of useless $(CONFIGURATION)
@jonpryor jonpryor merged commit faaa908 into dotnet:master Oct 30, 2018
@luhenry luhenry deleted the remove-CONFIGURATIONS branch November 1, 2018 15:11
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants