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

refactor: Bump AGP from 7.1.3 to 8.5.2 #1213

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
steps:
- name: Fetch Sources
uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -49,10 +49,10 @@ jobs:
steps:
- name: Fetch Sources
uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-automated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Generate Javadoc
run: javadoc @.javadoc || true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-manual-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Generate Javadoc
run: javadoc @.javadoc || true
Expand Down
11 changes: 6 additions & 5 deletions bolts-tasks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ java {

javadoc.options.addStringOption('Xdoclint:none', '-quiet')

task sourcesJar(type: Jar) {
tasks.register('sourcesJar', Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allJava
}

task javadocJar(type: Jar, dependsOn: javadoc) {
tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
Expand All @@ -39,7 +40,7 @@ afterEvaluate {
publishing {
publications {
boltsPublication(MavenPublication) {
from components.java
from components.findByName('java')
}
}
}
Expand All @@ -55,8 +56,8 @@ jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled true
html.enabled true
xml { enabled true }
html { enabled true }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

/* package */ static final long KEEP_ALIVE_TIME = 1L;
private static final AndroidExecutors INSTANCE = new AndroidExecutors();

/**
* Nexus 5: Quad-Core Moto X: Dual-Core
*
Expand All @@ -43,6 +44,7 @@
* <p>https://github.com/android/platform_frameworks_base/commit/719c44e03b97e850a46136ba336d729f5fbd1f47
*/
private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();

/* package */ static final int CORE_POOL_SIZE = CPU_COUNT + 1;
/* package */ static final int MAX_POOL_SIZE = CPU_COUNT * 2 + 1;
private final Executor uiThread;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public boolean isCancellationRequested() {
}
}

/** @return the token that can be passed to asynchronous method to control cancellation. */
/**
* @return the token that can be passed to asynchronous method to control cancellation.
*/
public CancellationToken getToken() {
synchronized (lock) {
throwIfClosed();
Expand Down
18 changes: 14 additions & 4 deletions bolts-tasks/src/main/java/com/parse/boltsinternal/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
public class Task<TResult> {
/** An {@link java.util.concurrent.Executor} that executes tasks in parallel. */
public static final ExecutorService BACKGROUND_EXECUTOR = BoltsExecutors.background();

/** An {@link java.util.concurrent.Executor} that executes tasks on the UI thread. */
public static final Executor UI_THREAD_EXECUTOR = AndroidExecutors.uiThread();

/**
* An {@link java.util.concurrent.Executor} that executes tasks in the current thread unless the
* stack runs too deep, at which point it will delegate to {@link Task#BACKGROUND_EXECUTOR} in
Expand Down Expand Up @@ -541,28 +543,36 @@ public boolean isCompleted() {
}
}

/** @return {@code true} if the task was cancelled, {@code false} otherwise. */
/**
* @return {@code true} if the task was cancelled, {@code false} otherwise.
*/
public boolean isCancelled() {
synchronized (lock) {
return cancelled;
}
}

/** @return {@code true} if the task has an error, {@code false} otherwise. */
/**
* @return {@code true} if the task has an error, {@code false} otherwise.
*/
public boolean isFaulted() {
synchronized (lock) {
return getError() != null;
}
}

/** @return The result of the task, if set. {@code null} otherwise. */
/**
* @return The result of the task, if set. {@code null} otherwise.
*/
public TResult getResult() {
synchronized (lock) {
return result;
}
}

/** @return The error for the task, if set. {@code null} otherwise. */
/**
* @return The error for the task, if set. {@code null} otherwise.
*/
public Exception getError() {
synchronized (lock) {
if (error != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public TaskCompletionSource() {
task = new Task<>();
}

/** @return the Task associated with this TaskCompletionSource. */
/**
* @return the Task associated with this TaskCompletionSource.
*/
public Task<TResult> getTask() {
return task;
}
Expand Down
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
buildscript {
ext.kotlin_version = "1.7.10"
ext.kotlin_version = "1.9.20"
ext.jacocoVersion = '0.8.12'
ext.spotlessVersion = '6.25.0'

repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.android.tools.build:gradle:8.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jacoco:org.jacoco.core:$jacocoVersion"
classpath "com.dicedmelon.gradle:jacoco-android:0.1.5"
classpath "io.freefair.gradle:android-gradle-plugins:4.2.0-m1"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.17.1"
classpath "io.freefair.gradle:android-gradle-plugins:7.2.0-m1"
classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion"
}
}

plugins {
id "com.github.ben-manes.versions" version "0.28.0"
id "com.diffplug.spotless" version "5.17.1"
id "com.diffplug.spotless" version "$spotlessVersion"
}

allprojects {
Expand All @@ -39,7 +39,7 @@ allprojects {
}
kotlin {
target '**/*.kt'
ktlint().userData(["disabled_rules": "no-wildcard-imports"])
ktlint()
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
Expand Down
9 changes: 7 additions & 2 deletions coroutines/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ apply plugin: "io.freefair.android-javadoc-jar"
apply plugin: "io.freefair.android-sources-jar"

android {
compileSdkVersion rootProject.ext.compileSdkVersion
namespace 'com.parse.coroutines'
compileSdk rootProject.ext.compileSdkVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
Expand Down Expand Up @@ -37,6 +38,10 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}

buildFeatures {
buildConfig true
}
}

ext {
Expand All @@ -54,7 +59,7 @@ afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
from components.findByName('release')
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine

suspend fun <T> callCloudFunction(functionName: String, params: Map<String, Any>): T {
suspend fun <T> callCloudFunction(
functionName: String,
params: Map<String, Any>,
): T {
return suspendCoroutine { continuation ->
ParseCloud.callFunctionInBackground<T>(functionName, params) { result, e ->
if (e == null) continuation.resume(result)
else continuation.resumeWithException(e)
if (e == null) {
continuation.resume(result)
} else {
continuation.resumeWithException(e)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ suspend fun <T : ParseObject> ParseObject.suspendFetch(): T {
return suspendCoroutine { continuation ->

fetchInBackground<T> { obj, e ->
if (e == null) continuation.resume(obj)
else continuation.resumeWithException(e)
if (e == null) {
continuation.resume(obj)
} else {
continuation.resumeWithException(e)
}
}
}
}
Expand All @@ -21,8 +24,11 @@ suspend fun <T : ParseObject> ParseObject.suspendFetchIfNeeded(): T {
return suspendCoroutine { continuation ->

fetchIfNeededInBackground<T> { obj, e ->
if (e == null) continuation.resume(obj)
else continuation.resumeWithException(e)
if (e == null) {
continuation.resume(obj)
} else {
continuation.resumeWithException(e)
}
}
}
}
Expand All @@ -31,8 +37,11 @@ suspend fun <T : ParseObject> ParseObject.fetchFromLocal(): T {
return suspendCoroutine { continuation ->

fetchFromLocalDatastoreInBackground<T> { obj, e ->
if (e == null) continuation.resume(obj)
else continuation.resumeWithException(e)
if (e == null) {
continuation.resume(obj)
} else {
continuation.resumeWithException(e)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@ import kotlin.coroutines.suspendCoroutine
suspend fun ParseObject.suspendSave() {
return suspendCoroutine { continuation ->
saveInBackground {
if (it == null) continuation.resume(Unit)
else continuation.resumeWithException(it)
if (it == null) {
continuation.resume(Unit)
} else {
continuation.resumeWithException(it)
}
}
}
}

suspend fun ParseObject.suspendPin() {
return suspendCoroutine { continuation ->
pinInBackground {
if (it == null) continuation.resume(Unit)
else continuation.resumeWithException(it)
if (it == null) {
continuation.resume(Unit)
} else {
continuation.resumeWithException(it)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import kotlin.coroutines.EmptyCoroutineContext
fun <T : ParseObject> CoroutineScope.launchQuery(
query: ParseQuery<T>,
context: CoroutineContext = EmptyCoroutineContext,
block: suspend ParseQueryOperation<T>.() -> Unit
block: suspend ParseQueryOperation<T>.() -> Unit,
): Job {
return launch(context) {
block.invoke(ParseQueryOperationImpl(query))
Expand Down
Loading
Loading