Skip to content

Commit e916f47

Browse files
author
Firefox Sync Engineering
committed
Nightly auto-update (128.0.20240515050300)
1 parent 151eefb commit e916f47

File tree

11 files changed

+567
-33
lines changed

11 files changed

+567
-33
lines changed

Package.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// swift-tools-version:5.4
22
import PackageDescription
33

4-
let checksum = "b7a6d4d920bb7b621d918b1110a6b4b8955ee95136aefb9b449dc04cee98244d"
5-
let version = "128.0.20240514050332"
6-
let url = "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.application-services.v2.swift.128.20240514050332/artifacts/public/build/MozillaRustComponents.xcframework.zip"
4+
let checksum = "95bab3ea5671b3dd891fa2b6b5af29a0edb7239ec29d38616daa64abd76cc097"
5+
let version = "128.0.20240515050300"
6+
let url = "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.application-services.v2.swift.128.20240515050300/artifacts/public/build/MozillaRustComponents.xcframework.zip"
77

88
// Focus xcframework
9-
let focusChecksum = "8da945a68aedff93252efeacdbc555d5df746065ac89137951fed1243f268550"
10-
let focusUrl = "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.application-services.v2.swift.128.20240514050332/artifacts/public/build/FocusRustComponents.xcframework.zip"
9+
let focusChecksum = "293169787ae64a3d2215f6f9426f8e8e96434f65d4ac57133d1d6d85203f890b"
10+
let focusUrl = "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.application-services.v2.swift.128.20240515050300/artifacts/public/build/FocusRustComponents.xcframework.zip"
1111
let package = Package(
1212
name: "MozillaRustComponentsSwift",
1313
platforms: [.iOS(.v14)],

swift-source/all/Generated/Metrics/Metrics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extension GleanMetrics {
2323
// Intentionally left private, no external user can instantiate a new global object.
2424
}
2525

26-
public static let info = BuildInfo(buildDate: DateComponents(calendar: Calendar.current, timeZone: TimeZone(abbreviation: "UTC"), year: 2024, month: 5, day: 14, hour: 5, minute: 13, second: 53))
26+
public static let info = BuildInfo(buildDate: DateComponents(calendar: Calendar.current, timeZone: TimeZone(abbreviation: "UTC"), year: 2024, month: 5, day: 15, hour: 5, minute: 21, second: 33))
2727
}
2828

2929
enum NimbusEvents {

swift-source/all/Generated/nimbus.swift

Lines changed: 200 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -549,11 +549,12 @@ open class NimbusClient:
549549
return try! rustCall { uniffi_nimbus_fn_clone_nimbusclient(self.pointer, $0) }
550550
}
551551

552-
public convenience init(appCtx: AppContext, coenrollingFeatureIds: [String], dbpath: String, remoteSettingsConfig: RemoteSettingsConfig?, metricsHandler: MetricsHandler) throws {
552+
public convenience init(appCtx: AppContext, recordedContext: RecordedContext?, coenrollingFeatureIds: [String], dbpath: String, remoteSettingsConfig: RemoteSettingsConfig?, metricsHandler: MetricsHandler) throws {
553553
let pointer =
554554
try rustCallWithError(FfiConverterTypeNimbusError.lift) {
555555
uniffi_nimbus_fn_constructor_nimbusclient_new(
556556
FfiConverterTypeAppContext.lower(appCtx),
557+
FfiConverterOptionTypeRecordedContext.lower(recordedContext),
557558
FfiConverterSequenceString.lower(coenrollingFeatureIds),
558559
FfiConverterString.lower(dbpath),
559560
FfiConverterOptionTypeRemoteSettingsConfig.lower(remoteSettingsConfig),
@@ -965,6 +966,175 @@ public func FfiConverterTypeNimbusTargetingHelper_lower(_ value: NimbusTargeting
965966
return FfiConverterTypeNimbusTargetingHelper.lower(value)
966967
}
967968

969+
public protocol RecordedContext: AnyObject {
970+
func record()
971+
972+
func toJson() -> JsonObject
973+
}
974+
975+
open class RecordedContextImpl:
976+
RecordedContext
977+
{
978+
fileprivate let pointer: UnsafeMutableRawPointer!
979+
980+
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
981+
public struct NoPointer {
982+
public init() {}
983+
}
984+
985+
// TODO: We'd like this to be `private` but for Swifty reasons,
986+
// we can't implement `FfiConverter` without making this `required` and we can't
987+
// make it `required` without making it `public`.
988+
public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
989+
self.pointer = pointer
990+
}
991+
992+
/// This constructor can be used to instantiate a fake object.
993+
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
994+
///
995+
/// - Warning:
996+
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
997+
public init(noPointer _: NoPointer) {
998+
pointer = nil
999+
}
1000+
1001+
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
1002+
return try! rustCall { uniffi_nimbus_fn_clone_recordedcontext(self.pointer, $0) }
1003+
}
1004+
1005+
// No primary constructor declared for this class.
1006+
1007+
deinit {
1008+
guard let pointer = pointer else {
1009+
return
1010+
}
1011+
1012+
try! rustCall { uniffi_nimbus_fn_free_recordedcontext(pointer, $0) }
1013+
}
1014+
1015+
open func record() { try! rustCall {
1016+
uniffi_nimbus_fn_method_recordedcontext_record(self.uniffiClonePointer(), $0)
1017+
}
1018+
}
1019+
1020+
open func toJson() -> JsonObject {
1021+
return try! FfiConverterTypeJsonObject.lift(try! rustCall {
1022+
uniffi_nimbus_fn_method_recordedcontext_to_json(self.uniffiClonePointer(), $0)
1023+
})
1024+
}
1025+
}
1026+
1027+
// Magic number for the Rust proxy to call using the same mechanism as every other method,
1028+
// to free the callback once it's dropped by Rust.
1029+
private let IDX_CALLBACK_FREE: Int32 = 0
1030+
// Callback return codes
1031+
private let UNIFFI_CALLBACK_SUCCESS: Int32 = 0
1032+
private let UNIFFI_CALLBACK_ERROR: Int32 = 1
1033+
private let UNIFFI_CALLBACK_UNEXPECTED_ERROR: Int32 = 2
1034+
1035+
// Put the implementation in a struct so we don't pollute the top-level namespace
1036+
private enum UniffiCallbackInterfaceRecordedContext {
1037+
// Create the VTable using a series of closures.
1038+
// Swift automatically converts these into C callback functions.
1039+
static var vtable: UniffiVTableCallbackInterfaceRecordedContext = .init(
1040+
record: { (
1041+
uniffiHandle: UInt64,
1042+
_: UnsafeMutableRawPointer,
1043+
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
1044+
) in
1045+
let makeCall = {
1046+
() throws in
1047+
guard let uniffiObj = try? FfiConverterTypeRecordedContext.handleMap.get(handle: uniffiHandle) else {
1048+
throw UniffiInternalError.unexpectedStaleHandle
1049+
}
1050+
return uniffiObj.record(
1051+
)
1052+
}
1053+
1054+
let writeReturn = { () }
1055+
uniffiTraitInterfaceCall(
1056+
callStatus: uniffiCallStatus,
1057+
makeCall: makeCall,
1058+
writeReturn: writeReturn
1059+
)
1060+
},
1061+
toJson: { (
1062+
uniffiHandle: UInt64,
1063+
uniffiOutReturn: UnsafeMutablePointer<RustBuffer>,
1064+
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
1065+
) in
1066+
let makeCall = {
1067+
() throws -> JsonObject in
1068+
guard let uniffiObj = try? FfiConverterTypeRecordedContext.handleMap.get(handle: uniffiHandle) else {
1069+
throw UniffiInternalError.unexpectedStaleHandle
1070+
}
1071+
return uniffiObj.toJson(
1072+
)
1073+
}
1074+
1075+
let writeReturn = { uniffiOutReturn.pointee = FfiConverterTypeJsonObject.lower($0) }
1076+
uniffiTraitInterfaceCall(
1077+
callStatus: uniffiCallStatus,
1078+
makeCall: makeCall,
1079+
writeReturn: writeReturn
1080+
)
1081+
},
1082+
uniffiFree: { (uniffiHandle: UInt64) in
1083+
let result = try? FfiConverterTypeRecordedContext.handleMap.remove(handle: uniffiHandle)
1084+
if result == nil {
1085+
print("Uniffi callback interface RecordedContext: handle missing in uniffiFree")
1086+
}
1087+
}
1088+
)
1089+
}
1090+
1091+
private func uniffiCallbackInitRecordedContext() {
1092+
uniffi_nimbus_fn_init_callback_vtable_recordedcontext(&UniffiCallbackInterfaceRecordedContext.vtable)
1093+
}
1094+
1095+
public struct FfiConverterTypeRecordedContext: FfiConverter {
1096+
fileprivate static var handleMap = UniffiHandleMap<RecordedContext>()
1097+
1098+
typealias FfiType = UnsafeMutableRawPointer
1099+
typealias SwiftType = RecordedContext
1100+
1101+
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RecordedContext {
1102+
return RecordedContextImpl(unsafeFromRawPointer: pointer)
1103+
}
1104+
1105+
public static func lower(_ value: RecordedContext) -> UnsafeMutableRawPointer {
1106+
guard let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: handleMap.insert(obj: value))) else {
1107+
fatalError("Cast to UnsafeMutableRawPointer failed")
1108+
}
1109+
return ptr
1110+
}
1111+
1112+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RecordedContext {
1113+
let v: UInt64 = try readInt(&buf)
1114+
// The Rust code won't compile if a pointer won't fit in a UInt64.
1115+
// We have to go via `UInt` because that's the thing that's the size of a pointer.
1116+
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
1117+
if ptr == nil {
1118+
throw UniffiInternalError.unexpectedNullPointer
1119+
}
1120+
return try lift(ptr!)
1121+
}
1122+
1123+
public static func write(_ value: RecordedContext, into buf: inout [UInt8]) {
1124+
// This fiddling is because `Int` is the thing that's the same size as a pointer.
1125+
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
1126+
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
1127+
}
1128+
}
1129+
1130+
public func FfiConverterTypeRecordedContext_lift(_ pointer: UnsafeMutableRawPointer) throws -> RecordedContext {
1131+
return try FfiConverterTypeRecordedContext.lift(pointer)
1132+
}
1133+
1134+
public func FfiConverterTypeRecordedContext_lower(_ value: RecordedContext) -> UnsafeMutableRawPointer {
1135+
return FfiConverterTypeRecordedContext.lower(value)
1136+
}
1137+
9681138
public struct AppContext {
9691139
public var appName: String
9701140
public var appId: String
@@ -1906,14 +2076,6 @@ public protocol MetricsHandler: AnyObject {
19062076
func recordMalformedFeatureConfig(event: MalformedFeatureConfigExtraDef)
19072077
}
19082078

1909-
// Magic number for the Rust proxy to call using the same mechanism as every other method,
1910-
// to free the callback once it's dropped by Rust.
1911-
private let IDX_CALLBACK_FREE: Int32 = 0
1912-
// Callback return codes
1913-
private let UNIFFI_CALLBACK_SUCCESS: Int32 = 0
1914-
private let UNIFFI_CALLBACK_ERROR: Int32 = 1
1915-
private let UNIFFI_CALLBACK_UNEXPECTED_ERROR: Int32 = 2
1916-
19172079
// Put the implementation in a struct so we don't pollute the top-level namespace
19182080
private enum UniffiCallbackInterfaceMetricsHandler {
19192081
// Create the VTable using a series of closures.
@@ -2093,6 +2255,27 @@ private struct FfiConverterOptionString: FfiConverterRustBuffer {
20932255
}
20942256
}
20952257

2258+
private struct FfiConverterOptionTypeRecordedContext: FfiConverterRustBuffer {
2259+
typealias SwiftType = RecordedContext?
2260+
2261+
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
2262+
guard let value = value else {
2263+
writeInt(&buf, Int8(0))
2264+
return
2265+
}
2266+
writeInt(&buf, Int8(1))
2267+
FfiConverterTypeRecordedContext.write(value, into: &buf)
2268+
}
2269+
2270+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
2271+
switch try readInt(&buf) as Int8 {
2272+
case 0: return nil
2273+
case 1: return try FfiConverterTypeRecordedContext.read(from: &buf)
2274+
default: throw UniffiInternalError.unexpectedOptionalTag
2275+
}
2276+
}
2277+
}
2278+
20962279
private struct FfiConverterOptionTypeRemoteSettingsConfig: FfiConverterRustBuffer {
20972280
typealias SwiftType = RemoteSettingsConfig?
20982281

@@ -2401,7 +2584,13 @@ private var initializationResult: InitializationResult {
24012584
if uniffi_nimbus_checksum_method_nimbustargetinghelper_eval_jexl() != 42395 {
24022585
return InitializationResult.apiChecksumMismatch
24032586
}
2404-
if uniffi_nimbus_checksum_constructor_nimbusclient_new() != 55869 {
2587+
if uniffi_nimbus_checksum_method_recordedcontext_record() != 5916 {
2588+
return InitializationResult.apiChecksumMismatch
2589+
}
2590+
if uniffi_nimbus_checksum_method_recordedcontext_to_json() != 530 {
2591+
return InitializationResult.apiChecksumMismatch
2592+
}
2593+
if uniffi_nimbus_checksum_constructor_nimbusclient_new() != 54745 {
24052594
return InitializationResult.apiChecksumMismatch
24062595
}
24072596
if uniffi_nimbus_checksum_method_metricshandler_record_enrollment_statuses() != 22229 {
@@ -2417,6 +2606,7 @@ private var initializationResult: InitializationResult {
24172606
return InitializationResult.apiChecksumMismatch
24182607
}
24192608

2609+
uniffiCallbackInitRecordedContext()
24202610
uniffiCallbackInitMetricsHandler()
24212611
return InitializationResult.ok
24222612
}

swift-source/all/Generated/nimbusFFI.h

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,20 @@ typedef void (*UniffiCallbackInterfaceMetricsHandlerMethod3)(uint64_t, RustBuffe
278278
RustCallStatus *_Nonnull uniffiCallStatus
279279
);
280280

281+
#endif
282+
#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_RECORDED_CONTEXT_METHOD0
283+
#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_RECORDED_CONTEXT_METHOD0
284+
typedef void (*UniffiCallbackInterfaceRecordedContextMethod0)(uint64_t, void* _Nonnull,
285+
RustCallStatus *_Nonnull uniffiCallStatus
286+
);
287+
288+
#endif
289+
#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_RECORDED_CONTEXT_METHOD1
290+
#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_RECORDED_CONTEXT_METHOD1
291+
typedef void (*UniffiCallbackInterfaceRecordedContextMethod1)(uint64_t, RustBuffer* _Nonnull,
292+
RustCallStatus *_Nonnull uniffiCallStatus
293+
);
294+
281295
#endif
282296
#ifndef UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_METRICS_HANDLER
283297
#define UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_METRICS_HANDLER
@@ -289,6 +303,15 @@ typedef struct UniffiVTableCallbackInterfaceMetricsHandler {
289303
UniffiCallbackInterfaceFree _Nonnull uniffiFree;
290304
} UniffiVTableCallbackInterfaceMetricsHandler;
291305

306+
#endif
307+
#ifndef UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_RECORDED_CONTEXT
308+
#define UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_RECORDED_CONTEXT
309+
typedef struct UniffiVTableCallbackInterfaceRecordedContext {
310+
UniffiCallbackInterfaceRecordedContextMethod0 _Nonnull record;
311+
UniffiCallbackInterfaceRecordedContextMethod1 _Nonnull toJson;
312+
UniffiCallbackInterfaceFree _Nonnull uniffiFree;
313+
} UniffiVTableCallbackInterfaceRecordedContext;
314+
292315
#endif
293316
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_CLONE_NIMBUSCLIENT
294317
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_CLONE_NIMBUSCLIENT
@@ -302,7 +325,7 @@ void uniffi_nimbus_fn_free_nimbusclient(void*_Nonnull ptr, RustCallStatus *_Nonn
302325
#endif
303326
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_CONSTRUCTOR_NIMBUSCLIENT_NEW
304327
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_CONSTRUCTOR_NIMBUSCLIENT_NEW
305-
void*_Nonnull uniffi_nimbus_fn_constructor_nimbusclient_new(RustBuffer app_ctx, RustBuffer coenrolling_feature_ids, RustBuffer dbpath, RustBuffer remote_settings_config, uint64_t metrics_handler, RustCallStatus *_Nonnull out_status
328+
void*_Nonnull uniffi_nimbus_fn_constructor_nimbusclient_new(RustBuffer app_ctx, RustBuffer recorded_context, RustBuffer coenrolling_feature_ids, RustBuffer dbpath, RustBuffer remote_settings_config, uint64_t metrics_handler, RustCallStatus *_Nonnull out_status
306329
);
307330
#endif
308331
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_METHOD_NIMBUSCLIENT_ADVANCE_EVENT_TIME
@@ -470,6 +493,31 @@ void uniffi_nimbus_fn_free_nimbustargetinghelper(void*_Nonnull ptr, RustCallStat
470493
int8_t uniffi_nimbus_fn_method_nimbustargetinghelper_eval_jexl(void*_Nonnull ptr, RustBuffer expression, RustCallStatus *_Nonnull out_status
471494
);
472495
#endif
496+
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_CLONE_RECORDEDCONTEXT
497+
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_CLONE_RECORDEDCONTEXT
498+
void*_Nonnull uniffi_nimbus_fn_clone_recordedcontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
499+
);
500+
#endif
501+
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_FREE_RECORDEDCONTEXT
502+
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_FREE_RECORDEDCONTEXT
503+
void uniffi_nimbus_fn_free_recordedcontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
504+
);
505+
#endif
506+
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_INIT_CALLBACK_VTABLE_RECORDEDCONTEXT
507+
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_INIT_CALLBACK_VTABLE_RECORDEDCONTEXT
508+
void uniffi_nimbus_fn_init_callback_vtable_recordedcontext(UniffiVTableCallbackInterfaceRecordedContext* _Nonnull vtable
509+
);
510+
#endif
511+
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_METHOD_RECORDEDCONTEXT_RECORD
512+
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_METHOD_RECORDEDCONTEXT_RECORD
513+
void uniffi_nimbus_fn_method_recordedcontext_record(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
514+
);
515+
#endif
516+
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_METHOD_RECORDEDCONTEXT_TO_JSON
517+
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_METHOD_RECORDEDCONTEXT_TO_JSON
518+
RustBuffer uniffi_nimbus_fn_method_recordedcontext_to_json(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
519+
);
520+
#endif
473521
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_INIT_CALLBACK_VTABLE_METRICSHANDLER
474522
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_FN_INIT_CALLBACK_VTABLE_METRICSHANDLER
475523
void uniffi_nimbus_fn_init_callback_vtable_metricshandler(UniffiVTableCallbackInterfaceMetricsHandler* _Nonnull vtable
@@ -927,6 +975,18 @@ uint16_t uniffi_nimbus_checksum_method_nimbusstringhelper_string_format(void
927975
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_CHECKSUM_METHOD_NIMBUSTARGETINGHELPER_EVAL_JEXL
928976
uint16_t uniffi_nimbus_checksum_method_nimbustargetinghelper_eval_jexl(void
929977

978+
);
979+
#endif
980+
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_CHECKSUM_METHOD_RECORDEDCONTEXT_RECORD
981+
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_CHECKSUM_METHOD_RECORDEDCONTEXT_RECORD
982+
uint16_t uniffi_nimbus_checksum_method_recordedcontext_record(void
983+
984+
);
985+
#endif
986+
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_CHECKSUM_METHOD_RECORDEDCONTEXT_TO_JSON
987+
#define UNIFFI_FFIDEF_UNIFFI_NIMBUS_CHECKSUM_METHOD_RECORDEDCONTEXT_TO_JSON
988+
uint16_t uniffi_nimbus_checksum_method_recordedcontext_to_json(void
989+
930990
);
931991
#endif
932992
#ifndef UNIFFI_FFIDEF_UNIFFI_NIMBUS_CHECKSUM_CONSTRUCTOR_NIMBUSCLIENT_NEW

0 commit comments

Comments
 (0)