@@ -42,7 +42,14 @@ protected ConsumableContentContribution(Project project, String type, String nam
42
42
43
43
@ Override
44
44
void produceFrom (CopySpec copySpec ) {
45
+ this .produceFrom (copySpec , false );
46
+ }
47
+
48
+ void produceFrom (CopySpec copySpec , boolean publish ) {
45
49
TaskProvider <? extends Task > producer = super .configureProduction (copySpec );
50
+ if (publish ) {
51
+ publish (producer );
52
+ }
46
53
Configuration configuration = createConfiguration (getName (),
47
54
"Configuration for %s Antora %s content artifacts." );
48
55
configuration .setCanBeConsumed (true );
@@ -63,11 +70,15 @@ void consumeFrom(String path) {
63
70
CopyAntoraContent .class , (task ) -> configureCopyContent (task , path , configuration , outputDirectory ));
64
71
configureAntora (addInputFrom (copyAntoraContent , configuration .getName ()));
65
72
configurePlaybookGeneration (this ::addToZipContentsCollectorDependencies );
73
+ publish (copyAntoraContent );
74
+ }
75
+
76
+ void publish (TaskProvider <? extends Task > producer ) {
66
77
getProject ().getExtensions ()
67
78
.getByType (PublishingExtension .class )
68
79
.getPublications ()
69
80
.withType (MavenPublication .class )
70
- .configureEach ((mavenPublication ) -> addPublishedMavenArtifact (mavenPublication , copyAntoraContent ));
81
+ .configureEach ((mavenPublication ) -> addPublishedMavenArtifact (mavenPublication , producer ));
71
82
}
72
83
73
84
private void configureCopyContent (CopyAntoraContent task , String path , Configuration configuration ,
@@ -82,10 +93,10 @@ private void addToZipContentsCollectorDependencies(GenerateAntoraPlaybook task)
82
93
task .getAntoraExtensions ().getZipContentsCollector ().getDependencies ().add (getName ());
83
94
}
84
95
85
- private void addPublishedMavenArtifact (MavenPublication mavenPublication , TaskProvider <?> copyAntoraContent ) {
96
+ private void addPublishedMavenArtifact (MavenPublication mavenPublication , TaskProvider <?> producer ) {
86
97
if ("maven" .equals (mavenPublication .getName ())) {
87
98
String classifier = "%s-%s-content" .formatted (getName (), getType ());
88
- mavenPublication .artifact (copyAntoraContent , (mavenArtifact ) -> mavenArtifact .setClassifier (classifier ));
99
+ mavenPublication .artifact (producer , (mavenArtifact ) -> mavenArtifact .setClassifier (classifier ));
89
100
}
90
101
}
91
102
0 commit comments