File tree Expand file tree Collapse file tree
main/groovy/io/openapiprocessor/gradle
testInt/groovy/io/openapiprocessor/gradle Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ class OpenApiProcessorPlugin implements Plugin<Project> {
4949
5050 private void addOpenApiProcessorRepository (Project project ) {
5151 def snapshots = project. findProperty (" openapi-processor-gradle.snapshots" )
52- if (snapshots != null && snapshots == false ) {
52+ if (snapshots == null || snapshots != " true" ) {
53+ project. logger. debug(" openapi-processor: snapshot repository disabled" )
5354 return
5455 }
5556
@@ -61,6 +62,7 @@ class OpenApiProcessorPlugin implements Plugin<Project> {
6162 }
6263 }
6364 }
65+ project. logger. debug(" openapi-processor: snapshot repository enabled" )
6466 }
6567
6668 /**
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2023 https://github.com/openapi-processor/openapi-processor-gradle
3+ * PDX-License-Identifier: Apache-2.0
4+ */
5+
6+ package io.openapiprocessor.gradle
7+
8+
9+ import io.openapiprocessor.gradle.support.PluginSpec
10+
11+ class SnapshotsRepositorySpec extends PluginSpec {
12+
13+ @Override
14+ String getBuildFileName () {
15+ ' build.gradle'
16+ }
17+
18+ @Override
19+ String getBuildFile (String projectDir ) {
20+ """ \
21+ plugins {
22+ id("io.openapiprocessor.openapi-processor")
23+ }
24+ """ . stripIndent ()
25+ }
26+
27+ @Override
28+ List<String > getGradleArguments () {
29+ [' --stacktrace' , ' --debug' ]
30+ }
31+
32+ void " does not add snapshot repository if ot enabled or disabled" () {
33+ when :
34+ def result = build(" 8.5" , """ \
35+ """ . stripIndent())
36+
37+ then :
38+ result. output. contains(" snapshot repository disabled" )
39+ }
40+
41+ void " does not add snapshot repository if disabled" () {
42+ when :
43+ def result = build(" 8.5" , """ \
44+ openapi-processor-gradle.snapshots = false
45+ """ . stripIndent())
46+
47+ then :
48+ result. output. contains(" snapshot repository disabled" )
49+ }
50+
51+ void " adds snapshot repository" () {
52+ when :
53+ def result = build(" 8.5" , """ \
54+ openapi-processor-gradle.snapshots = true
55+ """ . stripIndent())
56+
57+ then :
58+ result. output. contains(" snapshot repository enabled" )
59+ }
60+ }
You can’t perform that action at this time.
0 commit comments