Skip to content

Conversation

beroso
Copy link

@beroso beroso commented Jul 4, 2025

Motivation and Context

I'm integrating a flutter module inside a ionic cordova app. So accordingly to the flutter guide I need to put the following config on settings.gradle:

setBinding(new Binding([gradle: this]))
def filePath = settingsDir.parentFile.toString() + "/flutter_module/.android/include_flutter.groovy"
apply from: filePath 

But the file is regenerated on each build, and my changes are lost.

Description

Sometimes we need some extra settings on settings.gradle file, but the file is regenerated on each build.
The proposed solution applies a settings-additional.gradle file (if it exists) to the settings.gradle.

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@breautek breautek changed the title Allows additional settings to be included on settings.gradle feat: Allows additional settings to be included on settings.gradle Jul 4, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jul 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.12%. Comparing base (484c60e) to head (ef28380).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1819   +/-   ##
=======================================
  Coverage   72.12%   72.12%           
=======================================
  Files          23       23           
  Lines        1844     1844           
=======================================
  Hits         1330     1330           
  Misses        514      514           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@breautek
Copy link
Contributor

breautek commented Jul 4, 2025

I think this is a good clean enhancement and I think there isn't a risk of a breaking change. Because we have the same concept for build-extras.gradle, I don't think there is any issue doing the same for settings. Considering that Apache just made a release not that long ago, it might be some time before a feature release is made however.

A workaround that should work in the meantime if you don't want to use a custom version of cordova-android is the after prepare hook. It should allow you to manipulate the settings.gradle after Cordova has generated the file.

@breautek breautek added this to the 15.0.0 milestone Jul 4, 2025
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

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

LGTM

Could you add a note to the PR description explaining how someone can add their settings-extras.gradle file to the correct directory? I suspect it will involve the <resource-file> element in config.xml.

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.

4 participants