Status Update
Comments
zu...@gmail.com <zu...@gmail.com> #2
ls...@google.com <ls...@google.com> #3
Below is the comment from the CL, that we can get some idea what is current behavior.
"we only explicityly build:
a. App modules
b. Non-app modules that no other module depends on
This way, both the IDE and Gradle perform less work",
zu...@gmail.com <zu...@gmail.com> #4
Justin, what do you think?
sg...@google.com <sg...@google.com>
ra...@google.com <ra...@google.com> #5
I have run onto this several times. Compilers are often used to find code dependent on a change you have just made. There is no easy way to recompile all sources in the project in Android Studio.
It makes sense that when you build to launch an app the IDE builds only sources required for the target, but since Ctrl+F9 already builds all modules it is clear that its intention is not to make the least possible number of targets and thus it seems reasonable to build all tests too. Moreover, IDEA usually builds all sources on Ctrl+F9 but only required targets on run/debug.
Alternatively, we can add another build action which can be bound to a custom keyboard shortcut if anyone wants to.
ra...@google.com <ra...@google.com> #6
There are 3 options in the Build
Menu:
- Make Project
- Make Module X
- Recompile Y
The last 2 options are contextual, based on the currently active file opened in the editor, where X is the module, and Y is the file itself.
Option 1 will do:
assemble<Variant>
on the android app module, no matter which file is active in the editor. (It does this for all app modules currently in the project, and also all non-app modules that are not consumed by the current app modules).
Option 2 will do:
- On a java library:
assemble
andtestClasses
, even if the current active file is not a test file - On an android module:
assemble<Variant>
, even if the current active file is a test file
Option 3 will do:
- On a java library:
clean
andtestClasses
, even if the current active file is not a test file - On an android module:
clean
andassemble<Variant>
, even if the current active file is a test file
Proposal
We need to at least have consistent behavior between option 1 and 2 since they should only differ in which modules get build, not how they build them. I would recommend to build:
- fully build the current production variant
- compile the unit-test, code if present
- compile the androidTest, code if present.
For option, 1 this will require manually listing the test and androidTest tasks for each module. This can become a really long list for very large project. We should try it and see if there are scalability issue anywhere.
For option 3, we need to:
- not call
assemble
. The menu item saysRecompile Foo.kt
, notassemble module
. So we just need to call the compilation task. - we should also only clean the compilation task itself, not the full module (ie if call
testClasses
we prepend withcleanTestClasses
) - actually run the compilation task that will compile the current file. Right now it seems to always run a specific one (that is even different for java and android modules), and therefore it can be wrong because it does not actually recompile the current file.
Juan, does this make sense to you?
gh...@google.com <gh...@google.com> #7
zu...@gmail.com <zu...@gmail.com> #9
Not sure if some of this was already committed, but I have just upgraded to Studio 2020.3.1 Beta 2
+ AGP 7.0.0-beta02
, and getting the following errors when invoking "Make Project" (Ctrl + F9):
e: /path/to/project/lib/lint-checks/src/test/kotlin/ru/kode/base/lint/issue/LambdaTooLongForItTest.kt: (5, 12): Unresolved reference: junit
e: /path/to/project/lib/lint-checks/src/test/kotlin/ru/kode/base/lint/issue/LambdaTooLongForItTest.kt: (9, 4): Unresolved reference: Test
e: /path/to/project/lib/lint-checks/src/test/kotlin/ru/kode/base/lint/issue/LambdaTooLongForItTest.kt: (13, 9): Cannot access 'junit.framework.TestCase' which is a supertype of 'com.android.tools.lint.checks.infrastructure.LintDetectorTest'. Check your module classpath for missing or conflicting dependencies
e: /path/to/project/lib/lint-checks/src/test/kotlin/ru/kode/base/lint/issue/LambdaTooLongForItTest.kt: (26, 4): Unresolved reference: Test
e: /path/to/project/lib/lint-checks/src/test/kotlin/ru/kode/base/lint/issue/LambdaTooLongForItTest.kt: (30, 9): Cannot access 'junit.framework.TestCase' which is a supertype of 'com.android.tools.lint.checks.infrastructure.LintDetectorTest'. Check your module classpath for missing or conflicting dependencies
e: /path/to/project/lib/lint-checks/src/test/kotlin/ru/kode/base/lint/issue/LambdaTooLongForItTest.kt: (43, 4): Unresolved reference: Test
e: /path/to/project/lib/lint-checks/src/test/kotlin/ru/kode/base/lint/issue/LambdaTooLongForItTest.kt: (47, 9): Cannot access 'junit.framework.TestCase' which is a supertype of 'com.android.tools.lint.checks.infrastructure.LintDetectorTest'. Check your module classpath for missing or conflicting dependencies
The classes above are lint-based tests for my custom lint checks.
Here are deps from this module's build.gradle:
dependencies {
compileOnly Deps.coreLibs
compileOnly "com.android.tools.lint:lint-api:$lintVersion"
compileOnly "com.android.tools.lint:lint-checks:$lintVersion"
testCompileOnly "com.android.tools.lint:lint:$lintVersion"
testCompileOnly "com.android.tools.lint:lint-tests:$lintVersion"
}
If I downgrade to Studio 4.2.1 and corresponding AGP version, compilation goes without an error.
gh...@google.com <gh...@google.com> #10
Can you file a separate bug? This bug is about whether the make Project action even trigger a build. Your issues seems to be more about a project dependency setup issue. thank you.
zu...@gmail.com <zu...@gmail.com> #11
We can now better control what tasks are invoked in which case, but we haven't come to agreement on that.
Description
Android Studio Ladybug Feature Drop | 2024.2.2 Canary 2
Build #AI-242.21829.142.2422.12358220, built on September 12, 2024
Runtime version: 21.0.3+-12282718-b509.11 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 6144M
Cores: 24
Registry:
ide.instant.shutdown=false
debugger.new.tool.window.layout=true
ide.experimental.ui=true
i18n.locale=
Non-Bundled Plugins:
com.intellij.marketplace (242.21829.220)
siosio.kodkod (2.0.1)
com.alibabacloud.intellij.cosy (1.3.14)
cn.yiiguxing.plugin.translate (3.6.4)