Skip to content

Commit

Permalink
Support regeneration of GlobalConstants.java (#1421)
Browse files Browse the repository at this point in the history
This enables regeneration of the `GlobalConstants.java` via the command
`gradle constants`.  This requires Corset `v9.7.15` (which at this time
has not yet been released).  The solution is to allow for an override to
the class name being produced in Corset.  So, it doesn't always have to
generate a file `Trace.java`.  Rather you can specify the class name to
generate (in this case, `GlobalConstants`).  The relevant gradle option
for the `constants` command is updated to do this.
  • Loading branch information
DavePearce authored Oct 17, 2024
1 parent a5020ee commit 13ce736
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions buildSrc/src/main/groovy/TraceFilesTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import org.gradle.api.tasks.Optional

abstract class TraceFilesTask extends Exec {

@Input
@Optional
abstract Property<String> getClassName()

@Input
abstract Property<String> getModule()

Expand All @@ -22,6 +26,10 @@ abstract class TraceFilesTask extends Exec {
"-P", module.get(),
"-o", "${project.projectDir}/src/main/java/net/consensys/linea/zktracer/module/${moduleDir.getOrElse(module.get())}"
]
if(className) {
arguments.add("-c")
arguments.add("${className.get()}")
}
arguments.addAll(files.get().collect({"linea-constraints/${it}"}))

workingDir project.rootDir
Expand Down
1 change: 1 addition & 0 deletions gradle/trace-files.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ tasks.register('binreftable', TraceFilesTask) {
group "Trace files generation"
dependsOn corsetExists

className = "GlobalConstants"
module = moduleName
files = [ "${moduleName}/constants.lisp"]
}
Expand Down

0 comments on commit 13ce736

Please sign in to comment.