Fix insertion of packages and imports after the file annotation

This commit is contained in:
Pavel Punegov
2020-09-11 11:53:21 +03:00
committed by Pavel Punegov
parent c50ff6dd07
commit 646f2cb114
@@ -282,7 +282,7 @@ class RunExternalTestGroup extends JavaExec {
text = text.replaceFirst(packagePattern, "package $pkg") text = text.replaceFirst(packagePattern, "package $pkg")
} else { } else {
pkg = sourceName pkg = sourceName
text = insertInTextAfter(text, "\npackage $pkg\n", "@file:Suppress") text = insertInTextAfter(text, "\npackage $pkg\n", "@file:")
} }
if (text =~ boxPattern) { if (text =~ boxPattern) {
imports.add("${pkg}.*") imports.add("${pkg}.*")
@@ -331,7 +331,7 @@ class RunExternalTestGroup extends JavaExec {
pkg = 'package ' + (text =~ packagePattern)[0][1] pkg = 'package ' + (text =~ packagePattern)[0][1]
text = text.replaceFirst(packagePattern, '') text = text.replaceFirst(packagePattern, '')
} }
text = insertInTextAfter(text, (pkg ? "\n$pkg\n" : "") + "import $sourceName.*\n", "@file:Suppress") text = insertInTextAfter(text, (pkg ? "\n$pkg\n" : "") + "import $sourceName.*\n", "@file:")
} }
// now replace all package usages in full qualified names // now replace all package usages in full qualified names
def res = "" // filesToCompile def res = "" // filesToCompile