Stanislav Kral
10/14/2022, 9:37 AMA
and B
In A
I declare a dependency on a local x.aar
archive using the api
keyword.
Now, A
has access to all classes inside x.aar
.
In B
I declare a dependency on A
using the implementation
keyword, hoping, that I could access classes from x.aar
.
This does not work because B
says that x.aar
cannot be found.
This can be fixed by adding repositories
to `B`:
repositories {
flatDir {
dirs "../libs"
}
}
Is there any way I can do that without explicitly importing the x.aar
library in B
?
Summary: I'd like to access an imported library (.aar
lib) from A
in B
without having to import the lib in B
.
Thanks a lot.
EDIT: sorry, I meant dependency B -> A
. Additionally, sorry that this is a general Gradle question.mitch
10/17/2022, 6:42 AMtest {
filter {
includeTestsMatching("*SomeSpecificTest")
}
}
but it somehow ignores the inclusion and starts to execute everything. The excludeTestsMatching
seems to work as intended.. I wonder what have I done wrong in here. Can someone point me to the right direction?Davide Giuseppe Farella
10/19/2022, 12:08 PMGreg Rynkowski
10/20/2022, 12:13 PMtapchicoma
10/20/2022, 12:24 PMMikhail Zinchenko
10/20/2022, 2:47 PMK Merle
10/20/2022, 6:30 PMorg.gradle.parallel=true
run these tasks in parallel? ./gradlew build ktlintCheck test
andylamax
10/20/2022, 10:09 PMandylamax
10/23/2022, 7:21 AMjsBrowserTests
the fail with weird errorsandylamax
10/23/2022, 7:56 AMandylamax
10/24/2022, 8:54 AMExecution failed for task ':authenticator-api:jsTestPackageJson'.
> KotlinCompilationNpmResolver(picortex-authenticator-api-test) already closed
and it comes randomly, one time it might be submodule-one:jsTestPackageJson
another time it might be submodule-two:jsTestPackagejson
How do I solve this?nuhkoca
10/24/2022, 2:14 PMGradle
plugin in buildSrc and would like to use it inside plugins block in one of precompiled scripts but the IDE throws an exception like my plugin is not found unless I declare it as follows
apply<LibraryCommonPlugin>()
but one below is not working
plugins {
id("libraryPlugin")
}
is there any way to do so?nuhkoca
10/24/2022, 8:21 PMbuildTypes
using something like below? I don’t want to do it inside defaultConfig
block
configure<NamedDomainObjectContainer<BuildType>> { }
nuhkoca
10/25/2022, 12:17 PMGradle
to 7.3.1
from 7.1.3
and below task is not generating jacoco
folders anymore. Anybody knows why? Couldn’t find the release notes about what’s been done on Jacoco
tasks.register('jacocoTestReport', JacocoReport) {
dependsOn("testDebugUnitTest")
group = "Reporting"
description = "Generates code coverage report for the test task."
reports {
html.required = true
xml.required = true
}
def javaTree = fileTree(
dir: "$buildDir/intermediates/javac/debug",
excludes: coverageExcludes
)
def kotlinTree = fileTree(
dir: "$buildDir/tmp/kotlin-classes/debug",
excludes: coverageExcludes
)
classDirectories.setFrom(files([javaTree, kotlinTree]))
def coverageSourceDirs = [
"$projectDir/src/main/java",
"$projectDir/src/main/kotlin"
]
sourceDirectories.setFrom(files(coverageSourceDirs))
executionData.setFrom(files("$buildDir/outputs/unit_test_code_coverage/debugUnitTest/*.exec"))
}
Peter Mandeljc
10/29/2022, 11:29 PMplugins { id("shared-build") }
)
B. or is it also okay apply it
apply(from: "shared-build.gradle.kts")
Does using apply from have any impact on build performance?Didier Villevalois
10/30/2022, 4:50 PMnuhkoca
11/01/2022, 12:40 AMCommonExtension
in a precompiled script plugin? I am getting
Extension of type 'CommonExtension<?, ?, ?, ?>' does not exist.
configure<CommonExtension<*, *, *, *>> {
defaultConfig {
...
}
}
Guilherme Delgado
11/03/2022, 12:03 PMwith(pluginManager) {
apply("com.android.library")
apply("com.google.devtools.ksp")
}
but it always fails saying it cant be found. If i add it like this (in the build.gradle):
plugins {
alias(libs.plugins.ksp)
}
it works. Am i missing any syntax? I’ve tried also like this:
val catalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
with(pluginManager) {
apply("com.android.library")
apply("com.google.devtools.ksp:${catalog.findVersion("gradleGoogleKsp").get()}")
}
But with no luck 🤔Enrico Del Zotto
11/03/2022, 4:18 PMAdam Cooper
11/04/2022, 12:38 AMKy
11/04/2022, 5:07 PMUnable to load class 'com.android.build.gradle.internal.api.InstallableVariantImpl'.
This is an unexpected error. Please file a bug containing the idea.log file.
This error only occurs when trying to upload variants that declare artifactType = "AAB"
.
The only dependency change is adding
implementation("com.google.firebase:firebase-appdistribution-gradle:2.1.3")
to buildSrc/build.gradle.kts.
app/build.gradle.kts still configures productFlavors distribution properties as it did before when it was working without a problem.enighma
11/07/2022, 7:46 PMKy
11/08/2022, 5:49 AMBen Madore
11/08/2022, 3:16 PMmaaxgr
11/09/2022, 9:58 AM/**
* Adds a dependency to the 'implementation' configuration.
*
* @param dependencyNotation notation for the dependency to be added.
* @param dependencyConfiguration expression to use to configure the dependency.
* @return The dependency.
*
* @see [DependencyHandler.add]
*/
fun DependencyHandler.`implementation2`(
dependencyNotation: Provider<*>,
dependencyConfiguration: Action<ExternalModuleDependency>
): Unit = addConfiguredDependencyTo(
this, "implementation", dependencyNotation, dependencyConfiguration
)
But that can't be the solution or?
This is my current buildSrc/build.gradle.kts:
repositories {
google()
mavenCentral()
maven("<https://jitpack.io>")
}
plugins {
`kotlin-dsl`
}
dependencies {
implementation("com.android.tools.build:gradle:7.2.1")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
}
abdellah
11/09/2022, 7:09 PMKayacan Kaya
11/10/2022, 4:11 PMbuild.gradle
is as follows:
build.gradle
{
implementation Deps.libDependency
implementation Deps.otherLibDependency
}
where it gets the dependencies from the kotlin object called Deps
. My Deps
and Versions
objects are as follows:
Dependencies.kt
object Versions {
const val someDeps = "1.1.1"
const val someOtherDeps = OtherDeps.VERSION
}
object Deps {
const val libDependency = "com.example.tools:${Versions.someDeps}"
const val otherLibDependency = "com.another.tools:${Versions.someOtherDeps}"
}
as seen, my Versions
object is making use of another object called OtherDeps
for getting a dependency version for another library from another object. My OtherDeps
object is as follows:
OtherDeps.kt
object OtherDeps{
const val VERSION = "1.2.1"
}
The problem: Whenever I change OtherDeps.VERSION
and gradle sync the dependencies, it does not update and fetch the new otherLibDependency
version. I tried deleting all the caches, nothing worked. The only way that I was able to fetch the new OtherDeps.VERSION
was to make a change in Dependencies.kt
file (could be anything like adding dummy varible etc). After that, gradle sync could fetch the new version of otherLibDependency
. Is there any solution to this problem/bug?Marian Schubert
11/11/2022, 1:00 PMplugins { kotlin("jvm") version "1.7.21" }
, but I got Plugin requests from precompiled scripts must not include a version number.
error. Any example how to do this deduplication?André Martins
11/11/2022, 1:53 PMimplementation project("…")
dependency on a base module but when I generate the jar it doesn’t include the base module classes, any ideia why?Ellen Spertus
11/12/2022, 2:05 AM