-
Notifications
You must be signed in to change notification settings - Fork 7
Make gradle-revapi configuration cache friendly
#13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
3530454
27af76e
facccaf
80ef379
84cfaf5
abc9363
51fe379
f7d7695
c1d21e4
6e40d31
2964e78
3188085
126924f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,35 +20,31 @@ | |
| import java.util.Optional; | ||
| import org.gradle.api.DefaultTask; | ||
| import org.gradle.api.provider.Property; | ||
| import org.gradle.api.tasks.Input; | ||
| import org.gradle.api.tasks.Internal; | ||
| import org.gradle.api.tasks.TaskAction; | ||
| import org.gradle.api.tasks.options.Option; | ||
| import org.revapi.gradle.config.AcceptedBreak; | ||
| import org.revapi.gradle.config.GroupNameVersion; | ||
| import org.revapi.gradle.config.Justification; | ||
|
|
||
| public class RevapiAcceptBreakTask extends DefaultTask { | ||
| public abstract class RevapiAcceptBreakTask extends DefaultTask { | ||
| private static final String CODE_OPTION = "code"; | ||
| private static final String OLD_OPTION = "old"; | ||
| private static final String NEW_OPTION = "new"; | ||
| private static final String JUSTIFICATION_OPTION = "justification"; | ||
|
|
||
| private final Property<ConfigManager> configManager = | ||
| getProject().getObjects().property(ConfigManager.class); | ||
| private final Property<String> code = getProject().getObjects().property(String.class); | ||
| private final Property<String> oldElement = getProject().getObjects().property(String.class); | ||
| private final Property<String> newElement = getProject().getObjects().property(String.class); | ||
| private final Property<Justification> justification = | ||
| getProject().getObjects().property(Justification.class); | ||
|
|
||
| public RevapiAcceptBreakTask() { | ||
| getOutputs().upToDateWhen(_ignored -> false); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved to |
||
| } | ||
| @Input | ||
| protected abstract Property<GroupNameVersion> getGroupNameVersion(); | ||
|
|
||
| @Internal | ||
| final Property<ConfigManager> getConfigManager() { | ||
| return configManager; | ||
| } | ||
| protected abstract Property<ConfigManager> getConfigManager(); | ||
|
|
||
| @Option(option = CODE_OPTION, description = "Revapi change code") | ||
| public final void setCode(String codeString) { | ||
|
|
@@ -75,10 +71,10 @@ public final void addVersionOverride() { | |
| ensurePresent(code, CODE_OPTION); | ||
| ensurePresent(justification, JUSTIFICATION_OPTION); | ||
|
|
||
| configManager | ||
| getConfigManager() | ||
| .get() | ||
| .modifyConfigFile(revapiConfig -> revapiConfig.addAcceptedBreaks( | ||
| oldGroupNameVersion(), | ||
| getGroupNameVersion().get(), | ||
| Collections.singleton(AcceptedBreak.builder() | ||
| .code(code.get()) | ||
| .oldElement(Optional.ofNullable(oldElement.getOrNull())) | ||
|
|
@@ -92,8 +88,4 @@ private void ensurePresent(Property<?> prop, String option) { | |
| throw new IllegalArgumentException("Please supply the --" + option + " param to this task"); | ||
| } | ||
| } | ||
|
|
||
| private GroupNameVersion oldGroupNameVersion() { | ||
| return getProject().getExtensions().getByType(RevapiExtension.class).oldGroupNameVersion(); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the use of |
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.