From 66a64cad79a4106bf6519e9b72cbbd5f5adb5a11 Mon Sep 17 00:00:00 2001 From: Yaroslav Moria <5eeman@users.noreply.github.com> Date: Mon, 10 Jun 2024 15:59:29 +0200 Subject: [PATCH 1/6] Added publishing gradle setup. --- build.gradle.kts | 1 + gradle.properties | 20 ++++- publish-package.gradle | 110 ++++++++++++++++++++++++++++ rapidsnark_android/build.gradle.kts | 8 ++ 4 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 publish-package.gradle diff --git a/build.gradle.kts b/build.gradle.kts index c77e323..3075993 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,4 +3,5 @@ plugins { id("com.android.application") version "8.2.1" apply false id("org.jetbrains.kotlin.android") version "1.9.0" apply false id("com.android.library") version "8.2.1" apply false + `maven-publish` } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 70549d4..a95c941 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,22 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true + +VERSION_NAME=0.0.1-alpha.1 +VERSION_CODE=1 +GROUP=com.iden3 + +POM_DESCRIPTION=This library is Android Kotlin wrapper for the [Rapidsnark](https://github.com/iden3/rapidsnark). It enables the generation of proofs for specified circuits within an Android environment. +POM_URL=https://github.com/iden3/android-rapidsnark +POM_SCM_URL=https://github.com/iden3/android-rapidsnark +POM_SCM_CONNECTION=scm:git@github.com:iden3/android-rapidsnark.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:iden3/android-rapidsnark.git +POM_LICENCE_NAME=GNU General Public License v3.0 +POM_LICENCE_URL=https://github.com/iden3/android-rapidsnark/COPYING +POM_LICENCE_DIST=repo +POM_DEVELOPER_ID= +POM_DEVELOPER_NAME= +POM_DEVELOPER_EMAIL= +ossrhUsername='' +ossrhPassword='' \ No newline at end of file diff --git a/publish-package.gradle b/publish-package.gradle new file mode 100644 index 0000000..a814765 --- /dev/null +++ b/publish-package.gradle @@ -0,0 +1,110 @@ +apply plugin: "maven-publish" +apply plugin: "signing" + +task androidJavadoc(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + android.libraryVariants.all { variant -> + if (variant.name == "release") { + owner.classpath += variant.javaCompileProvider.get().classpath + } + } + + exclude "**/R.html", "**/R.*.html", "**/index.html" + options.encoding "utf-8" + options { + addStringOption "docencoding", "utf-8" + addStringOption "charset", "utf-8" + links "https://docs.oracle.com/javase/7/docs/api/" + links "https://d.android.com/reference" + links "https://developer.android.com/reference/androidx/" + } +} + +task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { + archiveClassifier.set("javadoc") + from androidJavadoc.destinationDir + + preserveFileTimestamps = false + reproducibleFileOrder = true +} + +task javaSourcesJar(type: Jar) { + archiveClassifier.set("sources") + from android.sourceSets.main.java.srcDirs + + preserveFileTimestamps = false + reproducibleFileOrder = true +} + +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + + from components.release + +// artifact androidJavadocJar +// artifact javaSourcesJar + + groupId GROUP + version VERSION_NAME + pom { + name = artifactId + description = POM_DESCRIPTION + url = POM_URL + licenses { + license { + name = POM_LICENCE_NAME + url = POM_LICENCE_URL + } + } + scm { + connection = POM_SCM_CONNECTION + url = "https://github.com/iden3/android-rapidsnark" + } + developers { + developer { + id = POM_DEVELOPER_ID + name = POM_DEVELOPER_NAME + email = POM_DEVELOPER_EMAIL + } + } + } + } + } + repositories { + maven { + name = "SonatypeSnapshot" + +// def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" +// def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" +// url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl + url = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + + credentials { + username ossrhUsername + password ossrhPassword + } + } + + maven { + name = "sonatype" + +// def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" +// def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" +// url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl + url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + + credentials { + username ossrhUsername + password ossrhPassword + } + } + } + } +} + +signing { + sign publishing.publications +} \ No newline at end of file diff --git a/rapidsnark_android/build.gradle.kts b/rapidsnark_android/build.gradle.kts index 6a26d11..ba6e5a0 100644 --- a/rapidsnark_android/build.gradle.kts +++ b/rapidsnark_android/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("com.android.library") id("org.jetbrains.kotlin.android") + id("maven-publish") } android { @@ -53,6 +54,13 @@ android { version = "3.22.1" } } + + publishing { + singleVariant("release") { + withJavadocJar() + withSourcesJar() + } + } } dependencies { From 434d35a319ed0a67d7533ccb62985d4cbaa54b02 Mon Sep 17 00:00:00 2001 From: Yaroslav Moria <5eeman@users.noreply.github.com> Date: Sun, 16 Jun 2024 14:03:16 +0200 Subject: [PATCH 2/6] Refactored package name to io.iden3.rapidsnark. Clean up. --- .idea/gradle.xml | 2 +- app/build.gradle.kts | 2 +- .../rapidsnark_example/MainActivity.kt | 4 +++- gradle.properties | 8 ++++++-- {rapidsnark_android => rapidsnark}/.gitignore | 0 .../build.gradle.kts | 8 +++++--- .../consumer-rules.pro | 0 .../proguard-rules.pro | 0 .../publish-package.gradle | 0 .../src/jniLibs/arm64-v8a/librapidsnark.so | Bin .../src/jniLibs/prover.h | 0 .../src/jniLibs/verifier.h | 0 .../src/jniLibs/x86_64/librapidsnark.so | Bin .../src/main/AndroidManifest.xml | 0 .../src/main/cpp/CMakeLists.txt | 0 .../src/main/cpp/rapidsnark_module.cpp | 10 +++++----- .../src/main/cpp/rapidsnark_module.h | 10 +++++----- .../java/io}/iden3/rapidsnark/Rapidsnark.kt | Bin 7506 -> 7505 bytes settings.gradle.kts | 4 +++- 19 files changed, 29 insertions(+), 19 deletions(-) rename {rapidsnark_android => rapidsnark}/.gitignore (100%) rename {rapidsnark_android => rapidsnark}/build.gradle.kts (92%) rename {rapidsnark_android => rapidsnark}/consumer-rules.pro (100%) rename {rapidsnark_android => rapidsnark}/proguard-rules.pro (100%) rename publish-package.gradle => rapidsnark/publish-package.gradle (100%) rename {rapidsnark_android => rapidsnark}/src/jniLibs/arm64-v8a/librapidsnark.so (100%) rename {rapidsnark_android => rapidsnark}/src/jniLibs/prover.h (100%) rename {rapidsnark_android => rapidsnark}/src/jniLibs/verifier.h (100%) rename {rapidsnark_android => rapidsnark}/src/jniLibs/x86_64/librapidsnark.so (100%) rename {rapidsnark_android => rapidsnark}/src/main/AndroidManifest.xml (100%) rename {rapidsnark_android => rapidsnark}/src/main/cpp/CMakeLists.txt (100%) rename {rapidsnark_android => rapidsnark}/src/main/cpp/rapidsnark_module.cpp (94%) rename {rapidsnark_android => rapidsnark}/src/main/cpp/rapidsnark_module.h (72%) rename {rapidsnark_android/src/main/java/com => rapidsnark/src/main/java/io}/iden3/rapidsnark/Rapidsnark.kt (99%) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index b406d34..b74e89b 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -10,7 +10,7 @@