-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbuild.gradle
196 lines (163 loc) · 5.71 KB
/
build.gradle
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'scala'
id 'idea'
id 'com.github.maiflai.scalatest' version '0.23'
id "de.undercouch.download" version "3.4.3"
}
description = """<p>Language support for <a href="http://fitnesse.org>">FitNesse</a>, the fully integrated standalone wiki and acceptance testing framework.</p>
<p>This plugin provides syntax highlighting, auto-completion and execution of FitNesse test suites all from within your IDE.</p>
"""
allprojects {
repositories {
jcenter()
maven {
url "http://dl.bintray.com/fitnesse/edge"
}
}
}
ext {
FITNESSE_VERSION = '20191229'
SCALA_VERSION = '2.11.8'
}
// Pick the Linux version, as it is a tar.gz, since we can simply extract that
// Older versions:
// - IDEA_ID = 'IC-139.1603.1', IDEA_URL = 'http://download.jetbrains.com/idea/ideaIC-14.0.4.tar.gz'
// Check out https://confluence.jetbrains.com/display/IntelliJIDEA/Previous+IntelliJ+IDEA+Releases
// for the versions available.
def IDEA_VERSIONS = [
15: [
ID: 'IC-143.2370.31',
URL: 'http://download.jetbrains.com/idea/ideaIC-15.0.6.tar.gz',
CSUM: '4238391a3e2ffdc7ada51e850702330ea172c6bf0bb859d2f269e3f2d45e6920',
JAVA: '1.8'
],
16: [
ID: 'IC-145.2070.6',
URL: 'https://download.jetbrains.com/idea/ideaIC-2016.1.4.tar.gz',
CSUM: 'b64767d87dbaae7e1511666fc032cf356e326770090e3a141969909d09670345',
JAVA: '1.8'
]
]
def idea_version = System.getenv('IDEA_VERSION')
def IDEA = IDEA_VERSIONS[idea_version ? idea_version.toInteger() : 15]
def IDEA_SDK_NAME = "IntelliJ IDEA Community Edition ${IDEA.ID}"
def IDEA_LIB = "lib/sdk/idea-${IDEA.ID}/lib"
configurations {
ideaSdk
bundle {
// dependencies bundled with the plugin
transitive = false
}
}
def jdkHome = System.getenv("JAVA_HOME")
dependencies {
ideaSdk fileTree(dir: IDEA_LIB, include: ['*.jar'])
bundle "org.scala-lang:scala-library:${SCALA_VERSION}"
bundle "org.fitnesse:fitnesse:${FITNESSE_VERSION}:standalone"
bundle project('idea-fitnesse_rt')
compile configurations.bundle
compile fileTree(dir: IDEA_LIB,
include: ['openapi.jar', 'idea.jar', 'util.jar', 'extensions.jar', 'annotations.jar',
'jdom.jar', 'picocontainer.jar', 'trove4j.jar',])
testCompile configurations.ideaSdk
testCompile 'org.scalatest:scalatest_2.11:2.2.5'
testCompile 'org.mockito:mockito-core:1.10.19'
// Scalatest requires:
testRuntime 'org.pegdown:pegdown:1.1.0'
testRuntime files("$jdkHome/lib/tools.jar")
}
sourceCompatibility = IDEA.JAVA
targetCompatibility = IDEA.JAVA
task downloadIdeaSdk(type: de.undercouch.gradle.tasks.download.Verify) {
description 'Download IDEA SDK from the interwebz'
doFirst {
download {
src IDEA.URL
dest file("lib/idea-${IDEA.ID}.tar.gz")
overwrite false
}
}
src file("lib/idea-${IDEA.ID}.tar.gz")
algorithm 'SHA-256'
checksum IDEA.CSUM
}
task extractIdeaSdk(type: Copy, dependsOn: [downloadIdeaSdk]) {
description 'Extract IDEA SDK'
def zipFile = file("lib/idea-${IDEA.ID}.tar.gz")
def outputDir = file("lib/sdk")
from tarTree(resources.gzip(zipFile))
into outputDir
}
processResources {
from('src/main/resources') {
include 'META-INF/plugin.xml'
filter(ReplaceTokens, tokens: [
version : project.version,
description: project.description ])
}
}
test {
// Avoid parallel execution, since the IntelliJ boilerplate is not up to that
maxParallelForks = 1
}
task dist(type: Zip, dependsOn: [jar, test]) {
from configurations.bundle
from jar.archivePath
rename { f -> "lib/${f}" }
into 'idea-fitnesse'
baseName 'idea-fitnesse'
}
compileScala {
dependsOn extractIdeaSdk
doLast {
ant {
println "Instrumenting form classes..."
taskdef(name: "instrumentIdeaExtensions",
classname: "com.intellij.ant.InstrumentIdeaExtensions",
classpath: configurations.ideaSdk.asPath)
instrumentIdeaExtensions(srcdir: sourceSets.main.scala.srcDirs[0],
classpath: classpath.asPath,
destdir: destinationDir,
includeAntRuntime: true,
source: sourceCompatibility,
target: targetCompatibility
)
}
}
}
// ========= Workspace setup tasks ========= //
idea {
targetVersion = '14'
project {
languageLevel = IDEA.JAVA
jdkName = IDEA_SDK_NAME
ipr {
withXml {
it.node.find { node ->
node.@name == 'ProjectRootManager'
}.'@project-jdk-type' = 'IDEA JDK'
logger.warn "=" * 74
logger.warn " Configured IDEA SDK '${jdkName}'."
logger.warn " Make sure you have it configured in IntelliJ before opening the project!"
logger.warn "=" * 74
}
}
}
module {
scopes.COMPILE.minus = [ configurations.ideaSdk ]
iml {
beforeMerged { module ->
module.dependencies.clear()
}
withXml {
it.node.@type = 'PLUGIN_MODULE'
// <component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/src/main/resources/META-INF/plugin.xml" />
def cmp = it.node.appendNode('component')
cmp.@name = 'DevKit.ModuleBuildProperties'
cmp.@url = 'file://$MODULE_DIR$/src/main/resources/META-INF/plugin.xml'
}
}
}
}
ideaProject.dependsOn extractIdeaSdk