Skip to content

Conversation

dconeybe
Copy link
Contributor

@dconeybe dconeybe commented Sep 5, 2025

This PR fixes some Gradle build warnings for the dataconnect project. The primary goal is to eliminate deprecation warnings by adopting updated syntax for Android's targetSdk and Kotlin's compiler options, ensuring the project remains compatible with the latest build tools and best practices.

Highlights

  • Gradle Configuration Updates: Updated Gradle build scripts across multiple modules to address deprecation warnings related to targetSdk and kotlinOptions.
  • Kotlin Compiler Options Migration: Migrated Kotlin compiler configurations from the deprecated kotlinOptions block to the new kotlin { compilerOptions { ... } } DSL, ensuring compatibility with newer Gradle and Kotlin versions.
  • Android Target SDK Relocation: Relocated the targetSdk property from defaultConfig to testOptions and lint blocks in Android libraries, as that targetSdk property in libraries is deprecated and scheduled for removal (only for libraries though, Android application DSL is not affected).
  • Explicit API Mode Refinement: Refined the configuration for Kotlin's 'Explicit API Mode' by updating the task type from KotlinCompile to KotlinJvmCompile and simplifying the addition of compiler arguments.
  • Gradle Task Warnings: Fixed some warnings about usages of DefaultTask.project attribute in the execution phase, which is deprecated and will be removed in a future version of Gradle. Using ExecOperations and FileSystemOperations instead.

See https://issuetracker.google.com/issues/230625468 for details about the removal of targetSdk from the DSL for Android libraries.

See https://kotlinlang.org/docs/gradle-compiler-options.html for details about the Kotlin compiler options change.

This comment was marked as off-topic.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @dconeybe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on modernizing the Gradle build configurations for the dataconnect project. The primary goal is to eliminate deprecation warnings by adopting updated syntax for Android's targetSdk and Kotlin's compiler options, ensuring the project remains compatible with the latest build tools and best practices.

Highlights

  • Gradle Configuration Updates: Updated Gradle build scripts across multiple modules to address deprecation warnings related to targetSdk and kotlinOptions.
  • Kotlin Compiler Options Migration: Migrated Kotlin compiler configurations from the deprecated kotlinOptions block to the new kotlin { compilerOptions { ... } } DSL, ensuring compatibility with newer Gradle and Kotlin versions.
  • Android Target SDK Relocation: Relocated the targetSdk property from defaultConfig to testOptions and lint blocks, aligning with modern Android Gradle Plugin recommendations.
  • Explicit API Mode Refinement: Refined the configuration for Kotlin's 'Explicit API Mode' by updating the task type from KotlinCompile to KotlinJvmCompile and simplifying the addition of compiler arguments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses several Gradle configuration warnings by updating deprecated properties like targetSdk and kotlinOptions. The changes are consistent across all modified modules and adopt the modern, recommended approach for configuring Kotlin compiler options. This improves the maintainability of the build scripts. I've found one potential issue in the Spotless configuration that could break the build, for which I've left a specific comment.

@google-oss-bot

This comment was marked as off-topic.

@google-oss-bot

This comment was marked as off-topic.

@dconeybe dconeybe requested a review from Copilot September 5, 2025 04:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modernizes Gradle and Kotlin build configurations for the dataconnect project to eliminate deprecation warnings and align with current best practices. The changes ensure compatibility with newer build tools while maintaining existing functionality.

  • Migrated deprecated kotlinOptions to the new kotlin { compilerOptions { ... } } DSL for better Kotlin compiler configuration
  • Relocated deprecated targetSdk property from defaultConfig to appropriate blocks (testOptions and lint) for Android libraries
  • Updated Gradle task dependencies to use injected services instead of deprecated project methods

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
firebase-dataconnect/testutil/testutil.gradle.kts Updated Kotlin compiler options and moved targetSdk to testOptions/lint blocks
firebase-dataconnect/firebase-dataconnect.gradle.kts Migrated to new Kotlin compiler options DSL and updated explicit API mode configuration
firebase-dataconnect/connectors/connectors.gradle.kts Applied Kotlin compiler modernization and targetSdk relocation
firebase-dataconnect/androidTestutil/androidTestutil.gradle.kts Updated Kotlin configuration and targetSdk placement
firebase-dataconnect/demo/build.gradle.kts Migrated Kotlin compiler options and updated spotless configuration
firebase-dataconnect/gradleplugin/plugin/src/main/kotlin/* Added dependency injection for ExecOperations and FileSystemOperations
.github/workflows/*.yml Added warning mode flags to Gradle commands for better build visibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

Summary of Changes

This pull request modernizes the Gradle build configurations across the dataconnect project. The changes primarily focus on resolving deprecation warnings related to Android's targetSdk and Kotlin's compiler options, ensuring the project aligns with the latest build tool recommendations and maintains compatibility.

Highlights

  • Gradle Configuration Updates: Updated build scripts to address deprecation warnings for targetSdk and kotlinOptions.
  • Kotlin Compiler Options Migration: Migrated Kotlin compiler configurations to the new kotlin { compilerOptions { ... } } DSL.
  • Android Target SDK Relocation: Moved targetSdk from defaultConfig to testOptions and lint blocks in Android libraries.
  • Explicit API Mode Refinement: Updated task type for 'Explicit API Mode' configuration from KotlinCompile to KotlinJvmCompile and simplified argument addition.
Changelog
  • firebase-dataconnect/androidTestutil/androidTestutil.gradle.kts
    • Updated Gradle configuration by relocating targetSdk from defaultConfig to testOptions and lint blocks.
    • Migrated Kotlin compiler options to the new kotlin { compilerOptions { ... } } DSL.
    • Removed old Kotlin compiler argument configuration.
    • Updated import for JvmTarget.
  • firebase-dataconnect/connectors/connectors.gradle.kts
    • Applied similar Gradle configuration updates as androidTestutil.gradle.kts.
    • Refined the Explicit API Mode setup by changing the task type to KotlinJvmCompile and simplifying compiler argument addition.
    • Added imports for withType and KotlinJvmCompile.
  • firebase-dataconnect/demo/build.gradle.kts
    • Migrated Kotlin compiler options to the new DSL.
    • Updated the Spotless XML formatter configuration from indentWithSpaces to leadingTabsToSpaces.
    • Added import for JvmTarget.
  • firebase-dataconnect/firebase-dataconnect.gradle.kts
    • Implemented the same Gradle configuration and Explicit API Mode updates as seen in connectors/connectors.gradle.kts.
    • Added imports for withType and KotlinJvmCompile.
  • firebase-dataconnect/gradleplugin/plugin/src/main/kotlin/com/google/firebase/dataconnect/gradle/plugin/DataConnectExecutableDownloadTask.kt
    • Refactored task logic to inject FileSystemOperations and ExecOperations.
    • Replaced direct project calls for file operations and command execution with injected services.
  • firebase-dataconnect/gradleplugin/plugin/src/main/kotlin/com/google/firebase/dataconnect/gradle/plugin/DataConnectExecutableLauncher.kt
    • Modified the runDataConnectExecutable function to accept ExecOperations.
    • Updated file system operations to use mkdirs() instead of project.mkdir.
  • firebase-dataconnect/gradleplugin/plugin/src/main/kotlin/com/google/firebase/dataconnect/gradle/plugin/DataConnectGenerateCodeTask.kt
    • Updated file deletion to use deleteRecursively().
    • Passed execOperations to executable calls.
  • firebase-dataconnect/gradleplugin/plugin/src/main/kotlin/com/google/firebase/dataconnect/gradle/plugin/DataConnectMergeConfigDirectoriesTask.kt
    • Injected FileSystemOperations.
    • Updated directory deletion and copying to use the injected service and deleteRecursively().
    • Improved logging string formatting.
  • firebase-dataconnect/gradleplugin/plugin/src/main/kotlin/com/google/firebase/dataconnect/gradle/plugin/DataConnectRunEmulatorTask.kt
    • Injected ExecOperations.
    • Passed execOperations to the runDataConnectExecutable call.
  • firebase-dataconnect/gradleplugin/plugin/src/main/kotlin/com/google/firebase/dataconnect/gradle/plugin/UpdateDataConnectExecutableVersionsTask.kt
    • Injected ExecOperations.
    • Passed execOperations to the downloadDataConnectExecutable call.
  • firebase-dataconnect/testutil/testutil.gradle.kts
    • Applied the same Gradle configuration updates as androidTestutil.gradle.kts.
    • Migrated Kotlin compiler options to the new kotlin { compilerOptions { ... } } DSL.
    • Removed old Kotlin compiler argument configuration.
    • Updated import for JvmTarget.
Activity
  • A bot provided a reminder about merging into the main branch.
  • A bot posted a coverage report, showing changes in coverage for firebase-dataconnect.
  • A bot posted a size report, indicating minor size changes for firebase-dataconnect.
  • The author requested a summary.
  • The author requested a review.
  • A bot provided a review comment regarding a potential build failure due to leadingTabsToSpaces in demo/build.gradle.kts.
  • The author responded to the review comment, marking it as a "False positive".

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request does an excellent job of addressing Gradle deprecation warnings and modernizing the build scripts. The migration from kotlinOptions to the compilerOptions DSL and updating the targetSdk location for Android libraries are well-executed across all modules. The refactoring of Gradle tasks to use injected services like FileSystemOperations and ExecOperations instead of direct project access is a significant improvement for build cacheability and correctness. I have a few suggestions to further improve the Gradle task implementations by using the recommended APIs for file operations, which will enhance build caching and reliability.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 5, 2025

Startup Time Report 1

The report is too large (117,108 chars) to be displayed on GitHub. Please check this report on GCS.

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/OTiO4xyJJf/index.html

@dconeybe dconeybe merged commit db3bd7a into main Sep 8, 2025
294 of 296 checks passed
@dconeybe dconeybe deleted the dconeybe/dataconnect/WarningFixesTargetSdkEtAl branch September 8, 2025 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants