forked from ichaly/flutter-getx-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
124 lines (103 loc) · 3.95 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
buildscript {
ext.kotlin_version = '1.5.0'
repositories {
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.7.3'
id 'org.jetbrains.kotlin.jvm' version "$kotlin_version"
}
group 'cn.te0.flutter-getx-starter'
def pluginVersionSuffix = ''
// must!!!
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}
repositories {
mavenCentral()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'org.freemarker:freemarker:2.3.31'
implementation 'org.yaml:snakeyaml:1.28'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version '2021.1'
updateSinceUntilBuild false
def requiredPlugins = ['yaml']
if (ideaVersionPrefix != '' && ideaVersionPrefix.toInteger() >= 192) {
requiredPlugins.add('java')
}
plugins = requiredPlugins
}
patchPluginXml {
version(pluginVersion + pluginVersionSuffix)
changeNotes """
version 1.0.0 has been released.<br>
"""
}
def productMatrixFile = "${projectDir.absolutePath}/product-matrix.json"
def jsonFile = new File(productMatrixFile)
if (jsonFile == null) {
// noinspection GroovyAssignabilityCheck
throw new GradleException("Unable to read $productMatrixFile, is it missing?")
}
// Fail if the product details file isn't found.
// noinspection UnnecessaryQualifiedReference
def productMatrix = new groovy.json.JsonSlurper().parseText(jsonFile.text)
if (productMatrix == null || !(productMatrix instanceof Map)) {
// noinspection GroovyAssignabilityCheck
throw new GradleException("Unable to read $productMatrixFile.")
}
// If an ideaVersionPrefix is provided, search for the first matched product and use that.
if (ideaVersionPrefix != '') {
def productMatrixKeys = productMatrix.keySet() as String[]
for (productMatrixKey in productMatrixKeys) {
if (productMatrixKey != null && productMatrixKey.startsWith("${ideaVersionPrefix}.")) {
ideaVersion = productMatrixKey
break
}
}
}
// Fail if requested version is unsupported.
if (!productMatrix.containsKey(ideaVersion)) {
// noinspection GroovyAssignabilityCheck
throw new GradleException("Requested IDEA version is unsupported: $ideaVersion")
}
// Determine which branch we're building for.
def productDetails = productMatrix[ideaVersion]
if (productDetails == null || !(productDetails instanceof Map)) {
// noinspection GroovyAssignabilityCheck
throw new GradleException("Product details for IDEA version $ideaVersion is missing or invalid.")
}
// Adjust plugin's output file name.
rootProject.setBuildDir("${rootProject.buildDir}/${productDetails.comments}")
System.out.println(
"\nBuilding plugin ${(pluginVersion + pluginVersionSuffix)} for IDEA " +
"version $ideaVersion (branch ${productDetails.comments})\n"
)
System.out.println("Since: ${productDetails.sinceBuild}")
System.out.println("Until: ${productDetails.untilBuild}")
System.out.println("Dart: ${productDetails.dartPluginVersion}")
System.out.println("Flutter: ${productDetails.flutterPluginVersion}\n")
System.out.println("Artifacts output directory: ${rootProject.buildDir}\n")
// Adjust plugin build settings.
intellij.version = ideaVersion
intellij.plugins += "Dart:${productDetails.dartPluginVersion}"
intellij.plugins += "io.flutter:${productDetails.flutterPluginVersion}"
intellij.plugins += "Kotlin"
patchPluginXml.sinceBuild = productDetails.sinceBuild
patchPluginXml.untilBuild = productDetails.untilBuild