-
-
Save brentvatne/88e27545243b828554bb376a7e6dd08d to your computer and use it in GitHub Desktop.
Modernized build.gradle diff (SDK 50 -> SDK 51)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/android/build.gradle | |
+++ b/android/build.gradle | |
@@ -1,92 +1,43 @@ | |
apply plugin: 'com.android.library' | |
-apply plugin: 'kotlin-android' | |
-apply plugin: 'maven-publish' | |
group = '<%- project.package %>' | |
version = '<%- project.version %>' | |
-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.8.10") | |
+def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle") | |
+apply from: expoModulesCorePlugin | |
+applyKotlinExpoModulesCorePlugin() | |
+useCoreDependencies() | |
+useExpoPublishing() | |
+ | |
+// If you want to use the managed Android SDK versions from expo-modules-core, set this to true. | |
+// The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code. | |
+// Most of the time, you may like to manage the Android SDK versions yourself. | |
+def useManagedAndroidSdkVersions = false | |
+if (useManagedAndroidSdkVersions) { | |
+ useDefaultAndroidSdkVersions() | |
+} else { | |
+ buildscript { | |
+ // 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 | |
} | |
} | |
- | |
- repositories { | |
- mavenCentral() | |
- } | |
- | |
- dependencies { | |
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}") | |
- } | |
-} | |
- | |
-afterEvaluate { | |
- publishing { | |
- publications { | |
- release(MavenPublication) { | |
- from components.release | |
- } | |
- } | |
- repositories { | |
- maven { | |
- url = mavenLocal().url | |
- } | |
+ project.android { | |
+ compileSdkVersion safeExtGet("compileSdkVersion", 34) | |
+ defaultConfig { | |
+ minSdkVersion safeExtGet("minSdkVersion", 21) | |
+ targetSdkVersion safeExtGet("targetSdkVersion", 34) | |
} | |
} | |
} | |
android { | |
- compileSdkVersion safeExtGet("compileSdkVersion", 33) | |
- | |
- def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION | |
- if (agpVersion.tokenize('.')[0].toInteger() < 8) { | |
- compileOptions { | |
- sourceCompatibility JavaVersion.VERSION_11 | |
- targetCompatibility JavaVersion.VERSION_11 | |
- } | |
- | |
- kotlinOptions { | |
- jvmTarget = JavaVersion.VERSION_11.majorVersion | |
- } | |
- } | |
- | |
namespace "<%- project.package %>" | |
defaultConfig { | |
- minSdkVersion safeExtGet("minSdkVersion", 21) | |
- targetSdkVersion safeExtGet("targetSdkVersion", 34) | |
versionCode 1 | |
versionName "<%- project.version %>" | |
} | |
lintOptions { | |
abortOnError false | |
} | |
- publishing { | |
- singleVariant("release") { | |
- withSourcesJar() | |
- } | |
- } | |
-} | |
- | |
-repositories { | |
- mavenCentral() | |
-} | |
- | |
-dependencies { | |
- implementation project(':expo-modules-core') | |
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment