forked from jtransc/jtransc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
132 lines (108 loc) · 4.31 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
import java.nio.charset.Charset
// http://jedicoder.blogspot.com.es/2011/11/automated-gradle-project-deployment-to.html
buildscript {
ext.kotlin_version = kotlinVersion
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "com.jfrog.bintray" version "1.7.3"
}
apply plugin: 'idea'
//tasks.withType(Test) {
// scanForTestClasses = false
// include "**/*Test.class" // whatever Ant pattern matches your test class files
//}
allprojects { project ->
//task hello << {task ->
// println "I'm $task.project.name: ${task.project.ext.jtranscVersion}"
//}
repositories {
jcenter()
}
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: 'com.jfrog.bintray'
project.ext.kotlin_version = kotlinVersion
project.ext.group = "com.jtransc"
project.ext.jtranscVersion = "${jtranscVersion}"
//apply from: '../include.gradle'
}
def sed = { String file, /* language=RegExp */ String regexp, String replacement ->
def f = new File(file)
def content = f.getText("UTF-8")
def res = content.replaceAll(regexp, replacement)
//println(res)
f.write(res)
}
println("Charset.defaultCharset(): " + Charset.defaultCharset())
task updateVersion() {
doLast {
def newversion = jtranscVersion
println "Updating jtransc to version '$newversion'"
println "Updating kotlin to version '$kotlin_version'"
def isSnapshot = "$newversion".endsWith("-SNAPSHOT")
// JTransc version
sed("jtransc-rt-core/src/com/jtransc/JTranscVersion.java", 'static private final String version = "(.*)"', "static private final String version = \"$newversion\"")
sed("gradle.properties", 'jtranscVersion=(.*)', "jtranscVersion=$newversion")
sed("jtransc-main-run/example-gradle/gradle.properties", 'jtranscVersion=(.*)', "jtranscVersion=$newversion")
sed("jtransc-main-run/example-gradle-multi/gradle.properties", 'jtranscVersion=(.*)', "jtranscVersion=$newversion")
sed("benchmark/gradle.properties", 'jtranscVersion=(.*)', "jtranscVersion=$newversion")
sed("jtransc-maven-plugin/resources/META-INF/maven/com.jtransc/jtransc-maven-plugin/pom.properties", 'version=(.*)', "version=$newversion")
sed("jtransc-main-run/pom.xml", '<!--jtransc--><version>(.*)<\\/version>', "<!--jtransc--><version>$newversion</version>")
sed("jtransc-maven-plugin/example/pom.xml", '<!--jtransc--><version>(.*)<\\/version>', "<!--jtransc--><version>$newversion</version>")
sed("jtransc-maven-plugin/resources/META-INF/maven/com.jtransc/jtransc-maven-plugin/plugin-help.xml", '<!--jtransc--><version>(.*)<\\/version>', "<!--jtransc--><version>$newversion</version>")
sed("jtransc-maven-plugin/resources/META-INF/maven/com.jtransc/jtransc-maven-plugin/pom.xml", '<!--jtransc--><version>(.*)<\\/version>', "<!--jtransc--><version>$newversion</version>")
sed("jtransc-maven-plugin/resources/META-INF/maven/plugin.xml", '<!--jtransc--><version>(.*)<\\/version>', "<!--jtransc--><version>$newversion</version>")
// JTransc non-snapshot versions
if (!isSnapshot) {
sed("README.md", 'id "com.jtransc" version "(.*)"', "id \"com.jtransc\" version \"$newversion\"")
}
// Kotlin version
sed("jtransc-utils/src/com/jtransc/KotlinVersion.kt", 'val KotlinVersion = "(.*)"', "val KotlinVersion = \"$kotlin_version\"")
sed("jtransc-maven-plugin/resources/META-INF/maven/plugin.xml", '<!--kotlin--><version>(.*)<\\/version>', "<!--kotlin--><version>$kotlin_version</version>")
sed("jtransc-maven-plugin/example/pom.xml", '<!--kotlin--><version>(.*)<\\/version>', "<!--kotlin--><version>$kotlin_version</version>")
}
}
task travisDeploy(dependsOn: ['bintrayUpload']) {
doLast {
println("Deployed!")
}
}
task snapshotTask() {
}
task releaseTask() {
}
if ("$jtranscVersion".endsWith("-snapshot")) {
travisDeploy.dependsOn('snapshotTask')
} else {
travisDeploy.dependsOn('releaseTask')
}
task wrapper(type: Wrapper) {
gradleVersion = '4.0'
}
clean.doFirst {
delete "${project.rootDir}/classes"
for (p in project.allprojects) {
delete "${p.projectDir}/out"
println "Deleting... ${p.projectDir}/out"
}
}
idea {
module {
excludeDirs = [
file(".gradle"), file(".idea"),
file("docs"), file("benchmark"),
file("examples"), file("extra"),
file("gradle"), file("inception"),
file("jtransc-intellij-plugin"), file("jtransc-main-run")
]
}
}