Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map the runtime scope to runtimeOnly for doc snippets #298

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ class BuildDependencyMacro extends InlineMacroProcessor implements ValueAtAttrib
return 'testImplementation'
case 'test':
return 'testImplementation'
break
case 'runtime':
return 'runtimeOnly'
case 'provided':
return 'developmentOnly'
default: return s
Expand Down
18 changes: 18 additions & 0 deletions src/test/groovy/io/micronaut/docs/BuildDependencyMacroSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ class BuildDependencyMacroSpec extends Specification {
content.contains('implementation(<span class="hljs-string">"io.micronaut:micronaut-function-aws-alexa")')
}

void "runtime scope is mapped to runtimeOnly in Gradle and kept in Maven"() {
when:
String content = BuildDependencyMacro.contentForTargetAndAttributes("micronaut-function-aws-alexa", [scope: 'runtime'])

then:
content.contains('data-lang="gradle">runtimeOnly')

and: 'only one gradle version is shown'
!content.contains('data-lang="gradle-groovy">runtimeOnly')
!content.contains('data-lang="gradle-kotlin">runtimeOnly')

and: 'snippet is kotlin compatible. It contains parenthesis and double quotes'
content.contains('runtimeOnly(<span class="hljs-string">"io.micronaut:micronaut-function-aws-alexa")')

and: 'maven snippet has correct scope'
content.contains('&lt;scope&gt;runtime&lt;/scope&gt;')
}

void "version appears after the 2nd column for gradle"() {
when:
def content = BuildDependencyMacro.contentForTargetAndAttributes("artifactId", ["text": 'version="1.2.3"'])
Expand Down