Skip to content

Instantly share code, notes, and snippets.

@lamvd0101
Created November 2, 2022 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lamvd0101/07c983053e216a85723337d455fd1a54 to your computer and use it in GitHub Desktop.
Save lamvd0101/07c983053e216a85723337d455fd1a54 to your computer and use it in GitHub Desktop.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "30.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath('com.android.tools.build:gradle:4.2.1')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
buildDir = "$rootDir/build/libs/${project.name}"
tasks.withType(Javadoc).all { enabled = false }
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
// Add hermes
flatDir {
dirs "$rootDir/../node_modules/hermes-engine/android"
}
}
}
subprojects {
afterEvaluate {
project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion = 30
buildToolsVersion = "30.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
}
}
}
}
// Get all dependencies
def dependencies = []
task getDeps() {
subprojects {
afterEvaluate {
project ->
if (project.name != "RNSDK") {
def arr = project.configurations.getByName("implementation").allDependencies + project.configurations.getByName("compile").allDependencies
arr.each { dep ->
if (dep.group != null && dep.group != "RNSDK" && dep.name != "react-native") {
dependencies += "${dep.group}:${dep.name}:${dep.version}"
}
}
}
}
}
}
task createGradleFile() {
doFirst {
def str = ""
dependencies.each {
str += it + "\n"
}
new File("${rootDir}/SDKOutput", "libs.txt").text = str
}
finalizedBy 'getDeps'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment