Skip to content

Commit

Permalink
Changed properties to not fail on empty should clause
Browse files Browse the repository at this point in the history
  • Loading branch information
sarpsahinalp committed Aug 5, 2024
1 parent 9577966 commit afa652e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@
import com.tngtech.archunit.core.domain.JavaClass;
import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import com.tngtech.archunit.core.importer.ImportOption;

import java.util.Optional;

/**
* Custom class resolver to resolve classes that are outside classpath to be able to analyze them transitively.
*/
public class CustomClassResolver {

/**
* Class file importer to import the class files.
* This is used to import the class files from the URL.
*/
private final JavaClasses allClasses;

public CustomClassResolver() {
// We need to import all classes to be able to resolve them later.
// TODO: We definitely need to improve this. We should not import all classes as it is not memory efficient.
// https://www.javadoc.io/doc/com.tngtech.archunit/archunit/0.10.2/com/tngtech/archunit/core/importer/ClassFileImporter.html
allClasses = new ClassFileImporter()
.withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS)
.withImportOption(location -> location.toString().contains("jrt:/"))
.importClasspath();
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/archunit.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Set to false to ignore missing dependencies in the classpath, as they are resolved manually by the de.tum.cit.ase.ares.api.architecturetest.java.postcompile.CustomClassResolver
resolveMissingDependenciesFromClassPath=false
resolveMissingDependenciesFromClassPath=false
archRule.failOnEmptyShould=false

0 comments on commit afa652e

Please sign in to comment.