Skip to content
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
15 changes: 11 additions & 4 deletions .github/workflows/google-foundation-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- "*.cake"
- "icons/googleiosmaps_128x128.png"
- "icons/googleiosplaces_128x128.png"
- "scripts/check-maps-resource-manifest.py"
- "source/AssemblyInfo.cs"
- "source/Google/Maps/**"
- "source/Google/Places/**"
Expand All @@ -34,7 +33,6 @@ on:
- "*.cake"
- "icons/googleiosmaps_128x128.png"
- "icons/googleiosplaces_128x128.png"
- "scripts/check-maps-resource-manifest.py"
- "source/AssemblyInfo.cs"
- "source/Google/Maps/**"
- "source/Google/Places/**"
Expand Down Expand Up @@ -154,15 +152,24 @@ jobs:
- name: Pack Google.Maps
run: dotnet tool run dotnet-cake -- --target=nuget --names=Google.Maps

- name: Maps resource manifest check
run: python3 scripts/check-maps-resource-manifest.py
- name: Package structure checks
run: >-
tools/e2e/check-package-structure.sh
--target Maps
--package-dir output

- name: Direct and transitive consumer checks
run: >-
tools/e2e/check-consumer-shapes.sh
--target Maps
--package-dir output

- name: Offline build proof
run: >-
tools/e2e/check-offline-build.sh
--target Maps
--package-dir output

- name: Simulator E2E
run: >-
tools/e2e/run-google-foundation.sh
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Firebase `12.10.0` is the current published Firebase package line.

| Package | Version |
| --- | --- |
| `Maps` | `9.2.0.8` |
| `Maps` | `9.2.0.9` |
| `Places` | `7.4.0.3` |
| `SignIn` | `9.0.0` |

Expand Down
2 changes: 2 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ Task ("externals")
FirebaseAnalyticsDownload ();
if (ARTIFACTS_TO_BUILD.Contains (GOOGLE_GOOGLE_APP_MEASUREMENT_ARTIFACT))
GoogleAppMeasurementDownload ();
if (ARTIFACTS_TO_BUILD.Contains (GOOGLE_MAPS_ARTIFACT))
GoogleMapsDownload ();
if (ARTIFACTS_TO_BUILD.Contains (GOOGLE_PLACES_ARTIFACT))
GooglePlacesDownload ();
});
Expand Down
4 changes: 2 additions & 2 deletions components.cake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Artifact FIREBASE_APP_CHECK_ARTIFACT = new Artifact ("Firebase.App
// Google artifacts available to be built. These artifacts generate NuGets.
Artifact GOOGLE_ANALYTICS_ARTIFACT = new Artifact ("Google.Analytics", "3.20.0.2", "15.0", ComponentGroup.Google, csprojName: "Analytics");
Artifact GOOGLE_CAST_ARTIFACT = new Artifact ("Google.Cast", "4.7.0.1", "15.0", ComponentGroup.Google, csprojName: "Cast");
Artifact GOOGLE_MAPS_ARTIFACT = new Artifact ("Google.Maps", "9.2.0.8", "15.0", ComponentGroup.Google, csprojName: "Maps");
Artifact GOOGLE_MAPS_ARTIFACT = new Artifact ("Google.Maps", "9.2.0.9", "15.0", ComponentGroup.Google, csprojName: "Maps");
Artifact GOOGLE_UMP_ARTIFACT = new Artifact ("Google.UserMessagingPlatform", "1.1.0.1", "15.0", ComponentGroup.Google, csprojName: "UserMessagingPlatform");
Artifact GOOGLE_PLACES_ARTIFACT = new Artifact ("Google.Places", "7.4.0.3", "15.0", ComponentGroup.Google, csprojName: "Places");
Artifact GOOGLE_APP_CHECK_CORE_ARTIFACT = new Artifact ("Google.AppCheckCore", "11.2.0.0", "15.0", ComponentGroup.Google, csprojName: "AppCheckCore");
Expand Down Expand Up @@ -220,7 +220,7 @@ void SetArtifactsPodSpecs ()
PodSpec.Create ("google-cast-sdk", "4.7.0")
};
GOOGLE_MAPS_ARTIFACT.PodSpecs = new [] {
PodSpec.Create ("GoogleMaps", "9.2.0")
PodSpec.Create ("GoogleMaps", "9.2.0", frameworkSource: FrameworkSource.Custom)
};
GOOGLE_UMP_ARTIFACT.PodSpecs = new [] {
PodSpec.Create ("GoogleUserMessagingPlatform", "1.1.0")
Expand Down
71 changes: 68 additions & 3 deletions custom_externals_download.cake
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,44 @@ class ExternalDownloadSource
public string Version { get; }
public string ArchiveKey { get; }
public string UrlPrefix { get; }

public ExternalDownloadSource (string id, string version, string archiveKey, string urlPrefix = DefaultUrlPrefix)
public string ExtractionRootName { get; }
public string ExpectedSha256 { get; }

public ExternalDownloadSource (
string id,
string version,
string archiveKey,
string urlPrefix = DefaultUrlPrefix,
string extractionRootName = null,
string expectedSha256 = null)
{
Id = id;
Version = version;
ArchiveKey = archiveKey;
UrlPrefix = urlPrefix;
ExtractionRootName = extractionRootName ?? $"{Id}-{Version}";
ExpectedSha256 = expectedSha256;
}

public string ArchiveFileName => $"{Id}-{Version}.tar.gz";
public string ExtractionRootName => $"{Id}-{Version}";
public string Url => $"{UrlPrefix}/{ArchiveKey}/{ArchiveFileName}";
}

// *.tar.gz URLs can be found in the podspecs (e.g., CocoaPods Specs repo paths), such as:
// FirebaseAnalytics: https://github.com/CocoaPods/Specs/tree/master/Specs/e/2/1/FirebaseAnalytics
// GoogleAppMeasurement: https://github.com/CocoaPods/Specs/tree/master/Specs/e/3/b/GoogleAppMeasurement
// GoogleMaps: https://github.com/CocoaPods/Specs/tree/master/Specs/1/9/0/GoogleMaps
// GooglePlaces: https://github.com/CocoaPods/Specs/tree/master/Specs/c/3/2/GooglePlaces
var ExternalDownloads = new Dictionary<string, ExternalDownloadSource> {
{ "FirebaseAnalytics", new ExternalDownloadSource ("FirebaseAnalytics", "12.10.0", "3c185b45848d98d8") },
{ "GoogleAppMeasurement", new ExternalDownloadSource ("GoogleAppMeasurement", "12.10.0", "5f5e4d8cb469941e") },
{ "GoogleMaps", new ExternalDownloadSource (
"GoogleMaps",
"9.2.0",
"33a7ac549361ab23",
"https://dl.google.com/dl/cpdc",
extractionRootName: "Maps",
expectedSha256: "81bbd92c2d627087ae222ae955e5f746590812d7389b9d800add15e4004b6431") },
{ "GooglePlaces", new ExternalDownloadSource ("GooglePlaces", "7.4.0", "3e8dc2602895d53405d075ff4eb569bff93ff1af97e69915d1e657c07ef28dd8", "https://dl.google.com/dl/geosdk") },
};

Expand Down Expand Up @@ -60,6 +77,7 @@ void DownloadAndExtract (ExternalDownloadSource source, Func<bool> artifactsAlre
DeleteFile (archivePath);

DownloadArchive (source, archivePath);
VerifyArchiveHash (source, archivePath);

var exitCode = ExtractArchive (source, externalsPath, archivePath);

Expand All @@ -84,6 +102,22 @@ void DownloadArchive (ExternalDownloadSource source, FilePath archivePath)
DownloadFile (source.Url, archivePath);
}

void VerifyArchiveHash (ExternalDownloadSource source, FilePath archivePath)
{
if (string.IsNullOrWhiteSpace (source.ExpectedSha256))
return;

string actualSha256;
using (var stream = System.IO.File.OpenRead (archivePath.FullPath))
using (var sha256 = System.Security.Cryptography.SHA256.Create ())
actualSha256 = BitConverter.ToString (sha256.ComputeHash (stream)).Replace ("-", "").ToLowerInvariant ();

if (!string.Equals (actualSha256, source.ExpectedSha256, StringComparison.OrdinalIgnoreCase))
throw new Exception ($"SHA-256 mismatch for {source.ArchiveFileName}: expected {source.ExpectedSha256}, got {actualSha256}.");

Information ($"Verified SHA-256 for {source.ArchiveFileName}.");
}

void FirebaseAnalyticsDownload ()
{
var source = ExternalDownloads["FirebaseAnalytics"];
Expand Down Expand Up @@ -126,6 +160,37 @@ void GooglePlacesDownload ()
});
}

void GoogleMapsDownload ()
{
var source = ExternalDownloads["GoogleMaps"];

DownloadAndExtract (
source,
() => DirectoryExists (new DirectoryPath ("./externals/GoogleMaps.xcframework")) &&
DirectoryExists (new DirectoryPath ("./externals/GoogleMaps.bundle")),
(extractionRoot, externalsPath, deleteSettings) => {
var frameworkSource = extractionRoot.Combine ("Frameworks").Combine ("GoogleMaps.xcframework");
var resourceSource = extractionRoot.Combine ("Resources").Combine ("GoogleMapsResources").Combine ("GoogleMaps.bundle");
var frameworkDestination = externalsPath.Combine ("GoogleMaps.xcframework");
var resourceDestination = externalsPath.Combine ("GoogleMaps.bundle");

if (!DirectoryExists (frameworkSource))
throw new Exception ($"Expected GoogleMaps.xcframework at {frameworkSource} after extraction.");

if (!DirectoryExists (resourceSource))
throw new Exception ($"Expected GoogleMaps.bundle at {resourceSource} after extraction.");

if (DirectoryExists (frameworkDestination))
DeleteDirectory (frameworkDestination, deleteSettings);

if (DirectoryExists (resourceDestination))
DeleteDirectory (resourceDestination, deleteSettings);

CopyDirectory (frameworkSource, frameworkDestination);
CopyDirectory (resourceSource, resourceDestination);
});
}

void GoogleAppMeasurementDownload ()
{
var source = ExternalDownloads["GoogleAppMeasurement"];
Expand Down
Loading
Loading