Skip to content
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

Update AGP 8 #300

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ jobs:
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
steps:
- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 17
- name: Checkout the code
uses: actions/checkout@v2
- name: Install Ruby
Expand Down Expand Up @@ -42,6 +47,11 @@ jobs:
assemble_samples:
runs-on: ubuntu-latest
steps:
- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 17
- name: Checkout the code
uses: actions/checkout@v2
- name: Assemble Counter
Expand Down
13 changes: 7 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: "com.github.ben-manes.versions"

buildscript {
ext {
kotlinVersion = '1.5.21'
kotlinVersion = '1.8.10'

versions = [:]
libraries = [:]
Expand All @@ -21,11 +21,13 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.android.tools.build:gradle:8.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.vanniktech:gradle-android-junit-jacoco-plugin:0.16.0"
// We need to fork the plugin to fix an incorrect usage of tasks.withType(Test)
// https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/compare/master...Laimiux:gradle-android-junit-jacoco-plugin:laimonas/gradle-8?expand=1
classpath("com.github.Jawnnypoo:gradle-android-junit-jacoco-plugin:61a9cc0129")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fork in order to support publishing on Jitpack. Hoping that we can see vanniktech/gradle-android-junit-jacoco-plugin#219 get merged and won't have to worry about this anymore.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we publish to Jitpack anymore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry yeah, that was confusing wording. I forked your fork of gradle-android-junit-jacoco-plugin so that I could change configuration of that lib to publish it to Jitpack, since it was configured to publish to IC's internal artifactory server, and was failing to build on Jitpack.

classpath "com.github.ben-manes:gradle-versions-plugin:0.38.0"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.32"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10"
classpath "org.jetbrains.dokka:android-documentation-plugin:1.4.32"
classpath "com.vanniktech:gradle-maven-publish-plugin:0.14.2"
}
Expand Down Expand Up @@ -57,8 +59,7 @@ task clean(type: Delete) {

apply plugin: "com.vanniktech.android.junit.jacoco"
junitJacoco {
// WARNING! Don't upgrade unless https://github.com/Malinskiy/danger-jacoco/issues/10 is fixed
jacocoVersion = '0.8.2'
jacocoVersion = '0.8.8'
excludes = [
// Defaults
'**/androidx/**/*.*',
Expand Down
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ext {
okhttpVersion = "3.13.1"
robolectricVersion = "4.6.1"
truthVersion = "1.1.3"
composeVersion = "1.0.1"
composeVersion = "1.4.3"
kotlinCoroutinesVersion = "1.5.2"
lintVersion = "30.0.0"
autoServiceVersion = "1.0-rc7"
Expand Down Expand Up @@ -80,7 +80,7 @@ ext {
tests: "com.android.tools.lint:lint-tests:${lintVersion}",
],
robolectric : "org.robolectric:robolectric:$robolectricVersion",
rxjava : "io.reactivex.rxjava3:rxjava:3.1.1",
rxjava : "io.reactivex.rxjava3:rxjava:3.1.6",
rxandroid : "io.reactivex.rxjava3:rxandroid:3.0.0",
rxrelays : "com.jakewharton.rxrelay3:rxrelay:3.0.1",
truth : "com.google.truth:truth:$truthVersion",
Expand Down
10 changes: 5 additions & 5 deletions formula-android-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apply from: rootProject.file('.buildscript/configure-signing.gradle')
apply from: rootProject.file('.buildscript/jacoco-workaround.gradle')

android {
namespace "com.instacart.formula.android.compose"
compileSdkVersion constants.compileSdk

defaultConfig {
Expand All @@ -17,13 +18,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = "1.8"
useIR = true
jvmTarget = JavaVersion.VERSION_11.toString()
}

composeOptions {
Expand All @@ -35,7 +35,7 @@ android {

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
2 changes: 1 addition & 1 deletion formula-android-compose/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="com.instacart.formula.android.compose"/>
<manifest />
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.instacart.formula.android.FeatureView
import com.instacart.formula.android.ViewFactory


abstract class ComposeViewFactory<RenderModel> : ViewFactory<RenderModel> {
abstract class ComposeViewFactory<RenderModel : Any> : ViewFactory<RenderModel> {

override fun create(inflater: LayoutInflater, container: ViewGroup?): FeatureView<RenderModel> {
val view = ComposeView(inflater.context)
Expand Down
7 changes: 4 additions & 3 deletions formula-android-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apply plugin: "kotlin-parcelize"
apply from: rootProject.file('.buildscript/jacoco-workaround.gradle')

android {
namespace "com.instacart.formula"
compileSdkVersion 28
defaultConfig {
applicationId "com.instacart.formula.samples"
Expand All @@ -16,8 +17,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

buildTypes {
Expand All @@ -36,7 +37,7 @@ android {

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
3 changes: 1 addition & 2 deletions formula-android-tests/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.instacart.formula">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:allowBackup="true"
android:label="@string/app_name"
Expand Down
7 changes: 4 additions & 3 deletions formula-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apply from: rootProject.file('.buildscript/configure-signing.gradle')
apply from: rootProject.file('.buildscript/jacoco-workaround.gradle')

android {
namespace "com.instacart.formula.android"
compileSdkVersion constants.compileSdk

defaultConfig {
Expand All @@ -15,14 +16,14 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
2 changes: 1 addition & 1 deletion formula-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="com.instacart.formula.android"/>
<manifest/>
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import io.reactivex.rxjava3.core.Observable
* @param bind A bind function connects state observable to the view rendering.
* @param lifecycleCallbacks Optional lifecycle callbacks if you need to know the Fragment state.
*/
class FeatureView<RenderModel>(
class FeatureView<RenderModel : Any>(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would not compile without adding this in various places, unfortunately. I believe this stems from RxJava (hence why I updated the dependency) but I am not 100% sure.

val view: View,
val bind: (State<RenderModel>) -> Cancelable?,
val lifecycleCallbacks: FragmentLifecycleCallback? = null,
) {
class State<RenderModel>(
class State<RenderModel : Any>(
val observable: Observable<RenderModel>,
val onError: (Throwable) -> Unit,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.instacart.formula.android.views.InflatedViewInstance
* }
* ```
*/
abstract class LayoutViewFactory<RenderModel>(@LayoutRes val layoutId: Int): ViewFactory<RenderModel> {
abstract class LayoutViewFactory<RenderModel : Any>(@LayoutRes val layoutId: Int): ViewFactory<RenderModel> {

abstract fun ViewInstance.create(): FeatureView<RenderModel>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.instacart.formula.android.views.DelegateLayoutViewFactory
*
* To create a view factory, use static constructor [fromLayout] or extend [LayoutViewFactory].
*/
fun interface ViewFactory<RenderModel> {
fun interface ViewFactory<RenderModel : Any> {

companion object {
/**
Expand All @@ -37,7 +37,7 @@ fun interface ViewFactory<RenderModel> {
* @param layoutId Layout resource to be inflated.
* @param createView Called with a [ViewInstance] to finish [FeatureView] creation
*/
fun <RenderModel> fromLayout(
fun <RenderModel : Any> fromLayout(
@LayoutRes layoutId: Int,
createView: ViewInstance.() -> FeatureView<RenderModel>
): ViewFactory<RenderModel> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract class ViewInstance {
/**
* Creates a [FeatureView] from a [render] function
*/
fun <RenderModel> featureView(
fun <RenderModel : Any> featureView(
lifecycleCallbacks: FragmentLifecycleCallback? = null,
render: (RenderModel) -> Unit
): FeatureView<RenderModel> {
Expand All @@ -31,7 +31,7 @@ abstract class ViewInstance {
/**
* Creates a [FeatureView] from a [Renderer].
*/
fun <RenderModel> featureView(
fun <RenderModel : Any> featureView(
renderer: Renderer<RenderModel>,
lifecycleCallbacks: FragmentLifecycleCallback? = null,
): FeatureView<RenderModel> {
Expand All @@ -45,7 +45,7 @@ abstract class ViewInstance {
/**
* Creates a [FeatureView] from a [RenderView].
*/
fun <RenderModel> featureView(
fun <RenderModel : Any> featureView(
renderView: RenderView<RenderModel>,
lifecycleCallbacks: FragmentLifecycleCallback? = null,
): FeatureView<RenderModel> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.instacart.formula.android.ViewInstance
/**
* An implementation of [LayoutViewFactory] which delegates [FeatureView] creation to [createView].
*/
internal class DelegateLayoutViewFactory<RenderModel>(
internal class DelegateLayoutViewFactory<RenderModel : Any>(
@LayoutRes layoutId: Int,
private val createView: ViewInstance.() -> FeatureView<RenderModel>
) : LayoutViewFactory<RenderModel>(layoutId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.lang.Exception
/**
* Binds [FeatureView.State] to a [render] function.
*/
internal class FeatureViewBindFunction<RenderModel>(
internal class FeatureViewBindFunction<RenderModel : Any>(
private val render: Renderer<RenderModel>
) : (FeatureView.State<RenderModel>) -> Cancelable? {
override fun invoke(state: FeatureView.State<RenderModel>): Cancelable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.instacart.formula.android.FeatureView
import com.instacart.formula.android.LayoutViewFactory
import com.instacart.formula.android.ViewInstance

class NoOpViewFactory<RenderModel> : LayoutViewFactory<RenderModel>(-1) {
class NoOpViewFactory<RenderModel : Any> : LayoutViewFactory<RenderModel>(-1) {
override fun ViewInstance.create(): FeatureView<RenderModel> {
return featureView { }
}
Expand Down
5 changes: 3 additions & 2 deletions formula-coroutines/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

dependencies {
Expand All @@ -22,6 +22,7 @@ dependencies {

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
}
4 changes: 2 additions & 2 deletions formula-lint/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ apply plugin: 'org.jetbrains.dokka'

apply from: rootProject.file('.buildscript/configure-signing.gradle')

targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11

dependencies {
compileOnly libraries.lint.api
Expand Down
6 changes: 3 additions & 3 deletions formula-rxjava3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ repositories {
}

tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
6 changes: 3 additions & 3 deletions formula-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ apply plugin: 'org.jetbrains.dokka'

apply from: rootProject.file('.buildscript/configure-signing.gradle')

sourceCompatibility = 1.8 // java 8
targetCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

repositories {
mavenCentral()
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
6 changes: 3 additions & 3 deletions formula/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ repositories {
}

tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/merge-reports.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ afterEvaluate {
}

task mergeReports(type: Copy) {
from { testTasks*.reports.junitXml.destination } {
from { file("$buildDir/test-results") } {
exclude("**/binary/*")
}
into { file("$buildDir/reports/allTests") }
Expand All @@ -39,7 +39,7 @@ def disableHtmlTestReport(Project project) {
project.android {
testOptions {
unitTests.all {
reports.html.enabled = false
reports.html.required = false
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading