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
54 changes: 52 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,57 @@ must also apply the Clojure plugin, directly or through a local convention plugi

The selector path is tested with strict configuration-cache validation in single,
sibling, and nested projects on Gradle 8.0 and the current wrapper (9.2.1), both
with and without Isolated Projects. Enabled uber-JAR configuration-cache issues
and overly broad documentation inputs remain unresolved. This coverage establishes
with and without Isolated Projects. This coverage establishes
selector behavior only, without claiming whole-plugin isolation compatibility or
defining a new minimum supported Gradle/JDK version.

# Documentation inputs

`build clojuredoc` can run together with strict configuration-cache validation,
including Isolated Projects, in single, sibling, and nested projects where each
participating project applies and configures the plugin locally. Coverage uses
Gradle 8.0 on a compatible JVM, the current wrapper (9.2.1), and Gradle 9.8.2.

Documentation tracks Clojure source files, relative source-directory paths,
classpath dependencies, Codox options, and project name, description, and version.
`ClojureDoc.projectDirectory` remains a `DirectoryProperty` used as the base for
source-link paths; unrelated project files and build outputs are no longer inputs.
Generated HTML, source links, static assets, configuration-cache reuse, and
regeneration after output deletion are verified.

# Uber-JARs

Uber-JAR tasks are disabled by default. Task creation retains its existing scope:
only `Jar` tasks already realized when the extras plugin is applied participate.
For example:

```groovy
plugins {
id 'java'
id 'com.netflix.nebula.clojure' apply false
}
tasks.named('jar').get()
apply plugin: 'com.netflix.nebula.clojure'

tasks.named('uberjar') {
enabled = true
}
```

`uber<jarTaskName>` combines the original task's sources and expanded
`runtimeClasspath` archives. Its default archive base name adds `-standalone` to
the original base name. These remain ordinary `Jar` tasks supporting archive-name,
manifest, exclusion, and additional-source customization. Dependency manifests
and `META-INF/*.SF`, `*.DSA`, and `*.RSA` signatures are excluded; the uber-JAR
keeps its own manifest.

Enabled execution is verified with strict configuration-cache validation and
Isolated Projects on the same versions and project layouts as documentation.
Tests check actual archive contents, application and dependency edits, cold cache
storage, warm reuse, and regeneration after deleting the archive.

This coverage does not define a new minimum supported Gradle/JDK version or
establish whole-plugin isolation compatibility. Each participating project must
configure the plugin locally; consumer cross-project configuration remains
outside this verified scope. Custom documentation writers must declare any
additional files they read as task inputs.
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,51 @@ package nebula.plugin.clojuresque

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Transformer
import org.gradle.api.file.ArchiveOperations
import org.gradle.api.file.FileSystemLocation
import org.gradle.api.file.FileTree
import org.gradle.api.tasks.ClasspathNormalizer
import org.gradle.api.tasks.bundling.Jar

import javax.inject.Inject

class ClojureExtrasUberJarPlugin implements Plugin<Project> {
void apply(Project project) {
project.tasks.withType(Jar).asMap.each { name, jar ->
project.tasks.register('uber' + name, Jar).configure {
def runtimeClasspath = project.configurations.runtimeClasspath
def archives = project.objects.newInstance(RuntimeArchives)
description = 'Constructs a jar with all runtime dependencies included'
group = "other"
dependsOn jar.source, project.configurations.runtimeClasspath
String baseName = jar.archiveBaseName.getOrNull() + '-standalone'
archiveBaseName.convention(baseName)
archiveBaseName.set(baseName)
dependsOn jar.source, runtimeClasspath
archiveBaseName.set(jar.archiveBaseName.map { it + '-standalone' })
enabled = false
doFirst {
project.configurations.runtimeClasspath.each {
from project.zipTree(it)
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
}
from jar.source
}

inputs.files(runtimeClasspath).withPropertyName('runtimeClasspath')
.withNormalizer(ClasspathNormalizer)
from(runtimeClasspath.elements.map(archives))
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
from jar.source
}
}
}

static class RuntimeArchives implements Transformer<List<FileTree>, Set<FileSystemLocation>> {
private final ArchiveOperations archives

@Inject
RuntimeArchives(ArchiveOperations archives) {
this.archives = archives
}

@Override
List<FileTree> transform(Set<FileSystemLocation> locations) {
def archiveOperations = archives
locations.collect { archiveOperations.zipTree(it.asFile) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ import org.gradle.api.provider.Property
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Classpath
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.StopExecutionException
import org.gradle.api.tasks.TaskAction
import org.gradle.process.ExecOperations
Expand Down Expand Up @@ -57,10 +55,15 @@ abstract class ClojureDoc extends ClojureSourceTask {
@Input
abstract Property<String> getProjectVersion()

@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
// A base for source links, not a directory whose contents are consumed.
@Internal
abstract DirectoryProperty getProjectDirectory()

@Input
List<String> getSourceDirectoryPaths() {
srcDirs.files.collect { relativize(it, projectDirectory.get().asFile) }
}

private final ExecOperations execOperations
private final ObjectFactory objectFactory

Expand Down Expand Up @@ -90,9 +93,7 @@ abstract class ClojureDoc extends ClojureSourceTask {
version: projectVersion.get()
],
codox: codox.get(),
sourceDirs: srcDirs.files.collect {
relativize(it, projectDirectory.get().asFile)
},
sourceDirs: sourceDirectoryPaths,
sourceFiles: source*.path
]

Expand Down
Loading
Loading