-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
147 lines (120 loc) · 3.35 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import org.apache.tools.ant.taskdefs.condition.Os
plugins {
id 'java'
id 'org.jastadd' version '1.13.3'
}
defaultTasks 'jar'
if (!file('extendj/jastadd_modules').exists()) {
throw new GradleException('ExtendJ seems to be missing. Please run "git submodule init", then "git submodule update".')
}
jastadd {
configureModuleBuild()
modules {
include("extendj/jastadd_modules") // Include core ExtendJ modules.
module "cat", {
imports "java11 frontend" // ExtendJ dependency for cat module.
jastadd {
basedir "src/jastadd/"
include "**/*.ast"
include "**/*.jadd"
include "**/*.jrag"
}
}
}
// Target module to build:
module = 'cat'
jastaddOptions = [ "--rewrite=cnta",
"--safeLazy",
"--visitCheck=false",
"--optimize-imports"
]
if (project.hasProperty('enableOptimization')) {
jastaddOptions += ["--dnc", "--optimisation-config=CacheConfiguration.csv", "--tracing=api"]
}else if (project.hasProperty('enableTracing') && project.hasProperty('enableOptimization')) {
jastaddOptions += ["--tracing=compute", "--dnc", "--optimisation-config=CacheConfiguration.csv"]
}else if(project.hasProperty('enableTracing')){
jastaddOptions += ["--tracing=compute"]
}else{
jastaddOptions += ["--tracing=api"]
}
astPackage = 'org.extendj.ast'
parser.name = 'JavaParser'
scanner.name = 'OriginalScanner'
}
sourceSets.main {
java {
srcDir 'extendj/src/frontend-main'
srcDir 'src/java'
}
resources {
srcDir 'src/java/magpiebridge/resources'
srcDir 'extendj/src/res'
srcDir jastadd.buildInfoDir
srcDir 'resources'
}
repositories {
mavenLocal()
flatDir { dirs "tools" }
}
dependencies {
jastadd2 name: "jastadd2"
}
}
dependencies{
testImplementation 'junit:junit:4.12'
implementation 'junit:junit:4.12'
implementation 'com.sparkjava:spark-core:2.9.3'
}
sourceSets.test{
java{
srcDir 'src/java/test/'
}
}
test {
useJUnit()
dependsOn 'cleanTest'
testLogging {
events "passed", "skipped", "failed"
}
}
jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest {
attributes 'Main-Class': 'org.extendj.Cat'
}
from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
baseName = 'cat'
}
task printClasspath {
doLast {
def classpath = sourceSets.main.compileClasspath.files
def classpathString = classpath.collect { it.absolutePath }.join(':')
println "Classpath used to compile the project:"
println classpathString
}
}
jar.destinationDirectory = projectDir
// Java -source and -target version.
sourceCompatibility = targetCompatibility = '1.8'
task sourceZip(type: Zip) {
description 'Builds a Zip file with the entire repisotory (including the ExtendJ submodule).'
destinationDirectory = projectDir
archiveFileName = "cat-src.zip"
from (projectDir) {
exclude '**/.git'
exclude '**/.gitignore'
exclude '**/.gitattributes'
exclude '**/.gitmodules'
exclude 'build'
exclude 'bin'
exclude '.gradle'
exclude '.classpath'
exclude '.settings'
exclude '.project'
exclude '*.jar'
exclude '*.zip'
exclude '**/*.swp'
}
into 'cat'
}