File tree 2 files changed +63
-1
lines changed
main/groovy/io/openapiprocessor/gradle
testInt/groovy/io/openapiprocessor/gradle 2 files changed +63
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ class OpenApiProcessorPlugin implements Plugin<Project> {
49
49
50
50
private void addOpenApiProcessorRepository (Project project ) {
51
51
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" )
53
54
return
54
55
}
55
56
@@ -61,6 +62,7 @@ class OpenApiProcessorPlugin implements Plugin<Project> {
61
62
}
62
63
}
63
64
}
65
+ project. logger. debug(" openapi-processor: snapshot repository enabled" )
64
66
}
65
67
66
68
/**
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