Skip to content

Commit

Permalink
Fix install of circom
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Richardson <[email protected]>
  • Loading branch information
awrichar committed Aug 29, 2024
1 parent e19b3cc commit 1570d33
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions domains/zeto/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
internal/zeto/abis/
zkp/
tools/
31 changes: 27 additions & 4 deletions domains/zeto/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

import org.apache.tools.ant.taskdefs.condition.Os

ext {
goFiles = fileTree(".") {
include "internal/**/*.go"
}
jsCircuits = "${rootDir}/zeto/zkp/circuits"
zkpOut = "${projectDir}/zkp"
toolsOut = "${projectDir}/tools"
}

configurations {
Expand Down Expand Up @@ -71,9 +74,28 @@ task circuitsInstall(type: Exec) {
outputs.dir("node_modules")
}

task installCircom(type: Download) {
src "https://github.com/iden3/circom/releases/download/v2.1.9/circom-linux-amd64"
dest new File(buildDir, "circom")
task installCircom {
def filename
def outname
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
filename = "circom-windows-amd64.exe"
outname = "circom.exe"
} else if (Os.isFamily(Os.FAMILY_MAC)) {
filename = "circom-macos-amd64"
outname = "circom"
} else {
filename = "circom-linux-amd64"
outname = "circom"
}

def url = "https://github.com/iden3/circom/releases/download/v2.1.9/${filename}"
def f = new File(toolsOut, outname)
doFirst {
mkdir(f.parent)
new URL(url).withInputStream{ i -> f.withOutputStream{ it << i }}
f.setExecutable(true)
}
outputs.file(f)
}

task circuitsGen(type: Exec, dependsOn: [circuitsInstall, installCircom]) {
Expand All @@ -82,7 +104,7 @@ task circuitsGen(type: Exec, dependsOn: [circuitsInstall, installCircom]) {
args '--', '-c', 'anon'
workingDir "${rootDir}/zeto/zkp/circuits"

environment 'PATH', "${environment.PATH}:${buildDir}/circom"
environment 'PATH', "${toolsOut}${File.pathSeparator}${environment.PATH}"
environment "CIRCUITS_ROOT", zkpOut
environment "PROVING_KEYS_ROOT", zkpOut
environment "PTAU_DOWNLOAD_PATH", zkpOut
Expand Down Expand Up @@ -122,4 +144,5 @@ task clean(type: Delete) {
delete 'coverage'
delete 'internal/zeto/abis'
delete zkpOut
delete toolsOut
}

0 comments on commit 1570d33

Please sign in to comment.