Files
Jason(Zhe-You) Liu 2bda192870 Java SDK: Pack each native Dag's source file into the bundle JAR (#74096)
* Java SDK: Record the class that declares each Dag and describe it on request

DagDef remembers the outermost class that built it, and a generated
@Builder.Dag builder names the annotated class instead of itself.
Server accepts --describe-sources <file> to write each Java-declared Dag's
declaring class and return without connecting, for the Gradle plugin.

* Java SDK: Pack each native Dag's source file into the bundle JAR

The packDagSources task runs mainClass in describe mode, finds each Dag's
source file through the class file's SourceFile attribute, and packs each
unique file with a sources.json mapping under META-INF/airflow/. The JAR
manifest names it with Airflow-Java-SDK-Sources.

* Java SDK: Bound the describe run and keep its payload to the bundle JAR

Every `Jar` task gained a dependency on `packDagSources`, so a sources or
javadoc JAR carried the Dag sources and claimed the
`Airflow-Java-SDK-Sources` attribute that the Python side picks a bundle
JAR out of a directory by. Only `jar` and `shadowJar` carry them now.

The describe run had no time bound, so a `main` that does not route
through `Server.create(args)` and starts serving instead held the build
open with no way out. It now runs under a timeout and falls back to
packing the entrypoint's source alone, which is what every other
describe failure already does.

Say in `serve` and `serveAsync` that a `--describe-sources` server
returns without connecting, and record in `sources.json` that its paths
are relative to the source directory, which is also where they sit under
`META-INF/airflow/sources/`.

* Java SDK: Show each Dag's own source and find it outside the package layout

The Java importer now passes the Dag ID to the source lookup, so the Code
view reads dag_source_paths instead of always showing the entrypoint.

The source locator falls back to a unique match on the SourceFile name
when the package does not match the directory, using an index built only
when the package path misses. An unresolvable entrypoint or Dag class is
now logged as a warning.

The describe task is no longer up to date after a failed run, so a
transient failure does not stick until a source changes. Its hint now
points at Server.create(args), which is what answers --describe-sources.

Add a shadowJar test, correct the comment on which JARs carry the sources
payload, and document that a Dag maps to the class that constructed it.

* Java SDK: Use a describe run's output even when the run itself failed

* Java SDK: Serve and describe sources from their own Server classes

* Java SDK: Pack the sources into the one JAR the bundle is built from

* Java SDK: Attach the plugin's documentation to the plugin class

* Java SDK: Drop the duplicated classes dir from the describe classpath

* Java SDK: Let a bundle set how long the describe run may take
2026-10-09 14:30:52 +08:00
..