Skip to content

Commit

Permalink
update ArchUnit-Example sources for release test
Browse files Browse the repository at this point in the history
At the moment the release test only supports non-breaking changes for the ArchUnit-Example project. While this in general is a nice idea it now restricts us to release breaking changes with `1.0.0-rc1`. I added an update of the ArchUnit-Example sources, just like the real update of the ArchUnit-Example project once the release has been published. By that we are testing against the current ArchUnit-Example sources that have been adjusted to possible breaking changes, which is i.g. fine since the release test is focused on functionality, not backwards compatibility.

Signed-off-by: Peter Gafert <[email protected]>
  • Loading branch information
codecholeric committed Jul 13, 2022
1 parent 94bfc14 commit 8782729
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
14 changes: 14 additions & 0 deletions build-steps/release/archunit-examples-utils.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,17 @@ ext.updateArchUnitExampleVersion = { File archUnitExampleDir ->
buildFile.text = buildFile.text.replaceAll(/(com\.tngtech\.archunit:archunit[^:]*:)[\d.]*/, "\$1${version}")
}
}
ext.updateArchUnitExampleSources = { File targetArchUnitExampleDir ->
['example-plain', 'example-junit4', 'example-junit5'].each { exampleFolder ->
def targetSource = new File(new File(targetArchUnitExampleDir, exampleFolder), 'src')
targetSource.deleteDir()
copy {
from new File(project(':archunit-example:example-plain').projectDir, 'src/main')
into new File(targetSource, 'main')
}
copy {
from new File(project(":archunit-example:${exampleFolder}").projectDir, 'src/test')
into new File(targetSource, 'test')
}
}
}
2 changes: 2 additions & 0 deletions build-steps/release/test-release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ task testRelease() {
doFirst {
gitHubClone(archunitExamplesGitRepo, testReleaseDir)

updateArchUnitExampleSources(testReleaseDir)

updateArchUnitExampleVersion(testReleaseDir)

configureStagingRepository()
Expand Down
14 changes: 1 addition & 13 deletions build-steps/release/update-examples.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import java.util.regex.Pattern
apply from: scriptRelativePath(this, 'archunit-examples-utils.gradle')

final File checkoutDir = new File(project.buildDir, 'example-update')
final List<String> exampleFolders = ['example-plain', 'example-junit4', 'example-junit5']

task checkoutArchUnitExample {
doLast {
Expand All @@ -15,18 +14,7 @@ task checkoutArchUnitExample {

task copyArchUnitExampleSrc(dependsOn: checkoutArchUnitExample) {
doLast {
exampleFolders.each { exampleFolder ->
def targetSource = new File(new File(checkoutDir, exampleFolder), 'src')
targetSource.deleteDir()
copy {
from new File(project(':archunit-example:example-plain').projectDir, 'src/main')
into new File(targetSource, 'main')
}
copy {
from new File(project(":archunit-example:${exampleFolder}").projectDir, 'src/test')
into new File(targetSource, 'test')
}
}
updateArchUnitExampleSources(checkoutDir)
}
}

Expand Down

0 comments on commit 8782729

Please sign in to comment.