implements PLN-0129
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 62.10% (17811/28682)
* Branch Coverage: 52.81% (6878/13025)
* Lines of Code: 28682
* Cyclomatic Complexity: 11494
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 654
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 62.10% (17811/28682)
* Branch Coverage: 52.81% (6878/13025)
* Lines of Code: 28682
* Cyclomatic Complexity: 11494
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 654
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
Add ArchUnit guards for Java multi-frontend boundaries in a test-only module. Identify PBS by frontend-module origin, allow only the registry as composition root, and lock the wording in specs 19, 20, and 22. Housekeep DSC-0064 with LSN-0066.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package p.studio.architecture;
|
||||
|
||||
import com.tngtech.archunit.base.DescribedPredicate;
|
||||
import com.tngtech.archunit.core.domain.JavaClass;
|
||||
|
||||
final class PbsModuleOrigins {
|
||||
static final String PBS_GRADLE_PATH = ":prometeu-compiler:frontends:prometeu-frontend-pbs";
|
||||
|
||||
private PbsModuleOrigins() {
|
||||
}
|
||||
|
||||
static boolean isPbsModule(final JavaClass javaClass) {
|
||||
return uriContains(javaClass, "/prometeu-frontend-pbs/")
|
||||
|| uriContains(javaClass, "prometeu-frontend-pbs.jar");
|
||||
}
|
||||
|
||||
static boolean isRegistryModule(final JavaClass javaClass) {
|
||||
return uriContains(javaClass, "/prometeu-frontend-registry/")
|
||||
|| uriContains(javaClass, "prometeu-frontend-registry.jar");
|
||||
}
|
||||
|
||||
static boolean isFrontendApiModule(final JavaClass javaClass) {
|
||||
return uriContains(javaClass, "/prometeu-frontend-api/")
|
||||
|| uriContains(javaClass, "prometeu-frontend-api.jar");
|
||||
}
|
||||
|
||||
static DescribedPredicate<JavaClass> fromPbsModule() {
|
||||
return DescribedPredicate.describe(
|
||||
"originate from the PBS frontend module",
|
||||
PbsModuleOrigins::isPbsModule);
|
||||
}
|
||||
|
||||
static DescribedPredicate<JavaClass> fromRegistryModule() {
|
||||
return DescribedPredicate.describe(
|
||||
"originate from the frontend registry module",
|
||||
PbsModuleOrigins::isRegistryModule);
|
||||
}
|
||||
|
||||
static DescribedPredicate<JavaClass> fromFrontendApiModule() {
|
||||
return DescribedPredicate.describe(
|
||||
"originate from the frontend-api module",
|
||||
PbsModuleOrigins::isFrontendApiModule);
|
||||
}
|
||||
|
||||
static String sourceUri(final JavaClass javaClass) {
|
||||
return javaClass.getSource()
|
||||
.map(source -> normalize(source.getUri().toString()))
|
||||
.orElse("<no source>");
|
||||
}
|
||||
|
||||
private static boolean uriContains(final JavaClass javaClass, final String fragment) {
|
||||
return javaClass.getSource()
|
||||
.map(source -> normalize(source.getUri().toString()).contains(fragment))
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
private static String normalize(final String uri) {
|
||||
return uri.replace('\\', '/');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user