forked from JetBrains/educational-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
213 lines (173 loc) · 5.52 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
buildscript {
ext.pythonPluginVersion = pythonPluginVersion
ext.pycharmSandbox = project.buildDir.absolutePath + File.separator + "pycharm-sandbox"
ext.studioSandbox = project.buildDir.absolutePath + File.separator + "studio-sandbox"
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51"
}
}
plugins {
id "org.jetbrains.intellij" version "0.2.16" apply false
id "java"
id "idea"
id "de.undercouch.download" version "3.2.0"
}
group = 'org.jetbrains.edu'
def buildNumber = System.getenv("BUILD_NUMBER")
version = "$pluginVersion-${buildNumber == null ? "SNAPSHOT" : buildNumber}"
import de.undercouch.gradle.tasks.download.Download
task downloadJavaFx(type: Download) {
overwrite true
src javafx
dest "${project.buildDir}/javafx.zip"
}
task prepareJavaFx(type: Copy) {
def javafxFile = file("${project.buildDir}/javafx.zip")
onlyIf { javafxFile.exists() }
from zipTree(javafxFile)
into file("${project.buildDir}/javafx")
}
prepareJavaFx.dependsOn downloadJavaFx
allprojects {
apply plugin: "org.jetbrains.intellij"
apply plugin: "java"
apply plugin: "kotlin"
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
intellij {
if (project.hasProperty("ideaVersion")) {
version ideaVersion
} else if (project.hasProperty("ideaPath")) {
localPath ideaPath
}
}
compileKotlin {
// see https://youtrack.jetbrains.com/issue/KT-19737
destinationDir = compileJava.destinationDir
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
compile group: 'org.twitter4j', name: 'twitter4j-core', version: '4.0.1'
compileOnly fileTree(dir: "${rootProject.buildDir}/javafx/jre/lib/ext")
}
}
intellij {
if (project.hasProperty("ideaVersion")) {
version ideaVersion
} else if (project.hasProperty("ideaPath")) {
localPath ideaPath
}
if (project.hasProperty("customSinceBuild")) {
patchPluginXml.sinceBuild = customSinceBuild
}
pluginName 'EduTools'
updateSinceUntilBuild true
downloadSources false
plugins 'junit', 'Kotlin', "PythonCore:$pythonPluginVersion", 'android'
}
task configurePyCharm {
doLast {
if (!project.hasProperty("pycharmPath")) {
throw new InvalidUserDataException("Path to PyCharm installed locally is needed\nDefine \"pycharmPath\" property")
}
intellij.sandboxDirectory pycharmSandbox
intellij.alternativeIdePath pycharmPath
}
}
task configureAndroidStudio {
doLast {
if (!project.hasProperty("androidStudioPath")) {
throw new InvalidUserDataException("Path to Android Studio installed locally is needed\nDefine \"androidStudioPath\" property")
}
intellij.sandboxDirectory studioSandbox
intellij.alternativeIdePath androidStudioPath
}
}
task copyXmls(type: Copy) {
def resultingMetaInf = "${sourceSets.main.output.resourcesDir}/META-INF"
for (def subProject : project.subprojects) {
from "${subProject.name}/resources/META-INF"
into resultingMetaInf
include "*.xml"
}
}
jar.dependsOn(copyXmls)
task removePyCharm(type: Delete) {
doLast {
file(pycharmSandbox + File.separator + "plugins" + File.separator + "python-ce").deleteDir()
}
}
// we need this so as not to install python plugin on PyCharm
prepareSandbox.finalizedBy(removePyCharm)
subprojects {
sourceSets {
main {
java.srcDirs 'src'
resources.srcDirs 'resources'
kotlin.srcDirs 'src'
}
test {
java.srcDirs 'testSrc'
resources.srcDirs 'resources', 'testResources'
}
}
project.tasks.getByPath("runIde").enabled false
project.tasks.getByPath("prepareSandbox").enabled false
}
sourceSets {
main {
resources.srcDirs 'resources'
}
}
configure(project(':educational-core')) {
task downloadColorFile(type: Download) {
overwrite false
src 'https://raw.githubusercontent.com/ozh/github-colors/master/colors.json'
dest "${projectDir}/resources/languageColors/colors.json"
}
}
configure([project(':Edu-Python'), project(':Edu-Java'), project(':Edu-Kotlin')]) {
dependencies {
compile project(':educational-core')
}
}
configure([project(':educational-core'), project(':Edu-Java')]) {
intellij.plugins 'junit', 'android'
}
configure(project(':Edu-Kotlin')) {
intellij.plugins 'junit', 'Kotlin'
task createTwitterProperties() {
def twitterFile = file("${projectDir}/resources/twitter/kotlin_koans/oauth_twitter.properties")
Properties props = new Properties()
props.setProperty("consumerKey", consumerKey)
props.setProperty("consumerSecret", consumerSecret)
props.store(twitterFile.newWriter(), null)
}
processResources.dependsOn(createTwitterProperties)
}
configure(project(':Edu-Python')) {
intellij.plugins "PythonCore:$pythonPluginVersion"
}
runIde.systemProperty("-Didea.is.internal", "true")
runIde.systemProperty("-ea", "")
dependencies {
compile project(':educational-core'), project(':Edu-Python'), project(':Edu-Kotlin'), project(':Edu-Java')
}
idea {
project {
jdkName = 1.8
languageLevel = 1.8
vcs = 'Git'
}
}