Skip to content

Commit 7edca0f

Browse files
authored
🔧 Make library version parsed from the yaml (#1283)
1 parent 28e3acc commit 7edca0f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

android/build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
File pubspec = new File(project.projectDir.parentFile, 'pubspec.yaml')
2+
String yaml = pubspec.text
3+
java.util.regex.Matcher versionMatcher = java.util.regex.Pattern.compile("^version:\\s*['|\"]?([^\\n|'|\"]*)['|\"]?\$", java.util.regex.Pattern.MULTILINE).matcher(yaml)
4+
versionMatcher.find()
5+
String library_version = versionMatcher.group(1).replaceAll("\\+", "-")
16

27
group 'com.fluttercandies.photo_manager'
3-
version '1.0-SNAPSHOT'
8+
version library_version
49

510
buildscript {
611
ext.kotlin_version = '1.9.23'

ios/photo_manager.podspec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
pubspec = YAML.load_file(File.join('..', 'pubspec.yaml'))
2+
library_version = pubspec['version'].gsub('+', '-')
3+
14
Pod::Spec.new do |s|
25
s.name = 'photo_manager'
3-
s.version = '2.0.0'
6+
s.version = library_version
47
s.summary = 'Photo management APIs for Flutter.'
58
s.description = <<-DESC
69
A Flutter plugin that provides assets abstraction management APIs.

0 commit comments

Comments
 (0)