Skip to content

Commit c3d6cf6

Browse files
ObjectBoxCommand: add and update comments
1 parent d3d911e commit c3d6cf6

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Plugins/GeneratorCommand/ObjectBoxCommand.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import PackagePlugin
2121
// - the stencil template file should be in the plugin directory, and be accessed from there
2222
// - XCode way needs to adopt paths ... find the common path from the model files, and work there
2323

24+
/// This is used when the command plugin is used from a Swift package
25+
/// (so when running via the swift package plugin command).
26+
///
27+
/// Also see the ``XcodeCommandPlugin`` extension below.
2428
@main
2529
struct GeneratorCommand: CommandPlugin {
2630

@@ -75,7 +79,7 @@ struct GeneratorCommand: CommandPlugin {
7579

7680
func performCommand(context: PluginContext, arguments: [String]) throws {
7781

78-
// keep for now as a reminder to check if we process args, or not
82+
// keep for now as a reminder to check if args are processed, or not
7983
let tool = try context.tool(named: "objectbox-generator")
8084
print("Processing arguments:: \(arguments)")
8185
if arguments.count == 1 {
@@ -132,15 +136,10 @@ struct GeneratorCommand: CommandPlugin {
132136
#if canImport(XcodeProjectPlugin)
133137
import XcodeProjectPlugin
134138

139+
/// This is used when the command plugin is used from an Xcode project
135140
extension GeneratorCommand: XcodeCommandPlugin {
136141

137142
func performCommand(context: XcodePluginContext, arguments: [String]) throws {
138-
139-
// TODO , this is more complex than the PackagePlugin version
140-
// XCode has no structure,
141-
// Probably just print a message to work with the cocoapod right now
142-
// but lets try and see how far we can come
143-
144143
let tool = try context.tool(named: "objectbox-generator")
145144

146145
var argExtractor = ArgumentExtractor(arguments)
@@ -165,13 +164,12 @@ struct GeneratorCommand: CommandPlugin {
165164
}
166165

167166
if inputFiles == nil {
168-
Diagnostics.warning("Target \(targetName) has not files")
167+
Diagnostics.warning("Target \(targetName) has no files")
169168
return
170169
}
171170

172171
var sourcesArgs: [String] = []
173172
for inputFile in inputFiles! {
174-
//inputFile.path.string
175173
if inputFile.path.string.hasSuffix(".swift") {
176174
sourcesArgs.append("--sources")
177175
sourcesArgs.append(inputFile.path.string)
@@ -199,7 +197,7 @@ struct GeneratorCommand: CommandPlugin {
199197

200198
runGenerator(generator: tool, args: args)
201199

202-
// TODO , figgure out how to add the generated folder to xcode within here
200+
// TODO Add the generated files to the Xcode project
203201
Diagnostics.remark(
204202
"! Don't forget to add the generated source file in 'ObjectBox-generated/EntityInfo.generated.swift' to the project, and to git if you want to keep it"
205203
)

0 commit comments

Comments
 (0)