-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
111 lines (93 loc) · 2.73 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
/*
* AspectJ configuration borrowed from:
* http://javagalleog.blogspot.com/2016/03/gradle-and-aspectj.html
*/
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'application'
description = "Example project for making SWF Flow Framework work with Gradle and Intellij"
mainClassName = "net.craigsquire.flow.helloworld.GreeterWorker"
sourceCompatibility = 1.8
targetCompatibility = 1.8
/*
* New configurations so the weaving can be separated cleanly
*/
configurations {
ajc
aspects
compile {
extendsFrom aspects
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile group: 'com.amazonaws', name: 'aws-java-sdk-swf-libraries', version: '1.11.22'
compile group: 'org.aspectj', name: 'aspectjrt', version: '1.8.9'
compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.8.9'
/*
* The AspectJ tools only need to be on the ajc classpath, also specify where the aspects
* can be found.
*/
ajc group: 'org.aspectj', name: 'aspectjtools', version: '1.8.9'
aspects group: 'com.amazonaws', name: 'aws-swf-build-tools', version: '1.1'
}
/*
* Create the directories where the Flow Framework will place its generated code
*/
task createGeneratedSrcDirs {
def generated = new File( 'generated' )
def generatedTests = new File( 'generated_tests' )
if( !generated.exists() ) {
generated.mkdirs()
}
if( !generatedTests.exists() ) {
generatedTests.mkdirs()
}
}
/*
* Make the idea task create the directories for the generated code
*/
tasks.idea {
dependsOn = [ createGeneratedSrcDirs ]
}
/*
* Add the generated code directories as src directories in the Idea project
*/
idea {
module {
sourceDirs += file('generated')
testSourceDirs += file('generated_tests')
}
}
/*
* Expose the task definitions for running ajc
*/
def aspectj = { destDir, aspectPath, inpath, classpath ->
ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties",
classpath: configurations.ajc.asPath)
ant.iajc(
maxmem: "1024m",
fork: "true",
Xlint: "ignore",
destDir: destDir,
aspectPath: aspectPath,
inpath: inpath,
classpath: classpath,
source: project.sourceCompatibility,
target: project.targetCompatibility
)
}
/*
* Configure build to perform the AspectJ weaving *after* the java compilation is done.
*/
compileJava {
doLast {
aspectj project.sourceSets.main.output.classesDir.absolutePath,
configurations.aspects.asPath,
project.sourceSets.main.output.classesDir.absolutePath,
project.sourceSets.main.runtimeClasspath.asPath
}
}