forked from JFormDesigner/markdown-writer-fx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
147 lines (124 loc) · 5.66 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry
import org.gradle.plugins.ide.eclipse.model.AccessRule
version = "0.12"
// check required Java version
if( JavaVersion.current() < JavaVersion.VERSION_1_8 || JavaVersion.current() > JavaVersion.VERSION_11 )
throw RuntimeException( "Java 8, 9, 10 or 11 required (running ${System.getProperty( "java.version" )})" )
// use Java version that currently runs Gradle for source/target compatibility
val javaCompatibility = JavaVersion.current()
// log version, Gradle and Java versions
println()
println( "-------------------------------------------------------------------------------" )
println( "Markdown Writer FX Version: ${version}" )
println( "Gradle ${gradle.gradleVersion} at ${gradle.gradleHomeDir}" )
println( "Java ${System.getProperty( "java.version" )}" )
println()
plugins {
java
application
eclipse
}
repositories {
jcenter()
}
dependencies {
// build RichTextFX from branch 'markdown-writer-fx' on https://github.com/JFormDesigner/RichTextFX
compile( "org.fxmisc.richtext:richtextfx" ) {
version {
branch = "markdown-writer-fx"
}
}
compile( "com.miglayout:miglayout-javafx:5.2" )
val fontawesomefxVersion = if( javaCompatibility >= JavaVersion.VERSION_1_9 ) "4.7.0-9.1.2" else "4.7.0-5"
val controlsfxVersion = if( javaCompatibility >= JavaVersion.VERSION_1_9 ) "9.0.0" else "8.40.14"
compile( "de.jensd:fontawesomefx-fontawesome:${fontawesomefxVersion}" )
if( javaCompatibility == JavaVersion.VERSION_1_8 ) {
// required since Gradle 5.0 because fontawesomefx-fontawesome-4.7.0-5.pom uses
// scope "runtime" for its "fontawesomefx-commons" dependency
// (fontawesomefx-fontawesome-4.7.0-9.pom uses scope "compile")
// https://docs.gradle.org/5.0/userguide/upgrading_version_4.html#rel5.0:pom_compile_runtime_separation
compile( "de.jensd:fontawesomefx-commons:8.15" )
}
compile( "org.controlsfx:controlsfx:${controlsfxVersion}" )
compile( "org.fxmisc.cssfx:cssfx:1.0.0" )
compile( "org.apache.commons:commons-lang3:3.8.1" )
compile( "com.esotericsoftware.yamlbeans:yamlbeans:1.13" )
val flexmarkVersion = "0.35.0"
compile( "com.vladsch.flexmark:flexmark:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-abbreviation:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-anchorlink:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-aside:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-autolink:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-definition:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-footnotes:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-gfm-tasklist:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-tables:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-toc:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-wikilink:${flexmarkVersion}" )
compile( "com.vladsch.flexmark:flexmark-ext-yaml-front-matter:${flexmarkVersion}" )
val commonmarkVersion = "0.12.1"
compile( "com.atlassian.commonmark:commonmark:${commonmarkVersion}" )
compile( "com.atlassian.commonmark:commonmark-ext-autolink:${commonmarkVersion}" )
compile( "com.atlassian.commonmark:commonmark-ext-gfm-strikethrough:${commonmarkVersion}" )
compile( "com.atlassian.commonmark:commonmark-ext-gfm-tables:${commonmarkVersion}" )
compile( "com.atlassian.commonmark:commonmark-ext-heading-anchor:${commonmarkVersion}" )
compile( "com.atlassian.commonmark:commonmark-ext-ins:${commonmarkVersion}" )
compile( "com.atlassian.commonmark:commonmark-ext-yaml-front-matter:${commonmarkVersion}" )
if( javaCompatibility >= JavaVersion.VERSION_11 ) {
val javafxVersion = "11.0.2"
val osName = System.getProperty( "os.name" ).toLowerCase()
val platform = if( osName.startsWith( "windows" ) ) "win" else if( osName.startsWith( "mac" ) ) "mac" else "linux"
compile( "org.openjfx:javafx-base:${javafxVersion}:${platform}" )
compile( "org.openjfx:javafx-controls:${javafxVersion}:${platform}" )
compile( "org.openjfx:javafx-graphics:${javafxVersion}:${platform}" )
compile( "org.openjfx:javafx-web:${javafxVersion}:${platform}" )
}
testCompile( "junit:junit:4.12" )
}
java {
sourceCompatibility = javaCompatibility
targetCompatibility = javaCompatibility
}
application {
mainClassName = "org.markdownwriterfx.MarkdownWriterFXApp"
}
val jar: Jar by tasks
jar.manifest {
attributes( mapOf(
"Main-Class" to "org.markdownwriterfx.MarkdownWriterFXApp",
"Class-Path" to configurations.compile.get().map { it.getName() }.joinToString( " " ),
"Implementation-Version" to version ) )
}
distributions {
getByName( "main" ) {
contents {
from( "LICENSE", "README.md", "CHANGES.md" )
into( "images" ) {
from( "images" )
}
}
}
}
//---- eclipse ----------------------------------------------------------------
eclipse {
classpath {
file {
whenMerged.add( object: Action<org.gradle.plugins.ide.eclipse.model.Classpath> {
override fun execute( classpath: org.gradle.plugins.ide.eclipse.model.Classpath ) {
val jre = classpath.entries.find {
it is AbstractClasspathEntry &&
it.path.contains("org.eclipse.jdt.launching.JRE_CONTAINER")
} as AbstractClasspathEntry
// make JavaFX API accessible in Eclipse project
// (when refreshing Gradle project in buildship)
jre.accessRules.add(AccessRule("accessible", "javafx/**"))
jre.accessRules.add(AccessRule("accessible", "com/sun/javafx/**"))
// remove trailing slash from jre path
if (jre.path.endsWith("/"))
jre.path = jre.path.substring(0, jre.path.length - 1)
}
} )
}
}
}