Skip to content

Commit 02fadb5

Browse files
3.0重构
1 parent 83d0810 commit 02fadb5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3691
-0
lines changed

.idea/.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
buildscript {
2+
ext.kotlin_version = '1.3.61'
3+
4+
repositories {
5+
mavenLocal()
6+
mavenCentral()
7+
}
8+
9+
dependencies {
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11+
}
12+
}
13+
14+
plugins {
15+
id 'java'
16+
id 'org.jetbrains.intellij' version '0.4.15'
17+
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
18+
}
19+
def pluginVersionSuffix = ideaVersionPrefix != '' ? '-' + ideaVersionPrefix : ''
20+
21+
apply plugin: 'idea'
22+
apply plugin: 'kotlin'
23+
apply plugin: 'org.jetbrains.intellij'
24+
25+
group 'org.ruiyu'
26+
version (pluginVersion + pluginVersionSuffix)
27+
28+
sourceCompatibility = 1.8
29+
30+
compileKotlin {
31+
kotlinOptions.jvmTarget = "1.8"
32+
}
33+
34+
compileTestKotlin {
35+
kotlinOptions.jvmTarget = "1.8"
36+
}
37+
sourceSets {
38+
main.java.srcDirs = [
39+
"src/main/java",
40+
"gen",
41+
"third_party/vmServiceDrivers",
42+
"src/main/resources"
43+
]
44+
test {
45+
java {
46+
srcDirs = [
47+
"gen",
48+
"src/main/java",
49+
"testSrc/unit",
50+
"third_party/vmServiceDrivers"
51+
]
52+
}
53+
resources {
54+
srcDirs = [
55+
"resources",
56+
"src",
57+
"testData/unit",
58+
"testSrc/unit"
59+
]
60+
}
61+
}
62+
}
63+
64+
repositories {
65+
mavenCentral()
66+
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
67+
}
68+
69+
dependencies {
70+
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
71+
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
72+
// compile 'com.alibaba:fastjson:1.2.61'
73+
implementation 'org.yaml:snakeyaml:1.21'
74+
testCompile group: 'junit', name: 'junit', version: '4.12'
75+
}
76+
77+
// See https://github.com/JetBrains/gradle-intellij-plugin/
78+
intellij {
79+
//不光此处要添加,还要在plugin.xml添加依赖 不然会报类找不到
80+
// plugins = ['android', 'Kotlin', 'gradle', "Dart:${dartVersion}", 'io.flutter:42.1.4']
81+
pluginName 'Flutter i18n'
82+
83+
def requiredPlugins = ['yaml']
84+
85+
// Starting with 2019.2, JetBrains extracted the Java functionality into its own plugin
86+
// so we have to check which plugins to load as build will fail when compiling for older IDE.
87+
// See: https://blog.jetbrains.com/platform/2019/06/java-functionality-extracted-as-a-plugin/
88+
if (ideaVersionPrefix != '' && ideaVersionPrefix.toInteger() >= 192) {
89+
requiredPlugins.add('java')
90+
}
91+
92+
plugins = requiredPlugins
93+
}
94+
95+
patchPluginXml {
96+
version (pluginVersion + pluginVersionSuffix)
97+
}
98+
99+
publishPlugin {
100+
token = System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken")
101+
}
102+
103+
def productMatrixFile = 'product-matrix.json'
104+
def jsonFile = new File(productMatrixFile)
105+
if (jsonFile == null) {
106+
// noinspection GroovyAssignabilityCheck
107+
throw new GradleException("Unable to read $productMatrixFile, is it missing?")
108+
}
109+
110+
// Fail if the product details file isn't found.
111+
// noinspection UnnecessaryQualifiedReference
112+
def productMatrix = new groovy.json.JsonSlurper().parseText(jsonFile.text)
113+
if (productMatrix == null || !(productMatrix instanceof Map)) {
114+
// noinspection GroovyAssignabilityCheck
115+
throw new GradleException("Unable to read $productMatrixFile.")
116+
}
117+
118+
// If an ideaVersionPrefix is provided, search for the first matched product and use that.
119+
if (ideaVersionPrefix != '') {
120+
def productMatrixKeys = productMatrix.keySet() as String[]
121+
for (productMatrixKey in productMatrixKeys) {
122+
if (productMatrixKey != null && productMatrixKey.startsWith("${ideaVersionPrefix}.")) {
123+
ideaVersion = productMatrixKey
124+
break
125+
}
126+
}
127+
}
128+
129+
// Fail if requested version is unsupported.
130+
if (!productMatrix.containsKey(ideaVersion)) {
131+
// noinspection GroovyAssignabilityCheck
132+
throw new GradleException("Requested IDEA version is unsupported: $ideaVersion")
133+
}
134+
135+
// Determine which branch we're building for.
136+
def productDetails = productMatrix[ideaVersion]
137+
if (productDetails == null || !(productDetails instanceof Map)) {
138+
// noinspection GroovyAssignabilityCheck
139+
throw new GradleException("Product details for IDEA version $ideaVersion is missing or invalid.")
140+
}
141+
142+
// Adjust plugin's output file name.
143+
rootProject.setBuildDir("${rootProject.buildDir}/${productDetails.comments}")
144+
145+
146+
System.out.println(
147+
"\nBuilding plugin ${(pluginVersion + pluginVersionSuffix)} for IDEA " +
148+
"version $ideaVersion (branch ${productDetails.comments})\n"
149+
)
150+
System.out.println("Since: ${productDetails.sinceBuild}")
151+
System.out.println("Until: ${productDetails.untilBuild}")
152+
System.out.println("Dart: ${productDetails.dartPluginVersion}")
153+
System.out.println("Flutter: ${productDetails.flutterPluginVersion}\n")
154+
System.out.println("Artifacts output directory: ${rootProject.buildDir}\n")
155+
156+
// Adjust plugin build settings.
157+
intellij.version = ideaVersion
158+
intellij.plugins += "Dart:${productDetails.dartPluginVersion}"
159+
intellij.plugins += "io.flutter:${productDetails.flutterPluginVersion}"
160+
intellij.plugins += "Kotlin"
161+
patchPluginXml.sinceBuild = productDetails.sinceBuild
162+
patchPluginXml.untilBuild = productDetails.untilBuild

gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
kotlin_version=1.3.61
2+
pluginVersion=3.1.1
3+
#每次修改这里去打包
4+
ideaVersionPrefix=191
5+
ideaVersion=

gradle/wrapper/gradle-wrapper.jar

53.9 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Sun Dec 22 14:38:49 CST 2019
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
3+
distributionBase=GRADLE_USER_HOME
4+
distributionPath=wrapper/dists
5+
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)