-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
97 lines (83 loc) · 2.88 KB
/
build.gradle
File metadata and controls
97 lines (83 loc) · 2.88 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
//This is the parent build file. The example is self contained and does not use the main
//build.gradle file for the whole repository (../build.gradle).
//This is the setup:
//
//We pretend we're in an environment with a backend and a frontend application. Between them,
//there is some shared source and test code.
//
//The dependencies are as follows:
//Backend depends on Shared, both for source and test code
//Frontend depends on Shared and Backend
//
//This is the folder structure:
//build.gradle (parent)
//|-shared (provides shared source and test code)
//|-backend (a bogus backend)
//|-frontend (a bogus frontend)
//################################################
// Nothing special happens here
//################################################
//Settings for all child projects (as included in settings.gradle)
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
defaultTasks 'build'
// UTF-8 should be standard by now. So use it!
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
repositories {
mavenCentral()
}
task wrapper(type: Wrapper) {
gradleVersion = '1.9'
}
// Hide output subfolders from IntelliJ for each subproject
idea {
module {
excludeDirs += file('.idea')
excludeDirs += file('target')
excludeDirs += file('gradle')
excludeDirs += file('out')
}
}
dependencies {
testCompile 'junit:junit:4.11'
}
}
// Set git as default VCS in IntelliJ
idea.project.ipr {
withXml { provider ->
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@directory = '$PROJECT_DIR$'
}
}
//################################################
// This is where special things start happening
//################################################
project(':backend') {
dependencies {
compile project(':shared')
testCompile project(':shared').sourceSets.test.output
}
//Just to show that we can have dedicated messages for different subprojects
test {
afterTest { descriptor, result ->
println "Executed backend test ${descriptor.className}#${descriptor.name} with result: ${result.resultType}"
}
}
}
project(':frontend') {
dependencies {
compile project(':shared')
testCompile project(':shared').sourceSets.test.output
compile project(':backend')
testCompile project(':backend').sourceSets.test.output
}
//Just to show that we can have dedicated messages for different subprojects
test {
afterTest { descriptor, result ->
println "Executed frontend test ${descriptor.className}#${descriptor.name} with result: ${result.resultType}"
}
}
}