Skip to content
Open
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
16 changes: 15 additions & 1 deletion build-steps/release/archunit-examples-utils.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ ext.archunitExamplesGitRepo = 'TNG/ArchUnit-Examples.git'
ext.updateArchUnitExampleVersion = { File archUnitExampleDir ->
fileTree(archUnitExampleDir) {
include '**/build.gradle'
include '**/pom.xml'
}.each { File buildFile ->
buildFile.text = buildFile.text.replaceAll(/(com\.tngtech\.archunit:archunit[^:]*:)[\w.-]*/, "\$1${version}")
buildFile.text = buildFile.text.replaceAll(/(com\.tngtech\.archunit(:|<\/groupId>\n\s*<artifactId>)archunit([^:]*:|[^<]*<\/artifactId>\n\s*<version>))[\w.-]*/, "\$1${version}")
}
}
ext.updateArchUnitExampleSources = { File targetArchUnitExampleDir ->
updateArchUnitExampleDependencies(targetArchUnitExampleDir)
updateArchUnitExampleJavaSources(targetArchUnitExampleDir)
updateArchUnitExampleGradleWrapper(targetArchUnitExampleDir)
}

@Field
Expand Down Expand Up @@ -55,3 +57,15 @@ private List updateArchUnitExampleJavaSources(File targetArchUnitExampleDir) {
}
}
}

private void updateArchUnitExampleGradleWrapper(File targetArchUnitExampleDir) {
copy {
from(['gradlew', 'gradlew.bat'].collect { new File(rootProject.projectDir, it) })
into targetArchUnitExampleDir.toPath()
}
String wrapperDir = 'gradle/wrapper'
copy {
from(['gradle-wrapper.properties', 'gradle-wrapper.jar'].collect { new File(rootProject.projectDir, "${wrapperDir}/${it}") })
into new File(targetArchUnitExampleDir, wrapperDir)
}
}
Loading