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
27 changes: 27 additions & 0 deletions .github/scripts/check-version-drift.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# Verify OptimizelySwiftSDK version is the same in both podspec and Package.swift.
# Exits non-zero if versions diverge (FR-014).

set -euo pipefail

PODSPEC="ios/optimizely_flutter_sdk.podspec"
PACKAGE_SWIFT="ios/optimizely_flutter_sdk/Package.swift"

PODSPEC_VER=$(grep "OptimizelySwiftSDK" "$PODSPEC" | grep -oE "'[0-9]+\.[0-9]+\.[0-9]+'" | tr -d "'")
SPM_VER=$(grep 'exact' "$PACKAGE_SWIFT" | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"')

if [ -z "$PODSPEC_VER" ] || [ -z "$SPM_VER" ]; then
echo "FAIL: Could not extract version from one or both files"
echo " podspec: ${PODSPEC_VER:-<not found>}"
echo " Package.swift: ${SPM_VER:-<not found>}"
exit 1
fi

if [ "$PODSPEC_VER" != "$SPM_VER" ]; then
echo "FAIL: OptimizelySwiftSDK version mismatch"
echo " podspec: $PODSPEC_VER"
echo " Package.swift: $SPM_VER"
exit 1
fi

echo "OK: OptimizelySwiftSDK version matches ($PODSPEC_VER)"
31 changes: 20 additions & 11 deletions .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ on:
# default: "master"

jobs:
version_drift_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check OptimizelySwiftSDK version parity
run: bash .github/scripts/check-version-drift.sh

unit_test_coverage:
runs-on: macos-latest

needs: version_drift_check

steps:
- uses: actions/checkout@v3
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.44.0'
channel: 'stable'
architecture: x64
- name: Install app dependencies
Expand Down Expand Up @@ -127,32 +136,32 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: 'stable' # or: 'beta' or 'master'
flutter-version: '3.44.0'
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:arch:-:channel:-:version:-:hash:' # optional, change this to force refresh cache
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path
architecture: x64 # optional, x64 or arm64
- run: flutter --version

cache-key: 'flutter-:os:-:arch:-:channel:-:version:-:hash:'
cache-path: ${{ runner.tool_cache }}/flutter
architecture: x64
- name: Setup java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.0.5'
- run: flutter pub get
- run: flutter test

build_test_ios:
runs-on: macos-latest

needs: version_drift_check

steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.44.0'
channel: 'stable'
architecture: x64
- name: Enable Swift Package Manager
run: flutter config --enable-swift-package-manager
- run: flutter pub get
- run: flutter test
3 changes: 3 additions & 0 deletions .specify/feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"feature_directory": "specs/001-cocoapods-to-spm-migration"
}
6 changes: 4 additions & 2 deletions .specify/memory/constitution.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ The source-of-truth for current versions is always the build files
themselves — not this document:

- **iOS**: `OptimizelySwiftSDK` version in
`ios/optimizely_flutter_sdk.podspec`.
`ios/optimizely_flutter_sdk.podspec` (CocoaPods) and
`ios/optimizely_flutter_sdk/Package.swift` (SPM). Both files MUST
declare the same version.
- **Android**: `com.optimizely.ab:android-sdk` version in
`android/build.gradle`.

Expand Down Expand Up @@ -343,4 +345,4 @@ All code changes MUST comply with the principles defined above.
- Use `CLAUDE.md` for runtime development guidance that supplements
(but does not override) this constitution.

**Version**: 1.1.0 | **Ratified**: 2022-06-07 | **Last Amended**: 2026-08-20
**Version**: 1.1.1 | **Ratified**: 2022-06-07 | **Last Amended**: 2026-08-22
16 changes: 11 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Optimizely Flutter SDK - Cross-platform plugin wrapping native Optimizely SDKs (
```bash
# Setup
flutter pub get
cd ios && pod install # iOS dependencies

# Testing
flutter test # All tests
Expand Down Expand Up @@ -74,11 +73,17 @@ Native Optimizely SDKs (check podspec/build.gradle for current versions)

## Version Management

**Three locations must stay synchronized:**
**Three locations must stay synchronized (SDK version):**
1. `pubspec.yaml` → `version: X.Y.Z`
2. `lib/package_info.dart` → `version = 'X.Y.Z'`
3. `README.md` → Installation example `^X.Y.Z`

**Two locations must stay synchronized (native iOS SDK version):**
1. `ios/optimizely_flutter_sdk.podspec` → `s.dependency 'OptimizelySwiftSDK', 'A.B.C'`
2. `ios/optimizely_flutter_sdk/Package.swift` → `.package(url: "...swift-sdk.git", exact: "A.B.C")`

A CI check (`.github/scripts/check-version-drift.sh`) enforces parity between these two files.

## Release Workflow

### With Claude Code (Recommended)
Expand Down Expand Up @@ -187,7 +192,7 @@ Follow [Angular guidelines](https://github.com/angular/angular/blob/master/CONTR
**iOS:**
- Minimum: iOS 10.0
- Swift: 5.0
- Native SDK: OptimizelySwiftSDK (see ios/optimizely_flutter_sdk.podspec for current version)
- Native SDK: OptimizelySwiftSDK (see ios/optimizely_flutter_sdk.podspec and ios/optimizely_flutter_sdk/Package.swift for current version)

## Key Implementation Files

Expand All @@ -203,8 +208,9 @@ Follow [Angular guidelines](https://github.com/angular/angular/blob/master/CONTR
- `android/build.gradle` - Dependencies & SDK versions

**iOS Layer:**
- `ios/Classes/SwiftOptimizelyFlutterSdkPlugin.swift` - Plugin implementation (786 LOC)
- `ios/Classes/OptimizelyFlutterLogger.swift` - Logger bridge (main-thread dispatch)
- `ios/optimizely_flutter_sdk/Sources/optimizely_flutter_sdk/SwiftOptimizelyFlutterSdkPlugin.swift` - Plugin implementation (786 LOC)
- `ios/optimizely_flutter_sdk/Sources/optimizely_flutter_sdk/OptimizelyFlutterLogger.swift` - Logger bridge (main-thread dispatch)
- `ios/optimizely_flutter_sdk/Package.swift` - SPM dependencies
- `ios/optimizely_flutter_sdk.podspec` - CocoaPods dependencies

<!-- SPECKIT START -->
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ See the [pubspec.yaml](https://github.com/optimizely/optimizely-flutter-sdk/blob

On the Android platform, the SDK requires a minimum SDK version of 21 or higher and compile SDK version of 32.

On the iOS platform, the SDK requires a minimum version of 10.0.
On the iOS platform, the SDK requires a minimum version of 10.0. The SDK supports both Swift Package Manager (SPM) and CocoaPods for iOS dependency resolution. Flutter 3.44+ uses SPM by default; older versions use CocoaPods.

Other Flutter platforms are not currently supported by this SDK.

Expand Down
7 changes: 7 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ analyzer:
exclude:
- example/**
- test/**
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
2 changes: 2 additions & 0 deletions example/ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*

**/swiftpm/

# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
Expand Down
Loading
Loading