Skip to content

Commit d5583f0

Browse files
committed
Add skip parameter to SBT plugin #961
1 parent 5b0bac5 commit d5583f0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

plugins/sbt/graphql-java-codegen-sbt-plugin/src/main/scala/io/github/dreamylost/graphql/codegen/GraphQLCodegenPlugin.scala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ class GraphQLCodegenPlugin(configuration: Configuration, private[codegen] val co
120120
responseProjectionMaxDepth := MappingConfigConstants.DEFAULT_RESPONSE_PROJECTION_MAX_DEPTH,
121121

122122
supportUnknownFields := MappingConfigConstants.DEFAULT_SUPPORT_UNKNOWN_FIELDS,
123-
unknownFieldsPropertyName := MappingConfigConstants.DEFAULT_UNKNOWN_FIELDS_PROPERTY_NAME
123+
unknownFieldsPropertyName := MappingConfigConstants.DEFAULT_UNKNOWN_FIELDS_PROPERTY_NAME,
124+
125+
skip := false
124126
)
125127

126128
private def getMappingConfig(): Def.Initialize[MappingConfig] = Def.setting {
@@ -234,11 +236,15 @@ class GraphQLCodegenPlugin(configuration: Configuration, private[codegen] val co
234236
throw new LanguageNotSupportedException(language)
235237
}
236238
}
237-
result = instantiateCodegen(getMappingConfig().value).generate.asScala
238-
for (file result) {
239-
sLog.value.info(s"${file.getName}")
239+
if (skip) {
240+
sLog.value.info("Skipping code generation")
241+
} else {
242+
result = instantiateCodegen(getMappingConfig().value).generate.asScala
243+
for (file result) {
244+
sLog.value.info(s"${file.getName}")
245+
}
246+
sLog.value.success(s"Total files: ${result.length}")
240247
}
241-
sLog.value.success(s"Total files: ${result.length}")
242248
} catch {
243249
case e: Exception
244250
(logLevel in configuration).?.value.orElse(state.value.get(logLevel.key)) match {

0 commit comments

Comments
 (0)