Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to disable cross import of modules #35

Merged
merged 4 commits into from
May 12, 2023
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
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