Hey. I'm playing around w/ writing a Kotlin SDK for Dagger, and am trying to execute a kotlin app inside of dagger. However, when I try to run the gradle task, the process seems to just run infinitely. I'm running dagger run ./gradlew playground:run which should execute a simple kotlin function. However, it just hangs, and the dagger container logs show no indication that the command is doing... anything
#Running Gradle in Dagger
1 messages · Page 1 of 1 (latest)
Ah.. i see this error fork/exec ./gradlew: no such file or directory
Shouldn't this be available though? because this is a binary wrapper available in the source directory? I would imagine that dagger takes the source root as a context. But maybe not. If not, how do commands like dagger run cargo run (from the tutorial on creating a rust SDK based on the GQL api work)?
Extra confused b/c in the dagger CLI output, I can see it running, with the output Staring a Gradle Daemon... so clearly dagger is able to access the gradle binary... it just... seems to get stuck at that point
Extra confused b/c in the dagger CLI output, I can see it running, with the output Staring a Gradle Daemon... so clearly dagger is able to access the gradle binary... it just... seems to get stuck at that point
dagger run just starts a dagger session and exports the authentication parameters for the command that you specify next:
❯ dagger run -s env | grep DAGGER
Connected to engine 9351479b0c81
DAGGER_SESSION_PORT=63597
DAGGER_SESSION_TOKEN=1aab3152-4a0c-48d2-8fde-5353ede8e8f7
Not familiar with gradlew though. Can you run it without dagger run? Have you checked if it has execution permissions?
If you want to make an SDK for Dagger, see https://github.com/dagger/dagger/blob/main/sdk/CONTRIBUTING.md.
You can use the Go based codegen here: https://github.com/dagger/dagger/tree/main/codegen/generator
I try on gradle + kotlin fresh project and execute gradle with dagger run ./gradlew build . The gradle seems to be stuck during run like screenshot.
Seems like it's a daemon so it makes sense that it's waiting for connections and not stuck. What's this gradle task supposed to do?
You may not see any output except build successful if you run in normal shell. But if you run with --console=plain the gradle will print task that it execute.
Not familiar with gradlew though
gradlew is basically just a script that you include with your repo that will fetch and cache a gradle distributable. That way users can install without first needing gradle installed on their machine.
Can you run it without dagger run
yes
If you want to make an SDK for Dagger, see
I saw this, likely for an initial proof of concept I will dev it in a separate repo. If it gets anywhere I will contribute it
I try on gradle + kotlin fresh project and execute gradle with dagger run ./gradlew build . The gradle seems to be stuck during run like screenshot.
Yes i get the same thing.
What's this gradle task supposed to do
That would depend on the task you are running. Can think of gradle as basically the equivalent of cargo in the rust ecosystem.
If the task works without dagger run that means you're not using the dagger API yet, but I assume that's what you want to work on, right?
sorry, should more specific. I can run gradle tasks in general no problem. I am also trying to run a gradle task that does call out to dagger. In either case, both hang when running via dagger run ...
dagger run takes control of stdout, stderr and stdin, can you check if that's affecting gradle? Try running with dagger run -s
seems to still just hang
❯ dagger run -s ./gradlew playground:run │
│Connected to engine 7c581e1429aa
Is there a simple example I can try? I don't have gradle btw.
sure i can make this repo public
the command would be dagger run -s ./gradlew playground:run
👋 this is what I get while running that:
dagger run -s ./gradlew playground:run
Connected to engine a4ed1837cb30
Downloading https://services.gradle.org/distributions/gradle-8.0-bin.zip
...........10%............20%............30%............40%............50%............60%...........70%....
........80%............90%............100%
Welcome to Gradle 8.0!
For more details see https://docs.gradle.org/8.0/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Starting Daemon
However, it doesn't move from there
yep, seems like something funky happens with the gradle daemon that doesn't like being wrapped in the dagger run command