Skip to content

Commit

Permalink
[build] ThirdPartyNotices.txt and $(CONFIGURATIONS) (dotnet#1367)
Browse files Browse the repository at this point in the history
An unanticipated side-effect of commit 2bd13c4 was that
`make prepare` was downloading `bundle-v*.zip` for *both*
[Debug and Release][0] configurations, even on the PR builder (which
only builds Debug by default):

[0]: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-pr-builder/2610/console

	Downloading `https://xamjenkinsartifact.azureedge.net/xamarin-android/xamarin-android/bin/Debug/bundle-v21-h86de098f-Debug-Darwin-libzip=1d8b1ac,llvm=bdb3a11,mono=607cbde.zip` to `/Users/builder/android-archives/.bundle-v21-h86de098f-Debug-Darwin-libzip=1d8b1ac,llvm=bdb3a11,mono=607cbde.zip.download`
	...
	Downloading `https://xamjenkinsartifact.azureedge.net/xamarin-android/xamarin-android/bin/Release/bundle-v21-h86de098f-Release-Darwin-libzip=1d8b1ac,llvm=bdb3a11,mono=607cbde.zip` to `/Users/builder/android-archives/.bundle-v21-h86de098f-Release-Darwin-libzip=1d8b1ac,llvm=bdb3a11,mono=607cbde.zip.download`.

This is unneccessary, but was a result of:

	$(foreach c, $(CONFIGURATIONS), \
	  $(eval $(call CREATE_THIRD_PARTY_NOTICES ...)))

Since `ThirdPartyNotices.csproj` has a `@(ProjectReference)` to
`xa-prep-tasks.csproj`, the build of which attempts to download the
bundle, simply executing `ThirdPartyNotices.csproj` was triggering a
bundle download, which is not desired.

Rework the dependencies so that by default we only create
`bin/$(CONFIGURATION)/lib/xamarin.android/ThirdPartyNotices.txt`, not
one for all `$(CONFIGURATIONS)`, and move the `$(CONFIGURATIONS)`
logic into `make leeroy-all`.
  • Loading branch information
jonpryor authored Mar 6, 2018
1 parent 0435a91 commit 351ca70
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
31 changes: 18 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,34 +123,39 @@ prepare-image-dependencies:
include build-tools/scripts/BuildEverything.mk
include tests/api-compatibility/api-compatibility.mk

prepare:: prepare-tpn

topdir := $(shell pwd)

# Usage: $(call CALL_CREATE_THIRD_PARTY_NOTICES,configuration,path,licenseType,includeExternalDeps,includeBuildDeps)
define CREATE_THIRD_PARTY_NOTICES
$(MSBUILD) $(MSBUILD_FLAGS) $(_MSBUILD_ARGS) \
$(topdir)/build-tools/ThirdPartyNotices/ThirdPartyNotices.csproj \
/p:Configuration=$(1) \
/p:ThirdPartyNoticeFile=$(topdir)/$(2) \
/p:ThirdPartyNoticeLicenseType=$(3) \
/p:TpnIncludeExternalDependencies=$(4) \
/p:TpnIncludeBuildDependencies=$(5)
endef # CREATE_THIRD_PARTY_NOTICES

prepare:: prepare-tpn

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

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

$(2) $(topdir)/$(2): build-tools/ThirdPartyNotices/ThirdPartyNotices.csproj \
$(wildcard external/*.tpnitems src/*.tpnitems) \
$(TPN_LICENSE_FILES)
$(MSBUILD) $(MSBUILD_FLAGS) $(_MSBUILD_ARGS) $$< \
/p:Configuration=$(1) \
/p:ThirdPartyNoticeFile=$(topdir)/$(2) \
/p:ThirdPartyNoticeLicenseType=$(3) \
/p:TpnIncludeExternalDependencies=$(4) \
/p:TpnIncludeBuildDependencies=$(5)
endef # CREATE_THIRD_PARTY_NOTICES
$(call CREATE_THIRD_PARTY_NOTICES,$(1),$(2),$(3),$(4),$(5))
endef # CREATE_THIRD_PARTY_NOTICES_RULE

THIRD_PARTY_NOTICE_LICENSE_TYPE = microsoft-oss

$(eval $(call CREATE_THIRD_PARTY_NOTICES,$(CONFIGURATION),ThirdPartyNotices.txt,foundation,False,False))
$(foreach c, $(CONFIGURATIONS), \
$(eval $(call CREATE_THIRD_PARTY_NOTICES,$(c),bin/$(c)/lib/xamarin.android/ThirdPartyNotices.txt,$(THIRD_PARTY_NOTICE_LICENSE_TYPE),True,False)))
$(eval $(call CREATE_THIRD_PARTY_NOTICES_RULE,$(CONFIGURATION),ThirdPartyNotices.txt,foundation,False,False))
$(eval $(call CREATE_THIRD_PARTY_NOTICES_RULE,$(CONFIGURATION),bin/$(CONFIGURATION)/lib/xamarin.android/ThirdPartyNotices.txt,$(THIRD_PARTY_NOTICE_LICENSE_TYPE),True,False))

run-all-tests:
$(MSBUILD) $(MSBUILD_FLAGS) $(TEST_TARGETS) /t:RunAllTests
Expand Down
3 changes: 2 additions & 1 deletion build-tools/scripts/BuildEverything.mk
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ leeroy: leeroy-all framework-assemblies opentk-jcw

leeroy-all:
$(foreach conf, $(CONFIGURATIONS), \
$(_SLN_BUILD) $(MSBUILD_FLAGS) $(SOLUTION) /p:Configuration=$(conf) $(_MSBUILD_ARGS) && ) \
$(_SLN_BUILD) $(MSBUILD_FLAGS) $(SOLUTION) /p:Configuration=$(conf) $(_MSBUILD_ARGS) && \
$(call CREATE_THIRD_PARTY_NOTICES,$(conf),bin/$(conf)/lib/xamarin.android/ThirdPartyNotices.txt,$(THIRD_PARTY_NOTICE_LICENSE_TYPE),True,False) && ) \
true

framework-assemblies:
Expand Down

0 comments on commit 351ca70

Please sign in to comment.