这是indexloc提供的服务,不要输入任何密码
Skip to content
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
26 changes: 13 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
id 'jacoco'
id 'maven-publish'
id 'java-gradle-plugin'
id 'org.sonarqube' version '6.1.0.5360'
id 'org.sonarqube' version '6.2.0.5505'
id 'com.gradle.plugin-publish' version '1.3.1'
id 'com.github.sherter.google-java-format' version '0.9'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
Expand Down Expand Up @@ -175,13 +175,13 @@ if (project.hasProperty('signing.keyId')) { // publish as library in maven centr

dependencies {
api 'com.github.spullara.mustache.java:compiler:0.9.14'
api 'com.fasterxml.jackson.core:jackson-databind:2.18.3'
api 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.3'
api 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.18.3'
api 'commons-io:commons-io:2.18.0'
api 'com.fasterxml.jackson.core:jackson-databind:2.19.0'
api 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.19.0'
api 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.19.0'
api 'commons-io:commons-io:2.19.0'
api gradleApi()

implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.3'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.19.0'
implementation 'org.reflections:reflections:0.10.2'
// swagger generators
implementation('io.swagger.codegen.v3:swagger-codegen-generators:1.0.56') {
Expand All @@ -193,14 +193,14 @@ dependencies {
}
}
implementation 'com.googlecode.lambdaj:lambdaj:2.3.3'
implementation 'com.google.googlejavaformat:google-java-format:1.25.2'
implementation 'com.google.googlejavaformat:google-java-format:1.27.0'

testImplementation gradleTestKit()
testImplementation 'org.mockito:mockito-junit-jupiter:5.17.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.12.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.12.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.12.0'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.18.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.12.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.12.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.12.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.2'

compileOnly 'org.projectlombok:lombok:1.18.38'
annotationProcessor 'org.projectlombok:lombok:1.18.38'
Expand Down Expand Up @@ -289,7 +289,7 @@ tasks.register('installGitHooks') {
}

tasks.named('wrapper') {
gradleVersion = '8.13'
gradleVersion = '8.14.1'
}

tasks.register('ci-updater', JavaExec) {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 2 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

# Stop when "xargs" is not available.
Expand Down
4 changes: 2 additions & 2 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/co/com/bancolombia/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@ public final class Constants {
public static final String PATH_GRAPHQL = "/graphql";
// dependencies
public static final String SECRETS_VERSION = "4.4.31";
public static final String SPRING_BOOT_VERSION = "3.4.4";
public static final String SPRING_BOOT_VERSION = "3.4.6";
public static final String LOMBOK_VERSION = "1.18.38";
public static final String REACTIVE_COMMONS_VERSION = "5.4.0";
public static final String REACTIVE_COMMONS_MAPPER_VERSION = "0.1.0";
public static final String BLOCK_HOUND_VERSION = "1.0.11.RELEASE";
public static final String AWS_BOM_VERSION = "2.31.25";
public static final String COMMONS_JMS_VERSION = "2.3.11";
public static final String AWS_BOM_VERSION = "2.31.48";
public static final String COMMONS_JMS_VERSION = "2.4.0";
public static final String GRAPHQL_KICKSTART_VERSION = "15.1.0";
public static final String ARCH_UNIT_VERSION = "1.4.0";
public static final String OKHTTP_VERSION = "4.12.0";
public static final String RESILIENCE_4J_VERSION = "2.3.0";
public static final String BIN_STASH_VERSION = "1.2.6";
public static final String SPRING_DOC_OPENAPI_VERSION = "2.8.6";
public static final String SPRING_DOC_OPENAPI_VERSION = "2.8.8";
public static final String CLOUD_EVENTS_VERSION = "4.0.1";
// gradle plugins
public static final String JACOCO_VERSION = "0.8.13";
public static final String SONAR_VERSION = "6.1.0.5360";
public static final String SONAR_VERSION = "6.2.0.5505";
public static final String COBERTURA_VERSION = "4.0.0";
public static final String PLUGIN_VERSION = "3.22.4";
public static final String DEPENDENCY_CHECK_VERSION = "12.1.1";
public static final String PITEST_VERSION = "1.15.0";
// custom
public static final String GRADLE_WRAPPER_VERSION = "8.13";
public static final String GRADLE_WRAPPER_VERSION = "8.14.1";

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public static class MainFiles {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package co.com.bancolombia.factory.upgrades.actions;

import static co.com.bancolombia.Constants.MainFiles.GRADLE_PROPERTIES;
import static co.com.bancolombia.Constants.MainFiles.SETTINGS_GRADLE;

import co.com.bancolombia.factory.ModuleBuilder;
import co.com.bancolombia.factory.upgrades.UpdateUtils;
import co.com.bancolombia.factory.upgrades.UpgradeAction;
import lombok.SneakyThrows;

public class UpgradeY2025M05D10Cache implements UpgradeAction {
private static final String BUILD_CACHE = "buildCache";
private static final String MATCH_CACHE = "rootProject.name";
private static final String APPEND_CACHE =
"buildCache {\n"
+ " local {\n"
+ " directory = new File(rootDir, 'build-cache')\n"
+ " }\n"
+ "}\n\n";

private static final String PARALLEL_CHECK = "org.gradle.parallel=true";
private static final String CACHING = "org.gradle.caching=true";
private static final String CACHING_REGEX = "\\borg\\.gradle\\.caching=false\\b";
private static final String CONFIGURATION_CACHE = "org.gradle.configuration-cache=true";
private static final String CONFIGURATION_CACHE_REGEX =
"\\borg\\.gradle\\.configuration-cache=false\\b";
private static final String CONFIGURATION_CACHE_PARALLEL =
"org.gradle.configuration-cache.parallel=true";
private static final String CONFIGURATION_CACHE_PARALLEL_REGEX =
"\\borg\\.gradle\\.configuration-cache.parallel=false\\b";
private static final String CONFIGURATION_CACHE_INTEGRITY =
"org.gradle.configuration-cache.integrity-check=true";
private static final String CONFIGURATION_CACHE_INTEGRITY_REGEX =
"\\borg\\.gradle\\.configuration-cache.integrity-check=false\\b";

@Override
@SneakyThrows
public boolean up(ModuleBuilder builder) {
return builder.updateFile(
SETTINGS_GRADLE,
content ->
UpdateUtils.insertBeforeMatch(content, MATCH_CACHE, BUILD_CACHE, APPEND_CACHE))
| builder.updateFile(
GRADLE_PROPERTIES,
content -> {
String modifiedContent = content;

modifiedContent =
updateGradleProperties(
builder,
modifiedContent,
CONFIGURATION_CACHE_INTEGRITY_REGEX,
"org.gradle.configuration-cache.integrity-check=false",
"org.gradle.configuration-cache.integrity-check=",
CONFIGURATION_CACHE_INTEGRITY);

modifiedContent =
updateGradleProperties(
builder,
modifiedContent,
CONFIGURATION_CACHE_PARALLEL_REGEX,
"org.gradle.configuration-cache.parallel=false",
"org.gradle.configuration-cache.parallel=",
CONFIGURATION_CACHE_PARALLEL);

modifiedContent =
updateGradleProperties(
builder,
modifiedContent,
CONFIGURATION_CACHE_REGEX,
"org.gradle.configuration-cache=false",
"org.gradle.configuration-cache=",
CONFIGURATION_CACHE);
modifiedContent =
updateGradleProperties(
builder,
modifiedContent,
CACHING_REGEX,
"org.gradle.caching=false",
"org.gradle.caching=",
CACHING);

return modifiedContent;
})
| UpdateUtils.appendIfNotContains(builder, "./.gitignore", "build-cache", "\nbuild-cache");
}

private String updateGradleProperties(
ModuleBuilder builder,
String content,
String regex,
String previous,
String containsValue,
String newValue) {
return !builder.findExpressions(GRADLE_PROPERTIES, regex).isEmpty()
? UpdateUtils.replace(content, previous, newValue)
: UpdateUtils.insertAfterMatch(
content, PARALLEL_CHECK, containsValue, "\n".concat(newValue));
}

@Override
public String name() {
return "3.22.4->3.22.5";
}

@Override
public String description() {
return "Add block hound validations";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import co.com.bancolombia.factory.ModuleBuilder;
import co.com.bancolombia.utils.FileUtils;
import java.io.File;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ArchitectureValidation {
Expand All @@ -23,13 +24,12 @@ public final class ArchitectureValidation {
private static final String FORBIDDEN_DOMAIN_NAMES =
"rabbit,sqs,sns,ibm,dynamo,aws,mysql,postgres,redis,mongo,rsocket,r2dbc,http,kms,s3,graphql,kafka";

public static void inject(Project project, ModuleBuilder builder) {
public static void inject(ModuleBuilder builder, Logger logger, Set<File> files) {
if (!FileUtils.readBooleanProperty(SKIP_PROP)) {
String os = System.getProperty("os.name");
String paths =
project.getAllprojects().stream()
.map(p -> "\"" + toOSPath(os, p.getProjectDir()) + "/\"")
.collect(Collectors.joining(","));
files.stream().map(f -> "\"" + toOSPath(os, f) + "/\"").collect(Collectors.joining(","));

builder.addParam("reactive", builder.isReactive());
builder.addParam("modulePaths", paths);
builder.addParam(
Expand All @@ -40,10 +40,11 @@ public static void inject(Project project, ModuleBuilder builder) {
"forbiddenDomainClassNames",
loadForbiddenValuesForAsString(
FORBIDDEN_DOMAIN_CLASS_NAMES_PROP, FORBIDDEN_DOMAIN_NAMES));
project.getAllprojects().stream()
.filter(p -> p.getName().equals(Constants.APP_SERVICE))

files.stream()
.filter(file -> file.getName().equals(Constants.APP_SERVICE))
.findFirst()
.ifPresent(appService -> generateArchUnitFiles(project, appService, builder));
.ifPresent(appService -> generateArchUnitFiles(logger, appService.getName(), builder));
}
}

Expand Down Expand Up @@ -109,10 +110,8 @@ private static String toOSPath(String os, File projectDir) {

@SneakyThrows
private static void generateArchUnitFiles(
Project project, Project appService, ModuleBuilder builder) {
project
.getLogger()
.lifecycle("Injecting ArchitectureTest in module {}", appService.getProjectDir().getName());
Logger logger, String appService, ModuleBuilder builder) {
logger.lifecycle("Injecting ArchitectureTest in module {}", appService);
builder.setupFromTemplate("structure/applications/appservice/arch-validations");
builder.appendDependencyToModule(
Constants.APP_SERVICE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.inject.Inject;
import lombok.SneakyThrows;
import org.gradle.api.DefaultTask;
Expand All @@ -26,10 +25,11 @@
import org.gradle.internal.logging.text.StyledTextOutputFactory;

public abstract class AbstractCleanArchitectureDefaultTask extends DefaultTask {
protected final ModuleBuilder builder = new ModuleBuilder(getProject());
protected final transient ModuleBuilder builder = new ModuleBuilder(getProject());
protected final Logger logger = getProject().getLogger();

protected AbstractCleanArchitectureDefaultTask() {
notCompatibleWithConfigurationCache("This task performs validations that should always run");
builder.setStyledLogger(
getTextOutputFactory().create(AbstractCleanArchitectureDefaultTask.class));
}
Expand Down Expand Up @@ -116,15 +116,15 @@ protected ModuleFactory resolveFactory(String packageName, String prefix, String
}

private String formatTypes() {
return resolveTypes().stream().collect(Collectors.joining("\n"));
return String.join("\n", resolveTypes());
}

@SneakyThrows
protected List<String> resolveTypes() {
return ReflectionUtils.getModuleFactories(resolvePackage())
.map(clazz -> clazz.getSimpleName().replace(resolvePrefix(), "").toUpperCase())
.sorted()
.collect(Collectors.toList());
.toList();
}

protected String resolvePrefix() {
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/co/com/bancolombia/task/DeleteModuleTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,35 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.options.Option;
import org.gradle.api.tasks.options.OptionValues;

@CATask(name = "deleteModule", shortcut = "dm", description = "Delete gradle module")
public class DeleteModuleTask extends AbstractCleanArchitectureDefaultTask {
private String module;

@Input private final ListProperty<String> availableModules;

public DeleteModuleTask() {
this.availableModules = getProject().getObjects().listProperty(String.class);
this.availableModules.set(new ArrayList<>(getProject().getChildProjects().keySet()));
}

@Option(option = "module", description = "Set module name to delete")
public void setModule(String module) {
this.module = module;
}

@OptionValues("module")
public List<String> getModules() {
return new ArrayList<>(getProject().getChildProjects().keySet());
return availableModules.get();
}

@Override
public void execute() throws IOException, CleanException {
if (module == null || !getProject().getChildProjects().containsKey(module)) {
if (module == null || !availableModules.get().contains(module)) {
printHelp();
throw new IllegalArgumentException(
"No valid module name is set, usage: gradle deleteModule --module "
Expand Down
Loading