-
-
Notifications
You must be signed in to change notification settings - Fork 251
feat: Adopt AGP v9 #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Adopt AGP v9 #733
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,8 @@ buildscript { | |
|
|
||
| dependencies { | ||
| classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") | ||
| classpath("com.android.tools.build:gradle:7.3.1") | ||
| classpath("com.diffplug.spotless:spotless-plugin-gradle:6.11.0") | ||
| classpath("com.android.tools.build:gradle:9.2.1") | ||
| classpath("com.diffplug.spotless:spotless-plugin-gradle:8.1.0") | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -32,7 +32,23 @@ def isNewArchitectureEnabled() { | |
| } | ||
|
|
||
| apply plugin: 'com.android.library' | ||
| apply plugin: 'kotlin-android' | ||
|
|
||
|
|
||
| def shouldEnableAgpFallback() { | ||
| def agpMajorVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger() | ||
| if (agpMajorVersion <= 8) { | ||
| return true | ||
| } | ||
|
|
||
| def propertyVal = providers.gradleProperty("android.builtInKotlin").orNull | ||
| def isBuiltInKotlinEnabled = propertyVal != null ? propertyVal.toBoolean() : true | ||
|
|
||
| return !isBuiltInKotlinEnabled | ||
| } | ||
|
|
||
| if (shouldEnableAgpFallback()) { | ||
| apply plugin: 'kotlin-android' | ||
| } | ||
|
|
||
| if (isNewArchitectureEnabled()) { | ||
| apply plugin: "com.facebook.react" | ||
|
|
@@ -82,17 +98,11 @@ android { | |
| exclude "**/libreact_render*.so" | ||
| } | ||
| sourceSets.main { | ||
| java { | ||
| if (isNewArchitectureEnabled()) { | ||
| srcDirs += [ | ||
| "src/fabric/java", | ||
| "${project.buildDir}/generated/source/codegen/java" | ||
| ] | ||
| } else { | ||
| srcDirs += [ | ||
| "src/paper/java" | ||
| ] | ||
| } | ||
| if (isNewArchitectureEnabled()) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you update |
||
| java.directories.add("${project.buildDir}/generated/source/codegen/java") // contains only java files | ||
| kotlin.directories.add("src/fabric/java") // contains only kotlin files | ||
| } else { | ||
| kotlin.directories.add("src/paper/java") // contains both java and kotlin files | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
hurali97 marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,5 @@ package com.th3rdwave.safeareacontext | |
|
|
||
| enum class SafeAreaViewMode { | ||
| PADDING, | ||
| MARGIN | ||
| MARGIN, | ||
| } | ||
|
hurali97 marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,3 +52,9 @@ bridgelessEnabled=true | |
|
|
||
| # Version of Kotlin to build against. | ||
| #KOTLIN_VERSION=1.8.22 | ||
| KOTLIN_VERSION=2.2.0 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we keep the example app on older AGP for now, I am more concerned about testing that than agp v9. |
||
|
|
||
| # Opt out of built-in kotlin and new DSL behavior that ships with AGP 9. | ||
| # Starting from AGP 10.x these opt outs will be removed. | ||
| android.builtInKotlin=false | ||
| android.newDsl=false | ||
|
hurali97 marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| diff --git a/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml b/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml | ||
| index c7502fc..7f788db 100644 | ||
| --- a/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml | ||
| +++ b/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml | ||
| @@ -4,7 +4,7 @@ gson = "2.8.9" | ||
| guava = "31.0.1-jre" | ||
| javapoet = "1.13.0" | ||
| junit = "4.13.2" | ||
| -kotlin = "2.1.20" | ||
| +kotlin = "2.2.0" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is required as we bumped Gradle version in example app. React Native core defaults to this kotlin version from RN 0.87.x. RN Core also defaults to Gradle version 9.4.1 from RN 0.87.x |
||
| assertj = "3.25.1" | ||
| ktfmt = "0.22.0" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.