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
8 changes: 4 additions & 4 deletions archunit-3rd-party-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ ext.moduleName = 'com.tngtech.archunit.thirdpartytest'
dependencies {
testImplementation project(path: ':archunit', configuration: 'shadow')
testImplementation project(path: ':archunit', configuration: 'tests')
testImplementation dependency.springBootLoader
testImplementation exampleLibs.springBootLoader
dependency.addGuava { dependencyNotation, config -> testImplementation(dependencyNotation, config) }
testImplementation dependency.junit4
testImplementation dependency.junit_dataprovider
testImplementation dependency.assertj
testImplementation libs.junit4
testImplementation libs.junitDataprovider
testImplementation libs.assertj
}
2 changes: 1 addition & 1 deletion archunit-example/example-plain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {

// we still use JUnit 4 as the test runner, but we don't use JUnit 4 support within this project
// so tests could well be run using TestNG, etc.
testImplementation dependency.junit4
testImplementation libs.junit4
}

test {
Expand Down
4 changes: 2 additions & 2 deletions archunit-integration-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ext.moduleName = 'com.tngtech.archunit.integrationtest'
ext.minimumJavaVersion = JavaVersion.VERSION_1_8

dependencies {
testImplementation dependency.junitPlatform
testImplementation dependency.assertj
testImplementation libs.junitPlatform
testImplementation libs.assertj
testImplementation project(path: ':archunit', configuration: 'tests')
testImplementation project(path: ':archunit-junit4')
testImplementation project(path: ':archunit-junit5-api')
Expand Down
22 changes: 6 additions & 16 deletions archunit-junit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,23 @@ artifacts {
dependencies {
archJunitApi project(path: ':archunit', configuration: 'shadow')
dependency.addGuava { dependencyNotation, config -> implementation(dependencyNotation, config) }
implementation dependency.slf4j

testImplementation dependency.junit4
testImplementation dependency.junit_dataprovider
testImplementation dependency.mockito
testImplementation dependency.assertj
testImplementation(dependency.assertj_guava) {
exclude module: 'assertj-core'
exclude module: 'guava'
}

testImplementation libs.junit4
testImplementation libs.junitDataprovider
testImplementation libs.mockito
testImplementation libs.assertj
testImplementation project(path: ':archunit', configuration: 'tests')

// This is a hack for running tests with IntelliJ instead of delegating to Gradle,
// because for some reason this dependency cannot be resolved otherwise :-(
testRuntimeOnly dependency.asm
}

archUnitTest {
providesTestJar = true
testRuntimeOnly libs.asm
}

shadowJar {
exclude 'META-INF/**'

dependencies {
exclude(project(':archunit'))
exclude(dependency(dependency.slf4j))
}
}

Expand Down
24 changes: 8 additions & 16 deletions archunit-junit/junit4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,18 @@ ext.moduleName = 'com.tngtech.archunit.junit4'
dependencies {
api project(path: ':archunit', configuration: 'shadow')
api project(path: ':archunit-junit', configuration: 'archJunitApi')
api dependency.junit4
api libs.junit4
implementation project(path: ':archunit-junit', configuration: 'shadow')
dependency.addGuava { dependencyNotation, config -> implementation(dependencyNotation, config) }
implementation dependency.slf4j

testImplementation dependency.junit4
testImplementation dependency.junit_dataprovider
testImplementation dependency.mockito
testImplementation dependency.assertj
testImplementation(dependency.assertj_guava) {
exclude module: 'assertj-core'
exclude module: 'guava'
}

testImplementation libs.junit4
testImplementation libs.mockito
testImplementation libs.assertj
testImplementation project(path: ':archunit', configuration: 'tests')
testImplementation project(path: ':archunit-junit', configuration: 'tests')

// This is a hack for running tests with IntelliJ instead of delegating to Gradle,
// because for some reason this dependency cannot be resolved otherwise :-(
testRuntimeOnly dependency.asm
testRuntimeOnly libs.asm
}

javadoc {
Expand All @@ -42,9 +35,8 @@ shadowJar {

dependencies {
exclude(project(':archunit'))
exclude(dependency(dependency.junit4))
exclude(dependency(dependency.slf4j))
exclude(dependency(dependency.hamcrest)) // Shadow doesn't respect transitive excludes :-(
exclude(dependency("${libs.junit4.get()}"))
exclude(dependency("${libs.hamcrest.get()}")) // Shadow doesn't respect transitive excludes :-(
}
}

Expand Down
5 changes: 2 additions & 3 deletions archunit-junit/junit5/api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ext.minimumJavaVersion = JavaVersion.VERSION_1_8
dependencies {
api project(path: ':archunit')
api project(path: ':archunit-junit', configuration: 'archJunitApi')
api dependency.junitPlatformCommons
api libs.junitPlatformCommons
}

javadoc {
Expand All @@ -23,8 +23,7 @@ shadowJar {
exclude 'META-INF/maven/**'

dependencies {
exclude(project(':archunit'))
exclude(dependency { it.name != dependency.guava && !it.name.contains('archunit-junit') })
exclude(dependency { !it.name.contains('archunit-junit') })
}
}

Expand Down
10 changes: 3 additions & 7 deletions archunit-junit/junit5/engine-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ ext.moduleName = 'com.tngtech.archunit.junit5.engineapi'
ext.minimumJavaVersion = JavaVersion.VERSION_1_8

dependencies {
api dependency.junitPlatformEngine
api libs.junitPlatformEngine
implementation project(path: ':archunit')
dependency.addGuava { dependencyNotation, config -> implementation(dependencyNotation, config) }
implementation dependency.slf4j

testImplementation project(path: ':archunit-junit5-api')
testImplementation project(path: ':archunit', configuration: 'tests')
testImplementation dependency.assertj
testImplementation dependency.mockito
testImplementation libs.assertj
}

compileJava.dependsOn project(':archunit-junit5-api').finishArchive
Expand All @@ -30,7 +26,7 @@ shadowJar {
exclude 'META-INF/maven/**'

dependencies {
exclude(dependency { it.name != dependency.guava })
exclude(dependency { true })
}
}

Expand Down
12 changes: 6 additions & 6 deletions archunit-junit/junit5/engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ dependencies {
api project(path: ':archunit-junit5-engine-api')
implementation project(path: ':archunit-junit')
dependency.addGuava { dependencyNotation, config -> implementation(dependencyNotation, config) }
implementation dependency.slf4j
implementation libs.slf4j

testImplementation project(path: ':archunit', configuration: 'tests')
testImplementation dependency.assertj
testImplementation dependency.mockito
testImplementation dependency.mockito_junit5
testImplementation dependency.log4j_core
testImplementation libs.assertj
testImplementation libs.mockito
testImplementation libs.mockito.junit5
testImplementation libs.log4j.core
}

gradle.projectsEvaluated {
Expand All @@ -45,7 +45,7 @@ shadowJar {
dependencies {
exclude(dependency {
def isApi = it.configuration == 'archJunitApi'
def isUnwantedDependency = it.name != dependency.guava && it.moduleName != 'archunit-junit'
def isUnwantedDependency = it.moduleName != 'archunit-junit'
isUnwantedDependency || isApi
})
}
Expand Down
7 changes: 4 additions & 3 deletions archunit-maven-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ def addMavenTest = { IntegrationTestConfig config ->
.replace('#{javaVersion}', "${config.javaVersion}")
.replace('#{additionalDependencies}', config.additionalDependencies ?: '')
.replace('#{surefireExampleConfiguration}', config.surefireExampleConfiguration)
.replaceAll(/#\{dependency.([^}:]+):?([^}]*)}/) { all, dependencyReference, scope ->
def targetDependency = dependency[dependencyReference]
.replaceAll(/#\{(libs|exampleLibs).([^}:]+):?([^}]*)}/) { all, catalog, dependencyReference, scope ->
def versionCatalog = versionCatalogs.named(catalog)
def targetDependency = versionCatalog.findLibrary(dependencyReference).get().get()
def scopePart = scope ? "\n <scope>${scope}</scope>" : ''
"""
| <dependency>
Expand Down Expand Up @@ -212,7 +213,7 @@ List<IntegrationTestConfig> integrationTestConfigs = [
)
]

def vintageEngine = dependency.junit5VintageEngine
def vintageEngine = libs.junit5VintageEngine.get()
integrationTestConfigs << new IntegrationTestConfig(
javaVersion: integrationTestJavaVersion,
testType: TestType.JUNIT5,
Expand Down
24 changes: 12 additions & 12 deletions archunit-maven-test/pom.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@
<version>#{archunit.version}</version>
<scope>test</scope>
</dependency>
#{dependency.javaxAnnotationApi}
#{dependency.geronimoEjb}
#{dependency.geronimoJpa}
#{dependency.jodaTime}
#{dependency.springBeans}
#{dependency.jakartaInject}
#{dependency.jakartaAnnotations}
#{dependency.guice}
#{dependency.junit4:test}
#{dependency.junit_dataprovider:test}
#{dependency.assertj:test}
#{dependency.joox:test}
#{exampleLibs.javaxAnnotationApi}
#{exampleLibs.geronimoEjb}
#{exampleLibs.geronimoJpa}
#{exampleLibs.jodaTime}
#{exampleLibs.springBeans}
#{exampleLibs.jakartaInject}
#{exampleLibs.jakartaAnnotations}
#{exampleLibs.guice}
#{libs.junit4:test}
#{libs.junitDataprovider:test}
#{libs.assertj:test}
#{exampleLibs.joox:test}
#{additionalDependencies}
</dependencies>

Expand Down
20 changes: 10 additions & 10 deletions archunit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ plugins {
ext.moduleName = 'com.tngtech.archunit'

dependencies {
api dependency.slf4j
implementation dependency.asm
api libs.slf4j
implementation libs.asm
dependency.addGuava { dependencyNotation, config -> implementation(dependencyNotation, config) }

testImplementation dependency.log4j_api
testImplementation dependency.log4j_core
testImplementation dependency.junit4
testImplementation dependency.junit_dataprovider
testImplementation dependency.mockito
testImplementation dependency.assertj
testImplementation(dependency.assertj_guava) {
testImplementation libs.log4j.api
testImplementation libs.log4j.core
testImplementation libs.junit4
testImplementation libs.junitDataprovider
testImplementation libs.mockito
testImplementation libs.assertj
testImplementation(libs.assertj.guava) {
exclude module: 'assertj-core'
exclude module: 'guava'
}
Expand All @@ -25,7 +25,7 @@ shadowJar {
exclude 'META-INF/**'

dependencies {
exclude(dependency(dependency.slf4j))
exclude(dependency("${libs.slf4j.get()}"))
}
}

Expand Down
4 changes: 2 additions & 2 deletions build-steps/release/archunit-examples-utils.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ private void updateArchUnitExampleDependencies(File targetArchUnitExampleDir) {
def buildFile = new File(targetArchUnitExampleDir, 'build.gradle')

List<Map<String, String>> sortedDependencies = archUnitExamplesMainDependencies.collect()
.sort { first, second -> first.group <=> second.group ?: first.name <=> second.name }
.sort { first, second -> first.get().group <=> second.get().group ?: first.get().name <=> second.get().name }
def dependencyIndent = ' ' * 8
List<String> dependencyLines = sortedDependencies
List<String> dependencyLines = sortedDependencies.collect { it.get() }
.collect { "${dependencyIndent}implementation '${it.group}:${it.name}:${it.version}'".toString() }

buildFile.text = archUnitExamplesRootBuildFileContent.replace('#{dependencies}', dependencyLines.join('\n')) // always Unix line separator
Expand Down
35 changes: 1 addition & 34 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,47 +35,14 @@ ext {
googleRelocationPackage = "${thirdPartyRelocationPackage}.com.google"

dependency = [
asm : [group: 'org.ow2.asm', name: 'asm', version: '9.8'],
guava : [group: 'com.google.guava', name: 'guava', version: '33.4.8-jre'],
addGuava : { dependencyHandler ->
dependencyHandler(dependency.guava) {
dependencyHandler(libs.guava) {
exclude module: 'listenablefuture'
exclude module: 'jspecify'
exclude module: 'error_prone_annotations'
exclude module: 'j2objc-annotations'
}
},
slf4j : [group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17'],
log4j_api : [group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.24.3'],
log4j_core : [group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.24.3'],
log4j_slf4j : [group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: '2.24.3'],

junit4 : [group: 'junit', name: 'junit', version: '4.13.2'],
junit5Jupiter : [group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.12.2'],
junit5VintageEngine : [group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.12.2'],
junitPlatform : [group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.12.2'],
junitPlatformCommons : [group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.12.2'],
junitPlatformEngine : [group: 'org.junit.platform', name: 'junit-platform-engine', version: '1.12.2'],
junitPlatformLauncher: [group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.12.2'],
hamcrest : [group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'],
junit_dataprovider : [group: 'com.tngtech.java', name: 'junit-dataprovider', version: '1.11.0'],
mockito : [group: 'org.mockito', name: 'mockito-core', version: '4.11.0'], // mockito 5 requires Java 11
mockito_junit5 : [group: 'org.mockito', name: 'mockito-junit-jupiter', version: '4.6.1'],
assertj : [group: 'org.assertj', name: 'assertj-core', version: '3.27.3'],
assertj_guava : [group: 'org.assertj', name: 'assertj-guava', version: '3.27.3'],

// Dependencies for example projects / tests
javaxAnnotationApi : [group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'],
springBeans : [group: 'org.springframework', name: 'spring-beans', version: '5.3.23'],
springBootLoader : [group: 'org.springframework.boot', name: 'spring-boot-loader', version: '2.7.13'],
jakartaInject : [group: 'jakarta.inject', name: 'jakarta.inject-api', version: '2.0.1'],
jakartaAnnotations : [group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '2.1.1'],
guice : [group: 'com.google.inject', name: 'guice', version: '5.1.0'],
// NOTE: The pure javaee-api dependencies are crippled, so to run any test we need to choose a full implementation provider
geronimoEjb : [group: 'org.apache.geronimo.specs', name: 'geronimo-ejb_3.1_spec', version: '1.0.2'],
geronimoJpa : [group: 'org.apache.geronimo.specs', name: 'geronimo-jpa_2.0_spec', version: '1.1'],
jodaTime : [group: 'joda-time', name: 'joda-time', version: '2.12.7'],
joox : [group: 'org.jooq', name: 'joox-java-6', version: '1.6.0']
]

minSupportedJavaVersion = JavaVersion.VERSION_1_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ archUnitTest {
}

rootProject.ext.archUnitExamplesMainDependencies = [
dependency.jodaTime,
dependency.javaxAnnotationApi,
dependency.jakartaInject,
dependency.jakartaAnnotations,
dependency.springBeans,
dependency.guice,
dependency.geronimoEjb,
dependency.geronimoJpa
exampleLibs.jodaTime,
exampleLibs.javaxAnnotationApi,
exampleLibs.jakartaInject,
exampleLibs.jakartaAnnotations,
exampleLibs.springBeans,
exampleLibs.guice,
exampleLibs.geronimoEjb,
exampleLibs.geronimoJpa
]

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ task ensureReleaseCheckUpToDate {
}

releaseCheckDependencies.each { releaseCheckDependency ->
def matchingProjectDependency = dependency.values().find {
VersionCatalog versionCatalog = versionCatalogs.named("libs")
def dependencies = versionCatalog.libraryAliases.collect { versionCatalog.findLibrary(it).get().get() }
def matchingProjectDependency = dependencies.find {
it.group == releaseCheckDependency.groupId && it.name == releaseCheckDependency.artifactId
}
assert matchingProjectDependency != null:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ abstract class ArchUnitTestExtension {
ext.archUnitTest = extensions.create('archUnitTest', ArchUnitTestExtension)

dependencies {
testImplementation dependency.junit5Jupiter
testImplementation libs.junit5Jupiter

testRuntimeOnly dependency.junit5VintageEngine
testRuntimeOnly dependency.junitPlatformLauncher
testRuntimeOnly dependency.log4j_slf4j
testRuntimeOnly libs.junit5VintageEngine
testRuntimeOnly libs.junitPlatformLauncher
testRuntimeOnly libs.log4j.slf4j
}

tasks.withType(Test) {
Expand Down
Loading