diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95f007e1..53659ab7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - name: Build without tests - run: ./gradlew build -PreleaseVersion=${{ steps.get_version.outputs.VERSION }} -x test -x spotlessCheck + run: ./gradlew build -PreleaseNativeLibs -PreleaseVersion=${{ steps.get_version.outputs.VERSION }} -x test -x spotlessCheck env: JAVA_OPTS: -Xmx2g -Dorg.gradle.daemon=false diff --git a/README.md b/README.md index 0b83fc12..6afe4a80 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ Linux/MacOs Windows * Requirement [Docker Desktop WSL 2 backend on Windows](https://docs.docker.com/desktop/wsl/) +On release native libs are build for all the supported platforms, +if you want to test this process locally run `./gradlew -PreleaseNativeLibs jar`, +jar is generated in `arithmetization/build/libs`. + ### Install Rust ``` diff --git a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java index 8534fe99..b8450f4e 100644 --- a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java +++ b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java @@ -78,7 +78,7 @@ public void transactionOverModuleLineCountNotAccepted() throws Exception { assertThat(signedTxContractInteractionResp.hasError()).isTrue(); assertThat(signedTxContractInteractionResp.getError().getMessage()) - .isEqualTo("Transaction line count for module ADD=2018 is above the limit 70"); + .isEqualTo("Transaction line count for module ADD=402 is above the limit 70"); assertThat(getTxPoolContent()).isEmpty(); diff --git a/native/Dockerfile-win-dockcross b/native/Dockerfile-dockcross similarity index 100% rename from native/Dockerfile-win-dockcross rename to native/Dockerfile-dockcross diff --git a/native/build.sh b/native/build.sh index 85be58c7..47c3286f 100755 --- a/native/build.sh +++ b/native/build.sh @@ -14,12 +14,15 @@ OSTYPE=$(uname -o) # delete old build dir, if exists rm -rf "$SCRIPTDIR/compress/build/native" || true -mkdir -p "$SCRIPTDIR/compress/build/native" + +ARCH_DIR="" if [ x"$OSTYPE" = x"msys" ]; then LIBRARY_EXTENSION=dll elif [ x"$OSTYPE" = x"GNU/Linux" ]; then LIBRARY_EXTENSION=so + ARCHITECTURE="$(uname --machine)" + ARCH_DIR="linux-$ARCHITECTURE" elif [ x"$OSTYPE" = x"Darwin" ]; then LIBRARY_EXTENSION=dylib else @@ -27,7 +30,10 @@ else exit 1 fi +DEST_DIR="$SCRIPTDIR/compress/build/native/$ARCH_DIR" +mkdir -p "$DEST_DIR" + cd "$SCRIPTDIR/compress/compress-jni" echo "Building Go module libcompress_jni.$LIBRARY_EXTENSION for $OSTYPE" CGO_ENABLED=1 go build -buildmode=c-shared -o libcompress_jni.$LIBRARY_EXTENSION compress-jni.go -mv libcompress_jni.* "$SCRIPTDIR/compress/build/native" +mv libcompress_jni.* "$DEST_DIR" diff --git a/native/compress/build.gradle b/native/compress/build.gradle index 9f456542..ea29549c 100644 --- a/native/compress/build.gradle +++ b/native/compress/build.gradle @@ -33,12 +33,15 @@ test { } tasks.register('buildJNI', Exec) { - if(org.gradle.internal.os.OperatingSystem.current().isWindows()) { + if(project.hasProperty("releaseNativeLibs")) { workingDir buildscript.sourceFile.parentFile.parentFile - commandLine 'wsl', './wsl.sh' + commandLine 'sh', '-c', './release.sh' + } else if(org.gradle.internal.os.OperatingSystem.current().isWindows()) { + workingDir buildscript.sourceFile.parentFile.parentFile + commandLine 'wsl', './release.sh' } else { - workingDir buildscript.sourceFile.parentFile - commandLine 'sh', '-c', '../build.sh' + workingDir buildscript.sourceFile.parentFile.parentFile + commandLine 'sh', '-c', './build.sh' } } @@ -70,13 +73,13 @@ tasks.register('macLibCopy', Copy) { processResources.dependsOn macLibCopy tasks.register('linuxLibCopy', Copy) { - from 'build/native/libcompress_jni.so' + from 'build/native/linux-x86_64/libcompress_jni.so' into 'build/resources/main/linux-x86-64' } processResources.dependsOn linuxLibCopy tasks.register('linuxArm64LibCopy', Copy) { - from 'build/native/libcompress_jni.so' + from 'build/native/linux-aarch64/libcompress_jni.so' into 'build/resources/main/linux-aarch64' } processResources.dependsOn linuxArm64LibCopy @@ -102,14 +105,3 @@ jar { } jar.dependsOn(buildJNI) - -sourceSets { - main { - resources { - srcDirs '${buildDir}/darwin-aaarch64' - srcDirs '${buildDir}/darwin-x86-64' - srcDirs '${buildDir}/linux-gnu-x86_64' - srcDirs '${buildDir}/linux-gnu-aarch64' - } - } -} diff --git a/native/release.sh b/native/release.sh new file mode 100755 index 00000000..45d18f3a --- /dev/null +++ b/native/release.sh @@ -0,0 +1,32 @@ +#!/bin/bash -x + +docker build -f Dockerfile-dockcross --build-arg IMAGE=windows-shared-x64 -t native-windows-shared-x64-cross-compile . +docker build -f Dockerfile-dockcross --build-arg IMAGE=linux-x64 -t native-linux-x64-cross-compile . +docker build -f Dockerfile-dockcross --build-arg IMAGE=linux-arm64 -t native-linux-arm64-cross-compile . + +mkdir -p compress/build/native/linux-x86_64 +mkdir -p compress/build/native/linux-aarch64 + +docker run --rm native-windows-shared-x64-cross-compile > compress/build/native/native-windows-shared-x64-cross-compile +docker run --rm native-linux-x64-cross-compile > compress/build/native/native-linux-x64-cross-compile +docker run --rm native-linux-arm64-cross-compile > compress/build/native/native-linux-arm64-cross-compile + +chmod +x \ +compress/build/native/native-windows-shared-x64-cross-compile \ +compress/build/native/native-linux-x64-cross-compile \ +compress/build/native/native-linux-arm64-cross-compile + +OCI_EXE=docker \ +compress/build/native/native-windows-shared-x64-cross-compile --image native-windows-shared-x64-cross-compile \ + bash -c "cd compress/compress-jni && + CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -buildmode=c-shared -o ../build/native/compress_jni.dll compress-jni.go" + +OCI_EXE=docker \ +compress/build/native/native-linux-x64-cross-compile --image native-linux-x64-cross-compile \ + bash -c "cd compress/compress-jni && + CGO_ENABLED=1 go build -buildmode=c-shared -o ../build/native/linux-x86_64/libcompress_jni.so compress-jni.go" + +OCI_EXE=docker \ +compress/build/native/native-linux-arm64-cross-compile --image native-linux-arm64-cross-compile \ + bash -c "cd compress/compress-jni && + CGO_ENABLED=1 GOARCH=arm64 go build -buildmode=c-shared -o ../build/native/linux-aarch64/libcompress_jni.so compress-jni.go" diff --git a/native/wsl.sh b/native/wsl.sh deleted file mode 100644 index 64387d15..00000000 --- a/native/wsl.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -x - -docker build -f Dockerfile-win-dockcross --build-arg IMAGE=windows-shared-x64 -t native-windows-shared-x64-cross-compile . -docker build -f Dockerfile-win-dockcross --build-arg IMAGE=linux-x64 -t native-linux-x64-cross-compile . - -mkdir -p compress/build/native/ - -docker run --rm native-windows-shared-x64-cross-compile > compress/build/native/native-windows-shared-x64-cross-compile -docker run --rm native-linux-x64-cross-compile > compress/build/native/native-linux-x64-cross-compile - -compress/build/native/native-windows-shared-x64-cross-compile --image native-windows-shared-x64-cross-compile \ - bash -c "cd compress/compress-jni && - CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -buildmode=c-shared -o ../build/native/compress_jni.dll compress-jni.go" - -compress/build/native/native-linux-x64-cross-compile --image native-linux-x64-cross-compile \ - bash -c "cd compress/compress-jni && - CGO_ENABLED=1 go build -buildmode=c-shared -o ../build/native/libcompress_jni.so compress-jni.go"