Skip to content
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

chore(deps): update dependency gradle to v8.11.1 #1787

Merged
merged 5 commits into from
Dec 2, 2024
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion example-projects/spring-boot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.tngtech.jgiven.gradle-plugin'

wrapper {
gradleVersion = '8.10.2'
gradleVersion = '8.11.1'
distributionType = Wrapper.DistributionType.ALL
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,35 @@
import com.tngtech.jgiven.report.html5.Html5ReportConfig;
import com.tngtech.jgiven.report.text.PlainTextReportConfig;
import com.tngtech.jgiven.report.text.PlainTextReportGenerator;
import groovy.lang.Closure;
import org.gradle.api.NonNullApi;
import org.gradle.api.Task;
import org.gradle.api.reporting.internal.TaskGeneratedSingleDirectoryReport;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.reporting.Report;
import org.gradle.api.tasks.Internal;
import org.gradle.util.internal.ConfigureUtil;

import javax.annotation.Nullable;
import java.io.File;

public abstract class AbstractJGivenReportImpl extends TaskGeneratedSingleDirectoryReport implements JGivenReport {
@NonNullApi
public abstract class AbstractJGivenReportImpl implements JGivenReport {

private File customCssFile;
private File customJsFile;
private String title;
private boolean excludeEmptyScenarios = false;
private boolean thumbnailsAreShown = true;
private final String taskPath;
private final String name;
private final String relativeEntryPath;

public AbstractJGivenReportImpl( String name, Task task, String relativeEntryPath ) {
super( name, task, relativeEntryPath );
this.name = name;
this.taskPath = task.getPath();
this.relativeEntryPath = relativeEntryPath;
this.getRequired().convention(false);
}

public AbstractReportGenerator createGenerator() {
Expand Down Expand Up @@ -67,23 +80,23 @@ public AbstractReportGenerator createGenerator() {
@Internal
public abstract ReportGenerator.Format getFormat();

@Override public File getCustomCssFile() {
@Override @Nullable public File getCustomCssFile() {
return customCssFile;
}

@Override public void setCustomCssFile( File customCssFile ) {
this.customCssFile = customCssFile;
}

@Override public File getCustomJsFile() {
@Override @Nullable public File getCustomJsFile() {
return customJsFile;
}

@Override public void setCustomJsFile( File customJsFile ) {
this.customJsFile = customJsFile;
}

@Override public String getTitle() {
@Override @Nullable public String getTitle() {
return title;
}

Expand All @@ -107,4 +120,41 @@ public AbstractReportGenerator createGenerator() {
this.thumbnailsAreShown = thumbnailsAreShown;
}

@Override
public File getEntryPoint() {
return new File(this.getOutputLocation().getAsFile().getOrNull(), this.relativeEntryPath);
}

@Override
public String getName() {
return name;
}

@Override
public String getDisplayName() {
return "Report generated by task '" + taskPath + "' (" + name + ")";
}

@Override
public abstract Property<Boolean> getRequired();

@Override
public abstract DirectoryProperty getOutputLocation();

@Override
@Deprecated
public void setDestination(File file) {
throw new UnsupportedOperationException("Use outputLocation instead");
}

@Override
public Report.OutputType getOutputType() {
return Report.OutputType.DIRECTORY;
}

@Override
public Report configure(Closure configure) {
return ConfigureUtil.configureSelf(configure, this);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,37 @@

import com.tngtech.jgiven.gradle.JGivenReport;
import com.tngtech.jgiven.gradle.JGivenReportsContainer;
import groovy.lang.Closure;
import groovyjarjarantlr4.v4.runtime.misc.NotNull;
import org.gradle.api.InvalidUserDataException;
import org.gradle.api.NamedDomainObjectSet;
import org.gradle.api.NonNullApi;
import org.gradle.api.Task;
import org.gradle.api.reporting.internal.TaskReportContainer;
import org.gradle.api.internal.DefaultNamedDomainObjectSet;
import org.gradle.api.internal.project.ProjectInternal;
import org.gradle.api.reporting.Report;
import org.gradle.api.reporting.ReportContainer;
import org.gradle.internal.instantiation.InstanceGenerator;
import org.gradle.internal.instantiation.InstantiatorFactory;
import org.gradle.internal.service.ServiceRegistry;
import org.gradle.util.internal.ConfigureUtil;

import javax.inject.Inject;
import java.util.Map;

import static org.gradle.api.internal.CollectionCallbackActionDecorator.NOOP;

public class JGivenReportsContainerImpl extends TaskReportContainer<JGivenReport> implements JGivenReportsContainer {
@NonNullApi
public class JGivenReportsContainerImpl extends DefaultNamedDomainObjectSet<JGivenReport> implements JGivenReportsContainer {

private final NamedDomainObjectSet<JGivenReport> enabled;
@Inject
public JGivenReportsContainerImpl( Task task ) {
super( JGivenReport.class, task, NOOP);
super( JGivenReport.class, locateInstantiator(task), Report::getName, NOOP);
add(JGivenHtmlReportImpl.class, task);
add(JGivenTextReportImpl.class, task);
add(JGivenAsciiDocReportImpl.class, task);
enabled = this.matching(element -> element.getRequired().get());
}

@Override public JGivenHtmlReportImpl getHtml() {
Expand All @@ -31,4 +47,41 @@ public JGivenReportsContainerImpl( Task task ) {
public JGivenAsciiDocReportImpl getAsciiDoc() {
return (JGivenAsciiDocReportImpl) getByName( JGivenAsciiDocReportImpl.NAME );
}

private static InstanceGenerator locateInstantiator(Task task) {
ServiceRegistry projectServices = ((ProjectInternal)task.getProject()).getServices();
return ((InstantiatorFactory)projectServices.get(InstantiatorFactory.class)).decorateLenient(projectServices);
}


protected void assertMutableCollectionContents() {
throw new ReportContainer.ImmutableViolationException();
}

public NamedDomainObjectSet<JGivenReport> getEnabled() {
return this.enabled;
}

public ReportContainer<JGivenReport> configure(Closure cl) {
ConfigureUtil.configureSelf(cl, this);
return this;
}


protected <N extends JGivenReport> N add(Class<N> clazz, Object... constructionArgs) {
N report = (N) this.getInstantiator().newInstance(clazz, constructionArgs);
String name = report.getName();
if (name.equals("enabled")) {
throw new InvalidUserDataException("Reports that are part of a ReportContainer cannot be named 'enabled'");
} else {
this.getStore().add(report);
this.index();
return report;
}
}

@NotNull
public Map<String, JGivenReport> getEnabledReports() {
return this.getEnabled().getAsMap();
}
}
Loading