Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d49adc0
commit 15f5fe3
Showing
7 changed files
with
123 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,4 @@ | |
out | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.shelf | ||
*.iws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
sourceSets { | ||
integTest { | ||
} | ||
} | ||
|
||
gradlePlugin.testSourceSets(sourceSets.integTest) | ||
configurations.integTestImplementation.extendsFrom(configurations.testImplementation) | ||
|
||
task integTest(type: Test) { | ||
testClassesDirs = sourceSets.integTest.output.classesDirs | ||
classpath = sourceSets.integTest.runtimeClasspath | ||
} | ||
|
||
check { | ||
dependsOn(tasks.integTest) | ||
} | ||
|
||
idea { | ||
module { | ||
testSourceDirs += file('src/integTest/groovy') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// docs: https://plugins.gradle.org/docs/publish-plugin | ||
gradlePlugin { | ||
plugins { | ||
autoVersion { | ||
id = 'org.shipkit.changelog' | ||
implementationClass = 'org.shipkit.changelog.ChangelogPlugin' | ||
} | ||
} | ||
} | ||
|
||
pluginBundle { | ||
website = 'https://github.com/shipkit/org.shipkit.shipkit-changelog' | ||
vcsUrl = 'https://github.com/shipkit/org.shipkit.shipkit-changelog.git' | ||
plugins { | ||
autoVersion { | ||
displayName = 'Shipkit changelog plugin' | ||
description = 'Generates changelog based on ticked IDs found in commit messages and GitHub pull request information' | ||
tags = ['ci', 'shipkit', 'changelog'] | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/integTest/groovy/org/shipkit/changelog/ChangelogPluginIntegTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.shipkit.changelog | ||
|
||
import org.gradle.testkit.runner.GradleRunner | ||
import org.junit.Rule | ||
import org.junit.rules.TemporaryFolder | ||
import spock.lang.Specification | ||
|
||
/** | ||
* Only smoke test, forever! Don't add more tests here, instead cover the complexity in lower level unit tests. | ||
*/ | ||
class ChangelogPluginIntegTest extends Specification { | ||
|
||
@Rule TemporaryFolder tmp = new TemporaryFolder() | ||
|
||
def setup() { | ||
file("settings.gradle") | ||
file("build.gradle") << """ | ||
plugins { id('org.shipkit.changelog')} | ||
""" | ||
} | ||
|
||
def "applies plugin cleanly"() { | ||
given: | ||
def result = run("tasks") | ||
|
||
expect: | ||
result.output.contains("Applying plugin...") | ||
} | ||
|
||
File file(String path) { | ||
def f = new File(rootDir, path) | ||
if (!f.exists()) { | ||
f.parentFile.mkdirs() | ||
f.createNewFile() | ||
assert f.exists() | ||
} | ||
return f | ||
} | ||
|
||
File getRootDir() { | ||
return tmp.root | ||
} | ||
|
||
def run(String ...args) { | ||
def runner = GradleRunner.create() | ||
runner.forwardOutput() | ||
runner.withPluginClasspath() | ||
runner.withArguments(args) | ||
runner.withProjectDir(rootDir) | ||
return runner.build() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.shipkit.changelog; | ||
|
||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.logging.Logger; | ||
import org.gradle.api.logging.Logging; | ||
|
||
/** | ||
* The plugin, ideally with zero business logic, but only the Gradle integration code | ||
*/ | ||
public class ChangelogPlugin implements Plugin<Project> { | ||
|
||
private static final Logger LOG = Logging.getLogger(ChangelogPlugin.class); | ||
|
||
public void apply(Project project) { | ||
LOG.lifecycle("Applying plugin..."); | ||
} | ||
} |