|
18 | 18 | package nebula.plugin.publishing |
19 | 19 |
|
20 | 20 | import nebula.test.dsl.TestKitAssertions.assertThat |
21 | | -import nebula.test.dsl.plugins |
22 | | -import nebula.test.dsl.rootProject |
23 | | -import nebula.test.dsl.testProject |
24 | | -import nebula.test.dsl.version |
| 21 | +import nebula.test.dsl.* |
25 | 22 | import org.gradle.testkit.runner.TaskOutcome |
26 | 23 | import org.junit.jupiter.api.Test |
27 | 24 | import org.junit.jupiter.api.io.TempDir |
@@ -117,4 +114,59 @@ afterEvaluate { |
117 | 114 | assertThat(result.task(":signNebulaPublication")).hasOutcome(TaskOutcome.SKIPPED) |
118 | 115 | assertThat(result.task(":signCustomMavenPublication")).isNull() |
119 | 116 | } |
| 117 | + |
| 118 | + @Test |
| 119 | + fun `gradle plugin signs nebula publication and corresponding plugin marker`() { |
| 120 | + val runner = testProject(projectDir) { |
| 121 | + rootProject { |
| 122 | + plugins { |
| 123 | + id("com.netflix.nebula.maven-publish") version ("19.0.0") |
| 124 | + id("java-gradle-plugin") |
| 125 | + id("com.netflix.nebula.signing") |
| 126 | + } |
| 127 | + src { |
| 128 | + main { |
| 129 | + java("MyPlugin.java",""" |
| 130 | +import org.gradle.api.Plugin; |
| 131 | +import org.gradle.api.Project; |
| 132 | +
|
| 133 | +public class MyPlugin implements Plugin<Project> { |
| 134 | + public void apply(Project project){ |
| 135 | + } |
| 136 | +} |
| 137 | +""") |
| 138 | + } |
| 139 | + } |
| 140 | + rawBuildScript( |
| 141 | + //language=kotlin |
| 142 | + """ |
| 143 | +nebulaOssPublishing { |
| 144 | + signingKey = "something" |
| 145 | + signingPassword = "something" |
| 146 | +} |
| 147 | +gradlePlugin { |
| 148 | + plugins { |
| 149 | + create("myPlugin") { |
| 150 | + id = "com.netflix.test" |
| 151 | + displayName = "Test plugin" |
| 152 | + description = "Test description" |
| 153 | + implementationClass = "MyPlugin" |
| 154 | + } |
| 155 | + } |
| 156 | +} |
| 157 | +tasks.named("publishNebulaPublicationToMavenLocal") { onlyIf { false }} |
| 158 | +afterEvaluate { |
| 159 | + tasks.named("signNebulaPublication") { onlyIf { false }} |
| 160 | + //tasks.named("signMyPluginMarkerMavenPublication") { onlyIf { false }} |
| 161 | +} |
| 162 | +""" |
| 163 | + ) |
| 164 | + } |
| 165 | + } |
| 166 | + |
| 167 | + val result = runner.run("publishNebulaPublicationToMavenLocal") |
| 168 | +projectDir.resolve("build/publications/myPluginPluginMarkerMaven") |
| 169 | + assertThat(result.task(":signNebulaPublication")).hasOutcome(TaskOutcome.SKIPPED) |
| 170 | + assertThat(result.task(":signMyPluginMarkerMavenPublication")).hasOutcome(TaskOutcome.SKIPPED) |
| 171 | + } |
120 | 172 | } |
0 commit comments