diff --git a/android/build.gradle b/android/build.gradle index 883f947..ab0ef9b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,12 @@ +File pubspec = new File(project.projectDir.parentFile, 'pubspec.yaml') +String yaml = pubspec.text +// Using \s*['|"]?([^\n|'|"]*)['|"]? to extract version number. +java.util.regex.Matcher versionMatcher = java.util.regex.Pattern.compile("^version:\\s*['|\"]?([^\\n|'|\"]*)['|\"]?\$", java.util.regex.Pattern.MULTILINE).matcher(yaml) +versionMatcher.find() +String library_version = versionMatcher.group(1).replaceAll("\\+", "-") + group 'io.github.v7lin.weibo_kit' -version '4.0.0' +version library_version buildscript { repositories { diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 4e88ddc..8facbfb 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -47,4 +47,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d -COCOAPODS: 1.11.2 +COCOAPODS: 1.11.3 diff --git a/ios/weibo_kit.podspec b/ios/weibo_kit.podspec index 0ed1231..b94b58c 100644 --- a/ios/weibo_kit.podspec +++ b/ios/weibo_kit.podspec @@ -2,9 +2,13 @@ # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. # Run `pod lib lint weibo_kit.podspec` to validate before publishing. # + +pubspec = YAML.load_file(File.join('..', 'pubspec.yaml')) +library_version = pubspec['version'].gsub('+', '-') + Pod::Spec.new do |s| s.name = 'weibo_kit' - s.version = '4.0.0' + s.version = library_version s.summary = 'A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs.' s.description = <<-DESC A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs.