Skip to content
Merged
Show file tree
Hide file tree
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
75 changes: 56 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,71 +90,108 @@ subprojects {
'-Ywarn-adapted-args'
]

tasks.withType(ScalaCompile) {
tasks.withType(ScalaCompile).configureEach {
options.encoding = 'UTF-8'
scalaCompileOptions.additionalParameters = scalacParameters
}

tasks.withType(ScalaDoc) {
tasks.withType(ScalaDoc).configureEach {
scalaDocOptions.additionalParameters = scalacParameters
}

task sourceJar(type: Jar) {
tasks.register('sourceJar', Jar) {
archiveClassifier = 'sources'
from(sourceSets.main.allSource)
}

task docJar(type: Jar) {
tasks.register('docJar', Jar) {
dependsOn tasks.scaladoc
archiveClassifier = 'javadoc'
from(tasks.scaladoc.destinationDir)
}

task testJar(type: Jar) {
tasks.register('testJar', Jar) {
archiveClassifier = 'tests'
from(sourceSets.test.output)
}

tasks.withType(Jar) {
tasks.withType(Jar).configureEach {
from(tasks.generateLicensesFiles) {
into("META-INF/")
}
}

task licenseFile {
tasks.register('licenseFile') {
outputs.file(project.parent.file('LICENSE.txt'))
}

task dependencySearch(type: DependencyInsightReportTask) {
tasks.register('dependencySearch', DependencyInsightReportTask) {
description = 'Searches all projects for a dependency'
group = 'help'
}

task runApp {
// TODO: it looks like this is only used for `:morpheus-examples` - we don't need it for all sub-projects 🤔
// see: README.md:163
tasks.register('runApp', JavaExec) {
dependsOn tasks.classes
group = 'run'
description = 'Run a custom Scala app (use -PmainClass=com.my.package.App)'
doLast {
javaexec {
classpath = sourceSets.main.runtimeClasspath
main = project.getProperty("mainClass")
}
}

classpath = sourceSets.main.runtimeClasspath
mainClass = project.getProperty("mainClass")
}

tasks.named('runApp').configure {
jvmArgs = [
'-Xmx2g',
'-Dconfig.file=app.conf',
'-XX:+IgnoreUnrecognizedVMOptions',
'--add-exports=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-opens=java.base/java.lang.invoke=ALL-UNNAMED',
'--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.lang.invoke=ALL-UNNAMED',
'--add-opens=java.base/java.lang.reflect=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/java.net=ALL-UNNAMED',
'--add-opens=java.base/java.nio=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED',
'--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.cs=ALL-UNNAMED',
'--add-opens=java.base/sun.security.action=ALL-UNNAMED',
'--add-opens=java.base/sun.util.calendar=ALL-UNNAMED',
'--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED',
'-Djdk.reflect.useDirectMethodHandle=false'
]
}

// copied from https://stackoverflow.com/a/38058671/568723
task depSize {
tasks.register('depSize') {
description = 'Lists all dependencies sorted by their size'

doFirst {
configurations {
resolvableDefault {
extendsFrom configurations.default
canBeResolved = true
canBeConsumed = false
description = 'Resolvable default configuration.'
}
}
}

doLast {
final formatStr = "%,10.2f"
final conf = configurations.default
final conf = configurations.resolvableDefault
final size = conf.collect { it.length() / (1024 * 1024) }.sum()
final out = new StringBuffer()
out << 'Total dependencies size:'.padRight(45)
out << 'Total dependencies size:'.padRight(65)
out << "${String.format(formatStr, size)} Mb\n\n"
conf.sort { -it.length() }
.each {
out << "${it.name}".padRight(45)
out << "${it.name}".padRight(65)
out << "${String.format(formatStr, (it.length() / 1024))} kb\n"
}
println(out)
Expand Down
4 changes: 2 additions & 2 deletions build.publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ subprojects {

if (project.name != "okapi-shade") {
// Convenience for quick publish to maven local
task devPublish {
tasks.register('devPublish') {
group = 'publishing'
description = 'Publishes main jars to the local Maven repository.'
dependsOn tasks.publishDevPublicationToMavenLocal
}
}

// Task run by teamcity
task ci {
tasks.register('ci') {
dependsOn tasks.check
dependsOn { tasks.publishFullPublicationToBuildDirRepository }
}
Expand Down
6 changes: 3 additions & 3 deletions documentation/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
group = "${group}.documentation"

task asciidocJar(type: Jar) {
tasks.register('asciidocJar', Jar) {
group = 'documentation'
description = 'Package asciidoc source files.'
archiveClassifier = 'asciidoc'
from("asciidoc")
}

task aggregatedScalaDoc(type: ScalaDoc) {
tasks.register('aggregatedScalaDoc', ScalaDoc) {
ext.fromProjects = [
project(':okapi-api'),
project(':morpheus-spark-cypher'),
Expand All @@ -25,7 +25,7 @@ task aggregatedScalaDoc(type: ScalaDoc) {
scalaDocOptions.additionalParameters = scalacParameters
}

task aggregatedScalaDocJar(type: Jar) {
tasks.register('aggregatedScalaDocJar', Jar) {
archiveClassifier = 'javadoc'
from tasks.aggregatedScalaDoc
}
Expand Down
16 changes: 7 additions & 9 deletions morpheus-tck/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ dependencies {
}

// split scenario name / key-words with | --> debugTCKScenarios -Pscenarios = 'sc1|sc2|..'
task debugTCKScenarios() {
tasks.register('debugTCKScenarios', JavaExec) {
description = 'Generates scala-test from TCK scenarios (keywords of the scenario names suffice)'
group = 'generator'
dependsOn sourceSets.generator.runtimeClasspath

def outPath = project.findProperty('outDir') ?: 'src/test/scala/org/opencypher/morpheus/testing/'
def resDir = project.findProperty('resDir') ?: 'src/test/resources/'
def scenarios = project.findProperty('scenarios') ?: ''
dependsOn sourceSets.generator.runtimeClasspath
doLast {
javaexec {
classpath = sourceSets.generator.runtimeClasspath
main = 'org.opencypher.morpheus.testing.MorpheusTestGenerator'
args = [outPath,resDir,scenarios]
}
}

mainClass = 'org.opencypher.morpheus.testing.MorpheusTestGenerator'
classpath = sourceSets.generator.runtimeClasspath
args = [outPath, resDir, scenarios]
}