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

[apidiff] Compare Xamarin.iOS between iOS and MacCatalyst #10924

Merged
merged 8 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tools/apidiff/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ $(APIDIFF_DIR)/diff/ios-to-tvos.html: $(APIDIFF_DIR)/temp/xi/Xamarin.iOS/Xamarin
$(Q) sed -e 's_<assembly name="Xamarin.TVOS" version="0.0.0.0">_<assembly name="Xamarin.iOS" version="0.0.0.0">_' $(APIDIFF_DIR)/temp/xi/Xamarin.TVOS/Xamarin.TVOS.xml > $(APIDIFF_DIR)/temp/Xamarin.TVOS-as-iOS.xml
$(QF_GEN) $(MONO_BUILD) --debug $(MONO_API_HTML) $< $(APIDIFF_DIR)/temp/Xamarin.TVOS-as-iOS.xml $@

# this is a hack to show the difference between Catalyst (iOS) and iOS
$(APIDIFF_DIR)/maccat-to-ios.md: $(APIDIFF_DIR)/temp/xi/Xamarin.iOS/Xamarin.iOS.xml $(APIDIFF_DIR)/temp/xi/Xamarin.MacCatalyst/Xamarin.iOS.xml
$(Q) mkdir -p $(dir $@)
$(QF_GEN) $(MONO_BUILD) --debug $(MONO_API_HTML) --md $^ $@

# create diff files for all the assemblies per platform

$(APIDIFF_DIR)/mac-api-diff.html: $(foreach file,$(MAC_ASSEMBLIES),$(APIDIFF_DIR)/diff/xm/$(file).html)
Expand Down Expand Up @@ -139,6 +144,7 @@ API_DIFF_DEPENDENCIES += $(APIDIFF_DIR)/diff/ios-to-tvos.html
endif
ifdef INCLUDE_MACCATALYST
API_DIFF_DEPENDENCIES += $(APIDIFF_DIR)/maccat-api-diff.html
API_DIFF_DEPENDENCIES += $(APIDIFF_DIR)/maccat-to-ios.md
endif
endif

Expand Down Expand Up @@ -325,6 +331,7 @@ ifdef INCLUDE_TVOS
endif
ifdef INCLUDE_MACCATALYST
@echo "@MonkeyWrench: AddFile: $(CURDIR)/maccat-api-diff.html"
@echo "@MonkeyWrench: AddFile: $(CURDIR)/maccat-to-ios.md"
endif
endif
$(Q) $(MAKE) $(UNZIP_STAMP)
Expand Down
33 changes: 28 additions & 5 deletions tools/devops/automation/scripts/GitHub.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,41 @@ function New-GitHubSummaryComment {
# we are dealing with an object, not a dictionary
$hasHtmlLinks = "html" -in $json.PSobject.Properties.Name
$hasMDlinks = "gist" -in $json.PSobject.Properties.Name
if ($hasHtmlLinks -and $hasMDlinks) {
if ($hasHtmlLinks -or $hasMDlinks) {
# build the required list
$sb.AppendLine("# API diff")
Write-Host "Message is '$($json.message)'"
$sb.AppendLine($json.message)
$sb.AppendLine("<details><summary>View API diff</summary>")
$sb.AppendLine("") # no new line results in a bad rendering in the links

foreach ($linkPlatform in @("iOS", "macOS", "macCat", "tvOS", "watchOS")) {
$htmlLink = $json.html | Select-Object -ExpandProperty $linkPlatform
$gistLink = $json.gist | Select-Object -ExpandProperty $linkPlatform
$sb.AppendLine("* $linkPlatform [vsdrops]($htmlLink) [gist]($gistLink)")
foreach ($linkPlatform in @("iOS", "macOS", "macCat", "macCatiOS", "tvOS", "watchOS")) {
$htmlLink = ""
$gistLink = ""

$platformHasHtmlLinks = $linkPlatform -in $json.html.PSobject.Properties.Name
$platformHasMDlinks = $linkPlatform -in $json.gist.PSobject.Properties.Name

# some do not have md, some do not have html
if ($platformHasHtmlLinks) {
Write-Host "Found html link for $linkPlatform"
$htmlLinkUrl = $json.html | Select-Object -ExpandProperty $linkPlatform
$htmlLink = "[vsdrops]($htmlLinkUrl)"
}

if ($platformHasMDlinks) {
Write-Host "Found gist link for $linkPlatform"
$gistLinkUrl = $json.gist | Select-Object -ExpandProperty $linkPlatform
$gistLink = "[gist]($gistLinkUrl)"
}

if (($htmlLink -eq "") -and ($gistLink -eq "")) {
$sb.AppendLine("* :fire: $linkPlatform :fire: Missing files")
} else {
# I don't like extra ' ' when we are missing vars, use join
$line = @("*", $linkPlatform, $htmlLink, $gistLink) -join " "
$sb.AppendLine($line)
}
}

$sb.AppendLine("</details>")
Expand Down
3 changes: 2 additions & 1 deletion tools/devops/automation/templates/build/publish-html.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ steps:
$filePatterns = @{
"iOS" = "ios-*.md";
"macOS" = "macos-*.md";
"macCat" = "maccat-*.md";
"macCat" = "maccat-api*.md";
"macCatiOS" = "maccat-to-ios*.md";
"tvOS" = "tvos-*.md";
"watchOS" = "watchos-*.md";
}
Expand Down