Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 59 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,53 +1,80 @@
apply plugin: "java"
plugins {
id 'java'
id 'maven-publish'
}

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

repositories {
mavenCentral()
}

dependencies {
// jpf-core
implementation files(jpf.Jar.getFullPath())

// JUnit 4
testImplementation 'junit:junit:4.12'
// JGroups (for example/Client.java, SimpleSender.java, SimpleReciever.java)
Comment thread
cyrille-artho marked this conversation as resolved.
implementation 'org.jgroups:jgroups:5.4.4.Final'

// bcel
implementation 'org.apache.bcel:bcel:6.5.0'
// Apache Commons Math3 (for example/CommonMath.java)
implementation 'org.apache.commons:commons-math3:3.6.1'

// jars used in the examples
implementation fileTree(dir: 'lib/example', include: ['*/*.jar'])
}
// Google Translate API (for example/GoogleTranslator.java)
implementation 'com.google.cloud:google-cloud-translate:2.6.0'

jar {
archiveBaseName = 'jpf-nhandler'
exclude('example/**')
destinationDirectory.set(file("${buildDir}"))
// BCEL (already present)
implementation 'org.apache.bcel:bcel:6.7.0'

// JUnit 5 for tests
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
}

test {
testLogging {
events "passed", "skipped", "failed"

sourceSets {
main {
java {
srcDirs = ['src/main/java']
exclude 'example/**'
}
}
test {
java {
srcDirs = ['src/test/java']
}
}
}

jvmArgs += ['--add-exports', 'java.base/jdk.internal.misc=ALL-UNNAMED','--add-opens', 'java.base/jdk.internal.misc=ALL-UNNAMED','--add-opens',
'java.base/java.lang=ALL-UNNAMED','--add-opens', 'java.base/java.util=ALL-UNNAMED','--add-opens', 'java.base/java.util.regex=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang.reflect=ALL-UNNAMED']

afterSuite { testDescriptor, result ->
if (!testDescriptor.parent) {
println "Test Execution: ${result.resultType}"
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.compilerArgs += [
'--add-exports', 'java.base/jdk.internal.misc=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-reads', 'java.base=ALL-UNNAMED'
]
}

def summaryFields = ["${result.testCount} tests",
"${result.successfulTestCount} passed",
"${result.failedTestCount} failed",
"${result.skippedTestCount} skipped"]
test {
useJUnitPlatform()
jvmArgs = [
'--add-exports', 'java.base/jdk.internal.misc=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'--add-opens', 'java.base/java.util=ALL-UNNAMED'
]
}

println ("Summary: " + summaryFields.join(", "))
}
jar {
archiveBaseName = 'jpf-nhandler'
manifest {
attributes(
'Implementation-Title': 'JPF Native Method Handler',
'Implementation-Version': '1.0'
)
}
exclude('example/**')
}

defaultTasks "jar"
defaultTasks 'clean', 'build'