Skip to content

Commit e5e4f4e

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

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ class GraphQLCodegenPlugin(configuration: Configuration, private[codegen] val co
121121

122122
supportUnknownFields := MappingConfigConstants.DEFAULT_SUPPORT_UNKNOWN_FIELDS,
123123
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)