File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed
plugins/edc-build/src/main/java/org/eclipse/edc/plugins/edcbuild Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 2323
2424public class MavenPublicationConvention implements EdcConvention {
2525
26- private static final boolean DEFAULT_SHOULD_PUBLISH = true ;
27-
2826 @ Override
2927 public void apply (Project target ) {
3028 // do not publish the root project or modules without a build.gradle.kts
@@ -33,9 +31,8 @@ public void apply(Project target) {
3331 }
3432
3533 var buildExtension = requireExtension (target , BuildExtension .class );
36- var shouldPublish = buildExtension .getPublish ().getOrElse (DEFAULT_SHOULD_PUBLISH );
3734
38- if (shouldPublish ) {
35+ if (buildExtension . shouldPublish () ) {
3936 target .getPlugins ().apply (MavenPublishPlugin .class );
4037
4138 target .getExtensions ().configure (MavenPublishBaseExtension .class , extension -> {
Original file line number Diff line number Diff line change 2424 * Root configuration resource for the EDC Build plugin
2525 */
2626public abstract class BuildExtension {
27+
28+ private static final boolean DEFAULT_SHOULD_PUBLISH = true ;
29+
2730 private final MavenPomExtension pom ;
2831 private final SwaggerGeneratorExtension swagger ;
2932
@@ -50,6 +53,15 @@ public SwaggerGeneratorExtension getSwagger() {
5053 return swagger ;
5154 }
5255
56+ /**
57+ * Tell if the module needs to be published
58+ *
59+ * @return true if the module needs to be published, false otherwise
60+ */
61+ public boolean shouldPublish () {
62+ return getPublish ().getOrElse (DEFAULT_SHOULD_PUBLISH );
63+ }
64+
5365 public abstract Property <Boolean > getPublish ();
5466
5567}
Original file line number Diff line number Diff line change 1414
1515package org .eclipse .edc .plugins .edcbuild .tasks ;
1616
17+ import org .eclipse .edc .plugins .edcbuild .extensions .BuildExtension ;
1718import org .gradle .api .DefaultTask ;
1819import org .gradle .api .artifacts .dsl .RepositoryHandler ;
1920import org .gradle .api .publish .PublishingExtension ;
@@ -37,6 +38,10 @@ public class WaitForPublishedArtifacts extends DefaultTask {
3738
3839 @ TaskAction
3940 public void waitForPublishedArtifacts () {
41+ if (!requireExtension (getProject (), BuildExtension .class ).shouldPublish ()) {
42+ return ;
43+ }
44+
4045 requireExtension (getProject (), PublishingExtension .class )
4146 .getPublications ().stream ()
4247 .map (MavenPublication .class ::cast )
You can’t perform that action at this time.
0 commit comments