forked from FedericoPecora/meta-csp-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
198 lines (177 loc) · 5.87 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
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
['java', 'eclipse', 'maven', 'application', 'signing'].each {
apply plugin : it
}
set("myGradleVersion", GradleVersion.current().getVersion())
set("myGradleVersionMajor", myGradleVersion.substring(0,myGradleVersion.indexOf(".")))
set("myGradleVersionMinor", myGradleVersion.substring(myGradleVersion.indexOf(".")+1))
println ("Using Gradle version: (major) " + myGradleVersionMajor + " (minor) " + myGradleVersionMinor)
try {
if ((Integer.parseInt(myGradleVersionMajor) > 1) || ((Integer.parseInt(myGradleVersionMajor) == 1) && (Integer.parseInt(myGradleVersionMinor) > 6))) {
apply plugin : 'maven-publish'
}
else {
println "Note: you need Gradle version >= 1.6 to publish to a Maven repo"
}
}
catch (NumberFormatException e) {
println "Note: could not parse Gradle version - you cannot invoke publish target"
}
//Main class for 'gradle run'
mainClassName = 'org.metacsp.examples.multi.TestTimelinePlotting'
//JDK version
sourceCompatibility = 1.6
targetCompatibility = 1.6
task releaseInfo {
def taskName = project.getGradle().startParameter.taskNames.get(0);
if (taskName.equals("publish")) {
//def cmd = "git describe --tags"
def cmd = "git tag"
def proc = cmd.execute()
def tagArray = proc.text.split("\n")
project.version = tagArray[tagArray.length-1]
}
else {
project.version = '0.0.0-SNAPSHOT'
}
println ("Releasing version: " + project.version + "...")
}
def getSvnRevision() {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'svn'
args = ['info']
standardOutput = os
}
def outputAsString = os.toString()
def matchLastChangedRev = outputAsString =~ /Last Changed Rev: (\d+)/
ext.svnRev = "${matchLastChangedRev[0][1]}".toInteger()
}
return svnRev
}
//MetaCSP version
//version = '1.0.' + getSvnRevision()
//version = '0.0.0-SNAPSHOT'
//group = 'org.metacsp'
project.group = 'org.metacsp'
//Repos for dependencies
repositories {
mavenCentral()
}
dependencies {
//It's all in Maven Central
compile 'org.ow2.sat4j:org.ow2.sat4j.sat:2.3.4'
compile 'net.sf.jung:jung2:2.0.1'
compile 'net.sf.jung:jung-graph-impl:2.0.1'
compile 'net.sf.jung:jung-algorithms:2.0.1'
compile 'net.sf.jung:jung-visualization:2.0.1'
compile 'org.prefuse:prefuse:beta-20071021'
compile 'jfree:jfreechart:1.0.13'
compile 'junit:junit:4.8.1'
compile 'com.googlecode.aima-java:aima-core:0.10.5'
compile 'com.vividsolutions:jts:1.13'
//compile 'com.googlecode.aima-java:aima-core:0.11.0'
}
javadoc {
//destinationDir = file(projectDir.toString() + "/../javadoc")
//imgDir = file(projectDir.toString() + "/..")
project.ext.set("imgDir", projectDir.toString() + "/..")
options.header = "Meta-CSP Framework API"
options.author = 'true'
title = "<table><tr><td align=left><a href=\"http://metacsp.org\" target=_blank><img src=img/meta-csp-logo-small.png></a></td><td> </td><td align=left>The Meta-CSP Framework<br><small><i>A Java API for Meta-CSP based reasoning</i></small></td></tr></table>"
copy {
from(project.imgDir) {
include 'img/*.png'
}
into javadoc.destinationDir
}
}
//create javaDoc jar
task javadocJar (type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
from(projectDir) {
include 'license.txt'
}
}
//create sources jar
task sourceJar (type : Jar) {
classifier = 'sources'
from sourceSets.main.allSource
from(projectDir) {
include 'license.txt'
}
}
//create extra lib jar (Orbital)
//task libJar (type : Jar) {
// def lib = file("lib")
// classifier = 'libs'
// from lib
//}
try {
//publish bin, source and javaDoc to repo
if ((Integer.parseInt(myGradleVersionMajor) > 1) || ((Integer.parseInt(myGradleVersionMajor) == 1) && (Integer.parseInt(myGradleVersionMinor) > 6))) {
publishing {
publications {
metaCSPFramework(MavenPublication) {
from components.java
//================
//== Modify POM ==
//================
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'The MetaCSP Framework'
description 'A Java API for Meta-CSP based reasoning'
url 'http://metacsp.org'
/*
parent {
groupId 'org.sonatype.oss'
//groupId 'org.metacsp'
artifactId 'oss-parent'
version '7'
}*/
scm {
url 'http://metacsp.org'
connection 'scm:git:https://github.com/FedericoPecora/meta-csp-framework.git'
developerConnection 'scm:git:https://github.com/FedericoPecora/meta-csp-framework.git'
}
licenses {
license {
name 'The MIT License'
url 'http://opensource.org/licenses/mit-license.php'
distribution 'repo'
}
}
developers {
developer {
id 'federico.pecora'
name 'Federico Pecora'
email 'federico.pecora@gmail.com'
}
}
}
}
//====================
//== end Modify POM ==
//====================
artifact (javadocJar) {
classifier = 'javadoc'
}
artifact (sourceJar) {
classifier = 'sources'
}
//artifact (libJar) {
// classifier = 'libs'
//}
}
}
repositories {
maven {
url "file:/${project.projectDir}/artifacts"
}
}
}
}
}
catch (NumberFormatException e) { }
defaultTasks 'install'