Skip to content

Commit

Permalink
Added autogenerated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
codemakerai-dev committed Feb 23, 2024
1 parent 229214a commit d59014a
Show file tree
Hide file tree
Showing 2,996 changed files with 173,466 additions and 20,673 deletions.
Expand Up @@ -59,7 +59,13 @@ public void apply(Project project) {
});
}

private static void configureNoHttpPlugin(Project project) {
/**
* Configures the NoHttpPlugin for the given project.
*
* @param project the project to configure the NoHttpPlugin for
* @throws IllegalArgumentException if the project is null
*/
private static void configureNoHttpPlugin(Project project) {
project.getPlugins().apply(NoHttpPlugin.class);
NoHttpExtension noHttp = project.getExtensions().getByType(NoHttpExtension.class);
noHttp.setAllowlistFile(project.file("src/nohttp/allowlist.lines"));
Expand Down
Expand Up @@ -34,7 +34,14 @@
*/
public class ConventionsPlugin implements Plugin<Project> {

@Override
/**
* Applies the conventions to the given project.
*
* @param project the project to apply the conventions to
* @throws NullPointerException if the project is null
* @returns void
*/
@Override
public void apply(Project project) {
new CheckstyleConventions().apply(project);
new JavaConventions().apply(project);
Expand Down
Expand Up @@ -61,7 +61,13 @@ public class JavaConventions {
"-Xlint:-deprecation", "-Xlint:-unchecked"));
}

public void apply(Project project) {
/**
* Applies the specified conventions to the given project.
*
* @param project the project to apply the conventions to
* @throws IllegalArgumentException if the project is null
*/
public void apply(Project project) {
project.getPlugins().withType(JavaBasePlugin.class, javaPlugin -> applyJavaCompileConventions(project));
}

Expand Down
Expand Up @@ -28,12 +28,24 @@
*/
public class KotlinConventions {

void apply(Project project) {
/**
* Applies the given project.
*
* @param project the project to apply
* @throws IllegalArgumentException if the project is null
*/
void apply(Project project) {
project.getPlugins().withId("org.jetbrains.kotlin.jvm",
(plugin) -> project.getTasks().withType(KotlinCompile.class, this::configure));
}

private void configure(KotlinCompile compile) {
/**
* Configures the Kotlin compilation options for the given KotlinCompile object.
*
* @param compile the KotlinCompile object to configure
* @throws NullPointerException if compile is null
*/
private void configure(KotlinCompile compile) {
KotlinJvmOptions kotlinOptions = compile.getKotlinOptions();
kotlinOptions.setApiVersion("1.7");
kotlinOptions.setLanguageVersion("1.7");
Expand Down
Expand Up @@ -37,19 +37,38 @@
*/
class TestConventions {

void apply(Project project) {
/**
* Applies test conventions to the given project.
*
* @param project the project to apply test conventions to
* @throws NullPointerException if the project is null
*/
void apply(Project project) {
project.getPlugins().withType(JavaBasePlugin.class, (java) -> configureTestConventions(project));
}

private void configureTestConventions(Project project) {
/**
* Configures test conventions for the given project.
*
* @param project the project to configure test conventions for
* @throws IllegalArgumentException if the project is null
*/
private void configureTestConventions(Project project) {
project.getTasks().withType(Test.class,
test -> {
configureTests(project, test);
configureTestRetryPlugin(project, test);
});
}

private void configureTests(Project project, Test test) {
/**
* Configures the tests for the given project and test.
*
* @param project the project to configure the tests for
* @param test the test to configure
* @throws IllegalArgumentException if the project or test is null
*/
private void configureTests(Project project, Test test) {
test.useJUnitPlatform();
test.include("**/*Tests.class", "**/*Test.class");
test.setSystemProperties(Map.of(
Expand All @@ -67,15 +86,29 @@ private void configureTests(Project project, Test test) {
"-Djava.locale.providers=COMPAT");
}

private void configureTestRetryPlugin(Project project, Test test) {
/**
* Configures the Test Retry Plugin for a given project and test.
*
* @param project the project to configure the Test Retry Plugin for
* @param test the test to configure the Test Retry Plugin for
* @throws IllegalArgumentException if the project or test is null
*/
private void configureTestRetryPlugin(Project project, Test test) {
project.getPlugins().withType(TestRetryPlugin.class, testRetryPlugin -> {
TestRetryTaskExtension testRetry = test.getExtensions().getByType(TestRetryTaskExtension.class);
testRetry.getFailOnPassedAfterRetry().set(true);
testRetry.getMaxRetries().set(isCi() ? 3 : 0);
});
}

private boolean isCi() {
/**
* Determines if the current environment is a Continuous Integration (CI) environment.
*
* @return {@code true} if the current environment is a CI environment, {@code false} otherwise.
*
* @throws NullPointerException if the environment variable "CI" is not set.
*/
private boolean isCi() {
return Boolean.parseBoolean(System.getenv("CI"));
}

Expand Down
Expand Up @@ -29,15 +29,29 @@ public class LocalDevelopmentPlugin implements Plugin<Project> {

private static final String SKIP_DOCS_PROPERTY = "skipDocs";

@Override
/**
* Applies the LocalDevelopmentPlugin to the specified Project.
*
* @param target the Project to apply the plugin to
* @throws IllegalArgumentException if the target Project is null
* @throws MissingPropertyException if the SKIP_DOCS_PROPERTY is not defined in the target Project
* @throws GradleException if an error occurs while skipping documentation tasks
*/
@Override
public void apply(Project target) {
if (target.hasProperty(SKIP_DOCS_PROPERTY)) {
skipDocumentationTasks(target);
target.subprojects(this::skipDocumentationTasks);
}
}

private void skipDocumentationTasks(Project project) {
/**
* Skips the documentation tasks for the specified project.
*
* @param project the project for which the documentation tasks should be skipped
* @throws IllegalArgumentException if the project is null
*/
private void skipDocumentationTasks(Project project) {
project.afterEvaluate(p -> {
p.getTasks().matching(task -> {
return JavaBasePlugin.DOCUMENTATION_GROUP.equals(task.getGroup())
Expand Down
Expand Up @@ -38,7 +38,15 @@ public interface RuntimeHintsAgentArgumentProvider extends CommandLineArgumentPr
@Input
SetProperty<String> getExcludedPackages();

@Override
/**
* Returns an iterable of arguments for the RuntimeHintsAgent.
*
* @return an iterable of arguments for the RuntimeHintsAgent
* @throws NoSuchElementException if any of the required properties are not set
* @throws NullPointerException if any of the required properties are null
* @param packages the packages to include and exclude
*/
@Override
default Iterable<String> asArguments() {
StringBuilder packages = new StringBuilder();
getIncludedPackages().get().forEach(packageName -> packages.append('+').append(packageName).append(','));
Expand Down
Expand Up @@ -43,7 +43,13 @@ public class RuntimeHintsAgentPlugin implements Plugin<Project> {
private static final String CONFIGURATION_NAME = "testRuntimeHintsAgentJar";


@Override
/**
* Applies the RuntimeHintsAgentPlugin to the given project.
*
* @param project The project to which the plugin is applied.
* @throws UnknownHostException If the host is unknown.
*/
@Override
public void apply(Project project) {

project.getPlugins().withType(JavaPlugin.class, javaPlugin -> {
Expand All @@ -62,14 +68,29 @@ public void apply(Project project) {
});
}

private static RuntimeHintsAgentExtension createRuntimeHintsAgentExtension(Project project) {
/**
* Creates a new instance of the {@link RuntimeHintsAgentExtension} class for the specified project.
*
* @param project the project for which the extension is created
* @return the created {@link RuntimeHintsAgentExtension} instance
* @throws IllegalArgumentException if the project is null
*/
private static RuntimeHintsAgentExtension createRuntimeHintsAgentExtension(Project project) {
RuntimeHintsAgentExtension agentExtension = project.getExtensions().create(EXTENSION_NAME, RuntimeHintsAgentExtension.class);
agentExtension.getIncludedPackages().convention(Collections.singleton("org.springframework"));
agentExtension.getExcludedPackages().convention(Collections.emptySet());
return agentExtension;
}

private static RuntimeHintsAgentArgumentProvider createRuntimeHintsAgentArgumentProvider(
/**
* Creates a {@link RuntimeHintsAgentArgumentProvider} object with the given project and agent extension.
*
* @param project The project object.
* @param agentExtension The agent extension object.
* @return The created {@link RuntimeHintsAgentArgumentProvider} object.
* @throws IllegalArgumentException if the project or agentExtension is null.
*/
private static RuntimeHintsAgentArgumentProvider createRuntimeHintsAgentArgumentProvider(
Project project, RuntimeHintsAgentExtension agentExtension) {
RuntimeHintsAgentArgumentProvider agentArgumentProvider = project.getObjects().newInstance(RuntimeHintsAgentArgumentProvider.class);
agentArgumentProvider.getAgentJar().from(createRuntimeHintsAgentConfiguration(project));
Expand All @@ -78,7 +99,14 @@ private static RuntimeHintsAgentArgumentProvider createRuntimeHintsAgentArgument
return agentArgumentProvider;
}

private static Configuration createRuntimeHintsAgentConfiguration(Project project) {
/**
* Creates a runtime hints agent configuration for the given project.
*
* @param project the project for which the configuration is created
* @return the created runtime hints agent configuration
* @throws IllegalArgumentException if the project is null
*/
private static Configuration createRuntimeHintsAgentConfiguration(Project project) {
return project.getConfigurations().create(CONFIGURATION_NAME, configuration -> {
configuration.setCanBeConsumed(false);
configuration.setTransitive(false); // Only the built artifact is required
Expand Down
Expand Up @@ -38,7 +38,13 @@ public class OptionalDependenciesPlugin implements Plugin<Project> {
*/
public static final String OPTIONAL_CONFIGURATION_NAME = "optional";

@Override
/**
* Applies the optional dependencies plugin to the given project.
*
* @param project the project to apply the plugin to
* @throws NullPointerException if the project is null
*/
@Override
public void apply(Project project) {
Configuration optional = project.getConfigurations().create(OPTIONAL_CONFIGURATION_NAME);
optional.setCanBeConsumed(false);
Expand Down

0 comments on commit d59014a

Please sign in to comment.