Skip to content

Commit c15f56b

Browse files
authored
Merge pull request #352 from scenerygraphics/gradle
Gradle
2 parents 92add67 + e080a4d commit c15f56b

File tree

73 files changed

+970
-190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+970
-190
lines changed

.github/workflows/build.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: build
2+
3+
on: [ push ]
4+
5+
jobs:
6+
linux:
7+
name: 'Linux'
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: gradle/wrapper-validation-action@v1
13+
- name: Set up JDK 1.11
14+
uses: actions/setup-java@v1
15+
with:
16+
java-version: 11
17+
- name: Grant execute permission for gradlew
18+
run: chmod +x gradlew
19+
# - name: Build with Gradle
20+
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
21+
- uses: burrunan/gradle-cache-action@v1
22+
name: Build scenery
23+
with:
24+
arguments: build -x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
25+
# - name: Cleanup Gradle Cache
26+
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
27+
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
28+
# run: |
29+
# rm -f ~/.gradle/caches/modules-2/modules-2.lock
30+
# rm -f ~/.gradle/caches/modules-2/gc.properties
31+
32+
windows:
33+
name: 'Windows'
34+
runs-on: windows-latest
35+
36+
steps:
37+
- uses: actions/checkout@v2
38+
- uses: gradle/wrapper-validation-action@v1
39+
- name: Set up JDK 1.11
40+
uses: actions/setup-java@v1
41+
with:
42+
java-version: 11
43+
# - name: Build with Gradle
44+
# run: .\gradlew.bat build -x dokkaHtml -x dokkaHtmlJar
45+
- uses: burrunan/gradle-cache-action@v1
46+
name: Build scenery
47+
with:
48+
arguments: build -x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
49+
# - name: Cleanup Gradle Cache
50+
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
51+
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
52+
# run: |
53+
# rm -f ~/.gradle/caches/modules-2/modules-2.lock
54+
# rm -f ~/.gradle/caches/modules-2/gc.properties
55+
56+
mac:
57+
name: 'Mac OS'
58+
runs-on: macos-latest
59+
60+
steps:
61+
- uses: actions/checkout@v2
62+
- uses: gradle/wrapper-validation-action@v1
63+
- name: Set up JDK 1.11
64+
uses: actions/setup-java@v1
65+
with:
66+
java-version: 11
67+
- name: Grant execute permission for gradlew
68+
run: chmod +x gradlew
69+
# - name: Build with Gradle
70+
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
71+
- uses: burrunan/gradle-cache-action@v1
72+
name: Build scenery
73+
with:
74+
arguments: build -x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
75+
# - name: Cleanup Gradle Cache
76+
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
77+
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
78+
# run: |
79+
# rm -f ~/.gradle/caches/modules-2/modules-2.lock
80+
# rm -f ~/.gradle/caches/modules-2/gc.properties

.travis/ci.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def package_conda():
5858

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

61-
package_conda()
61+
#package_conda()
6262

6363
# Update sites
6464
print('')
@@ -84,8 +84,8 @@ def package_conda():
8484
## - release
8585

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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[![Build Status](https://github.com/scenerygraphics/sciView/workflows/build/badge.svg)](https://github.com/scenerygraphics/sciView/actions?workflow=build)
12
[![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)
23
[![](https://travis-ci.org/scenerygraphics/sciview.svg?branch=master)](https://travis-ci.org/scenerygraphics/sciview)
34
[![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)

build.gradle.kts

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
import org.gradle.kotlin.dsl.implementation
2+
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.*
3+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
4+
import sciJava.*
5+
import java.net.URL
6+
7+
plugins {
8+
val ktVersion = "1.4.20"
9+
java
10+
kotlin("jvm") version ktVersion
11+
kotlin("kapt") version ktVersion
12+
sciview.publish
13+
sciview.sign
14+
id("com.github.elect86.sciJava") version "0.0.4"
15+
id("org.jetbrains.dokka") version ktVersion
16+
jacoco
17+
idea
18+
}
19+
20+
repositories {
21+
mavenCentral()
22+
jcenter()
23+
maven("https://jitpack.io")
24+
maven("https://maven.scijava.org/content/groups/public")
25+
}
26+
27+
val sceneryVersion = "4a0c1f7"
28+
// here we set some versions
29+
//"scijava-common"("2.84.0")
30+
"ui-behaviour"("2.0.3")
31+
"imagej-mesh"("0.8.1")
32+
"bigdataviewer-vistools"("1.0.0-beta-21")
33+
"bigvolumeviewer"("0.1.8") // added from Gradle conversion
34+
35+
"kotlin"("1.4.20")
36+
"kotlinx-coroutines-core"("1.3.9")
37+
38+
dependencies {
39+
40+
// Graphics dependencies
41+
42+
val sciJavaCommon = "org.scijava:scijava-common:${versions["scijava-common"]}"
43+
annotationProcessor(sciJavaCommon)
44+
kapt(sciJavaCommon)
45+
46+
// api("graphics.scenery:scenery:$sceneryVersion")
47+
api("com.github.scenerygraphics:scenery:$sceneryVersion")
48+
49+
sciJava("net.clearvolume:cleargl")
50+
sciJava("net.clearcontrol:coremem")
51+
sciJava("org.jogamp.jogl:jogl-all", native = joglNative)
52+
53+
implementation("com.formdev:flatlaf:0.38")
54+
55+
// SciJava dependencies
56+
57+
sciJava("org.scijava"["scijava-common", "ui-behaviour", "script-editor", "scijava-ui-swing",
58+
"scijava-ui-awt", "scijava-search", "scripting-jython"])
59+
implementation("org.scijava:scijava-common:2.83.0") {
60+
version { strictly("2.83.3") }
61+
}
62+
sciJava("com.miglayout:miglayout-swing")
63+
64+
// ImageJ dependencies
65+
66+
sciJava("net.imagej") {
67+
exclude("org.scijava", "scripting-renjin")
68+
exclude("org.scijava", "scripting-jruby")
69+
}
70+
71+
sciJava("net.imagej:imagej-"["common", "mesh", "mesh-io", "ops", "launcher", "ui-swing", "legacy"])
72+
sciJava("io.scif:scifio"["", "-bf-compat"])
73+
74+
// ImgLib2 dependencies
75+
76+
sciJava("net.imglib2:imglib2"["-roi", ""])
77+
78+
// Math dependencies
79+
80+
sciJava("org.apache.commons:commons-math3")
81+
sciJava("org.joml")
82+
83+
// Kotlin dependencies
84+
85+
sciJava("org.jetbrains.kotlinx:kotlinx-coroutines-core")
86+
87+
// Optional dependencies - for sc.iview.Main only! -->
88+
// <dependency>
89+
// <groupId>org.scijava</groupId>
90+
// <artifactId>scijava-plugins-commands</artifactId>
91+
// <scope>runtime</scope>
92+
// <optional>true</optional>
93+
// </dependency>
94+
// <dependency>
95+
// <groupId>net.imagej</groupId>
96+
// <artifactId>imagej-plugins-commands</artifactId>
97+
// <scope>runtime</scope>
98+
// <optional>true</optional>
99+
// </dependency>
100+
// <dependency>
101+
// <groupId>ch.qos.logback</groupId>
102+
// <artifactId>logback-classic</artifactId>
103+
// </dependency>
104+
105+
// Test scope
106+
107+
testSciJava("junit")
108+
sciJava("net.imagej:ij", test = false)
109+
sciJava("net.imglib2:imglib2-ij", test = false)
110+
111+
112+
sciJava("org.janelia.saalfeldlab:n5"["", "-hdf5", "-imglib2"])
113+
sciJava("sc.fiji:spim_data")
114+
115+
implementation(platform(kotlin("bom")))
116+
implementation(kotlin("stdlib-jdk8"))
117+
testImplementation(kotlin("test-junit"))
118+
119+
sciJava("sc.fiji"["bigdataviewer-core", "bigdataviewer-vistools", "bigvolumeviewer"])
120+
121+
// this apparently is still necessary
122+
implementation(platform("org.lwjgl:lwjgl-bom:3.2.3"))
123+
val os = getCurrentOperatingSystem()
124+
val lwjglNatives = "natives-" + when {
125+
os.isWindows -> "windows"
126+
os.isLinux -> "linux"
127+
os.isMacOsX -> "macos"
128+
else -> error("invalid")
129+
}
130+
listOf("", "-glfw", "-jemalloc", "-vulkan", "-opengl", "-openvr", "-xxhash", "-remotery").forEach {
131+
implementation("org.lwjgl:lwjgl$it")
132+
if (it != "-vulkan")
133+
runtimeOnly("org.lwjgl", "lwjgl$it", classifier = lwjglNatives)
134+
}
135+
136+
sciJava("graphics.scenery:spirvcrossj:0.7.0-1.1.106.0")
137+
runtimeOnly("graphics.scenery", "spirvcrossj", "0.7.0-1.1.106.0", classifier = lwjglNatives)
138+
139+
sciJava("net.java.jinput:jinput:2.0.9", native = "natives-all")
140+
}
141+
142+
kapt {
143+
useBuildCache = false // safe
144+
arguments {
145+
arg("-Werror")
146+
arg("-Xopt-in", "kotlin.RequiresOptIn")
147+
}
148+
}
149+
150+
tasks {
151+
withType<KotlinCompile>().all {
152+
val version = System.getProperty("java.version").substringBefore('.').toInt()
153+
val default = if (version == 1) "1.8" else "$version"
154+
kotlinOptions {
155+
jvmTarget = project.properties["jvmTarget"]?.toString() ?: default
156+
freeCompilerArgs += listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn")
157+
}
158+
sourceCompatibility = project.properties["sourceCompatibility"]?.toString() ?: default
159+
}
160+
// https://docs.gradle.org/current/userguide/java_testing.html#test_filtering
161+
test {
162+
finalizedBy(jacocoTestReport) // report is always generated after tests run
163+
}
164+
jar {
165+
archiveVersion.set(rootProject.version.toString())
166+
}
167+
168+
dokkaHtml {
169+
enabled = false
170+
dokkaSourceSets.configureEach {
171+
sourceLink {
172+
localDirectory.set(file("src/main/kotlin"))
173+
remoteUrl.set(URL("https://github.com/scenerygraphics/sciview/tree/master/src/main/kotlin"))
174+
remoteLineSuffix.set("#L")
175+
}
176+
}
177+
}
178+
179+
dokkaJavadoc {
180+
enabled = false
181+
}
182+
183+
jacocoTestReport {
184+
reports {
185+
xml.isEnabled = true
186+
html.apply {
187+
isEnabled = false
188+
// destination = file("$buildDir/jacocoHtml")
189+
}
190+
}
191+
dependsOn(test) // tests are required to run before generating the report
192+
}
193+
register("runApp", JavaExec::class.java) {
194+
classpath = sourceSets.main.get().runtimeClasspath
195+
196+
main = "sc.iview.commands.demo.basic.MeshDemo"
197+
198+
// arguments to pass to the application
199+
// args 'appArg1'
200+
}
201+
}
202+
203+
val dokkaJavadocJar by tasks.register<Jar>("dokkaJavadocJar") {
204+
dependsOn(tasks.dokkaJavadoc)
205+
from(tasks.dokkaJavadoc.get().outputDirectory.get())
206+
archiveClassifier.set("javadoc")
207+
}
208+
209+
val dokkaHtmlJar by tasks.register<Jar>("dokkaHtmlJar") {
210+
dependsOn(tasks.dokkaHtml)
211+
from(tasks.dokkaHtml.get().outputDirectory.get())
212+
archiveClassifier.set("html-doc")
213+
}
214+
215+
216+
artifacts {
217+
archives(dokkaJavadocJar)
218+
archives(dokkaHtmlJar)
219+
}
220+
221+
java.withSourcesJar()

buildSrc/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
jcenter() // or maven(url="https://dl.bintray.com/kotlin/dokka")
8+
}

0 commit comments

Comments
 (0)