1apply plugin: 'com.android.library' 2apply plugin: 'kotlin-android' 3apply plugin: 'maven-publish' 4 5group = 'host.exp.exponent' 6version = '1.0.0' 7 8buildscript { 9 def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle") 10 if (expoModulesCorePlugin.exists()) { 11 apply from: expoModulesCorePlugin 12 applyKotlinExpoModulesCorePlugin() 13 } 14 15 // Simple helper that allows the root project to override versions declared by this library. 16 ext.safeExtGet = { prop, fallback -> 17 rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 18 } 19 20 // Ensures backward compatibility 21 ext.getKotlinVersion = { 22 if (ext.has("kotlinVersion")) { 23 ext.kotlinVersion() 24 } else { 25 ext.safeExtGet("kotlinVersion", "1.6.10") 26 } 27 } 28 29 repositories { 30 mavenCentral() 31 } 32 33 dependencies { 34 classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}") 35 } 36} 37 38// Creating sources with comments 39task androidSourcesJar(type: Jar) { 40 classifier = 'sources' 41 from android.sourceSets.main.java.srcDirs 42} 43 44afterEvaluate { 45 publishing { 46 publications { 47 release(MavenPublication) { 48 from components.release 49 // Add additional sourcesJar to artifacts 50 artifact(androidSourcesJar) 51 } 52 } 53 repositories { 54 maven { 55 url = mavenLocal().url 56 } 57 } 58 } 59} 60 61android { 62 compileSdkVersion safeExtGet("compileSdkVersion", 31) 63 64 compileOptions { 65 sourceCompatibility JavaVersion.VERSION_11 66 targetCompatibility JavaVersion.VERSION_11 67 } 68 69 kotlinOptions { 70 jvmTarget = JavaVersion.VERSION_11.majorVersion 71 } 72 73 defaultConfig { 74 minSdkVersion safeExtGet("minSdkVersion", 21) 75 targetSdkVersion safeExtGet("targetSdkVersion", 31) 76 versionCode 6 77 versionName '1.0.0' 78 } 79 lintOptions { 80 abortOnError false 81 } 82} 83 84dependencies { 85 //noinspection GradleDynamicVersion 86 implementation 'com.facebook.react:react-native:+' 87 88 implementation 'com.squareup.okhttp3:okhttp:3.14.9' 89 90 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}" 91 implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3" 92} 93