11plugins {
22 id ' java'
3+ id ' java-library'
34 id ' jacoco'
45 id ' application'
6+ id ' maven-publish'
7+ id ' signing'
58}
69
710group ' io.github.andrewquijano'
@@ -17,17 +20,26 @@ java {
1720}
1821
1922dependencies {
20- implementation ' junit:junit:4.13.2'
21- testImplementation ' org.junit.jupiter:junit-jupiter-api:5.11.0-M2'
22- testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.11.0-M2'
23+ testImplementation ' junit:junit:4.13.2'
2324
24- implementation ' io.github.andrewquijano:ciphercraft:1.0.3 '
25+ implementation ' io.github.andrewquijano:ciphercraft:1.0.6 '
2526 // https://mvnrepository.com/artifact/commons-io/commons-io
2627 implementation ' commons-io:commons-io:2.16.1'
2728 // https://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-dev
2829 implementation ' nz.ac.waikato.cms.weka:weka-dev:3.9.6'
29- implementation ' org.apache.logging.log4j:log4j-core:3.0.0-beta1'
30- implementation fileTree(dir : ' libs' , include : [' *.jar' ])
30+ // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
31+ implementation ' org.apache.logging.log4j:log4j-core:2.24.3'
32+ }
33+
34+ // To create the JAR file with 'gradlew jar'
35+ tasks. named(' jar' ) {
36+ archiveFileName = " ${ project.name} -${ project.version} .jar"
37+ manifest {
38+ attributes(
39+ ' Implementation-Title' : project. name,
40+ ' Implementation-Version' : System . getenv(' VERSION' ) ?: project. version
41+ )
42+ }
3143}
3244
3345// Commenting because it doesn't work well on TravisCI
@@ -89,3 +101,84 @@ check.dependsOn jacocoTestReport
89101application {
90102 mainClass. set(project. findProperty(" chooseRole" ). toString())
91103}
104+
105+ tasks. register(' generateJavadoc' , Javadoc ) {
106+ source = sourceSets. main. allJava
107+ classpath = sourceSets. main. compileClasspath
108+ options. encoding = ' UTF-8'
109+ options. memberLevel = JavadocMemberLevel . PUBLIC
110+ options. addStringOption(' Xdoclint:none' , ' -quiet' )
111+ options. docTitle = ' Level-Site Privacy-Preserving Decision Tree'
112+ }
113+
114+ // This is for publishing the library to Maven Central
115+ publishing {
116+ publications {
117+ register(" mavenJava" , MavenPublication ) {
118+ from components. java
119+
120+ pom {
121+ name. set(' level-site-ppdt' )
122+ description. set(' This JAR file is used for implementing the Level-Site Privacy-Preserving Decision Trees (PPDT). ' +
123+ ' See the paper "Enhanced Outsourced and Secure Inference for Tall Sparse Decision Trees" which describes the implementation and ' +
124+ ' performance gains this approach has in avoiding the conversion to a complete binary tree as in the Joye and Salehi paper.' )
125+ url. set(' https://github.com/adwise-fiu/Level-Site-PPDT' )
126+
127+ licenses {
128+ license {
129+ name. set(' MIT License' )
130+ url. set(' https://opensource.org/licenses/MIT' )
131+ }
132+ }
133+
134+ developers {
135+ developer {
136+ id. set(' AndrewQuijano' )
137+ name. set(' Andrew Quijano' )
138+ email. set(' andrew.quijano@nyu.edu' )
139+ }
140+ }
141+
142+ scm {
143+ connection. set(' scm:git:git://github.com/adwise-fiu/Level-Site-PPDT.git' )
144+ developerConnection. set(' scm:git:ssh://github.com:adwise-fiu/Level-Site-PPDT.git' )
145+ url. set(' https://github.com/adwise-fiu/Level-Site-PPDT' )
146+ }
147+ }
148+ }
149+ }
150+ }
151+
152+ // Update this file, ~/.gnupg/dirmngr.conf
153+ // and add this line to the file 'keyserver hkps://keyserver.ubuntu.com'
154+ // then run 'gpg --send-keys YOUR_KEY_ID'
155+ signing {
156+ // Point to the key file on your machine, used for local testing
157+ def signingKeyFile = findProperty(" signingKeyFile" ) ?: System . getenv(" SIGNING_KEY_FILE" )
158+ // gpg --armor --export-secret-keys YOUR_KEY_ID, export the key into a secret
159+ def signingKey = findProperty(" signingKey" ) ?: System . getenv(" SIGNING_KEY" ) ?: " "
160+ // If no property or environment variable is found, it will be empty password
161+ def signingPassword = findProperty(" signingPassword" ) ?: System . getenv(" SIGNING_PASSWORD" ) ?: " "
162+
163+ if (signingKeyFile) {
164+ println (" Reading signing key from file: $signingKeyFile " )
165+ def signingKey_content = new File (signingKeyFile. toString()). text
166+ useInMemoryPgpKeys(signingKey_content. toString(), signingPassword. toString())
167+ publishing. publications. named(" mavenJava" ). configure { publication ->
168+ signing. sign(publication)
169+ }
170+ }
171+ else {
172+ println (" No signing key file found, will attempt to use in-memory key" )
173+ if (signingKey) {
174+ println (" Using in-memory signing key" )
175+ useInMemoryPgpKeys(signingKey. toString(), signingPassword?. toString())
176+ publishing. publications. named(" mavenJava" ). configure { publication ->
177+ signing. sign(publication)
178+ }
179+ }
180+ else {
181+ println (" No signing key found. Skipping signing." )
182+ }
183+ }
184+ }
0 commit comments