-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from MateeDevs/fix/swiftgen-plugin
Fix SwiftGen Plugin high CPU usage issue
- Loading branch information
Showing
3 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
ios/PresentationLayer/UIToolkit/Plugins/SwiftGenPlugin/Plugin.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Created by Petr Chmelar on 08.09.2022 | ||
// Copyright © 2022 Matee. All rights reserved. | ||
// | ||
|
||
import PackagePlugin | ||
|
||
@main | ||
struct SwiftGenPlugins: BuildToolPlugin { | ||
func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] { | ||
let configurations: [Path] = [context.package.directory, target.directory] | ||
.map { $0.appending("swiftgen.yml") } | ||
|
||
return try configurations.map { configuration in | ||
return Command.prebuildCommand( | ||
displayName: "SwiftGen", | ||
executable: try context.tool(named: "swiftgen").path, | ||
arguments: [ | ||
"config", | ||
"run", | ||
"--verbose", | ||
"--config", "\(configuration)" | ||
], | ||
environment: [ | ||
"PROJECT_DIR": context.package.directory, | ||
"TARGET_NAME": target.name, | ||
"PRODUCT_MODULE_NAME": (target as? SourceModuleTarget)?.moduleName ?? "", | ||
"DERIVED_SOURCES_DIR": context.pluginWorkDirectory | ||
], | ||
outputFilesDirectory: context.pluginWorkDirectory | ||
) | ||
} | ||
} | ||
} |