Created
November 22, 2022 22:04
-
-
Save MaatheusGois/5425a45f6c40d4887c110139f2c1e79c to your computer and use it in GitHub Desktop.
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
def add_spm_to_target(project, target_name, url, requirement, product_name) | |
project.targets.each do |target| | |
if target.name == target_name | |
pkg = project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference) | |
pkg.repositoryURL = url | |
pkg.requirement = requirement | |
ref = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency) | |
ref.package = pkg | |
ref.product_name = product_name | |
target.package_product_dependencies << ref | |
project.root_object.package_references << pkg | |
end | |
end | |
project.save | |
end | |
post_install do |installer| | |
spm_spec = { | |
url: "https://github.com/maplibre/maplibre-gl-native-distribution", | |
requirement: { | |
kind: "upToNextMajorVersion", | |
minimumVersion: "5.11.0" | |
}, | |
product_name: "Mapbox" | |
} | |
add_spm_to_target( | |
installer.pods_project, | |
"react-native-mapbox-gl", | |
spm_spec[:url], | |
spm_spec[:requirement], | |
spm_spec[:product_name] | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment