-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
230 lines (193 loc) · 5.58 KB
/
build.gradle
File metadata and controls
230 lines (193 loc) · 5.58 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS
gradle.startParameter.logLevel = LogLevel.DEBUG
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.google.gradle:osdetector-gradle-plugin:$osDetectorVersion"
classpath "com.satori:satori-libs-gradle-utils:$composerVersion"
classpath "com.satori:satori-libs-gradle-docker:$composerVersion"
classpath "com.satori:satori-libs-gradle-transform:$composerVersion"
classpath "com.satori:satori-libs-gradle-codegen:$composerVersion"
classpath "com.satori:satori-gradle-composer-plugin:$composerVersion"
}
}
group group
version version
buildDir = ".out"
apply plugin: "com.google.osdetector"
apply plugin: "com.satori.codegen"
apply plugin: 'com.satori.docker'
apply plugin: 'com.satori.transform'
apply plugin: 'com.satori.composer'
apply plugin: "idea"
idea {
project {
jdkName = JavaVersion.VERSION_1_10.toString()
languageLevel = JavaVersion.VERSION_1_10.toString()
}
module {
inheritOutputDirs = false
outputDir = file("$buildDir/idea")
testOutputDir = file("$buildDir/idea-tests")
}
}
apply plugin: "java"
//apply plugin: 'java-library'
sourceCompatibility = JavaVersion.VERSION_1_10
targetCompatibility = JavaVersion.VERSION_1_10
ext {
pckg = "$group.${codeFormatter.packageName(project.name)}"
pckgDir = pckg.replace('.', '/')
}
sourceSets.main.java.srcDirs = ['src']
sourceSets.main.resources.srcDirs = ['res']
sourceSets.test.java.srcDirs = ['tests/src']
sourceSets.test.resources.srcDirs = ['tests/res']
apply plugin: "kotlin"
kotlin {
experimental {
coroutines 'enable'
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
//freeCompilerArgs = ['-Xallow-kotlin-package']
}
}
sourceSets.main.kotlin.srcDirs = sourceSets.main.java.srcDirs
sourceSets.test.kotlin.srcDirs = sourceSets.test.java.srcDirs
sourceSets.main.kotlin.exclude "**/*.java"
//sourceSets.main.kotlin.filter.excludes("module-info.java")
task showSources{
doFirst{
sourceSets.main.kotlin.forEach{
println "kotlin source: $it"
}
}
}
// TODO: fix it
/*
compileKotlin {
compileJava.dependsOn it
//destinationDir = compileJava.destinationDir
}
compileTestKotlin {
compileTestJava.dependsOn it
//destinationDir = compileTestJava.destinationDir
}
*/
/*task createDefaultProjectStructure {
group 'init'
doLast {
println "creating default project structure for project '${project.name}'..."
// create directories for all source sets
sourceSets.forEach { sourceSet ->
sourceSet.java.srcDirs.forEach {
def pathToCreate = new File(it, pckgDir)
println "creating sources path for '${sourceSet.name}': '$pathToCreate'"
pathToCreate.mkdirs()
}
sourceSet.resources.srcDirs.forEach {
def pathToCreate = new File(it, pckgDir)
println "creating resources path for '${sourceSet.name}': '$pathToCreate'"
pathToCreate.mkdirs()
}
}
// generate build.gradle
if (!file("build.gradle").exists() && file("build.template.gradle").exists()) {
println "creating build.gadle: '${file('build.gradle')}'"
transform {
template = rootProject.file('build.template.gradle')
output = file('build.gradle')
}
}
}
}*/
/*sourceSets.all { sourceSet ->
def n = sourceSet.name
n = n != "main" ? n.capitalize() : ""
def taskName = "generate${n}Code"
println "defining task: '${project.name}:${taskName}'"
def t = task "generate${n}Code"() {
group 'codegen'
}
tasks["compile${n}Java"].dependsOn t
tasks["compile${n}Kotlin"].dependsOn t
}*/
repositories {
//jcenter()
mavenCentral()
//maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
jar {
manifest {
attributes "Main-Class": "${pckg}.App"
}
}
//
task link() {
group "build"
dependsOn clean
dependsOn jar
def javaHome = System.getProperty('java.home')
println "javaHome='$javaHome'"
def outDir = new File(buildDir, "dist")
doFirst {
delete outDir
exec{
workingDir buildDir
commandLine = [
"${javaHome}/bin/jlink",
"--module-path", (["libs", "${javaHome}/jmods"] + sourceSets.main.compileClasspath*.path).join(File.pathSeparator),
"--add-modules", "mymodule",
"--launcher", "app=mymodule/org.andreyko.j9exec.App",
//"--strip-debug",
//"--compress", "2",
//"--no-header-files",
//"--no-man-pages",
"--output", outDir
]
println "> ${commandLine.join(' ')}"
}
}
}
task copyDependencies{
doFirst{
delete file("!ext")
copy{
//from sourceSets.main.compileClasspath
from configurations.compile
into file("!ext")
}
}
}
compileJava{
options.verbose = true
doFirst {
/* options.compilerArgs = [
'--module-path', classpath.asPath,
]*/
//classpath = classpath.asPath
}
}
jar{
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
// main dependencies
dependencies {
implementation gradleApi()
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
//implementation "org.jetbrains.kotlin:kotlin-stdlib"
//implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion"
//implementation satoriLibsAsyncKotlin()
//implementation satoriLibsCommonKotlin()
}