dropbox / focus Goto Github PK
View Code? Open in Web Editor NEWA Gradle plugin that helps you speed up builds by excluding unnecessary modules.
License: Apache License 2.0
A Gradle plugin that helps you speed up builds by excluding unnecessary modules.
License: Apache License 2.0
Plugin works great! But when trigger clean or rebuild (from Android Studio), all build directories will be removed. So generated focus.settings.gradle
will be deleted and project will be broken (.focus file exists, but points at nowhere now).
How do you solve that problem in your team?
As workaround I'm replacing path where generated focus.settings.gradle
will be saved - select root folder of target project, which placed in focus.
We recently migrated from buildSrc
to convention plugins which are being pulled in as an includeBuild
in our settings.gradle
.
Currently, I only have our app module in settings-all.gradle
and the original settings.gradle
file has the rest of the existing logic
pluginManagement {
includeBuild("build-logic")
}
plugins {
...
}
include("...")
This is the error we're getting
> Task :library:repository:createFocusSettings FAILED
1 problem was found storing the configuration cache.
- Task `:library:repository:createFocusSettings` of type `com.dropbox.focus.CreateFocusSettingsTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/8.0/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
See the complete report at file:///Users/changd/code/android/build/reports/configuration-cache/c2kiincfd0w2hzkql27qyhlqc/8pf9nvszsnq578qy2l4bu38yi/configuration-cache-report.html
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/changd/code/android/build.gradle' line: 29
* What went wrong:
Error resolving plugin [id: 'org.gradle.android.cache-fix', version: '2.7.1', apply: false]
> Included builds are not yet available for this build.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
10 actionable tasks: 1 executed, 9 up-to-date
I'm trying to integrate the plugin into our large mono-repo, the focus
task generates the .focus file but not the focus.settings.gradle file and thus Gradle is unable to find the file.
I have not configured the plugin, I have:
Is there another requirement that must be done?
Thanks
We have have multiple subprojects per feature. So let's say we have a "Sign In" feature, and have tagged a number of subprojects to be under that feature.
Would be nice to allow a developer working on the "Sign In" feature to run:
./gradlew signInFocus
That would "focus" all subprojects with that tag
Hello,
Trying to use this plugin with a Kotlin Multiplatform project, it does not work, as it looks for a hard-named settings-all.gradle
, which is not compatible with .kts
files.
Is it possible to make it compatible with Gradle's Kotlin DSL?
Thanks,
When I'm focused to module A and add (or merge) new module B to settings-all.gradle, gradle doesn't know module B when gradle sync and I have to call focus task again to generate new focus.settings.gradle.
Would it be possible that focus recognize during gradle sync that settings-all.gradle was changed and regenerate focus.settings.gradle automatically so I don't need to call focus task again?
I was trying to use focus for my project, but I was not able to set it up properly for the following reasons:
.gradle
files and .kts
files in the documentation and in the sample. It should either or, but don't mix both at the same timesettings.gradle.kts
, see screenshot for referenceGradle version: 7.3
AGP version: 7.1.0
Maybe someone can help out
In our project s_ettings.gradle_ we use includeBuild
statement to add in classpath separate project.
Focus plugin generates focus.settings.gradle without that statement, that's why included project is missing and project configuration become broken.
For example:
original settings.gradle
includeBuild("path_to_project")
include ':app'
generated settings.gradle
include ':app'
Need to point out that included project is not directly used in dependencies section of any subproject. It only contains gradle scripts that is applied at each subprojects.
As workaround, I'm using project.tasks.findByName("createFocusSettings").finalizedBy(myTask)
to intercept in settings creation process and append in file missing statements. May be you'll provide special configuration property in focus's extension, to allow edit generated settings file?
Could not resolve com.dropbox.focus:focus:0.4.0.
Required by:
unspecified:unspecified:unspecified > com.dropbox.focus:com.dropbox.focus.gradle.plugin:0.4.0
Unable to find a matching variant of com.dropbox.focus:focus:0.4.0:
- Variant 'apiElements' capability com.dropbox.focus:focus:0.4.0:
- Incompatible attributes:
- Required org.gradle.jvm.version '8' and found incompatible value '11'.
- Required org.gradle.usage 'java-runtime' and found incompatible value 'java-api'.
- Other attributes:
- Found org.gradle.category 'library' but wasn't required.
- Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
- Found org.gradle.jvm.environment 'standard-jvm' but wasn't required.
- Required org.gradle.libraryelements 'jar' and found compatible value 'jar'.
- Found org.gradle.status 'release' but wasn't required.
- Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
- Variant 'runtimeElements' capability com.dropbox.focus:focus:0.4.0:
- Incompatible attribute:
- Required org.gradle.jvm.version '8' and found incompatible value '11'.
- Other attributes:
- Found org.gradle.category 'library' but wasn't required.
- Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
- Found org.gradle.jvm.environment 'standard-jvm' but wasn't required.
- Required org.gradle.libraryelements 'jar' and found compatible value 'jar'.
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
- Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("com.dropbox.focus") version "0.4.0"
}
...included projects here
settings-all.gradle is empty for now
Project isolation is coming down the pipeline in Gradle and adds new limitations
https://gradle.github.io/configuration-cache/#status_as_of_gradle_8_5
The problematic line is use of subprojects
here: https://github.com/dropbox/focus/blob/main/focus-gradle-plugin/src/main/kotlin/com/dropbox/focus/FocusPlugin.kt#L71
This is part of a larger issue with this feature's limitations: gradle/gradle#22514
We're trying to use this plugin in a large repo. However, when the focus is applied, it generates a .focus
file and focus.settings.gradle
which appears to have all of the expected projects.
Though, when running ./gradlew clean
, it attempts to configure projects that are not in the focus file.
I've been debugging this for a few hours and can't produce a minimal reproducible set. Any help would be appreciated in what to track down. If I hazard a guess, there's some Plugin
that is pulling in dependencies recursively -- but I am unsure.
After calling the "focus" task, a file is generated focus.settings.gradle in which the paths on the module are specified using such a slash - , but Windows only accepts such a slash - /. Please let me know if this is a bug and someone is working on a fix.
Running with configuration caching yields the following errors
* What went wrong:
Configuration cache problems found in this build.
10 problems were found storing the configuration cache, 2 of which seem unique.
- Task `:tooling:vulcan:createFocusSettings` of type `com.dropbox.focus.CreateFocusSettingsTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/7.4/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
- Task `:tooling:vulcan:focus` of type `com.dropbox.focus.FocusTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/7.4/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
See the complete report at file:///Users/zsweers/dev/slack/android3/build/reports/configuration-cache/7g4wvgv20v66oia9a3wlgl3fw/4wl3j2ake574xd7cq4p2iiwz7/configuration-cache-report.html
> Invocation of 'Task.project' by task ':tooling:vulcan:createFocusSettings' at execution time is unsupported.
> Invocation of 'Task.project' by task ':tooling:vulcan:focus' at execution time is unsupported.
hello, please tell me when the new version will be released?
Our team recently added the Focus gradle plugin, which adds tasks like :subproject:focus
.
I'd love support in the IDE to be able to right click and run specific Gradle tasks from the right-click on subproject context menu.
For example, I have a subproject: :util:app-in-foreground-observer
. I would like to be able to right click on the subproject from the left side project menu in Android Studio and see a context menu with:
Run Gradle Task `:util:app-in-foreground-observer:focus`
While this is a useful feature for Focus, it makes sense that the IDE as a whole supports executing generating Gradle tasks from the context of a subproject, so I filed https://youtrack.jetbrains.com/issue/IDEA-291803 as well
I tried integrating focus into a project using Gradle 8.4 with configuration cache enabled and got a warning regarding incompatibilities.
I've updated the sample project to Gradle 8.4 and enabled configuration cache as a reproducer and this is the warning I got:
3 problems were found storing the configuration cache, 1 of which seems unique.
- Task `:sample:createFocusSettings` of type `com.dropbox.focus.CreateFocusSettingsTask`: invocation of ‘Task.project’ at execution time is unsupported.
See https://docs.gradle.org/8.4/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
PR with reproducer:#41
If a project depends on another via a SelfResolvingDependency
, then resolve(true)
must be called to resolve the actual dependency, otherwise it won't be added to the generated settings file.
After updating to Gradle 8.0 we have the following error :
A problem was found with the configuration of task ':clearFocus' (type 'ClearFocusTask').
- Type 'com.dropbox.focus.ClearFocusTask' property 'focusFile' has @Input annotation used on property of type 'RegularFileProperty'.
Reason: A property of type 'RegularFileProperty' annotated with @Input cannot determine how to interpret the file.
Possible solutions:
1. Annotate with @InputFile for regular files.
2. Annotate with @InputFiles for collections of files.
3. If you want to track the path, return File.absolutePath as a String and keep @Input.
Please refer to https://docs.gradle.org/8.0.2/userguide/validation_problems.html#incorrect_use_of_input_annotation for more details about this problem.
To reproduce you can update this project to Gradle 8.0.2 and run ./gradlew clearFocus
: build scan.
AGP 7.4.2
Gradle 8.0.2
Tell me how Focus can help me, if I write an android application and every time I launch the app module, does gradle work for a long time? It seems nothing, because my app module in gradle has all the other modules as dependencies. And if I focus on a particular module, make changes to it and try to compile the app module, I get an error like this : Project with path ':chat' could not be found in project ':app'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.