Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .dagger/modules/e2e/fixtures/clients/app-self/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package io.dagger.modules.app;

import static io.dagger.client.app.App.app;
import static io.dagger.client.dep.Dep.dep;
import static io.dagger.client.greeter.Greeter.greeter;
import static io.dagger.sdk.Dagger.dag;

import io.dagger.module.annotation.Function;
import io.dagger.module.annotation.Object;
import io.dagger.sdk.exception.DaggerQueryException;
import java.util.concurrent.ExecutionException;

@Object
public class App {
/** A call on a dependency, through its generated client. */
@Function
public String greetViaDep(String name)
throws InterruptedException, ExecutionException, DaggerQueryException {
return dep(dag()).greet(name);
}

/** A core type returned by the dependency's client, used through core: the same Java type. */
@Function
public String depFileViaCore()
throws InterruptedException, ExecutionException, DaggerQueryException {
return dep(dag()).scratch().file("dep.txt").contents();
}

/** The same dependency under an alias: a second client, on the same session. */
@Function
public String greetViaAlias(String name)
throws InterruptedException, ExecutionException, DaggerQueryException {
return greeter(dag()).greet(name);
}

/** A self call, through this module's own generated client. */
@Function
public String greetSelf(String name)
throws InterruptedException, ExecutionException, DaggerQueryException {
return app(dag()).greetViaDep(name);
}
}
15 changes: 15 additions & 0 deletions .dagger/modules/e2e/fixtures/clients/app/dagger-module.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name = "app"
engineVersion = "v1.0.0-beta.10"

[runtime]
source = "java"

[[dependencies]]
name = "dep"
source = "../dep"

# The same module under another name: the engine applies the alias with
# withName, so its client has to chain and serve "greeter", not "dep".
[[dependencies]]
name = "greeter"
source = "../dep"
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.dagger.modules.app;

import static io.dagger.client.dep.Dep.dep;
import static io.dagger.sdk.Dagger.dag;

import io.dagger.module.annotation.Function;
import io.dagger.module.annotation.Object;
import io.dagger.sdk.exception.DaggerQueryException;
import java.util.concurrent.ExecutionException;

@Object
public class App {
/** A call on a dependency, through its generated client. */
@Function
public String greetViaDep(String name)
throws InterruptedException, ExecutionException, DaggerQueryException {
return dep(dag()).greet(name);
}

/** A core type returned by the dependency's client, used through core: the same Java type. */
@Function
public String depFileViaCore()
throws InterruptedException, ExecutionException, DaggerQueryException {
return dep(dag()).scratch().file("dep.txt").contents();
}
}
15 changes: 15 additions & 0 deletions .dagger/modules/e2e/fixtures/clients/dep-client/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.dagger.clients.depclient;

import static io.dagger.client.dep.Dep.dep;

import io.dagger.sdk.AutoCloseableClient;
import io.dagger.sdk.Dagger;

/** A standalone client: opens its own session and reaches the module through the preamble. */
public class Main {
public static void main(String[] args) throws Exception {
try (AutoCloseableClient dag = Dagger.connect()) {
System.out.println(dep(dag).greet("client"));
}
}
}
5 changes: 5 additions & 0 deletions .dagger/modules/e2e/fixtures/clients/dep/dagger-module.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = "dep"
engineVersion = "v1.0.0-beta.10"

[runtime]
source = "java"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.dagger.modules.dep;

import static io.dagger.sdk.Dagger.dag;

import io.dagger.core.Directory;
import io.dagger.module.annotation.Function;
import io.dagger.module.annotation.Object;

@Object
public class Dep {
@Function
public String greet(String name) {
return "hello " + name;
}

/** A core type handed across the client boundary. */
@Function
public Directory scratch() {
return dag().directory().withNewFile("dep.txt", "from dep");
}
}
15 changes: 15 additions & 0 deletions .dagger/modules/e2e/fixtures/clients/workspace.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Placed at the workspace root by the e2e checks, so that both the SDK's module
# list and the engine's generator rollup for local dependencies see the same
# config. Not named dagger.toml so that find-up from another fixture never
# reads it.
[modules.java-sdk]
source = "."

[modules.java-sdk.as-sdk]
name = "java"

[[modules.java-sdk.as-sdk.modules]]
path = ".dagger/modules/e2e/fixtures/clients/dep"

[[modules.java-sdk.as-sdk.modules]]
path = ".dagger/modules/e2e/fixtures/clients/app"
Loading