Skip to content

Commit 413dfef

Browse files
authored
[Vertex AI] Prepare podspec for a CocoaPods release (firebase#13585)
1 parent 7c6c555 commit 413dfef

File tree

7 files changed

+105
-51
lines changed

7 files changed

+105
-51
lines changed

.github/workflows/vertexai.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,29 @@ jobs:
7272
retry_wait_seconds: 120
7373
command: scripts/build.sh FirebaseVertexAIIntegration ${{ matrix.target }} spm
7474

75+
pod-lib-lint:
76+
# Don't run on private repo unless it is a PR.
77+
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
78+
strategy:
79+
matrix:
80+
target: [ios]
81+
os: [macos-14]
82+
include:
83+
- os: macos-14
84+
xcode: Xcode_15.2
85+
runs-on: ${{ matrix.os }}
86+
steps:
87+
- uses: actions/checkout@v4
88+
- name: Clone mock responses
89+
run: scripts/update_vertexai_responses.sh
90+
- uses: ruby/setup-ruby@v1
91+
- name: Setup Bundler
92+
run: scripts/setup_bundler.sh
93+
- name: Xcode
94+
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
95+
- name: Build and test
96+
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseVertexAI.podspec --platforms=${{ matrix.target }}
97+
7598
sample:
7699
strategy:
77100
matrix:

FirebaseVertexAI-Docs.not_podspec

Lines changed: 0 additions & 47 deletions
This file was deleted.

FirebaseVertexAI.podspec

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'FirebaseVertexAI'
3+
s.version = '11.2.0-beta'
4+
s.summary = 'Vertex AI in Firebase - Public Preview'
5+
6+
s.description = <<-DESC
7+
[Public Preview] Build AI-powered apps and features with the Gemini API using
8+
the Vertex AI in Firebase SDK.
9+
DESC
10+
11+
s.homepage = 'https://firebase.google.com'
12+
s.license = { :type => 'Apache-2.0', :file => 'LICENSE' }
13+
s.authors = 'Google, Inc.'
14+
15+
s.source = {
16+
:git => 'https://github.com/firebase/firebase-ios-sdk.git',
17+
:tag => 'CocoaPods-' + s.version.to_s
18+
}
19+
20+
s.social_media_url = 'https://twitter.com/Firebase'
21+
22+
ios_deployment_target = '15.0'
23+
osx_deployment_target = '11.0'
24+
tvos_deployment_target = '15.0'
25+
watchos_deployment_target = '8.0'
26+
27+
s.ios.deployment_target = ios_deployment_target
28+
s.osx.deployment_target = osx_deployment_target
29+
s.tvos.deployment_target = tvos_deployment_target
30+
s.watchos.deployment_target = watchos_deployment_target
31+
32+
s.cocoapods_version = '>= 1.12.0'
33+
s.prefix_header_file = false
34+
35+
s.source_files = [
36+
'FirebaseVertexAI/Sources/**/*.swift',
37+
]
38+
39+
s.swift_version = '5.9'
40+
41+
s.framework = 'Foundation'
42+
s.ios.framework = 'UIKit'
43+
s.osx.framework = 'AppKit'
44+
s.tvos.framework = 'UIKit'
45+
s.watchos.framework = 'WatchKit'
46+
47+
s.dependency 'FirebaseAppCheckInterop', '~> 11.2'
48+
s.dependency 'FirebaseAuthInterop', '~> 11.2'
49+
s.dependency 'FirebaseCore', '~> 11.2'
50+
s.dependency 'FirebaseCoreExtension', '~> 11.2'
51+
52+
s.test_spec 'unit' do |unit_tests|
53+
unit_tests_dir = 'FirebaseVertexAI/Tests/Unit/'
54+
unit_tests.scheme = { :code_coverage => true }
55+
unit_tests.platforms = {
56+
:ios => ios_deployment_target,
57+
:osx => osx_deployment_target,
58+
:tvos => tvos_deployment_target
59+
}
60+
unit_tests.source_files = [
61+
unit_tests_dir + '**/*.swift',
62+
]
63+
unit_tests.resources = [
64+
unit_tests_dir + 'vertexai-sdk-test-data/mock-responses/**/*.{txt,json}',
65+
]
66+
end
67+
end

FirebaseVertexAI/Tests/Unit/ChatTests.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ final class ChatTests: XCTestCase {
3232
}
3333

3434
func testMergingText() async throws {
35-
let fileURL = try XCTUnwrap(Bundle.module.url(
35+
#if SWIFT_PACKAGE
36+
let bundle = Bundle.module
37+
#else // SWIFT_PACKAGE
38+
let bundle = Bundle(for: Self.self)
39+
#endif // SWIFT_PACKAGE
40+
let fileURL = try XCTUnwrap(bundle.url(
3641
forResource: "streaming-success-basic-reply-parts",
3742
withExtension: "txt"
3843
))

FirebaseVertexAI/Tests/Unit/GenerativeModelTests.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,12 @@ final class GenerativeModelTests: XCTestCase {
12781278
#if os(watchOS)
12791279
throw XCTSkip("Custom URL protocols are unsupported in watchOS 2 and later.")
12801280
#endif // os(watchOS)
1281-
let fileURL = try XCTUnwrap(Bundle.module.url(forResource: name, withExtension: ext))
1281+
#if SWIFT_PACKAGE
1282+
let bundle = Bundle.module
1283+
#else // SWIFT_PACKAGE
1284+
let bundle = Bundle(for: Self.self)
1285+
#endif // SWIFT_PACKAGE
1286+
let fileURL = try XCTUnwrap(bundle.url(forResource: name, withExtension: ext))
12821287
return { request in
12831288
let requestURL = try XCTUnwrap(request.url)
12841289
XCTAssertEqual(requestURL.path.occurrenceCount(of: "models/"), 1)

FirebaseVertexAI/Tests/Unit/VertexComponentTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
import FirebaseCore
1616
import Foundation
17-
import SharedTestUtilities
1817
import XCTest
1918

19+
@_implementationOnly import FirebaseCoreExtension
20+
2021
@testable import FirebaseVertexAI
2122

2223
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ let package = Package(
13051305
),
13061306
.testTarget(
13071307
name: "FirebaseVertexAIUnit",
1308-
dependencies: ["FirebaseVertexAI", "SharedTestUtilities"],
1308+
dependencies: ["FirebaseVertexAI"],
13091309
path: "FirebaseVertexAI/Tests/Unit",
13101310
resources: [
13111311
.process("vertexai-sdk-test-data/mock-responses"),

0 commit comments

Comments
 (0)