For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

getSourceFile

@Nullable
abstract fun getSourceFile(): @Nullable File(source)

Returns the source file for this script, or null if this script has no associated source file. If this method returns a non-null value, the given source file will exist.

Return

The source file. Returns null if the script has no associated source file.

Since

1.8