Skip to content

Commit

Permalink
[agp] Upgrade AGP, Kotlin, Gradle, maven publish plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
passy committed Apr 25, 2024
1 parent 11ffd62 commit 7d5f581
Show file tree
Hide file tree
Showing 95 changed files with 221 additions and 200 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
java-version: 17
- name: Gradle caches
uses: actions/cache@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
java-version: 17
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
java-version: 17
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand All @@ -120,7 +120,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
java-version: 17
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down
30 changes: 25 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.1'
classpath 'com.android.tools.build:gradle:8.1.0'
classpath "com.vanniktech:gradle-maven-publish-plugin:${MAVEN_PUBLISH_PLUGIN}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${KOTLIN_VERSION}"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${DOKKA_VERSION}"
Expand All @@ -43,6 +43,14 @@ allprojects {
tasks.withType(Javadoc).all {
options.addStringOption('Xdoclint:none', '-quiet')
}
configurations.all {
// These are to prevent upgrade problems where second-party dependencies like Fresco may be
// dependencing on a specific, older version of Litho causing dex merging conflicts.
resolutionStrategy.dependencySubstitution {
substitute module('com.facebook.litho:litho-annotations') using project(':litho-annotations')
substitute module('com.facebook.litho:litho-widget') using project(':litho-widget')
}
}
}

subprojects {
Expand Down Expand Up @@ -70,6 +78,18 @@ subprojects {
}
}

plugins.withType(org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper) {
kotlin {
jvmToolchain(11)
}
}

plugins.withType(org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper) {
kotlin {
jvmToolchain(11)
}
}

afterEvaluate {
tasks.withType(Test) {
it.dependsOn copyYogaLibs
Expand Down Expand Up @@ -99,8 +119,8 @@ ext {
targetSdkVersion = latestSdkVersion
compileSdkVersion = latestSdkVersion
buildToolsVersion = '33.0.2'
sourceCompatibilityVersion = JavaVersion.VERSION_1_8
targetCompatibilityVersion = JavaVersion.VERSION_1_8
sourceCompatibilityVersion = JavaVersion.VERSION_11
targetCompatibilityVersion = JavaVersion.VERSION_11
}

ext.forceReleaseBuild = project.hasProperty('forceReleaseBuild')
Expand Down Expand Up @@ -143,8 +163,8 @@ ext.deps = [
soloader : 'com.facebook.soloader:soloader:0.10.5',
textlayoutbuilder : 'com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.7.0',
screenshot : 'com.facebook.testing.screenshot:core:0.5.0',
flipper : 'com.facebook.flipper:flipper:0.183.0',
flipperLithoPlugin : 'com.facebook.flipper:flipper-litho-plugin:0.183.0',
flipper : 'com.facebook.flipper:flipper:0.250.0',
flipperLithoPlugin : 'com.facebook.flipper:flipper-litho-plugin:0.250.0',
// Annotations
jsr305 : 'com.google.code.findbugs:jsr305:3.0.1',
inferAnnotations : 'com.facebook.infer.annotation:infer-annotation:0.18.0',
Expand Down
11 changes: 7 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@ POM_DEVELOPER_NAME=facebook

GRADLE_VERSIONS_PLUGIN_VERSION=0.15.0

KOTLIN_VERSION=1.9.10
DOKKA_VERSION=1.9.10
KOTLIN_VERSION=1.9.22
DOKKA_VERSION=1.9.20
DATA_CLASS_GENERATE_VERSION=1.0.1

# Deps for publishing
MAVEN_PUBLISH_PLUGIN=0.15.1
MAVEN_PUBLISH_PLUGIN=0.28.0

# Gradle internals
org.gradle.internal.repository.max.retries=10
org.gradle.internal.repository.initial.backoff=1250
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1024m
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1024m --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED

# AndroidX
android.useAndroidX = true
android.enableJetifier = true
android.jetifier.ignorelist=bcprov-jdk15on
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions lib/yoga/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
namespace 'com.facebook.yoga'

ndkVersion '26.1.10909125'

Expand Down
1 change: 1 addition & 0 deletions lib/yogajni/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
namespace 'com.facebook.yogajni'

ndkVersion '26.1.10909125'

Expand Down
7 changes: 4 additions & 3 deletions litho-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ android {
buildConfigField 'boolean', useIncrementalMountHelper, 'true'
}
}

// TODO(#62): Re-enable abort on error.
lintOptions {
namespace 'com.facebook.litho'
lint {
abortOnError false
}

// TODO(#62): Re-enable abort on error.
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions litho-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.litho">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
1 change: 1 addition & 0 deletions litho-coroutines-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ android {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
}
namespace 'com.facebook.litho.coroutines'
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand Down
4 changes: 1 addition & 3 deletions litho-coroutines-kotlin/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@
-->

<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.litho.coroutines"
/>
xmlns:android="http://schemas.android.com/apk/res/android" />
7 changes: 4 additions & 3 deletions litho-editor-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ android {
}

// TODO(#62): Re-enable abort on error.
lintOptions {
abortOnError false
}

dependencies {
api project(':litho-core')
compileOnly deps.jsr305
compileOnly deps.proguardAnnotations
compileOnly deps.supportAnnotations
}
namespace 'com.facebook.litho.editor'
lint {
abortOnError false
}
}

apply plugin: "com.vanniktech.maven.publish"
3 changes: 1 addition & 2 deletions litho-editor-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.litho.editor">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
11 changes: 8 additions & 3 deletions litho-editor-flipper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ android {
}

// TODO(#62): Re-enable abort on error.
lintOptions {
abortOnError false
}

dependencies {
kapt project(':litho-processor')
Expand Down Expand Up @@ -63,6 +60,14 @@ android {

kaptTest project(':litho-processor')
}
namespace 'com.facebook.litho.editor.flipper'
lint {
abortOnError false
}
}

kotlin {
jvmToolchain(17)
}

apply plugin: "com.vanniktech.maven.publish"
4 changes: 1 addition & 3 deletions litho-editor-flipper/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
-->

<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.litho.editor.flipper"
>
xmlns:android="http://schemas.android.com/apk/res/android">

<!-- This is the version BUCK tests will run against to -->
<uses-sdk
Expand Down
5 changes: 3 additions & 2 deletions litho-espresso/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ android {
testInstrumentationRunner 'com.facebook.litho.testing.espresso.LithoEspressoTestRunner'
minSdkVersion rootProject.minSdkVersion
}

lintOptions {
namespace 'com.facebook.litho.testing.espresso'
lint {
abortOnError false
}

}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions litho-espresso/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.litho.testing.espresso">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
1 change: 1 addition & 0 deletions litho-flexlayout/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ android {
version '3.18.1'
}
}
namespace 'com.facebook.flexlayout'
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions litho-flexlayout/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.flexlayout">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
1 change: 1 addition & 0 deletions litho-fresco-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ android {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
}
namespace 'com.facebook.litho.fresco.kotlin'
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand Down
3 changes: 1 addition & 2 deletions litho-fresco-kotlin/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.litho.fresco.kotlin">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
7 changes: 4 additions & 3 deletions litho-fresco/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ android {
defaultConfig {
minSdkVersion rootProject.minSdkVersion
}

// TODO(#62): Re-enable abort on error.
lintOptions {
namespace 'com.facebook.litho.fresco'
lint {
abortOnError false
}

// TODO(#62): Re-enable abort on error.
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions litho-fresco/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.litho.fresco">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
5 changes: 3 additions & 2 deletions litho-instrumentation-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility rootProject.sourceCompatibilityVersion
targetCompatibility rootProject.targetCompatibilityVersion
}
namespace 'com.facebook.litho.instrumentationtests'
}

dependencies {
Expand Down
1 change: 0 additions & 1 deletion litho-instrumentation-tests/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.facebook.litho.instrumentationtests"
android:versionCode="1"
android:versionName="1.0">
<application
Expand Down
6 changes: 3 additions & 3 deletions litho-intellij-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ apply plugin: "org.jetbrains.intellij"

group 'com.facebook.litho.intellij'

sourceCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = rootProject.sourceCompatibilityVersion

compileKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8
kotlinOptions.jvmTarget = rootProject.targetCompatibilityVersion
}
compileTestKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8
kotlinOptions.jvmTarget = rootProject.targetCompatibilityVersion
}

sourceSets {
Expand Down
Loading

0 comments on commit 7d5f581

Please sign in to comment.