-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
80 lines (65 loc) · 1.94 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
import java.time.LocalDateTime
buildscript {
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.16.1'
classpath 'org.ajoberstar:grgit:1.7.2'
}
}
buildDir = 'target'
apply plugin:'java'
apply plugin:'idea'
apply plugin:'org.jetbrains.intellij'
version = '1.3.1'.with {
def r = project.properties['RELEASE']
if ( r == null) {
return "$it-SNAPSHOT"
} else if (r != it) {
throw new GradleException("RELEASE mismatch: RELEASE='$r', expected '$it'")
} else {
return it
}
}
sourceCompatibility = targetCompatibility = '17'
repositories {
mavenCentral()
}
intellij {
version = '233.11799.300' // (2023.3.1)
updateSinceUntilBuild = false
sandboxDir = 'idea-sandbox'
}
//noinspection GroovyAssignabilityCheck
task updateLicense() {
ext.copyrightProfile = file(file('.idea/copyright/MIT.xml'))
ext.licenseFile = file('LICENSE')
inputs.file copyrightProfile
outputs.file licenseFile
doFirst {
String lic = new XmlSlurper().parse(copyrightProfile as File).copyright.option.find({it.@name=='notice'}).@value as String
lic = lic.replaceAll('(\\\$|$)today.year(\\b)', "${LocalDateTime.now().year}\$2")
licenseFile.text = lic
}
}
buildPlugin {
dependsOn updateLicense
from updateLicense.licenseFile
}
patchPluginXml {
String repoContentRootUrl = 'https://raw.githubusercontent.com/Abnaxos/idea-run-popup/'
if (version.get().contains('SNAPSHOT')) {
repoContentRootUrl += 'develop'
} else {
repoContentRootUrl += project.version
}
inputs.property 'repoContentRootUrl', repoContentRootUrl
doLast {
file("${destinationDir.get()}/plugin.xml").with {
setText(getText('UTF-8').replace('@@repoContentRootUrl@@', repoContentRootUrl), 'UTF-8')
}
}
}