-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
129 lines (110 loc) · 3.51 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
/* Copyright 2018 ChemAxon Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This 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/4.8.1/userguide/java_library_plugin.html
*/
plugins {
id 'java-library'
id 'eclipse'
}
def version = project.hasProperty('release')?project.getProperty('release'):'+'
dependencies {
implementation ("com.chemaxon:jchem-main:${version}") {
exclude group: 'com.oracle.jdbc', module: 'ojdbc8'
}
// https://mvnrepository.com/artifact/junit/junit
testImplementation group: 'junit', name: 'junit', version: '4.12'
// https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testImplementation 'org.mockito:mockito-core:2.19.0'
}
repositories {
jcenter()
maven {
credentials {
//set this in gradle.properties
username chemaxonUser
//set this in gradle.properties
password chemaxonPassword
}
url chemaxonRepository
}
}
test {
environment 'CHEMAXON_HOME', file('cxn_home').getAbsolutePath()
maxHeapSize = "2g"
}
def mains = [
'search.DuplicateSearchExample',
'search.MemorySearchExample',
'search.StandardizedMolSearchExample',
'search.db.AsyncSearchExample',
'search.db.CalculatedColumnsSearchExample',
'search.db.ChemicalTermsFilteringExample',
'search.db.DatabaseImportExample',
'search.db.DiverseSelectionExample',
'search.db.MultipleQueriesExample',
'search.db.ReactionSimilaritySearchExample',
'search.db.RetrievingDatabaseFieldsExample',
'search.db.SearchTypesExample',
'search.db.SearchWithFilterQueryExample',
'search.db.SimilaritySearchExample',
'search.db.SortedSearchExample',
'search.hitdisplay.HitColoringExample',
'search.hitdisplay.PartialCleanExample',
'search.hitdisplay.RotateDatabaseHitsExample',
'search.hitdisplay.RotateExample'
]
mains.each { className ->
task "${getTaskNameFromClass(className)}" (type: JavaExec) {
classpath=sourceSets.main.runtimeClasspath
main=className
environment "CHEMAXON_HOME", file('cxn_home').getAbsolutePath()
group 'example'
}
}
task runAllExamples {
group 'Run all examples'
mains.each {
dependsOn getTaskNameFromClass(it)
}
}
if(findCxlFiles().isEmpty()) {
throw new GradleException("cxn_home folder has no license, gardle can not run! Please copy license.cxl to cxn_home folder");
}
def findCxlFiles() {
File cxnHome=file('cxn_home')
return findCxlFiles(cxnHome)
}
def findCxlFiles(File file) {
def result = []
if(file.isDirectory()) {
file.listFiles().each{ File f ->
if(f.isDirectory()) {
result.addAll(findCxlFiles(f));
} else if(f.getName().endsWith('.cxl')) {
result.add(f);
}
}
}
return result
}
def getTaskNameFromClass(String className) {
return "run${className.split('\\.')[-1]}"
}