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

Support mapbox 6.0 and later and switch to $ReactNativeMapboxGLIOSVersion #1044

Merged
merged 2 commits into from
Oct 2, 2020
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
13 changes: 9 additions & 4 deletions react-native-mapbox-gl.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))


REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION = ENV["REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION"] || '~> 5.8'
default_ios_mapbox_version = '~> 5.8'
rnmbgl_ios_version = $ReactNativeMapboxGLIOSVersion || ENV["REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION"] || default_ios_mapbox_version
if ENV.has_key?("REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION")
puts "REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION env is deprecated please use `$ReactNativeMapboxGLIOSVersion = \"#{rnmbgl_ios_version}\"`"
end

Pod::Spec.new do |s|
s.name = "react-native-mapbox-gl"
Expand All @@ -15,7 +18,7 @@ Pod::Spec.new do |s|
s.license = "MIT"
s.platform = :ios, "8.0"

s.dependency 'Mapbox-iOS-SDK', REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION
s.dependency 'Mapbox-iOS-SDK', rnmbgl_ios_version
s.dependency 'React'

s.subspec 'DynamicLibrary' do |sp|
Expand All @@ -26,7 +29,9 @@ Pod::Spec.new do |s|
s.default_subspecs= ['DynamicLibrary']
else
s.subspec 'StaticLibraryFixer' do |sp|
s.dependency '@react-native-mapbox-gl-mapbox-static', REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION
if rnmbgl_ios_version.split('.')[0] =~ /.*(\d+)/ && $1.to_i == 5
s.dependency '@react-native-mapbox-gl-mapbox-static', rnmbgl_ios_version
end
end

s.default_subspecs= ['DynamicLibrary', 'StaticLibraryFixer']
Expand Down
2 changes: 1 addition & 1 deletion scripts/autogenerate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function readIosVersion() {
'react-native-mapbox-gl.podspec',
);
const lines = fs.readFileSync(podspecPath, 'utf8').split('\n');
const mapboxLineRegex = /^REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION\s*=\s*.+'~>\s+(\d+\.\d+)'$/;
const mapboxLineRegex = /^default_ios_mapbox_version\s*=\s*'~>\s+(\d+\.\d+)'$/;
const mapboxLine = lines.filter(i => mapboxLineRegex.exec(i))[0];
return `${mapboxLineRegex.exec(mapboxLine)[1]}.0`;
}
Expand Down