File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,10 +38,19 @@ get_md5sum() {
3838}
3939
4040find_schema_class_file () {
41- # The schema class heuristic is a bit hacky for now, we just expect
42- # the filename containing the schema code to end with Schema or is named InputModel
41+ # The schema class heuristic is a bit hacky for now, we try to find a file
42+ # where a class has been annotated with the schema annotation
43+ # Otherwise we fallback on finding the filename containing the schema code
44+ # to end with Schema or is named InputModel
4345 # We might want to improve this in the future
44- find src -name " *Schema.scala" -o -name " InputModel.scala" | head -n 1 || return 0
46+ schema_class_file=" $( grep -lr " ^@schema" src | head -n 1 || return 0) "
47+
48+ if [[ -z " ${schema_class_file} " ]]; then
49+ schema_class_file=" $( find src -name " *Schema.scala" -o -name " InputModel.scala" | head -n 1 || return 0) "
50+ fi
51+
52+ echo " ${schema_class_file} "
53+
4554}
4655
4756find_schema_class () {
You can’t perform that action at this time.
0 commit comments