forked from EddieRingle/clion-cmakedocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
73 lines (62 loc) · 1.8 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
import org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository
buildscript {
ext.ver = [
kotlin: "1.2.51",
]
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${ver.kotlin}"
}
repositories {
jcenter()
}
}
plugins {
id "org.jetbrains.intellij" version "0.3.5"
}
apply plugin: "idea"
apply plugin: "kotlin"
repositories {
jcenter()
}
group "io.ringle.ij"
version "1.0.1"
def clionPath = getCLionPath()
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:${ver.kotlin}"
implementation "org.jetbrains.plugins:org.asciidoctor.intellij.asciidoc:0.20.6"
}
intellij {
pluginName "clion-cmakedocs"
plugins = ["org.asciidoctor.intellij.asciidoc:0.20.6"]
localPath clionPath
alternativeIdePath clionPath
ideaDependencyCachePath = file("deps").absolutePath
afterEvaluate {
project.repositories.forEach { repo ->
if (repo instanceof DefaultIvyArtifactRepository) {
if (repo.name.equals("ivy2")) {
repo.artifactPattern(
"${gradle.gradleUserHomeDir}/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/plugins.jetbrains.com/[module]-[revision]/[artifact](.[ext])")
}
}
}
}
}
task(verifySetup) {
doLast {
def clionJar = "${clionPath}/lib/clion.jar"
if (!file(clionJar).exists()) {
throw new GradleException("${clionJar} not found, set clion.dir to valid CLion installation")
}
}
}
compileKotlin.dependsOn verifySetup
def getCLionPath() {
Properties props = new Properties()
props.load(project.rootProject.file("local.properties").newDataInputStream())
def clionPath = props.getProperty("clion.dir", null)
if (clionPath == null) {
throw new GradleException("CLion path not found. Define clion.dir in local.properties file.")
}
return clionPath
}