You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
4.1 KiB
160 lines
4.1 KiB
apply plugin: 'com.android.library'
|
|
apply plugin: 'kotlin-android'
|
|
apply plugin: 'maven-publish'
|
|
|
|
// Import autolinking script
|
|
apply from: "../scripts/autolinking.gradle"
|
|
|
|
static def versionToNumber(major, minor, patch) {
|
|
return patch * 100 + minor * 10000 + major * 1000000
|
|
}
|
|
|
|
def getRNVersion() {
|
|
def nodeModulesVersion = [
|
|
"node",
|
|
"-e",
|
|
"console.log(require('react-native/package.json').version);"
|
|
]
|
|
.execute([], projectDir)
|
|
.text
|
|
.trim()
|
|
|
|
def version = System.getenv("REACT_NATIVE_OVERRIDE_VERSION") ?: safeExtGet("reactNativeVersion", nodeModulesVersion)
|
|
def coreVersion = version.split("-")[0]
|
|
def (major, minor, patch) = coreVersion.tokenize('.').collect { it.toInteger() }
|
|
|
|
return versionToNumber(
|
|
major,
|
|
minor,
|
|
patch
|
|
)
|
|
}
|
|
|
|
ensureDependeciesWereEvaluated(project)
|
|
|
|
group = 'host.exp.exponent'
|
|
version = '47.0.13'
|
|
|
|
buildscript {
|
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
if (expoModulesCorePlugin.exists()) {
|
|
apply from: expoModulesCorePlugin
|
|
applyKotlinExpoModulesCorePlugin()
|
|
}
|
|
|
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
ext.safeExtGet = { prop, fallback ->
|
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
}
|
|
|
|
// Ensures backward compatibility
|
|
ext.getKotlinVersion = {
|
|
if (ext.has("kotlinVersion")) {
|
|
ext.kotlinVersion()
|
|
} else {
|
|
ext.safeExtGet("kotlinVersion", "1.6.10")
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
}
|
|
}
|
|
|
|
// Creating sources with comments
|
|
task androidSourcesJar(type: Jar) {
|
|
classifier = 'sources'
|
|
from android.sourceSets.main.java.srcDirs
|
|
}
|
|
|
|
afterEvaluate {
|
|
publishing {
|
|
publications {
|
|
release(MavenPublication) {
|
|
from components.release
|
|
// Add additional sourcesJar to artifacts
|
|
artifact(androidSourcesJar)
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
url = mavenLocal().url
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion safeExtGet("compileSdkVersion", 31)
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_11
|
|
targetCompatibility JavaVersion.VERSION_11
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
}
|
|
|
|
defaultConfig {
|
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
versionCode 1
|
|
versionName "47.0.13"
|
|
consumerProguardFiles("proguard-rules.pro")
|
|
}
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
testOptions {
|
|
unitTests.includeAndroidResources = true
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDirs += new File(project.buildDir, generatedFilesSrcDir)
|
|
|
|
def rnVersion = getRNVersion()
|
|
if (rnVersion >= versionToNumber(0, 71, 0)) {
|
|
srcDirs += "src/reactNativeHostWrapper"
|
|
} else if (rnVersion >= versionToNumber(0, 69, 0)) {
|
|
srcDirs += "src/reactNativeHostWrapper69"
|
|
} else if (rnVersion >= versionToNumber(0, 67, 0)) {
|
|
srcDirs += "src/reactNativeHostWrapper67"
|
|
} else {
|
|
srcDirs += "src/reactNativeHostWrapper64"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies { dependencyHandler ->
|
|
//noinspection GradleDynamicVersion
|
|
implementation 'com.facebook.react:react-native:+'
|
|
|
|
testImplementation 'junit:junit:4.13.1'
|
|
testImplementation 'androidx.test:core:1.4.0'
|
|
testImplementation "com.google.truth:truth:1.1.2"
|
|
testImplementation 'io.mockk:mockk:1.12.0'
|
|
|
|
// Link expo modules as dependencies of the adapter. It uses `api` configuration so they all will be visible for the app as well.
|
|
// A collection of the dependencies depends on the options passed to `useExpoModules` in your project's `settings.gradle`.
|
|
addExpoModulesDependencies(dependencyHandler, project)
|
|
}
|
|
|
|
// A task generating a package list of expo modules.
|
|
task generateExpoModulesPackageList {
|
|
doLast {
|
|
generateExpoModulesPackageList()
|
|
}
|
|
}
|
|
|
|
// Run that task during prebuilding phase.
|
|
preBuild.dependsOn "generateExpoModulesPackageList"
|