Initial commit

This commit is contained in:
fekt
2022-06-30 01:53:12 -04:00
commit 0131016214
703 changed files with 33394 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import org.jetbrains.kotlin.konan.properties.loadProperties
plugins {
`kotlin-dsl`
}
buildscript {
dependencyLocking {
lockAllConfigurations()
}
}
dependencyLocking {
lockAllConfigurations()
}
// Per conversation in the KotlinLang Slack, Gradle uses Java 8 compatibility internally
// for all build scripts.
// https://kotlinlang.slack.com/archives/C19FD9681/p1636632870122900?thread_ts=1636572288.117000&cid=C19FD9681
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
val rootProperties = getRootProperties()
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProperties.getProperty("KOTLIN_VERSION")}")
implementation("com.android.tools.build:gradle:${rootProperties.getProperty("ANDROID_GRADLE_PLUGIN_VERSION")}")
implementation("wtf.emulator:gradle-plugin:${rootProperties.getProperty("EMULATOR_WTF_GRADLE_PLUGIN_VERSION")}")
}
// A slightly gross way to use the root gradle.properties as the single source of truth for version numbers
fun getRootProperties() = loadProperties(File(project.projectDir.parentFile, "gradle.properties").path)

View File

@@ -0,0 +1,45 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.github.gundy:semver4j:0.16.4=classpath
com.google.code.findbugs:jsr305:3.0.2=classpath
com.google.code.gson:gson:2.8.6=classpath
com.google.errorprone:error_prone_annotations:2.3.4=classpath
com.google.guava:failureaccess:1.0.1=classpath
com.google.guava:guava:29.0-jre=classpath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=classpath
com.google.j2objc:j2objc-annotations:1.3=classpath
de.undercouch:gradle-download-task:4.1.1=classpath
org.checkerframework:checker-qual:2.11.1=classpath
org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:2.1.7=classpath
org.gradle.kotlin:gradle-kotlin-dsl-plugins:2.1.7=classpath
org.jetbrains.intellij.deps:trove4j:1.0.20181211=classpath
org.jetbrains.kotlin:kotlin-android-extensions:1.5.31=classpath
org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.5.31=classpath
org.jetbrains.kotlin:kotlin-build-common:1.5.31=classpath
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.31=classpath
org.jetbrains.kotlin:kotlin-compiler-runner:1.5.31=classpath
org.jetbrains.kotlin:kotlin-daemon-client:1.5.31=classpath
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.5.31=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.5.31=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.5.31=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31=classpath
org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.5.31=classpath
org.jetbrains.kotlin:kotlin-native-utils:1.5.31=classpath
org.jetbrains.kotlin:kotlin-project-model:1.5.31=classpath
org.jetbrains.kotlin:kotlin-sam-with-receiver:1.5.31=classpath
org.jetbrains.kotlin:kotlin-scripting-common:1.5.31=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.5.31=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.5.31=classpath
org.jetbrains.kotlin:kotlin-scripting-jvm:1.5.31=classpath
org.jetbrains.kotlin:kotlin-stdlib-common:1.5.31=classpath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.31=classpath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31=classpath
org.jetbrains.kotlin:kotlin-stdlib:1.5.31=classpath
org.jetbrains.kotlin:kotlin-tooling-metadata:1.5.31=classpath
org.jetbrains.kotlin:kotlin-util-io:1.5.31=classpath
org.jetbrains.kotlin:kotlin-util-klib:1.5.31=classpath
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0=classpath
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0=classpath
org.jetbrains:annotations:13.0=classpath
empty=

View File

@@ -0,0 +1,182 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
androidx.databinding:databinding-common:7.2.1=runtimeClasspath
androidx.databinding:databinding-compiler-common:7.2.1=runtimeClasspath
com.android.databinding:baseLibrary:7.2.1=runtimeClasspath
com.android.tools.analytics-library:crash:30.2.1=runtimeClasspath
com.android.tools.analytics-library:protos:30.2.1=runtimeClasspath
com.android.tools.analytics-library:shared:30.2.1=runtimeClasspath
com.android.tools.analytics-library:tracker:30.2.1=runtimeClasspath
com.android.tools.build.jetifier:jetifier-core:1.0.0-beta09=runtimeClasspath
com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta09=runtimeClasspath
com.android.tools.build:aapt2-proto:7.2.1-7984345=runtimeClasspath
com.android.tools.build:aaptcompiler:7.2.1=runtimeClasspath
com.android.tools.build:apksig:7.2.1=compileClasspath,runtimeClasspath
com.android.tools.build:apkzlib:7.2.1=compileClasspath,runtimeClasspath
com.android.tools.build:builder-model:7.2.1=compileClasspath,runtimeClasspath
com.android.tools.build:builder-test-api:7.2.1=runtimeClasspath
com.android.tools.build:builder:7.2.1=compileClasspath,runtimeClasspath
com.android.tools.build:bundletool:1.8.2=runtimeClasspath
com.android.tools.build:gradle-api:7.2.1=compileClasspath,runtimeClasspath
com.android.tools.build:gradle:7.2.1=compileClasspath,runtimeClasspath
com.android.tools.build:manifest-merger:30.2.1=compileClasspath,runtimeClasspath
com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api=runtimeClasspath
com.android.tools.ddms:ddmlib:30.2.1=runtimeClasspath
com.android.tools.layoutlib:layoutlib-api:30.2.1=runtimeClasspath
com.android.tools.lint:lint-model:30.2.1=runtimeClasspath
com.android.tools.lint:lint-typedef-remover:30.2.1=runtimeClasspath
com.android.tools.utp:android-device-provider-ddmlib-proto:30.2.1=runtimeClasspath
com.android.tools.utp:android-device-provider-gradle-proto:30.2.1=runtimeClasspath
com.android.tools.utp:android-test-plugin-host-additional-test-output-proto:30.2.1=runtimeClasspath
com.android.tools.utp:android-test-plugin-host-coverage-proto:30.2.1=runtimeClasspath
com.android.tools.utp:android-test-plugin-host-retention-proto:30.2.1=runtimeClasspath
com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.2.1=runtimeClasspath
com.android.tools:annotations:30.2.1=runtimeClasspath
com.android.tools:common:30.2.1=runtimeClasspath
com.android.tools:dvlib:30.2.1=runtimeClasspath
com.android.tools:repository:30.2.1=runtimeClasspath
com.android.tools:sdk-common:30.2.1=runtimeClasspath
com.android.tools:sdklib:30.2.1=runtimeClasspath
com.android:signflinger:7.2.1=runtimeClasspath
com.android:zipflinger:7.2.1=compileClasspath,runtimeClasspath
com.fasterxml.jackson.core:jackson-annotations:2.11.1=runtimeClasspath
com.fasterxml.jackson.core:jackson-core:2.11.1=runtimeClasspath
com.fasterxml.jackson.core:jackson-databind:2.11.1=runtimeClasspath
com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.1=runtimeClasspath
com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.11.1=runtimeClasspath
com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1=runtimeClasspath
com.fasterxml.woodstox:woodstox-core:6.2.1=runtimeClasspath
com.github.gundy:semver4j:0.16.4=runtimeClasspath
com.google.android:annotations:4.1.1.4=runtimeClasspath
com.google.api.grpc:proto-google-common-protos:1.12.0=runtimeClasspath
com.google.auto.value:auto-value-annotations:1.6.2=runtimeClasspath
com.google.code.findbugs:jsr305:3.0.2=runtimeClasspath
com.google.code.gson:gson:2.8.9=runtimeClasspath
com.google.crypto.tink:tink:1.3.0-rc2=runtimeClasspath
com.google.dagger:dagger:2.28.3=runtimeClasspath
com.google.errorprone:error_prone_annotations:2.3.4=runtimeClasspath
com.google.flatbuffers:flatbuffers-java:1.12.0=runtimeClasspath
com.google.guava:failureaccess:1.0.1=runtimeClasspath
com.google.guava:guava:30.1-jre=runtimeClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=runtimeClasspath
com.google.j2objc:j2objc-annotations:1.3=runtimeClasspath
com.google.jimfs:jimfs:1.1=runtimeClasspath
com.google.protobuf:protobuf-java-util:3.10.0=runtimeClasspath
com.google.protobuf:protobuf-java:3.10.0=runtimeClasspath
com.google.testing.platform:core-proto:0.0.8-alpha07=runtimeClasspath
com.googlecode.json-simple:json-simple:1.1=runtimeClasspath
com.googlecode.juniversalchardet:juniversalchardet:1.0.3=runtimeClasspath
com.squareup:javapoet:1.10.0=runtimeClasspath
com.squareup:javawriter:2.5.0=compileClasspath,runtimeClasspath
com.sun.activation:javax.activation:1.2.0=runtimeClasspath
com.sun.istack:istack-commons-runtime:3.0.8=runtimeClasspath
com.sun.xml.fastinfoset:FastInfoset:1.2.16=runtimeClasspath
com.vdurmont:semver4j:3.1.0=runtimeClasspath
commons-codec:commons-codec:1.11=runtimeClasspath
commons-io:commons-io:2.4=runtimeClasspath
commons-logging:commons-logging:1.2=runtimeClasspath
de.undercouch:gradle-download-task:4.1.1=runtimeClasspath
io.grpc:grpc-api:1.21.1=runtimeClasspath
io.grpc:grpc-context:1.21.1=runtimeClasspath
io.grpc:grpc-core:1.21.1=runtimeClasspath
io.grpc:grpc-netty:1.21.1=runtimeClasspath
io.grpc:grpc-protobuf-lite:1.21.1=runtimeClasspath
io.grpc:grpc-protobuf:1.21.1=runtimeClasspath
io.grpc:grpc-stub:1.21.1=runtimeClasspath
io.netty:netty-buffer:4.1.34.Final=runtimeClasspath
io.netty:netty-codec-http2:4.1.34.Final=runtimeClasspath
io.netty:netty-codec-http:4.1.34.Final=runtimeClasspath
io.netty:netty-codec-socks:4.1.34.Final=runtimeClasspath
io.netty:netty-codec:4.1.34.Final=runtimeClasspath
io.netty:netty-common:4.1.34.Final=runtimeClasspath
io.netty:netty-handler-proxy:4.1.34.Final=runtimeClasspath
io.netty:netty-handler:4.1.34.Final=runtimeClasspath
io.netty:netty-resolver:4.1.34.Final=runtimeClasspath
io.netty:netty-transport:4.1.34.Final=runtimeClasspath
io.opencensus:opencensus-api:0.21.0=runtimeClasspath
io.opencensus:opencensus-contrib-grpc-metrics:0.21.0=runtimeClasspath
it.unimi.dsi:fastutil:8.4.0=runtimeClasspath
jakarta.activation:jakarta.activation-api:1.2.1=runtimeClasspath
jakarta.xml.bind:jakarta.xml.bind-api:2.3.2=runtimeClasspath
javax.inject:javax.inject:1=runtimeClasspath
net.java.dev.jna:jna-platform:5.6.0=runtimeClasspath
net.java.dev.jna:jna:5.6.0=runtimeClasspath
net.sf.jopt-simple:jopt-simple:4.9=runtimeClasspath
net.sf.kxml:kxml2:2.3.0=runtimeClasspath
org.apache.commons:commons-compress:1.20=runtimeClasspath
org.apache.httpcomponents:httpclient:4.5.9=runtimeClasspath
org.apache.httpcomponents:httpcore:4.4.11=runtimeClasspath
org.apache.httpcomponents:httpmime:4.5.6=runtimeClasspath
org.bitbucket.b_c:jose4j:0.7.0=runtimeClasspath
org.bouncycastle:bcpkix-jdk15on:1.56=runtimeClasspath
org.bouncycastle:bcprov-jdk15on:1.56=runtimeClasspath
org.checkerframework:checker-qual:3.5.0=runtimeClasspath
org.codehaus.mojo:animal-sniffer-annotations:1.17=runtimeClasspath
org.codehaus.woodstox:stax2-api:4.2.1=runtimeClasspath
org.glassfish.jaxb:jaxb-runtime:2.3.2=runtimeClasspath
org.glassfish.jaxb:txw2:2.3.2=runtimeClasspath
org.jdom:jdom2:2.0.6=runtimeClasspath
org.jetbrains.dokka:dokka-core:1.4.32=runtimeClasspath
org.jetbrains.intellij.deps:trove4j:1.0.20181211=kotlinCompilerClasspath
org.jetbrains.intellij.deps:trove4j:1.0.20200330=runtimeClasspath
org.jetbrains.kotlin:kotlin-android-extensions:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-build-common:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.31=kotlinCompilerClasspath
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-compiler-runner:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-daemon-client:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.5.31=kotlinCompilerClasspath
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.6.21=compileClasspath,runtimeClasspath
org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.6.21=compileClasspath,runtimeClasspath
org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21=compileClasspath,runtimeClasspath
org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-native-utils:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-native-utils:1.6.21=compileClasspath,runtimeClasspath
org.jetbrains.kotlin:kotlin-project-model:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-project-model:1.6.21=compileClasspath,runtimeClasspath
org.jetbrains.kotlin:kotlin-reflect:1.5.31=compileClasspath,kotlinCompilerClasspath,runtimeClasspath
org.jetbrains.kotlin:kotlin-sam-with-receiver:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-script-runtime:1.5.31=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-scripting-common:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-scripting-common:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-scripting-jvm:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-scripting-jvm:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-stdlib-common:1.5.31=compileClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,runtimeClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.0=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.31=compileClasspath,runtimeClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.0=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31=compileClasspath,runtimeClasspath
org.jetbrains.kotlin:kotlin-stdlib:1.5.31=compileClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,runtimeClasspath
org.jetbrains.kotlin:kotlin-tooling-metadata:1.6.21=runtimeClasspath
org.jetbrains.kotlin:kotlin-util-io:1.5.31=kotlinCompilerPluginClasspathMain
org.jetbrains.kotlin:kotlin-util-io:1.6.21=compileClasspath,runtimeClasspath
org.jetbrains.kotlin:kotlin-util-klib:1.6.21=runtimeClasspath
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0=kotlinCompilerPluginClasspathMain,runtimeClasspath
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1=runtimeClasspath
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0=kotlinCompilerPluginClasspathMain
org.jetbrains:annotations:13.0=compileClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,runtimeClasspath
org.jetbrains:markdown-jvm:0.2.1=runtimeClasspath
org.jetbrains:markdown:0.2.1=runtimeClasspath
org.json:json:20180813=runtimeClasspath
org.jsoup:jsoup:1.13.1=runtimeClasspath
org.jvnet.staxex:stax-ex:1.8.1=runtimeClasspath
org.ow2.asm:asm-analysis:9.1=runtimeClasspath
org.ow2.asm:asm-commons:9.1=runtimeClasspath
org.ow2.asm:asm-tree:9.1=runtimeClasspath
org.ow2.asm:asm-util:9.1=runtimeClasspath
org.ow2.asm:asm:9.1=compileClasspath,runtimeClasspath
org.slf4j:slf4j-api:1.7.30=runtimeClasspath
org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2=runtimeClasspath
wtf.emulator:gradle-plugin:0.0.10=compileClasspath,runtimeClasspath
xerces:xercesImpl:2.12.0=runtimeClasspath
xml-apis:xml-apis:1.4.01=runtimeClasspath
empty=annotationProcessor

View File

@@ -0,0 +1,15 @@
pluginManagement {
repositories {
gradlePluginPortal()
}
}
@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}
}
rootProject.name = "build-conventions"

View File

@@ -0,0 +1,102 @@
import com.android.build.api.dsl.CommonExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
pluginManager.withPlugin("com.android.application") {
project.the<com.android.build.gradle.AppExtension>().apply {
configureBaseExtension()
defaultConfig {
minSdk = project.property("ANDROID_MIN_SDK_VERSION").toString().toInt()
targetSdk = project.property("ANDROID_TARGET_SDK_VERSION").toString().toInt()
// en_XA and ar_XB are pseudolocales for debugging.
// The rest of the locales provides an explicit list of the languages to keep in the
// final app. Doing this will strip out additional locales from libraries like
// Google Play Services and Firebase, which add unnecessary bloat.
resourceConfigurations.addAll(listOf("en", "en-rUS", "en-rGB", "en-rAU", "en_XA", "ar_XB"))
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
if (project.property("IS_USE_TEST_ORCHESTRATOR").toString().toBoolean()) {
testInstrumentationRunnerArguments["clearPackageData"] = "true"
}
}
}
}
pluginManager.withPlugin("com.android.library") {
project.the<com.android.build.gradle.LibraryExtension>().apply {
configureBaseExtension()
defaultConfig {
minSdk = project.property("ANDROID_MIN_SDK_VERSION").toString().toInt()
targetSdk = project.property("ANDROID_TARGET_SDK_VERSION").toString().toInt()
// The last two are for support of pseudolocales in debug builds.
// If we add other localizations, they should be included in this list.
// By explicitly setting supported locales, we strip out unused localizations from third party
// libraries (e.g. play services)
resourceConfigurations.addAll(listOf("en", "en-rUS", "en-rGB", "en-rAU", "en_XA", "ar_XB"))
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("proguard-consumer.txt")
if (project.property("IS_USE_TEST_ORCHESTRATOR").toString().toBoolean()) {
testInstrumentationRunnerArguments["clearPackageData"] = "true"
}
}
testCoverage {
jacocoVersion = project.property("JACOCO_VERSION").toString()
}
}
}
fun com.android.build.gradle.BaseExtension.configureBaseExtension() {
compileSdkVersion(project.property("ANDROID_COMPILE_SDK_VERSION").toString().toInt())
ndkVersion = project.property("ANDROID_NDK_VERSION").toString()
compileOptions {
val javaVersion = JavaVersion.toVersion(project.property("ANDROID_JVM_TARGET").toString())
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
buildTypes {
getByName("debug").apply {
isTestCoverageEnabled = project.property("IS_ANDROID_INSTRUMENTATION_TEST_COVERAGE_ENABLED")
.toString().toBoolean()
}
}
signingConfigs {
val debugKeystorePath = project.property("ZCASH_DEBUG_KEYSTORE_PATH").toString()
val isExplicitDebugSigningEnabled = !debugKeystorePath.isNullOrBlank()
if (isExplicitDebugSigningEnabled) {
// If this block doesn't execute, the output will still be signed with the default keystore
getByName("debug").apply {
storeFile = File(debugKeystorePath)
}
}
}
testOptions {
animationsDisabled = true
if (project.property("IS_USE_TEST_ORCHESTRATOR").toString().toBoolean()) {
execution = "ANDROIDX_TEST_ORCHESTRATOR"
}
}
if (this is CommonExtension<*, *, *, *>) {
kotlinOptions {
jvmTarget = project.property("ANDROID_JVM_TARGET").toString()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn" +
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi" + "-opt-in=kotlinx.coroutines.FlowPreview"
}
}
}
fun CommonExtension<*, *, *, *>.kotlinOptions(block: KotlinJvmOptions.() -> Unit) {
(this as ExtensionAware).extensions.configure("kotlinOptions", block)
}

View File

@@ -0,0 +1,15 @@
//dependencyLocking {
// lockAllConfigurations()
//}
tasks {
register("resolveAll") {
doLast {
configurations.filter {
// Add any custom filtering on the configurations to be resolved
it.isCanBeResolved
}.forEach { it.resolve() }
}
}
}

View File

@@ -0,0 +1,33 @@
// Emulator WTF has min and max values that might differ from our project's
// These are determined by `ew-cli --models`
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
val EMULATOR_WTF_MIN_SDK = 23
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
val EMULATOR_WTF_MAX_SDK = 31
pluginManager.withPlugin("wtf.emulator.gradle") {
project.the<wtf.emulator.EwExtension>().apply {
val tokenString = project.properties["ZCASH_EMULATOR_WTF_API_KEY"].toString()
if (tokenString.isNotEmpty()) {
token.set(tokenString)
}
val libraryMinSdkVersion = run {
val buildMinSdk = project.properties["ANDROID_MIN_SDK_VERSION"].toString().toInt()
buildMinSdk.coerceAtLeast(EMULATOR_WTF_MIN_SDK).toString()
}
val targetSdkVersion = run {
val buildTargetSdk = project.properties["ANDROID_TARGET_SDK_VERSION"].toString().toInt()
buildTargetSdk.coerceAtMost(EMULATOR_WTF_MAX_SDK).toString()
}
devices.set(
listOf(
mapOf("model" to "Pixel2", "version" to libraryMinSdkVersion),
mapOf("model" to "Pixel2", "version" to targetSdkVersion)
)
)
}
}

View File

@@ -0,0 +1,41 @@
plugins {
id("java")
}
val ktlint by configurations.creating
dependencies {
ktlint("com.pinterest:ktlint:${project.property("KTLINT_VERSION")}") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named<Bundling>(Bundling.EXTERNAL))
}
}
}
tasks {
val editorConfigFile = rootProject.file(".editorconfig")
val ktlintArgs = listOf("**/src/**/*.kt", "!**/build/**.kt", "--editorconfig=$editorConfigFile")
register("ktlint", org.gradle.api.tasks.JavaExec::class) {
description = "Check code style with ktlint"
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = ktlintArgs
}
register("ktlintFormat", org.gradle.api.tasks.JavaExec::class) {
// https://github.com/pinterest/ktlint/issues/1195#issuecomment-1009027802
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
description = "Apply code style formatting with ktlint"
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("-F") + ktlintArgs
}
}
java {
val javaVersion = JavaVersion.toVersion(project.property("ANDROID_JVM_TARGET").toString())
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}

View File

@@ -0,0 +1,47 @@
import java.util.concurrent.TimeUnit
if (isRosetta()) {
logger.warn("This Gradle invocation is running under Rosetta. Use an ARM (aarch64) JDK to " +
"improve performance. One can be downloaded from https://adoptium.net/temurin/releases")
}
@Suppress("MagicNumber")
private val maxTimeoutMillis = 5000L
/**
* This method is safe to call from any operating system or CPU architecture.
*
* @return True if the application is running under Rosetta.
*/
fun isRosetta(): Boolean {
if (System.getProperty("os.name").toLowerCase(java.util.Locale.ROOT).startsWith("mac")) {
// Counterintuitive, but running under Rosetta is reported as Intel64 to the JVM
if (!System.getProperty("os.arch").toLowerCase(java.util.Locale.ROOT).contains("aarch64")) {
val outputValue = Runtime.getRuntime()
.exec("sysctl -in sysctl.proc_translated")
.scanOutputLine()
?.toIntOrNull()
if (1 == outputValue) {
return true
}
}
}
return false
}
fun Process.scanOutputLine(): String? {
var outputString = ""
inputStream.use { inputStream ->
java.util.Scanner(inputStream).useDelimiter("\\A").use { scanner ->
while (scanner.hasNext()) {
outputString = scanner.next()
}
}
}
waitFor(maxTimeoutMillis, TimeUnit.MILLISECONDS)
return outputString.trim()
}