-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add a WorkflowListener extension. Resolves #968
- Loading branch information
Showing
216 changed files
with
2,164 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
...leaser-model-api/src/main/java/org/jreleaser/extensions/api/workflow/WorkflowAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright 2020-2022 The JReleaser authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jreleaser.extensions.api.workflow; | ||
|
||
import org.jreleaser.model.api.JReleaserContext; | ||
import org.jreleaser.model.api.announce.Announcer; | ||
import org.jreleaser.model.api.assemble.Assembler; | ||
import org.jreleaser.model.api.deploy.Deployer; | ||
import org.jreleaser.model.api.distributions.Distribution; | ||
import org.jreleaser.model.api.download.Downloader; | ||
import org.jreleaser.model.api.hooks.ExecutionEvent; | ||
import org.jreleaser.model.api.packagers.Packager; | ||
import org.jreleaser.model.api.release.Releaser; | ||
import org.jreleaser.model.api.upload.Uploader; | ||
|
||
/** | ||
* Base implementation of the {@code WorkflowListener} interface. | ||
* | ||
* @author Andres Almiray | ||
* @since 1.3.0 | ||
*/ | ||
public class WorkflowAdapter implements WorkflowListener { | ||
@Override | ||
public boolean isContinueOnError() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void onSessionStart(JReleaserContext context) { | ||
|
||
} | ||
|
||
@Override | ||
public void onSessionEnd(JReleaserContext context) { | ||
|
||
} | ||
|
||
@Override | ||
public void onWorkflowStep(ExecutionEvent event, JReleaserContext context) { | ||
|
||
} | ||
|
||
@Override | ||
public void onAnnounceStep(ExecutionEvent event, JReleaserContext context, Announcer announcer) { | ||
|
||
} | ||
|
||
@Override | ||
public void onAssembleStep(ExecutionEvent event, JReleaserContext context, Assembler assembler) { | ||
|
||
} | ||
|
||
@Override | ||
public void onDeployStep(ExecutionEvent event, JReleaserContext context, Deployer deployer) { | ||
|
||
} | ||
|
||
@Override | ||
public void onDownloadStep(ExecutionEvent event, JReleaserContext context, Downloader downloader) { | ||
|
||
} | ||
|
||
@Override | ||
public void onUploadStep(ExecutionEvent event, JReleaserContext context, Uploader uploader) { | ||
|
||
} | ||
|
||
@Override | ||
public void onReleaseStep(ExecutionEvent event, JReleaserContext context, Releaser releaser) { | ||
|
||
} | ||
|
||
@Override | ||
public void onPackagerPrepareStep(ExecutionEvent event, JReleaserContext context, Distribution distribution, Packager packager) { | ||
|
||
} | ||
|
||
@Override | ||
public void onPackagerPackageStep(ExecutionEvent event, JReleaserContext context, Distribution distribution, Packager packager) { | ||
|
||
} | ||
|
||
@Override | ||
public void onPackagerPublishStep(ExecutionEvent event, JReleaserContext context, Distribution distribution, Packager packager) { | ||
|
||
} | ||
|
||
@Override | ||
public void onDistributionStart(JReleaserContext context, Distribution distribution) { | ||
|
||
} | ||
|
||
@Override | ||
public void onDistributionEnd(JReleaserContext context, Distribution distribution) { | ||
|
||
} | ||
} |
165 changes: 165 additions & 0 deletions
165
...easer-model-api/src/main/java/org/jreleaser/extensions/api/workflow/WorkflowListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright 2020-2022 The JReleaser authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jreleaser.extensions.api.workflow; | ||
|
||
import org.jreleaser.extensions.api.ExtensionPoint; | ||
import org.jreleaser.model.api.JReleaserContext; | ||
import org.jreleaser.model.api.announce.Announcer; | ||
import org.jreleaser.model.api.assemble.Assembler; | ||
import org.jreleaser.model.api.deploy.Deployer; | ||
import org.jreleaser.model.api.distributions.Distribution; | ||
import org.jreleaser.model.api.download.Downloader; | ||
import org.jreleaser.model.api.hooks.ExecutionEvent; | ||
import org.jreleaser.model.api.packagers.Packager; | ||
import org.jreleaser.model.api.release.Releaser; | ||
import org.jreleaser.model.api.upload.Uploader; | ||
|
||
/** | ||
* @author Andres Almiray | ||
* @since 1.3.0 | ||
*/ | ||
public interface WorkflowListener extends ExtensionPoint { | ||
/** | ||
* Signals JReleaser to halt execution if this listener fails. | ||
* | ||
* @return {@code false} to halt execution on failure, {@code true} to continue. | ||
*/ | ||
boolean isContinueOnError(); | ||
|
||
/** | ||
* Triggered when the execution session starts. | ||
* | ||
* @param context the execution context. | ||
*/ | ||
void onSessionStart(JReleaserContext context); | ||
|
||
/** | ||
* Triggered when the execution session ends. | ||
* | ||
* @param context the execution context. | ||
*/ | ||
void onSessionEnd(JReleaserContext context); | ||
|
||
/** | ||
* Triggered when a workflow step starts/ends/fails. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
*/ | ||
void onWorkflowStep(ExecutionEvent event, JReleaserContext context); | ||
|
||
/** | ||
* Triggered when an announcer starts/ends/fails. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
* @param announcer the executing announcer. | ||
*/ | ||
void onAnnounceStep(ExecutionEvent event, JReleaserContext context, Announcer announcer); | ||
|
||
/** | ||
* Triggered when an assembler starts/ends/fails. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
* @param assembler the executing assembler. | ||
*/ | ||
void onAssembleStep(ExecutionEvent event, JReleaserContext context, Assembler assembler); | ||
|
||
/** | ||
* Triggered when a deployer starts/ends/fails. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
* @param deployer the executing deployer. | ||
*/ | ||
void onDeployStep(ExecutionEvent event, JReleaserContext context, Deployer deployer); | ||
|
||
/** | ||
* Triggered when a downloader starts/ends/fails. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
* @param downloader the executing downloader. | ||
*/ | ||
void onDownloadStep(ExecutionEvent event, JReleaserContext context, Downloader downloader); | ||
|
||
/** | ||
* Triggered when an uploader starts/ends/fails. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
* @param uploader the executing uploader. | ||
*/ | ||
void onUploadStep(ExecutionEvent event, JReleaserContext context, Uploader uploader); | ||
|
||
/** | ||
* Triggered when a releaser starts/ends/fails. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
* @param releaser the executing releaser. | ||
*/ | ||
void onReleaseStep(ExecutionEvent event, JReleaserContext context, Releaser releaser); | ||
|
||
/** | ||
* Triggered when a distribution is about to be processed. | ||
* | ||
* @param context the execution context. | ||
* @param distribution the distribution to be processed. | ||
*/ | ||
void onDistributionStart(JReleaserContext context, Distribution distribution); | ||
|
||
/** | ||
* Triggered when a distribution has been processed. | ||
* | ||
* @param context the execution context. | ||
* @param distribution the processed distribution. | ||
*/ | ||
void onDistributionEnd(JReleaserContext context, Distribution distribution); | ||
|
||
/** | ||
* Triggered when a packager starts/ends/fails the preparing step. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
* @param distribution the distribution to be processed. | ||
* @param packager the executing packager. | ||
*/ | ||
void onPackagerPrepareStep(ExecutionEvent event, JReleaserContext context, Distribution distribution, Packager packager); | ||
|
||
/** | ||
* Triggered when a packager starts/ends/fails the packaging step. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
* @param distribution the distribution to be processed. | ||
* @param packager the executing packager. | ||
*/ | ||
void onPackagerPackageStep(ExecutionEvent event, JReleaserContext context, Distribution distribution, Packager packager); | ||
|
||
/** | ||
* Triggered when a packager starts/ends/fails the publishing step. | ||
* | ||
* @param event event metadata. | ||
* @param context the execution context. | ||
* @param distribution the distribution to be processed. | ||
* @param packager the executing packager. | ||
*/ | ||
void onPackagerPublishStep(ExecutionEvent event, JReleaserContext context, Distribution distribution, Packager packager); | ||
} |
35 changes: 35 additions & 0 deletions
35
...el-api/src/main/java/org/jreleaser/extensions/api/workflow/WorkflowListenerException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright 2020-2022 The JReleaser authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jreleaser.extensions.api.workflow; | ||
|
||
/** | ||
* @author Andres Almiray | ||
* @since 1.3.0 | ||
*/ | ||
public class WorkflowListenerException extends Exception { | ||
private final WorkflowListener listener; | ||
|
||
public WorkflowListenerException(WorkflowListener listener, RuntimeException cause) { | ||
super(cause); | ||
this.listener = listener; | ||
} | ||
|
||
public WorkflowListener getListener() { | ||
return listener; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.