Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .dagger/modules/e2e/main.dang
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
End-to-end checks for the Java SDK helper module.

Every check here calls the java-sdk module, which needs an engine at its floor,
v1.0.0-beta.18, or later. dagger.toml does not install this module, so
v1.0.0-beta.26, or later. dagger.toml does not install this module, so
`dagger check` runs these checks only through `engine-e2e:floor-check`, on an
engine built from the floor's commit. AGENTS.md has the commands that run them
on the local engine.
Expand Down Expand Up @@ -64,10 +64,10 @@ type E2e {
entrypoint only.
"""
let entrypointManifest(name: String!): String! {
"name = \"" + name + "\"\n\n[entrypoint]\n kind = \"dang\"\n source = \"./" + dangEntrypointPath + "\"\n"
"name = \"" + name + "\"\n\n[entrypoint]\nkind = \"dang\"\nsource = \"./" + dangEntrypointPath + "\"\n"
}

let floorVersion: String! = "v1.0.0-beta.18"
let floorVersion: String! = "v1.0.0-beta.26"

"""
Checks of a module generated with the Dang entrypoint, through the CLI.
Expand Down Expand Up @@ -722,11 +722,11 @@ type E2e {
"""
engineFloorRefusalCheck(ws: Workspace!): Void @check {
let refused = [
"v1.0.0-beta.17", "v1.0.0-beta.17+0da36c8d", "v1.0.0-beta.11", "v1.0.0-beta.9",
"v1.0.0-beta.25", "v1.0.0-beta.25+a45241b2", "v1.0.0-beta.11", "v1.0.0-beta.9",
"v1.0.0-alpha.20", "v0.21.9",
]
let accepted = [
"v1.0.0-beta.18", "v1.0.0-beta.18+249edbd6", "v1.0.0-beta.19", "v1.0.0-rc.1", "v1.0.0",
"v1.0.0-beta.26", "v1.0.0-beta.26+9f15293b", "v1.0.0-beta.27", "v1.0.0-rc.1", "v1.0.0",
"v1.0.1", "v2.0.0-beta.1", "v0.21.1-20260529020034-dev-b2f595b50044", "v1.0.0-dev.3", "devel", "",
]
refused.each { engine =>
Expand Down
8 changes: 4 additions & 4 deletions .dagger/modules/engine-e2e/dagger-module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ engineVersion = "v1.0.0-0"

[[dependencies]]
name = "engine-dev"
source = "github.com/dagger/dagger/.dagger/modules/engine-dev@249edbd646e63c5181053c8af72623ed9bdf030d"
pin = "249edbd646e63c5181053c8af72623ed9bdf030d"
source = "github.com/dagger/dagger/.dagger/modules/engine-dev@9f15293b2d3960d9eeee567d2e50bd60dcf0df80"
pin = "9f15293b2d3960d9eeee567d2e50bd60dcf0df80"

[[dependencies]]
name = "below-floor-engine-dev"
source = "github.com/dagger/dagger/.dagger/modules/engine-dev@0da36c8da9cb6a682c7d27eca9bd2c125de5ed09"
pin = "0da36c8da9cb6a682c7d27eca9bd2c125de5ed09"
source = "github.com/dagger/dagger/.dagger/modules/engine-dev@a45241b20a5e07fbfc5954479ef0b61da843499c"
pin = "a45241b20a5e07fbfc5954479ef0b61da843499c"
10 changes: 5 additions & 5 deletions .dagger/modules/engine-e2e/main.dang
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ engine-dev dependency in dagger-module.toml.
"""
type EngineE2e {
"""
Commit of v1.0.0-beta.18, this SDK's floor.
Commit of v1.0.0-beta.26, this SDK's floor.
"""
let floorCommit: String! = "249edbd646e63c5181053c8af72623ed9bdf030d"
let floorCommit: String! = "9f15293b2d3960d9eeee567d2e50bd60dcf0df80"

"""
Commit of v1.0.0-beta.17, the last release below the floor.
Commit of v1.0.0-beta.25, the last release below the floor.
"""
let belowFloorCommit: String! = "0da36c8da9cb6a682c7d27eca9bd2c125de5ed09"
let belowFloorCommit: String! = "a45241b20a5e07fbfc5954479ef0b61da843499c"

let modulePath: String! = ".dagger/modules/sdk-smoke"

Expand Down Expand Up @@ -95,7 +95,7 @@ type EngineE2e {
)
let refusal = initialized.stdout + initialized.stderr
assert(
refusal.contains("needs Dagger engine v1.0.0-beta.18 or later"),
refusal.contains("needs Dagger engine v1.0.0-beta.26 or later"),
"dagger module init on the engine below the floor did not name the floor:\n" + refusal,
)

Expand Down
12 changes: 9 additions & 3 deletions .dagger/modules/packager/main.dang
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,23 @@ type Packager {
# A module's introspection schema includes its dependencies' types, so the
# schema is taken from a dependency-free module: the SDK reactor must compile
# against plain core types, the way a freshly generated Java module does.
let introspectionJSON = ws
.moduleSource("/.dagger/modules/templates")
.introspectionSchemaJSON
let templates = ws.moduleSource("/.dagger/modules/templates")
let introspectionJSON = templates.introspectionSchemaJSON
# The same module at the engine's own version, whose schema spells names by
# the current rules (asJson, PER_SESSION): the SDK's tests run against it too.
let latestJSON = templates.withEngineVersion(engineVersion).introspectionSchemaJSON
mvn
.withoutEntrypoint
.withMountedCache("/root/.m2", mavenRepo, sharing: CacheSharingMode.LOCKED)
.withMountedFile("/schema.json", introspectionJSON)
.withMountedFile("/schema-latest.json", latestJSON)
.withDirectory("/dagger-io", sdkSource(ws))
.withWorkdir("/dagger-io")
.withExec(["mvn", "--projects", "dagger-codegen-maven-plugin", "--also-make", "install", "-T1C", "-Dmaven.test.skip=true", "-Dfmt.skip=true", "-Dproject.build.outputTimestamp=2024-01-01T00:00:00Z", "--no-transfer-progress"])
.withExec(["mvn", "-Ptests", "test", "-Ddaggerengine.schema=/schema.json", "-Ddaggerengine.version=" + engineVersion, "-Dfmt.skip=true", "--no-transfer-progress"])
# clean: the run above generated into the same target/, and codegen
# leaves behind the classes a formatted schema renames (JSON.java, ...).
.withExec(["mvn", "-Ptests", "clean", "test", "--projects", "dagger-java-sdk,dagger-java-annotation-processor", "-Ddaggerengine.schema=/schema-latest.json", "-Ddaggerengine.version=" + engineVersion, "-Dfmt.skip=true", "--no-transfer-progress"])
# Compile the client the gate produces from the *real* schema, pinned to the
# version the gate opens at. The engine has since reached it, so the run
# above already generates this shape — but pinning keeps the post-gate
Expand Down
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Run the checks locally

The checks need an engine at this SDK's floor, v1.0.0-beta.18, or later. The
The checks need an engine at this SDK's floor, v1.0.0-beta.26, or later. The
CLI runs on the engine it ships with; `--engine` or `DAGGER_ENGINE` selects
another (`dagger help engine`):

Expand Down Expand Up @@ -36,12 +36,12 @@ dagger check engine-e2e:dev-sdk-check
```

`floor-check` runs every e2e check on the floor engine, built from its commit.
`below-floor-check` checks that v1.0.0-beta.17 is refused. `dev-sdk-check`
`below-floor-check` checks that v1.0.0-beta.25 is refused. `dev-sdk-check`
initializes a Java module through the CLI on the floor engine and calls it. To
run e2e checks on the floor's released engine instead:

```sh
dagger check --engine=image://registry.dagger.io/engine:v1.0.0-beta.18 \
dagger check --engine=image://registry.dagger.io/engine:v1.0.0-beta.26 \
-m .dagger/modules/e2e find-client-root-check
```

Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ generated when the engine loads the module**. The module builds with a plain
> until it moves to the entrypoint.

> [!IMPORTANT]
> This SDK needs an engine `v1.0.0-beta.18` or later. On an older engine,
> This SDK needs an engine `v1.0.0-beta.26` or later. On an older engine,
> `dagger module init` and `dagger generate` stop before they write anything,
> with a message that names the floor and the engine's version.
>
> It writes module manifests through
> [`github.com/dagger/sdk-helpers`](https://github.com/dagger/sdk-helpers), the
> manifest builder that
> [dagger/dagger#13992](https://github.com/dagger/dagger/pull/13992) moved out of
> the engine, pinned at its `v1.0.8` tag.
> the engine, pinned at its `v1.0.12` tag.

## Install

Expand Down Expand Up @@ -150,7 +150,7 @@ computed again.

### The engine release a module targets

A module on the entrypoint targets `v1.0.0-beta.25`: its bindings use the
A module on the entrypoint targets `v1.0.0-beta.28`: its bindings use the
running engine's view of that release, its entrypoint sets
`DAGGER_CLIENT_VERSION` on the process that runs a call, and generation writes
`src/generated/dang/entrypoint/dang.toml` with `dang = "2.1"` and that release
Expand All @@ -159,6 +159,11 @@ comments, and refuses settings it would break. Those files are listed in
`src/generated/sha256sums`, so after editing one, run `dagger generate`. The
`targetVersion` scope setting accepts only that release.

Generated Java names follow Java's conventions as the engine formats them:
`Json`, `Id` and `Llm` for `JSON`, `ID` and `LLM`, `asJson()` for `asJSON`, and
`PER_SESSION` for `PerSession`. A method or enum constant the engine renames
keeps its schema name as a deprecated alias; a renamed class has no alias.

### Stale generated files

A call refuses a module on the entrypoint whose generated files are stale, and
Expand Down Expand Up @@ -396,11 +401,11 @@ On the engine the CLI runs on, this runs the SDK library's unit tests
templates. The `engine-e2e` checks build engines from the dagger/dagger commits
pinned in `.dagger/modules/engine-e2e`:

- `engine-e2e:floor-check` builds the floor release, `v1.0.0-beta.18`, and runs
- `engine-e2e:floor-check` builds the floor release, `v1.0.0-beta.26`, and runs
every e2e check on it.
- `engine-e2e:dev-sdk-check` installs this checkout as the `java` SDK on the
same engine, initializes a Java module through the CLI, and calls it.
- `engine-e2e:below-floor-check` builds `v1.0.0-beta.17` and checks that
- `engine-e2e:below-floor-check` builds `v1.0.0-beta.25` and checks that
generation and `dagger module init` refuse it.
- `engine-e2e:cache-policy-sessions-check`, `pinned-git-client-check` and
`standalone-client-check` run calls in sessions of their own on the same
Expand Down
4 changes: 2 additions & 2 deletions dagger-module.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name = "java-sdk"
engineVersion = "v1.0.0-beta.18"
engineVersion = "v1.0.0-beta.26"

[runtime]
source = "dang"

[[dependencies]]
name = "sdk-helpers"
source = "github.com/dagger/sdk-helpers@v1.0.8"
source = "github.com/dagger/sdk-helpers@v1.0.12"
4 changes: 2 additions & 2 deletions dagger.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "java-sdk",
"engineVersion": "v1.0.0-beta.18",
"engineVersion": "v1.0.0-beta.26",
"sdk": {
"source": "dang"
},
"dependencies": [
{
"name": "sdk-helpers",
"source": "github.com/dagger/sdk-helpers@v1.0.8"
"source": "github.com/dagger/sdk-helpers@v1.0.12"
}
]
}
4 changes: 2 additions & 2 deletions dagger.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
[["version","2"]]
["","git-latest",["github.com/dagger/alpine"],"refs/heads/main"]
["","git-latest",["github.com/dagger/dang-sdk"],"refs/heads/main"]
["","git-latest",["github.com/dagger/sdk-helpers",["version","v1.0.8"]],"refs/tags/v1.0.8"]
["","git-latest",["github.com/dagger/sdk-helpers",["version","v1.0.12"]],"refs/tags/v1.0.12"]
["","git-sha",["github.com/containernetworking/plugins","refs/tags/v1.9.0"],"9b3772e1a7abf93cbb7c6526a28bc0d27b830e02"]
["","git-sha",["github.com/dagger/alpine","main"],"ff6a5f4c28364912d92c00e682dd0bf19f524ef9"]
["","git-sha",["github.com/dagger/alpine","refs/heads/main"],"ff6a5f4c28364912d92c00e682dd0bf19f524ef9"]
["","git-sha",["github.com/dagger/dagger","refs/tags/v1.0.0-beta.11"],"a4e1e4ff663e5e51c2b96c2c0772f3d2f00cfb94"]
["","git-sha",["github.com/dagger/dang-sdk","refs/heads/main"],"9c8e5c6f1927b9adc325846d47e66e697991797d"]
["","git-sha",["github.com/dagger/sdk-helpers","refs/tags/v1.0.8"],"31dafd0c74d9a08faa00c09dce87a5af072e7a9d"]
["","git-sha",["github.com/dagger/sdk-helpers","refs/tags/v1.0.12"],"69e2b90a3dce437cb07f5ee19ad901bf83fff097"]
["","git-sha",["github.com/libfuse/sshfs","refs/tags/sshfs-3.7.6"],"7a2d988775446ebe7af9b01c99b3b8e86bddb05a"]
["","git-sha",["github.com/opencontainers/runc","refs/tags/v1.4.2"],"c241c0bb5e60a8e8c1b2e53d4eca8d0068d8d57e"]
["","oci-latest",["docker.io/library/busybox"],"1.38.0"]
Expand Down
2 changes: 1 addition & 1 deletion docs/collections.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Collections

A collection is an object that holds a set of items a module discovers at run
time, each with a unique key. This SDK needs an engine v1.0.0-beta.18 or later.
time, each with a unique key. This SDK needs an engine v1.0.0-beta.26 or later.
The engine serves collections from v1.0.0-beta.15
([dagger/dagger#14221](https://github.com/dagger/dagger/pull/14221)).
v1.0.0-beta.17 adds the projected types that every call into a collection
Expand Down
9 changes: 3 additions & 6 deletions main.dang
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,9 @@ type JavaSdk {

"""
The engine release a module on the entrypoint is staged at, so its bindings
are generated from the API view the engine serves the module: an entrypoint
module carries no engine version, and the engine serves it a release before
the identifier-casing cut. Pre-cut until the Java codegen is ported to the
new naming rules.
are generated from the API view its entrypoint imports.
"""
let entrypointTarget: String! = "v1.0.0-beta.25"
let entrypointTarget: String! = "v1.0.0-beta.28"

"""
The engine release a module on the entrypoint targets, refusing a
Expand All @@ -398,7 +395,7 @@ type JavaSdk {
"""
The first engine release this SDK runs on.
"""
let engineFloor: String! = "v1.0.0-beta.18"
let engineFloor: String! = "v1.0.0-beta.26"

"""
Why this SDK refuses an engine of the given version, or the empty string when
Expand Down
9 changes: 3 additions & 6 deletions main.dang.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,9 @@ type JavaSdk {

"""
The engine release a module on the entrypoint is staged at, so its bindings
are generated from the API view the engine serves the module: an entrypoint
module carries no engine version, and the engine serves it a release before
the identifier-casing cut. Pre-cut until the Java codegen is ported to the
new naming rules.
are generated from the API view its entrypoint imports.
"""
let entrypointTarget: String! = "v1.0.0-beta.25"
let entrypointTarget: String! = "v1.0.0-beta.28"

"""
The engine release a module on the entrypoint targets, refusing a
Expand All @@ -398,7 +395,7 @@ type JavaSdk {
"""
The first engine release this SDK runs on.
"""
let engineFloor: String! = "v1.0.0-beta.18"
let engineFloor: String! = "v1.0.0-beta.26"

"""
Why this SDK refuses an engine of the given version, or the empty string when
Expand Down
6 changes: 3 additions & 3 deletions mod.dang
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ type Mod {
clients.reduce(directory.withFile("core/schema.json", introspectionJSON)) { plan, client =>
let entry = "target-" + client.moduleName
plan
.withFile(entry + "/schema.json", client.withEngineVersion(view).clientSchemaIntrospectionJSON)
.withFile(entry + "/schema.json", client.withEngineVersion(view).clientSchemaIntrospectionJson)
.withNewFile(entry + "/module", client.moduleName + "\n")
.withNewFile(entry + "/descriptor", clientDescriptor(client))
}
Expand Down Expand Up @@ -421,7 +421,7 @@ type Mod {
.withNewFile("dagger-module.toml", "name = \"core-schema\"\n")
.asModuleSource
.withEngineVersion(engineVersion)
.clientSchemaIntrospectionJSON
.clientSchemaIntrospectionJson
}

"""
Expand Down Expand Up @@ -604,7 +604,7 @@ type Mod {
}
let modSource = ws.moduleSource(workspaceRef(rootPath))
let name = modSource.moduleName
let introspectionJSON = modSource.introspectionSchemaJSON
let introspectionJSON = modSource.introspectionSchemaJson
let vendored = vendoredSdk(introspectionJSON, name)
let pom = withClientsProfile(committed.file("pom.xml").contents)
let stale = staleClientDirs(committed)
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ public static String getBinary(String defaultCLIPath) {

public static InputStream query(InputStream query, String binPath)
throws IOException, InterruptedException {
return query(query, binPath, null);
}

/**
* Runs a GraphQL query with {@code dagger query}, with its variables as JSON (or null), and
* returns the response data as JSON.
*/
public static InputStream query(InputStream query, String binPath, String variables)
throws IOException, InterruptedException {
if (query == null) {
throw new IOException("missing introspection query resource");
}
Expand All @@ -60,7 +69,7 @@ public static InputStream query(InputStream query, String binPath)
envVars.remove("OTEL_EXPORTER_OTLP_ENDPOINT");
envVars.remove("OTEL_EXPORTER_OTLP_METRICS_ENDPOINT");

ProcessBuilder builder = new ProcessBuilder(binPath, "query", "-s", "-M");
ProcessBuilder builder = new ProcessBuilder(queryCommand(binPath, variables));
builder.environment().clear();
builder.environment().putAll(envVars);

Expand Down Expand Up @@ -109,6 +118,16 @@ public static InputStream query(InputStream query, String binPath)
return new ByteArrayInputStream(out.toByteArray());
}

/** The {@code dagger query} command line, passing variables (when not null) as JSON. */
static List<String> queryCommand(String binPath, String variables) {
List<String> command = new ArrayList<>(List.of(binPath, "query", "-s", "-M"));
if (variables != null) {
command.add("--var-json");
command.add(variables);
}
return command;
}

public static InputStream introspectionQuery(Class<?> anchorClass) throws IOException {
String resource = "introspection/introspection.graphql";
InputStream stream = getResource(anchorClass.getClassLoader(), resource);
Expand Down
Loading