[apidiff] Simplify code a bit to use templates and iterate over the selected platforms. (#15006)

This commit is contained in:
Rolf Bjarne Kvinge 2022-05-13 20:44:15 +02:00 коммит произвёл GitHub
Родитель 0caa8166c3
Коммит 009bd4ac01
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 9 добавлений и 30 удалений

Просмотреть файл

@ -205,6 +205,14 @@ API_DIFF_DEPENDENCIES += $(foreach assembly,$(DOTNET_ASSEMBLIES),$(APIDIFF_DIR)/
API_DIFF_DEPENDENCIES += $(foreach assembly,$(DOTNET_LEGACY_ASSEMBLIES),$(APIDIFF_DIR)/dotnet/legacy-diff/$(assembly)-api-diff.html)
endif
define ApiDiffReport
if ! grep "No change detected" $(APIDIFF_DIR)/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1)-api-diff.html >/dev/null 2>&1; then \
echo "<h2><a href='dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1)-api-diff.html'>Microsoft.$(1) (.NET) API diff</a></h2>" >> $(2); \
else \
echo "<h2>Microsoft.$(1) (.NET) API diff is empty</h2>" >> $(2); \
fi;
endef
$(APIDIFF_DIR)/api-diff.html: $(API_DIFF_DEPENDENCIES)
$(QF_GEN) echo "<h1>API diffs</h1>" > $@
ifdef INCLUDE_IOS
@ -237,35 +245,7 @@ ifdef INCLUDE_MAC
endif
# New Dotnet vs Stable Dotnet
ifdef ENABLE_DOTNET
ifdef INCLUDE_IOS
$(Q) if ! grep "No change detected" $(APIDIFF_DIR)/dotnet/Microsoft.iOS.Ref/ref/$(DOTNET_TFM)/Microsoft.iOS-api-diff.html >/dev/null 2>&1; then \
echo "<h2><a href='dotnet/Microsoft.iOS.Ref/ref/$(DOTNET_TFM)/Microsoft.iOS-api-diff.html'>Microsoft.iOS Dotnet API diff</a></h2>" >> $@; \
else \
echo "<h2>Microsoft.iOS Dotnet API diff is empty</h2>" >> $@; \
fi;
ifdef INCLUDE_TVOS
$(Q) if ! grep "No change detected" $(APIDIFF_DIR)/dotnet/Microsoft.tvOS.Ref/ref/$(DOTNET_TFM)/Microsoft.tvOS-api-diff.html >/dev/null 2>&1; then \
echo "<h2><a href='dotnet/Microsoft.tvOS.Ref/ref/$(DOTNET_TFM)/Microsoft.tvOS-api-diff.html'>Microsoft.tvOS Dotnet API diff</a></h2>" >> $@; \
else \
echo "<h2>Microsoft.tvOS Dotnet API diff is empty</h2>" >> $@; \
fi;
endif
ifdef INCLUDE_MACCATALYST
$(Q) if ! grep "No change detected" $(APIDIFF_DIR)/dotnet/Microsoft.MacCatalyst.Ref/ref/$(DOTNET_TFM)/Microsoft.MacCatalyst-api-diff.html >/dev/null 2>&1; then \
echo "<h2><a href='dotnet/Microsoft.MacCatalyst.Ref/ref/$(DOTNET_TFM)/Microsoft.MacCatalyst-api-diff.html'>Microsoft.MacCatalyst Dotnet API diff</a></h2>" >> $@; \
else \
echo "<h2>Microsoft.MacCatalyst Dotnet API diff is empty</h2>" >> $@; \
fi;
endif
endif
ifdef INCLUDE_MAC
$(Q) if ! grep "No change detected" $(APIDIFF_DIR)/dotnet/Microsoft.macOS.Ref/ref/$(DOTNET_TFM)/Microsoft.macOS-api-diff.html >/dev/null 2>&1; then \
echo "<h2><a href='dotnet/Microsoft.macOS.Ref/ref/$(DOTNET_TFM)/Microsoft.macOS-api-diff.html'>Microsoft.macOS Dotnet API diff</a></h2>" >> $@; \
else \
echo "<h2>Microsoft.macOS Dotnet API diff is empty</h2>" >> $@; \
fi;
endif
$(Q) $(foreach platform,$(DOTNET_PLATFORMS),$(call ApiDiffReport,$(platform),$@))
# New Dotnet vs. Stable Legacy
ifdef INCLUDE_IOS
@ -284,7 +264,6 @@ ifdef INCLUDE_MACCATALYST
$(Q) echo "<h2><a href='dotnet/iOS-MacCatalyst-diff/Microsoft.iOS.Ref/ref/$(DOTNET_TFM)/Microsoft.iOS.MacCatalyst-api-diff.html'>Microsoft.iOS vs Microsoft.MacCatalyst API diff</a></h2>" >> $@
endif
endif
endif # ENABLE_DOTNET
# easy-to-type helper targets.
# one rule to create all the api diffs