-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
129 lines (113 loc) · 3.18 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
/*
* This build file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java Library project to get you started.
* For more details take a look at the Java Libraries chapter in the Gradle
* user guide available at https://docs.gradle.org/3.5/userguide/java_library_plugin.html
*/
plugins {
id 'java'
id 'eclipse'
id 'idea'
}
configurations {
cupGeneration
jflexGeneration
}
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
mavenCentral()
}
dependencies {
// jflex : generation de l'analyseur lexical
jflexGeneration 'de.jflex:jflex:1.6.1'
// cup : generation de l'analyseur syntaxique
cupGeneration 'com.github.vbmacher:java-cup:11b-20151001'
// on a aussi besoin du runtime CUP pour la compilation et l'execution
implementation 'com.github.vbmacher:java-cup-runtime:11b-20151001'
}
// on reutilise la tache ant pour jflex
task jflex (group: 'build') {
ext.source = fileTree ( 'src/main/jflex'){
include "**/*.jflex"
include "**/*.flex"
}
ext.destdir = file("src/main/generated-jflex")
ext.noback = 'true'
ext.verbose = 'on'
inputs.property('noback', jflex.noback)
inputs.files(jflex.source)
outputs.dir(jflex.destdir)
ant.taskdef(name:'jflex', classpath:configurations.jflexGeneration.asPath, classname:"jflex.anttask.JFlexTask")
doLast {
sourceSets.main.java.srcDir jflex.destdir
source.each { File f ->
println "jflex source --> ${f}"
ant.jflex(file:f, destdir:destdir, nobak:noback, verbose:verbose)
}
}
}
// on reutilise la tache ant pour cup
task cup (group: 'build') {
ext.source = fileTree ('src/main/cup'){
include "**/*.cup"
}
ext.destdir = file("src/main/generated-cup")
ext.force = 'true'
ext.dump = 'off'
ext.locations = 'false'
inputs.property('locations', cup.locations)
inputs.files(cup.source)
outputs.dir(cup.destdir)
ant.taskdef(name:'cup', classpath:configurations.cupGeneration.asPath, classname:"java_cup.anttask.CUPTask")
doLast {
sourceSets.main.java.srcDir cup.destdir
source.each { File f ->
println "cup source --> ${f}"
ant.cup(srcfile:f, destdir:destdir, force:force, dump:dump, locations:locations)
}
}
}
clean.doFirst {
delete jflex.destdir
delete cup.destdir
}
compileJava.dependsOn cup, jflex
jar {
from {
configurations.compileClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes 'Main-Class': 'fr.usmb.m1isc.compilation.tp.Main'
}
}
task ide {
eclipseClasspath.dependsOn ide
ideaModule.dependsOn ide
doFirst {
mkdir jflex.destdir
mkdir cup.destdir
}
}
// configuration des IDE
idea {
module {
generatedSourceDirs += cup.destdir
generatedSourceDirs += jflex.destdir
}
}
sourceSets {
main {
java {
sourceCompatibility = 1.8
targetCompatibility = 1.8
srcDir cup.destdir
srcDir jflex.destdir
}
}
}