Skip to content

Commit

Permalink
restrict public api to be interfaceForSwift only
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-hui committed Jan 31, 2025
1 parent 4b3a9aa commit 1eefcbf
Show file tree
Hide file tree
Showing 27 changed files with 152 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#if SWIFT_PACKAGE
import FirebaseFirestoreCpp
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import FirebaseSharedSwift
import Foundation

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import Foundation

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/DocumentID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/EncoderDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/ExplicitNull.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/FieldValue+Encodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/GeoPoint+Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/VectorValue+Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import SwiftUI

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import SwiftUI

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/SwiftAPI/FieldValue+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/SwiftAPI/Pipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#if SWIFT_PACKAGE
import FirebaseFirestoreCpp
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/SwiftAPI/VectorValue+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/SwiftHeaderWorkaround.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
12 changes: 6 additions & 6 deletions Firestore/core/interfaceForSwift/api/FirebaseFirestoreCpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIREBASEFIRESTORECPP_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIREBASEFIRESTORECPP_H_

#import "CollectionStage.h"
#import "FirestorePipeline.h"
#import "Pipeline.h"
#import "PipelineResult.h"
#import "PipelineSource.h"
#import "Stage.h"
#import "Firestore/core/interfaceForSwift/api/collection_stage.h"
#import "Firestore/core/interfaceForSwift/api/firestore_pipeline.h"
#import "Firestore/core/interfaceForSwift/api/pipeline.h"
#import "Firestore/core/interfaceForSwift/api/pipeline_result.h"
#import "Firestore/core/interfaceForSwift/api/pipeline_source.h"
#import "Firestore/core/interfaceForSwift/api/stage.h"

#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIREBASEFIRESTORECPP_H_
39 changes: 39 additions & 0 deletions Firestore/core/interfaceForSwift/api/collection_stage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_COLLECTION_STAGE_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_COLLECTION_STAGE_H_

#include <string>
#include "Firestore/core/interfaceForSwift/api/stage.h"

namespace firebase {
namespace firestore {

namespace api {

class Collection : public Stage {
public:
explicit Collection(std::string collection_path);

private:
std::string collection_path_;
};

} // namespace api

} // namespace firestore
} // namespace firebase

#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_COLLECTION_STAGE_H_
37 changes: 37 additions & 0 deletions Firestore/core/interfaceForSwift/api/firestore_pipeline.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIRESTORE_PIPELINE_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIRESTORE_PIPELINE_H_

#include <memory>

#include "Firestore/core/interfaceForSwift/api/pipeline_source.h"

namespace firebase {
namespace firestore {

namespace api {
class Firestore;

class FirestorePipeline {
public:
static PipelineSource pipeline(std::shared_ptr<Firestore> firestore);
};

} // namespace api
} // namespace firestore
} // namespace firebase

#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIRESTORE_PIPELINE_H_
47 changes: 47 additions & 0 deletions Firestore/core/interfaceForSwift/api/pipeline_source.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINE_SOURCE_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINE_SOURCE_H_

#include <memory>
#include <string>
#include <vector>

#include "Firestore/core/interfaceForSwift/api/pipeline.h"

namespace firebase {
namespace firestore {

namespace api {

class Firestore;
class DocumentReference;

class PipelineSource {
public:
explicit PipelineSource(std::shared_ptr<Firestore> firestore);

Pipeline GetCollection(std::string collection_path) const;

private:
std::shared_ptr<Firestore> firestore_;
};

} // namespace api

} // namespace firestore
} // namespace firebase

#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINE_SOURCE_H_
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ func firestoreTargets() -> [Target] {
"core/include/",
"core/src",
],
publicHeadersPath: "core/src/api",
publicHeadersPath: "core/interfaceForSwift",
cSettings: [
.headerSearchPath("../"),
.headerSearchPath("Protos/nanopb"),
Expand Down

0 comments on commit 1eefcbf

Please sign in to comment.