group 'com.tencent.flutter_render' version '1.0-SNAPSHOT' buildscript { ext { kotlin_version = '1.6.20' THIRD_PARTY_LIBRARY_PATH = "$projectDir.absolutePath/src/main/jni/third_party" JNI_LIBRARY_PATH = "$projectDir.absolutePath/libs" // 默认不编译C++代码,可以加快编译速度和调试速度(默认关闭LLVM调试器) // 如果需要本地调试/修改C++代码,打开这个即可 enableLocalCmake = true if (!enableLocalCmake) { def enable = System.getenv("ENABLE_LOCAL_CMAKE") println("system env enable local cmake:$enable") if (enable == "true") { println("system env enable local cmake inner:$enable") enableLocalCmake = false } else { // 系统环境里面没有从local.properties里面取 def dir = System.getProperty("user.dir") def file = new File(dir, 'local.properties') Properties properties = new Properties() if (file.exists()) { properties.load(file.newDataInputStream()) enableLocalCmake = Boolean.valueOf(properties.getProperty('enableLocalCmake', "false")) } } } println("enable local cmake:$enableLocalCmake") } repositories { mavenCentral() google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:7.0.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.novoda:bintray-release:0.9.2' } } rootProject.allprojects { repositories { mavenCentral() google() jcenter() } } apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { compileSdkVersion 32 publishNonDefault true ndkVersion = NDK_VERSION defaultConfig { minSdkVersion 21 consumerProguardFiles "proguard-rules.pro" if (enableLocalCmake) { externalNativeBuild { cmake { cppFlags "-std=c++17" arguments "-DJS_ENGINE=V8", "-DANDROID_CPP_FEATURES=no-rtti no-exceptions", "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=$ANDROID_STL", "-DV8_COMPONENT=$V8_COMPONENT", "-DENABLE_INSPECTOR=$ENABLE_INSPECTOR", "-DHIDDEN_LIBRARY_SYMBOL=$HIDDEN_LIBRARY_SYMBOL" } } } } buildTypes { profile { minifyEnabled false } release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } debug { minifyEnabled false jniDebuggable true } } tasks.withType(JavaCompile) { options.encoding = "UTF-8" } sourceSets { main.java.srcDirs += 'src/main/kotlin' main { if (!enableLocalCmake) { jniLibs.srcDirs = ['libs'] } } } if (enableLocalCmake) { externalNativeBuild { cmake { version CMAKE_VERSION path "../core/CMakeLists.txt" } } } lintOptions { disable 'InvalidPackage' } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }