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
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "0.38.5",
"commands": [
"dotnet-cake"
]
}
}
}

52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
names:
description: "Cake --names (comma-separated)"
required: false
default: "Google.SignIn"

permissions:
contents: read

jobs:
build:
runs-on: macos-14
env:
CAKE_NAMES: ${{ inputs.names || 'Google.SignIn' }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET (global.json)
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Restore .NET workloads
run: dotnet workload restore Xamarin.Google.sln

- name: Install CocoaPods
run: |
if ! command -v pod >/dev/null 2>&1; then
sudo gem install cocoapods
fi
pod --version

- name: Restore tools
run: dotnet tool restore

- name: Build + pack
run: dotnet tool run dotnet-cake -- --target=nuget --names="${CAKE_NAMES}"

- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: nuget
path: output/*.nupkg
53 changes: 53 additions & 0 deletions .github/workflows/publish-github-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish (GitHub Packages)

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
names:
description: "Cake --names (comma-separated)"
required: false
default: "Google.SignIn"

permissions:
contents: read
packages: write

jobs:
publish:
runs-on: macos-14
env:
CAKE_NAMES: ${{ inputs.names || 'Google.SignIn' }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET (global.json)
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Restore .NET workloads
run: dotnet workload restore Xamarin.Google.sln

- name: Install CocoaPods
run: |
if ! command -v pod >/dev/null 2>&1; then
sudo gem install cocoapods
fi
pod --version

- name: Restore tools
run: dotnet tool restore

- name: Build + pack
run: dotnet tool run dotnet-cake -- --target=nuget --names="${CAKE_NAMES}"

- name: Push packages
run: |
dotnet nuget push "output/*.nupkg" \
--source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
--api-key "${{ secrets.GITHUB_TOKEN }}" \
--skip-duplicate
18 changes: 18 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Agent Instructions (public OSS)

## Non-negotiables
- Documentation and samples must be generic (not app-specific).
- Do not reference private business context.
- Do not commit secrets; samples must rely on local config templates.

## Working agreements
- Keep changes reviewable and releaseable (small PR-sized diffs).
- Prefer minimal disruption to existing package IDs and build scripts.

## Quick commands
- Build and pack a single component (macOS):
- `dotnet tool restore`
- `dotnet tool run dotnet-cake -- --target=nuget --names=Google.SignIn`

## CI
- GitHub Actions should run build/pack validation without requiring any app secrets (publishing uses the built-in `GITHUB_TOKEN`).
5 changes: 5 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ This was a really unfortunate decision from Microsoft. Having these extremely co

Microsoft's current recommendation to iOS.NET developers is that they should write their own bindings using this [slim binding demo project](https://github.com/Redth/DotNet.Platform.SlimBindings) as a guide. However, developers following this approach can find their 'slim bindings' to be incompatible with any other published libraries with dependency conflicts, such as Plugin.Firebase.

## CI and publishing

- Local build instructions: `docs/BUILDING.md`
- GitHub Packages publishing workflow (NuGet): `docs/PUBLISHING_GITHUB_PACKAGES.md`

# Contributing & Sponsoring
As a community-supported continuation, I'm happy to review any PRs to help move this project forward. These libraries almost certainly have some missing or stale bindings. Work needs to happen to keep these bindings current with native SDKs. Whole artifacts still need to be converted from where Microsoft left them. Sample projects need to be updated (or rewritten). Tests would be nice.

Expand Down
12 changes: 12 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ FilePath GetCakeToolPath ()
return new FilePath (p.Modules[0].FileName);
}

string GetDefaultiOSSimulatorRuntimeIdentifier ()
{
var arch = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture;
return arch == System.Runtime.InteropServices.Architecture.Arm64
? "iossimulator-arm64"
: "iossimulator-x64";
}

void BuildCake (string target)
{
var cakeSettings = new CakeSettings {
Expand Down Expand Up @@ -184,6 +192,10 @@ Task ("samples")
.Does(() =>
{
var msBuildSettings = new DotNetCoreMSBuildSettings ();
msBuildSettings.Properties ["Platform"] = new [] { "iPhoneSimulator" };
msBuildSettings.Properties ["RuntimeIdentifier"] = new [] { GetDefaultiOSSimulatorRuntimeIdentifier () };
msBuildSettings.Properties ["EnableCodeSigning"] = new [] { "false" };

var dotNetCoreBuildSettings = new DotNetCoreBuildSettings {
Configuration = "Release",
Verbosity = DotNetCoreVerbosity.Diagnostic,
Expand Down
8 changes: 4 additions & 4 deletions components.cake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Artifact GOOGLE_MAPS_ARTIFACT = new Artifact ("Google.Maps"
Artifact GOOGLE_MOBILE_ADS_ARTIFACT = new Artifact ("Google.MobileAds", "8.13.0.3", "15.0", ComponentGroup.Google, csprojName: "MobileAds");
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.2", "15.0", ComponentGroup.Google, csprojName: "Places");
Artifact GOOGLE_SIGN_IN_ARTIFACT = new Artifact ("Google.SignIn", "8.0.0.4", "15.0", ComponentGroup.Google, csprojName: "SignIn");
Artifact GOOGLE_SIGN_IN_ARTIFACT = new Artifact ("Google.SignIn", "9.0.0.0", "15.0", ComponentGroup.Google, csprojName: "SignIn");
Artifact GOOGLE_TAG_MANAGER_ARTIFACT = new Artifact ("Google.TagManager", "7.4.0.2", "15.0", ComponentGroup.Google, csprojName: "TagManager");

Artifact GOOGLE_GOOGLE_APP_MEASUREMENT_ARTIFACT = new Artifact ("Google.AppMeasurement", "12.5.0.4", "15.0", ComponentGroup.Google, csprojName: "GoogleAppMeasurement");
Expand Down Expand Up @@ -233,10 +233,10 @@ void SetArtifactsPodSpecs ()
PodSpec.Create ("GooglePlaces", "7.4.0")
};
GOOGLE_SIGN_IN_ARTIFACT.PodSpecs = new [] {
PodSpec.Create ("GoogleSignIn", "8.0.0", frameworkSource: FrameworkSource.Pods),
PodSpec.Create ("AppAuth", "1.7.6", frameworkSource: FrameworkSource.Pods),
PodSpec.Create ("GoogleSignIn", "~> 9.0.0", frameworkSource: FrameworkSource.Pods),
PodSpec.Create ("AppAuth", "2.0.0", frameworkSource: FrameworkSource.Pods),
PodSpec.Create ("AppCheckCore", "11.2.0", frameworkSource: FrameworkSource.Pods),
PodSpec.Create ("GTMAppAuth", "4.1.1", frameworkSource: FrameworkSource.Pods),
PodSpec.Create ("GTMAppAuth", "5.0.0", frameworkSource: FrameworkSource.Pods),
};
GOOGLE_TAG_MANAGER_ARTIFACT.PodSpecs = new [] {
PodSpec.Create ("GoogleTagManager", "7.4.0")
Expand Down
37 changes: 37 additions & 0 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Building locally (macOS)

This repo builds .NET iOS/macOS bindings and NuGet packages using Cake.

## Prerequisites

- .NET SDK (see `global.json`)
- Xcode (matching the installed iOS workload requirements)
- CocoaPods (`pod`)

Restore the local Cake tool (any version `< 1.0` should work):

```sh
dotnet tool restore
```

## Build + pack a component

Build and produce `.nupkg` files into `./output`:

```sh
dotnet tool run dotnet-cake -- --target=nuget --names=Google.SignIn
```

## Build samples (using source)

Build sample projects (without publishing packages):

```sh
dotnet tool run dotnet-cake -- --target=samples --names=Google.SignIn
```

Clean generated folders:

```sh
dotnet tool run dotnet-cake -- --target=clean
```
20 changes: 20 additions & 0 deletions docs/NUGET_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Overview

This package is part of a set of .NET bindings for Google and Firebase native iOS SDKs.

## Target frameworks

These packages are intended for iOS and Mac Catalyst TFMs (for example `net8.0-ios`, `net9.0-ios`, `net10.0-ios`).

When multi-targeting, condition the reference so it only restores for iOS:

```xml
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0-ios'">
<PackageReference Include="AdamE.Google.iOS.SignIn" Version="9.0.0.0" />
</ItemGroup>
```

## Notes on native dependency conflicts

Google/Firebase iOS SDKs share native dependencies (xcframeworks). Avoid mixing multiple independent bindings that ship overlapping Google/Firebase native SDK binaries in the same app, as it can lead to duplicate symbols or runtime issues.

31 changes: 31 additions & 0 deletions docs/PUBLISHING_GITHUB_PACKAGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Publishing to GitHub Packages (NuGet)

This repository can publish `.nupkg` files to GitHub Packages (NuGet feed) via GitHub Actions.

## How publishing works

- A tag push triggers the publish workflow.
- The workflow builds and packs NuGet packages.
- Optionally, you can run the workflow manually (`workflow_dispatch`) and pass a custom Cake `--names` value.
- The workflow pushes packages to:
- `https://nuget.pkg.github.com/<OWNER>/index.json`

## Consuming packages

Add GitHub Packages as a NuGet source and authenticate using a GitHub PAT (or workflow token in CI).

Notes:
- The publish workflow uses the built-in `GITHUB_TOKEN` (no extra repository secret is required).
- Local development typically uses a GitHub PAT with `read:packages` (and `repo` for private repos).

Create a local `NuGet.Config` (or update your existing one) and add:

```xml
<configuration>
<packageSources>
<add key="github" value="https://nuget.pkg.github.com/<OWNER>/index.json" />
</packageSources>
</configuration>
```

Then restore using credentials for the `<OWNER>` account.
19 changes: 12 additions & 7 deletions samples/Google/SignIn/SignInExample/AppDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@ public class AppDelegate : UIApplicationDelegate
{
// class-level declarations

public override UIWindow Window {
public override UIWindow? Window {
get;
set;
}

public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
public override bool FinishedLaunching (UIApplication application, NSDictionary? launchOptions)
{
// You can get the GoogleService-Info.plist file at https://developers.google.com/mobile/add
var googleServiceDictionary = NSDictionary.FromFile ("GoogleService-Info.plist");
SignIn.SharedInstance.ClientId = googleServiceDictionary ["CLIENT_ID"].ToString ();
// For a runnable sample, add your own GoogleService-Info.plist (not committed) and set CLIENT_ID.
var googleServiceInfoPath = NSBundle.MainBundle.PathForResource ("GoogleService-Info", "plist");
var googleServiceDictionary = !string.IsNullOrWhiteSpace (googleServiceInfoPath)
? NSMutableDictionary.FromFile (googleServiceInfoPath)
: null;

var clientId = googleServiceDictionary?["CLIENT_ID"]?.ToString ();

if (!string.IsNullOrWhiteSpace (clientId))
SignIn.SharedInstance.Configuration = new Configuration (clientId);

return true;
}
Expand All @@ -40,5 +47,3 @@ public override bool OpenUrl (UIApplication application, NSUrl url, string sourc
}
}
}


26 changes: 0 additions & 26 deletions samples/Google/SignIn/SignInExample/GoogleService-Info.plist

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>YOUR_CLIENT_ID.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.YOUR_REVERSED_CLIENT_ID</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.example.signinexample</string>
<key>IS_SIGNIN_ENABLED</key>
<true/>
</dict>
</plist>

2 changes: 1 addition & 1 deletion samples/Google/SignIn/SignInExample/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
UIApplication.Main (args, null, typeof (AppDelegate));
}
}
}
Loading