diff --git a/build-steps/release/update-examples.gradle b/build-steps/release/update-examples.gradle index c1781cf810..9128d13c0d 100644 --- a/build-steps/release/update-examples.gradle +++ b/build-steps/release/update-examples.gradle @@ -4,6 +4,7 @@ import java.util.regex.Pattern final String archunitExamplesGitRepo = 'https://github.com/TNG/ArchUnit-Examples.git' final File checkoutDir = new File(project.buildDir, 'example-update') +final List exampleFolders = ['example-plain', 'example-junit4', 'example-junit5'] task checkoutArchUnitExample { doLast { @@ -13,38 +14,61 @@ task checkoutArchUnitExample { task copyArchUnitExampleSrc(dependsOn: checkoutArchUnitExample) { doLast { - def targetSource = new File(checkoutDir, 'src') - targetSource.deleteDir() - copy { - from new File(project(':archunit-example').projectDir, 'src') - into targetSource + 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') + } } } } -task removeArchUnitExampleCategory(dependsOn: copyArchUnitExampleSrc) { - doLast { - new File(checkoutDir, 'src/test/java/com/tngtech/archunit/exampletest/Example.java').delete() +def removeLines = { File file, List linesToRemove -> + def regex = "(${linesToRemove.collect { Pattern.quote(it) }.join('|')})\n" + file.text = file.text.replaceAll(regex, '') +} - def removeLines = { File file, List linesToRemove -> - def regex = "(${linesToRemove.collect { Pattern.quote(it) }.join('|')})\n" - file.text = file.text.replaceAll(regex, '') - } +def removeExampleCategory = { File baseDir, String categoryFqn -> + new File(baseDir, "src/test/java/${categoryFqn.replace('.', '/')}.java").delete() - new File(checkoutDir, 'src').traverse(type: FileType.FILES, nameFilter: { it.endsWith('.java') }) { File file -> - removeLines(file, [ - '@Category(Example.class)', - 'import org.junit.experimental.categories.Category;', - 'import com.tngtech.archunit.exampletest.Example;' - ]) - } + new File(baseDir, 'src').traverse(type: FileType.FILES, nameFilter: { it.endsWith('.java') }) { File file -> + removeLines(file, [ + '@Category(Example.class)', + 'import org.junit.experimental.categories.Category;', + "import ${categoryFqn};" + ]) + } +} + +def removeExampleTag = { File baseDir -> + new File(baseDir, 'src').traverse(type: FileType.FILES, nameFilter: { it.endsWith('.java') }) { File file -> + removeLines(file, [ + '@ArchTag("example")', + 'import com.tngtech.archunit.junit.ArchTag;' + ]) + } +} + +task removeArchUnitExampleCategory(dependsOn: copyArchUnitExampleSrc) { + doLast { + removeExampleCategory(new File(checkoutDir, 'example-plain'), 'com.tngtech.archunit.exampletest.Example') + removeExampleCategory(new File(checkoutDir, 'example-junit4'), 'com.tngtech.archunit.exampletest.junit4.Example') + removeExampleTag(new File(checkoutDir, 'example-junit5')) } } task updateArchUnitExampleVersion(dependsOn: checkoutArchUnitExample) { doLast { - def buildFile = new File(checkoutDir, 'build.gradle') - buildFile.text = buildFile.text.replaceAll(/(com\.tngtech\.archunit:archunit-junit4:)[\d.]*/, "\$1${version}") + exampleFolders.each { exampleFolder -> + def buildFile = new File(new File(checkoutDir, exampleFolder), 'build.gradle') + buildFile.text = buildFile.text.replaceAll(/(com\.tngtech\.archunit:archunit[^:]*:)[\d.]*/, "\$1${version}") + } } } diff --git a/docs/_posts/2018-08-19-release-v0.9.0.markdown b/docs/_posts/2018-08-19-release-v0.9.0.markdown new file mode 100644 index 0000000000..d92e717d4e --- /dev/null +++ b/docs/_posts/2018-08-19-release-v0.9.0.markdown @@ -0,0 +1,8 @@ +--- +layout: splash +title: "New release of ArchUnit (v0.9.0)" +date: 2018-08-19 18:00:00 +categories: news release +--- + +A new release of ArchUnit (v0.9.0) is out. For details see [the release on GitHub](https://github.com/TNG/ArchUnit/releases/tag/v0.9.0 "ArchUnit v0.9.0 on GitHub"). \ No newline at end of file