Slackbot
11/01/2022, 9:50 PMZak Taccardi
11/01/2022, 10:01 PMChris Lee
11/01/2022, 10:30 PMZak Taccardi
11/01/2022, 10:31 PMperhaps have ProjectA publish an artifact to maven repo (which would include versioning, dependency metadata) and have ProjectB consume it?this is what
./gradlew assembleArtifact
doesChris Lee
11/01/2022, 10:32 PMZak Taccardi
11/01/2022, 10:59 PMis the issue then having to build everything togetheryes. this issue is about avoiding a custom scripting tool and being able to leverage Gradle instead of say https://fastlane.tools/ I have a custom job where I build a downstream app and our internal SDK together, I would like this to be a gradle task
Chris Lee
11/01/2022, 11:01 PMZak Taccardi
11/01/2022, 11:02 PMexecOperations.exec {
commandLine(
"./gradlew",
":assembleArtifact",
"-Ppublish.version=$version"
)
}
Just kind of wild to have 3 gradle daemonsChris Lee
11/01/2022, 11:03 PMVampire
11/02/2022, 7:51 AMexec
. I'd say it is at least a bit cleaner. :-)Vampire
11/02/2022, 7:53 AMZak Taccardi
11/02/2022, 6:36 PMVampire
11/02/2022, 6:44 PMGradleBuild
will run within the same daemon?Zak Taccardi
11/02/2022, 6:45 PMVampire
11/02/2022, 6:45 PMChris Lee
11/02/2022, 6:45 PMVampire
11/02/2022, 6:46 PMVampire
11/02/2022, 6:50 PMthe daemon is typically limited to doing one build at a timeThat's the source of my doubt 😄
Chris Lee
11/02/2022, 6:50 PMZak Taccardi
11/02/2022, 6:52 PMGradleBuild
stays isolated, then I could use it. But the downstream app internally uses composite builds, as does my sdk. So that might be a blocker?Chris Lee
11/02/2022, 6:54 PMZak Taccardi
11/02/2022, 6:54 PMaccess to task outputI’ll be building APKs, and would probably want to copy them into the build directory of my 3rd composing project. Obviously could do this with a
CopySpec
, but there might be something more efficient then executing a ./gradlew buildApk
command every time, and copyingZak Taccardi
11/02/2022, 6:56 PMLots of Gradle overhead just to sequence two things.It’s actually fairly complicated. I’ll have logic to build the downstream app from our SDKs source, from artifactory, from a git branch. And that downstream app may be a local copy, or a git commit that would be checked out insolation.
Zak Taccardi
11/02/2022, 6:58 PMperhaps change the third gradle project to a simple scriptI’d like to write all this logic in kotlin, which Gradle supports well - and other developers on my team are familiar with Gradle, so there’s benefit there. And after all, it is build logic. it just gets weird with all the combining of gradle builds/daemons
Chris Lee
11/02/2022, 7:00 PMbuild the downstream app from our SDKs source, from artifactory, from a git branch…build the downstream app from a versioned artifact (pass in version as a property), thereby decoupling producer from consumer.
Vampire
11/02/2022, 7:04 PMagreed, same here…But we were wrong actually. I just tried and indeed
GradleBuild
runs in-daemon and thus has to be compatible with the same Gradle version.
Using the tooling API, it always runs in a separate daemon and by default uses the Gradle version defined in the wrapper files, so better for unknown sub-builds.
IfYes, as I said,stays isolated, then I could use it. But the downstream app internally uses composite builds, as does my sdk. So that might be a blocker?GradleBuild
GradleBuild
does not support running composite builds right now, see the linked issue above.
Does the tooling API provide more efficient access to task output? I have no idea where to get started with that tbh.The tooling API is what IDEs also use, so generally said, everything the IDE can do, you can do in your build too, so I'd say yes, you can access task outcome better.
Zak Taccardi
11/02/2022, 7:06 PM…build the downstream app from a versioned artifact (pass in version as a property), thereby decoupling producer from consumer.This is what I’m doing. I’m just using that 3rd Gradle project to effective compose these two calls:
# from SDK - it publishes to a local maven folder
./gradlew assembleArtifact -Ppublish.version=99.99.99-SNAPSHOT
# from downstream app
./gradlew :downstream-app:assembleDebug -PSDK_VERSION=99.99.99-SNAPSHOT -PADDITIONAL_MAVEN_REPOSITORIES='/absolutePath/my-sdk/build/artifactory-publishing/artifacts/assembleArtifact'
And note, the above is simplified. I’m just trying to build some wrapper logic to make it all one step. It might include things like checking out a git repo in the future at a specific commit (or if the repo is already checked out, navigate to the desired commit)Zak Taccardi
11/02/2022, 7:08 PMruns in-daemon and thus has to be compatible with the same Gradle versionI am actually not too concerned with this being an issue, gradle seems to work well with transitively upgraded versions (outside of major version upgrades). I would be concerned with with the plugins bleeding together: • my SDK - on AGP 7.4 • downstream app - on AGP 7.1 And having the downstream app build fail bc it cannot be transitively upgraded due to a compiler error
Vampire
11/02/2022, 7:10 PMVampire
11/02/2022, 7:10 PMZak Taccardi
11/02/2022, 7:10 PMGradleBuild
? I guess it doesn’t matter with composite buildsZak Taccardi
11/02/2022, 7:10 PM