Fix separate compilation for ConstantsGen (#5630)

A combination of commands triggered separate compilation that only recompiled part of builtins. A mechanism that workaround annotation processor's problems with separate compilation was updated to include changes from https://github.com/enso-org/enso/pull/4111. This was pretty tough to find given the rather unusual circumstances in CI.

# Important Notes
This eliminates the _random_ failures in CI related to separate compilation.
To reproduce a specific set of steps has to be executed:
```
sbt> all buildEngineDistribution engine-runner/assembly runtime/Benchmark/compile language-server/Benchmark/compile searcher/Benchmark/compile
(exit sbt)
sbt> test
```
This commit is contained in:
Hubert Plociniczak 2023-02-10 23:14:43 +01:00 committed by GitHub
parent d1af25793a
commit 9ea9fd56e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,19 +115,7 @@ public class TypeProcessor extends BuiltinsMetadataProcessor<TypeProcessor.TypeM
for (Map.Entry<String, BuiltinTypeConstr> entry : builtinTypes.get(f).entrySet()) { for (Map.Entry<String, BuiltinTypeConstr> entry : builtinTypes.get(f).entrySet()) {
BuiltinTypeConstr constr = entry.getValue(); BuiltinTypeConstr constr = entry.getValue();
if (!constr.getFullName().isEmpty()) { if (!constr.getFullName().isEmpty()) {
out.println( generateEntry(entry.getKey().toUpperCase(), constr.getFullName(), out);
" public static final String "
+ entry.getKey().toUpperCase()
+ " = \""
+ constr.getFullName()
+ "\";");
out.println(
" public static final String "
+ entry.getKey().toUpperCase() + "_BUILTIN"
+ " = "
+ toBuiltinName(constr.getFullName())
+ ";");
} }
} }
} }
@ -136,14 +124,7 @@ public class TypeProcessor extends BuiltinsMetadataProcessor<TypeProcessor.TypeM
.values() .values()
.forEach( .forEach(
entry -> entry ->
entry.stdlibName().ifPresent(n -> entry.stdlibName().ifPresent(n -> generateEntry(entry.ensoName().toUpperCase(), n, out))
out.println(
" public static final String "
+ entry.ensoName().toUpperCase()
+ " = \""
+ n
+ "\";")
)
); );
out.println(); out.println();
@ -151,6 +132,21 @@ public class TypeProcessor extends BuiltinsMetadataProcessor<TypeProcessor.TypeM
} }
} }
public void generateEntry(String name, String value, PrintWriter out) {
out.println(
" public static final String "
+ name
+ " = \""
+ value
+ "\";");
out.println(
" public static final String "
+ name + "_BUILTIN"
+ " = "
+ toBuiltinName(value)
+ ";");
}
private String toBuiltinName(String name) { private String toBuiltinName(String name) {
return "Constants.BUILTIN_NAMESPACE + \"." + name.substring(name.lastIndexOf('.') + 1) + "\""; return "Constants.BUILTIN_NAMESPACE + \"." + name.substring(name.lastIndexOf('.') + 1) + "\"";
} }