mirror of
https://github.com/RxReader/wechat_kit.git
synced 2025-08-26 16:50:28 +08:00

在 android/build.gradle 文件中为项目指定了一个新的命名空间 'io.github.v7lin.wechat_kit'。这有助于在 Android 应用中更好地组织和管理代码,提高模块间的隔离性和可维护性。
83 lines
2.1 KiB
Dart
83 lines
2.1 KiB
Dart
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.wechat_kit'
|
|
version library_version
|
|
|
|
buildscript {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:7.3.0'
|
|
}
|
|
}
|
|
|
|
rootProject.allprojects {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
android {
|
|
if (project.android.hasProperty('namespace') ||
|
|
getGradle().getGradleVersion().substring(0, 1).toInteger() >= 8) {
|
|
namespace 'io.github.v7lin.wechat_kit'
|
|
}
|
|
|
|
compileSdkVersion 31
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
resourcePrefix 'wechat_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 'com.tencent.mm.opensdk:wechat-sdk-android:6.8.24'
|
|
|
|
testImplementation 'junit:junit:4.13.2'
|
|
testImplementation 'org.mockito:mockito-core:5.0.0'
|
|
}
|
|
|
|
testOptions {
|
|
unitTests.returnDefaultValues = true
|
|
unitTests.all {
|
|
testLogging {
|
|
events "passed", "skipped", "failed", "standardOut", "standardError"
|
|
outputs.upToDateWhen {false}
|
|
showStandardStreams = true
|
|
}
|
|
}
|
|
}
|
|
}
|