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 library_version

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
    }
}

rootProject.allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 31

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    resourcePrefix 'weibo_kit'

    defaultConfig {
        minSdkVersion 16

        // library 混淆 -> 随 library 引用，自动添加到 apk 打包混淆
        consumerProguardFiles 'consumer-rules.pro'
    }

    flavorDimensions 'vendor'

    productFlavors {
        vendor {
            dimension 'vendor'

            // library 混淆 -> 随 library 引用，自动添加到 apk 打包混淆
            consumerProguardFiles 'consumer-vendor-rules.pro'
        }
    }
}

dependencies {
    vendorImplementation 'androidx.appcompat:appcompat:1.0.0'
    vendorImplementation 'io.github.sinaweibosdk:core:12.5.0@aar'
}
