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
3 changes: 2 additions & 1 deletion NOTICES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ This product uses derivations of swift-extras/swift-extras-base64 'Base64.swift'
---

This product uses derivations of apple/swift-openapi-generator 'StructuredSwiftRepresentation.swift',
'TypeName.swift', 'TypeUsage.swift' and 'Builtins.swift'.
'TypeName.swift', 'TypeUsage.swift', 'Builtins.swift', 'RendererProtocol.swift', 'TextBasedProtocol',
and 'Test_TextBasedRenderer'.

* LICENSE (Apache License 2.0):
* https://github.com/apple/swift-openapi-generator/blob/main/LICENSE.txt
Expand Down
11 changes: 10 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ extension Target {
.nioEmbedded,
.nioTransportServices,
.logging,
.reflectionService,
.reflectionService
].appending(
.nioSSL, if: includeNIOSSL
),
Expand All @@ -235,6 +235,13 @@ extension Target {
]
)

static let grpcCodeGenTests: Target = .testTarget(
name: "GRPCCodeGenTests",
dependencies: [
.grpcCodeGen
]
)

static let interopTestModels: Target = .target(
name: "GRPCInteroperabilityTestModels",
dependencies: [
Expand Down Expand Up @@ -559,9 +566,11 @@ let package = Package(

// v2
.grpcCore,
.grpcCodeGen,

// v2 tests
.grpcCoreTests,
.grpcCodeGenTests
]
)

Expand Down
44 changes: 44 additions & 0 deletions Sources/GRPCCodeGen/Internal/Renderer/RendererProtocol.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2023, gRPC Authors All rights reserved.
*
* 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.
*/
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftOpenAPIGenerator open source project
//
// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftOpenAPIGenerator project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

/// An object that renders structured Swift representations
/// into Swift files.
///
/// Rendering is the last phase of the generator pipeline.
protocol RendererProtocol {

/// Renders the specified structured code into a raw Swift file.
/// - Parameters:
/// - code: A structured representation of the Swift code.
/// - config: The configuration of the generator.
/// - diagnostics: The collector to which to emit diagnostics.
/// - Returns: A raw file with Swift contents.
/// - Throws: An error if an issue occurs during rendering.
func render(structured code: StructuredSwiftRepresentation) throws -> SourceFile
}
Loading