Skip to content

Commit

Permalink
Merge pull request #352 from scenerygraphics/gradle
Browse files Browse the repository at this point in the history
Gradle
  • Loading branch information
kephale authored Apr 5, 2021
2 parents 92add67 + e080a4d commit c15f56b
Show file tree
Hide file tree
Showing 73 changed files with 970 additions and 190 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: build

on: [ push ]

jobs:
linux:
name: 'Linux'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# - name: Build with Gradle
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
- uses: burrunan/gradle-cache-action@v1
name: Build scenery
with:
arguments: build -x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
# - name: Cleanup Gradle Cache
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
# run: |
# rm -f ~/.gradle/caches/modules-2/modules-2.lock
# rm -f ~/.gradle/caches/modules-2/gc.properties

windows:
name: 'Windows'
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 11
# - name: Build with Gradle
# run: .\gradlew.bat build -x dokkaHtml -x dokkaHtmlJar
- uses: burrunan/gradle-cache-action@v1
name: Build scenery
with:
arguments: build -x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
# - name: Cleanup Gradle Cache
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
# run: |
# rm -f ~/.gradle/caches/modules-2/modules-2.lock
# rm -f ~/.gradle/caches/modules-2/gc.properties

mac:
name: 'Mac OS'
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# - name: Build with Gradle
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
- uses: burrunan/gradle-cache-action@v1
name: Build scenery
with:
arguments: build -x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
# - name: Cleanup Gradle Cache
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
# run: |
# rm -f ~/.gradle/caches/modules-2/modules-2.lock
# rm -f ~/.gradle/caches/modules-2/gc.properties
10 changes: 5 additions & 5 deletions .travis/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def package_conda():

subprocess.check_call(['mv', 'dist/sciview', exe_name])

package_conda()
#package_conda()

# Update sites
print('')
Expand All @@ -84,8 +84,8 @@ def package_conda():
## - release

# TODO: check branch == <pom-release-version>
if ( not is_PR and travis_secure and release_properties_exists ) or \
( '[SV_IJ_DEPLOY_PRIMARY]' in commit_message ):
print('Upload to SciView')
subprocess.check_call(['sh', 'sciview_deploy.sh'])
# if ( not is_PR and travis_secure and release_properties_exists ) or \
# ( '[SV_IJ_DEPLOY_PRIMARY]' in commit_message ):
# print('Upload to SciView')
# subprocess.check_call(['sh', 'sciview_deploy.sh'])

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![Build Status](https://github.com/scenerygraphics/sciView/workflows/build/badge.svg)](https://github.com/scenerygraphics/sciView/actions?workflow=build)
[![Image.sc forum](https://img.shields.io/badge/dynamic/json.svg?label=forum&url=https%3A%2F%2Fforum.image.sc%2Ftags%2Fsciview.json&query=%24.topic_list.tags.0.topic_count&colorB=brightgreen&suffix=%20topics&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABPklEQVR42m3SyyqFURTA8Y2BER0TDyExZ+aSPIKUlPIITFzKeQWXwhBlQrmFgUzMMFLKZeguBu5y+//17dP3nc5vuPdee6299gohUYYaDGOyyACq4JmQVoFujOMR77hNfOAGM+hBOQqB9TjHD36xhAa04RCuuXeKOvwHVWIKL9jCK2bRiV284QgL8MwEjAneeo9VNOEaBhzALGtoRy02cIcWhE34jj5YxgW+E5Z4iTPkMYpPLCNY3hdOYEfNbKYdmNngZ1jyEzw7h7AIb3fRTQ95OAZ6yQpGYHMMtOTgouktYwxuXsHgWLLl+4x++Kx1FJrjLTagA77bTPvYgw1rRqY56e+w7GNYsqX6JfPwi7aR+Y5SA+BXtKIRfkfJAYgj14tpOF6+I46c4/cAM3UhM3JxyKsxiOIhH0IO6SH/A1Kb1WBeUjbkAAAAAElFTkSuQmCC)](https://forum.image.sc/tags/sciview)
[![](https://travis-ci.org/scenerygraphics/sciview.svg?branch=master)](https://travis-ci.org/scenerygraphics/sciview)
[![Join the chat at https://gitter.im/scenerygraphics/SciView](https://badges.gitter.im/scenerygraphics/SciView.svg)](https://gitter.im/scenerygraphics/SciView?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Expand Down
221 changes: 221 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
import org.gradle.kotlin.dsl.implementation
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import sciJava.*
import java.net.URL

plugins {
val ktVersion = "1.4.20"
java
kotlin("jvm") version ktVersion
kotlin("kapt") version ktVersion
sciview.publish
sciview.sign
id("com.github.elect86.sciJava") version "0.0.4"
id("org.jetbrains.dokka") version ktVersion
jacoco
idea
}

repositories {
mavenCentral()
jcenter()
maven("https://jitpack.io")
maven("https://maven.scijava.org/content/groups/public")
}

val sceneryVersion = "4a0c1f7"
// here we set some versions
//"scijava-common"("2.84.0")
"ui-behaviour"("2.0.3")
"imagej-mesh"("0.8.1")
"bigdataviewer-vistools"("1.0.0-beta-21")
"bigvolumeviewer"("0.1.8") // added from Gradle conversion

"kotlin"("1.4.20")
"kotlinx-coroutines-core"("1.3.9")

dependencies {

// Graphics dependencies

val sciJavaCommon = "org.scijava:scijava-common:${versions["scijava-common"]}"
annotationProcessor(sciJavaCommon)
kapt(sciJavaCommon)

// api("graphics.scenery:scenery:$sceneryVersion")
api("com.github.scenerygraphics:scenery:$sceneryVersion")

sciJava("net.clearvolume:cleargl")
sciJava("net.clearcontrol:coremem")
sciJava("org.jogamp.jogl:jogl-all", native = joglNative)

implementation("com.formdev:flatlaf:0.38")

// SciJava dependencies

sciJava("org.scijava"["scijava-common", "ui-behaviour", "script-editor", "scijava-ui-swing",
"scijava-ui-awt", "scijava-search", "scripting-jython"])
implementation("org.scijava:scijava-common:2.83.0") {
version { strictly("2.83.3") }
}
sciJava("com.miglayout:miglayout-swing")

// ImageJ dependencies

sciJava("net.imagej") {
exclude("org.scijava", "scripting-renjin")
exclude("org.scijava", "scripting-jruby")
}

sciJava("net.imagej:imagej-"["common", "mesh", "mesh-io", "ops", "launcher", "ui-swing", "legacy"])
sciJava("io.scif:scifio"["", "-bf-compat"])

// ImgLib2 dependencies

sciJava("net.imglib2:imglib2"["-roi", ""])

// Math dependencies

sciJava("org.apache.commons:commons-math3")
sciJava("org.joml")

// Kotlin dependencies

sciJava("org.jetbrains.kotlinx:kotlinx-coroutines-core")

// Optional dependencies - for sc.iview.Main only! -->
// <dependency>
// <groupId>org.scijava</groupId>
// <artifactId>scijava-plugins-commands</artifactId>
// <scope>runtime</scope>
// <optional>true</optional>
// </dependency>
// <dependency>
// <groupId>net.imagej</groupId>
// <artifactId>imagej-plugins-commands</artifactId>
// <scope>runtime</scope>
// <optional>true</optional>
// </dependency>
// <dependency>
// <groupId>ch.qos.logback</groupId>
// <artifactId>logback-classic</artifactId>
// </dependency>

// Test scope

testSciJava("junit")
sciJava("net.imagej:ij", test = false)
sciJava("net.imglib2:imglib2-ij", test = false)


sciJava("org.janelia.saalfeldlab:n5"["", "-hdf5", "-imglib2"])
sciJava("sc.fiji:spim_data")

implementation(platform(kotlin("bom")))
implementation(kotlin("stdlib-jdk8"))
testImplementation(kotlin("test-junit"))

sciJava("sc.fiji"["bigdataviewer-core", "bigdataviewer-vistools", "bigvolumeviewer"])

// this apparently is still necessary
implementation(platform("org.lwjgl:lwjgl-bom:3.2.3"))
val os = getCurrentOperatingSystem()
val lwjglNatives = "natives-" + when {
os.isWindows -> "windows"
os.isLinux -> "linux"
os.isMacOsX -> "macos"
else -> error("invalid")
}
listOf("", "-glfw", "-jemalloc", "-vulkan", "-opengl", "-openvr", "-xxhash", "-remotery").forEach {
implementation("org.lwjgl:lwjgl$it")
if (it != "-vulkan")
runtimeOnly("org.lwjgl", "lwjgl$it", classifier = lwjglNatives)
}

sciJava("graphics.scenery:spirvcrossj:0.7.0-1.1.106.0")
runtimeOnly("graphics.scenery", "spirvcrossj", "0.7.0-1.1.106.0", classifier = lwjglNatives)

sciJava("net.java.jinput:jinput:2.0.9", native = "natives-all")
}

kapt {
useBuildCache = false // safe
arguments {
arg("-Werror")
arg("-Xopt-in", "kotlin.RequiresOptIn")
}
}

tasks {
withType<KotlinCompile>().all {
val version = System.getProperty("java.version").substringBefore('.').toInt()
val default = if (version == 1) "1.8" else "$version"
kotlinOptions {
jvmTarget = project.properties["jvmTarget"]?.toString() ?: default
freeCompilerArgs += listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn")
}
sourceCompatibility = project.properties["sourceCompatibility"]?.toString() ?: default
}
// https://docs.gradle.org/current/userguide/java_testing.html#test_filtering
test {
finalizedBy(jacocoTestReport) // report is always generated after tests run
}
jar {
archiveVersion.set(rootProject.version.toString())
}

dokkaHtml {
enabled = false
dokkaSourceSets.configureEach {
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("https://github.com/scenerygraphics/sciview/tree/master/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
}
}

dokkaJavadoc {
enabled = false
}

jacocoTestReport {
reports {
xml.isEnabled = true
html.apply {
isEnabled = false
// destination = file("$buildDir/jacocoHtml")
}
}
dependsOn(test) // tests are required to run before generating the report
}
register("runApp", JavaExec::class.java) {
classpath = sourceSets.main.get().runtimeClasspath

main = "sc.iview.commands.demo.basic.MeshDemo"

// arguments to pass to the application
// args 'appArg1'
}
}

val dokkaJavadocJar by tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.get().outputDirectory.get())
archiveClassifier.set("javadoc")
}

val dokkaHtmlJar by tasks.register<Jar>("dokkaHtmlJar") {
dependsOn(tasks.dokkaHtml)
from(tasks.dokkaHtml.get().outputDirectory.get())
archiveClassifier.set("html-doc")
}


artifacts {
archives(dokkaJavadocJar)
archives(dokkaHtmlJar)
}

java.withSourcesJar()
8 changes: 8 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
jcenter() // or maven(url="https://dl.bintray.com/kotlin/dokka")
}
Loading

0 comments on commit c15f56b

Please sign in to comment.