Pod::Spec.new do |s|
require_relative 'Utils/spec'
s.extend MetaCodable::Spec
s.module_name = "MetaCodable"
s.define
sources_dir = 'Sources'
plugin_module = 'MacroPlugin'
manifest_file = 'Package*.swift'
plugin_core = 'PluginCore'
script_path = 'Utils/macro_plugin_build.rb'
preserved_sources = "{#{manifest_file},#{sources_dir}/{#{plugin_module},#{plugin_core}}/**/*.swift,#{script_path}}"
inputs = Dir.glob(preserved_sources).map { |path| "$(PODS_TARGET_SRCROOT)/#{path}" }
build_path = "${PODS_BUILD_DIR}/Macros/#{plugin_module}"
plugin_path = "#{build_path}/${CONFIGURATION}/#{plugin_module}##{plugin_module}"
plugin_output = "$(PODS_BUILD_DIR)/Macros/#{plugin_module}/$(CONFIGURATION)/#{plugin_module}"
script = script,
:input_files => inputs, :output_files => [plugin_output],
:execution_position => :before_compile
}
s.user_target_xcconfig = {
'OTHER_SWIFT_FLAGS' => "-Xfrontend -load-plugin-executable -Xfrontend #{plugin_path}",
'METACODABLE_PLUGIN_BUILD_ENVIRONMENT' => 'METACODABLE_BEING_USED_FROM_COCOAPODS=true'
}
s.pod_target_xcconfig = {
'OTHER_SWIFT_FLAGS' => "-Xfrontend -load-plugin-executable -Xfrontend #{plugin_path} -Xfrontend -package-name -Xfrontend MetaCodable",
'METACODABLE_PLUGIN_BUILD_ENVIRONMENT' => 'METACODABLE_BEING_USED_FROM_COCOAPODS=true'
}
end