11package nebula.plugin.publishing
22
3+ import nebula.test.dsl.*
34import nebula.test.dsl.TestKitAssertions.assertThat
4- import nebula.test.dsl.plugins
5- import nebula.test.dsl.rootProject
6- import nebula.test.dsl.testProject
7- import nebula.test.dsl.version
85import org.gradle.testkit.runner.TaskOutcome
96import org.junit.jupiter.api.Test
107import org.junit.jupiter.api.io.TempDir
@@ -17,26 +14,23 @@ internal class NebulaOssPublishingPluginTest {
1714 @TempDir
1815 lateinit var remoteGitDir: File
1916
20- @Test
21- fun `test single project final` () {
22- val runner = withGitTag(projectDir, remoteGitDir, " v0.0.1" ) {
23- testProject(projectDir) {
24- rootProject {
25- plugins {
26- id(" java" )
27- // this plugin has behavior dependent on the existence of the contacts plugin
28- id(" com.netflix.nebula.contacts" ) version " latest.release"
29- // this plugin has behavior dependent on the existence of the info plugin
30- id(" com.netflix.nebula.info" ) version " latest.release"
31- id(" com.netflix.nebula.maven-publish" ) version " latest.release"
32- // this plugin has behavior dependent on the existence of the release plugin
33- id(" com.netflix.nebula.release" ) version " latest.release"
34- id(" com.netflix.nebula.maven-apache-license" ) version " latest.release"
35- id(" com.netflix.nebula.oss-publishing" )
36- }
37- // language=kotlin
38- rawBuildScript(
39- """
17+ private fun TestProjectBuilder.sampleSingleProjectSetup () {
18+ rootProject {
19+ plugins {
20+ id(" java" )
21+ // this plugin has behavior dependent on the existence of the contacts plugin
22+ id(" com.netflix.nebula.contacts" ) version " latest.release"
23+ // this plugin has behavior dependent on the existence of the info plugin
24+ id(" com.netflix.nebula.info" ) version " latest.release"
25+ id(" com.netflix.nebula.maven-publish" ) version " latest.release"
26+ // this plugin has behavior dependent on the existence of the release plugin
27+ id(" com.netflix.nebula.release" ) version " latest.release"
28+ id(" com.netflix.nebula.maven-apache-license" ) version " latest.release"
29+ id(" com.netflix.nebula.oss-publishing" )
30+ }
31+ // language=kotlin
32+ rawBuildScript(
33+ """
4034group = "test"
4135description = "description"
4236nebulaOssPublishing {
@@ -53,8 +47,15 @@ contacts {
5347$DISABLE_PUBLISH_TASKS
5448$DISABLE_MAVEN_CENTRAL_TASKS
5549"""
56- )
57- }
50+ )
51+ }
52+ }
53+
54+ @Test
55+ fun `test single project final` () {
56+ val runner = withGitTag(projectDir, remoteGitDir, " v0.0.1" ) {
57+ testProject(projectDir) {
58+ sampleSingleProjectSetup()
5859 }
5960 }
6061 val result = runner.run (
@@ -88,4 +89,15 @@ $DISABLE_MAVEN_CENTRAL_TASKS
8889 assertThat(result.task(" :postRelease" )).hasOutcome(TaskOutcome .SUCCESS )
8990 assertThat(result.task(" :final" )).hasOutcome(TaskOutcome .SUCCESS )
9091 }
92+
93+ @Test
94+ fun `test build without git tag` () {
95+ val runner = testProject(projectDir) {
96+ sampleSingleProjectSetup()
97+ }
98+ val result = runner.run (" build" , " --stacktrace" )
99+ assertThat(result.task(" :release" )).isNull()
100+ assertThat(result.task(" :postRelease" )).isNull()
101+ assertThat(result.task(" :build" )).hasOutcome(TaskOutcome .SUCCESS )
102+ }
91103}
0 commit comments