Skip to content

Commit

Permalink
#35 Add ability to disable cross import of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerluan authored May 12, 2023
2 parents 4ee72d4 + 1e935e6 commit 91f480b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/arkana/models/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Config
attr_reader :should_generate_unit_tests
# @returns [string]
attr_reader :package_manager
# @returns [boolean]
attr_reader :should_cocoapods_cross_import_modules

# @returns [string]
attr_accessor :current_flavor
Expand All @@ -45,6 +47,8 @@ def initialize(yaml)
@should_generate_unit_tests = yaml["should_generate_unit_tests"]
@should_generate_unit_tests = true if @should_generate_unit_tests.nil?
@package_manager = yaml["package_manager"] || "spm"
@should_cocoapods_cross_import_modules = yaml["should_cocoapods_cross_import_modules"]
@should_cocoapods_cross_import_modules = true if @should_cocoapods_cross_import_modules.nil?
end
# rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity

Expand Down
2 changes: 2 additions & 0 deletions lib/arkana/models/template_arguments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def initialize(environment_secrets:, global_secrets:, config:, salt:)
@swift_declaration_strategy = config.swift_declaration_strategy
# Whether unit tests should be generated.
@should_generate_unit_tests = config.should_generate_unit_tests
# Whether cocoapods modules should cross import.
@should_cocoapods_cross_import_modules = config.should_cocoapods_cross_import_modules
end

def environment_protocol_secrets(environment)
Expand Down
7 changes: 7 additions & 0 deletions lib/arkana/templates/arkana.swift.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
// Automatically generated by Arkana (https://github.com/rogerluan/arkana)

import Foundation
<% if !@should_cocoapods_cross_import_modules %>
#if COCOAPODS
#else
<% end %>
import <%= @import_name %>Interfaces
<% if !@should_cocoapods_cross_import_modules %>
#endif
<% end %>

public enum <%= @namespace %> {
@inline(__always)
Expand Down
1 change: 1 addition & 0 deletions template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ flavors: # Optional. Flavors are keywords added as a prefix to every secret when
- FrootLoops
swift_declaration_strategy: let # Optional. One of: lazy var, var, let. Defaults to let.
should_generate_unit_tests: true # Optional. One of: true, false. Defaults to true.
should_cocoapods_cross_import_modules: true # Optional. If false, the two generated cocoapods pods do not cross import (for manual import of the Sources folders), useful when building SDKs, for instance. One of: true, false. Defaults to true.
package_manager: cocoapods # Optional. This setting defines which type of dependency management you're going ot use to integrate Arkana into your project. One of: spm, cocoapods. If you use both in your project, use cocoapods here. Defaults to spm.
environments: # Optional. List of environments that will be used to generate secret keys when you have keys that are different between environments (e.g. debug/staging/prod). Defaults to empty.
- Debug
Expand Down

0 comments on commit 91f480b

Please sign in to comment.