-
Notifications
You must be signed in to change notification settings - Fork 423
/
build.gradle
171 lines (153 loc) · 4.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
/****************************************************************
* Gradle Scipt for Building Microsoft JDBC Driver for SQL Server
****************************************************************
* Instruction for Building JDBC Driver:
* For building particular version of the driver, use commands:
* jreXX - - PS> gradle build -PbuildProfile=jreXX
*
* For Excluding Groups in command line:
* PS> gradle build -PbuildProfile=jre11 "-PexcludedGroups=['xSQLv15','xGradle']"
****************************************************************/
apply plugin: 'java'
version = '12.8.0'
def releaseExt = ''
def jreVersion = ""
def testOutputDir = file("build/classes/java/test")
def archivesBaseName = 'mssql-jdbc'
def excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
allprojects {
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Test) {
systemProperty "file.encoding", "UTF-8"
}
}
test {
useJUnitPlatform {
excludeTags (hasProperty('excludedGroups') ? excludedGroups : 'xSQLv15','xGradle','reqExternalSetup','NTLM','MSI','clientCertAuth','fedAuth','kerberos')
}
}
if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile == "jre22")) {
jreVersion = "jre22"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
jar {
manifest {
attributes 'Automatic-Module-Name': 'com.microsoft.sqlserver.jdbc'
}
}
sourceCompatibility = 22
targetCompatibility = 22
}
if (hasProperty('buildProfile') && buildProfile == "jre21") {
jreVersion = "jre21"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
jar {
manifest {
attributes 'Automatic-Module-Name': 'com.microsoft.sqlserver.jdbc'
}
}
sourceCompatibility = 21
targetCompatibility = 21
}
if (hasProperty('buildProfile') && buildProfile == "jre17") {
jreVersion = "jre17"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
jar {
manifest {
attributes 'Automatic-Module-Name': 'com.microsoft.sqlserver.jdbc'
}
}
sourceCompatibility = 17
targetCompatibility = 17
}
if (hasProperty('buildProfile') && buildProfile == "jre11") {
jreVersion = "jre11"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
jar {
manifest {
attributes 'Automatic-Module-Name': 'com.microsoft.sqlserver.jdbc'
}
}
sourceCompatibility = 11
targetCompatibility = 11
}
if(hasProperty('buildProfile') && buildProfile == "jre8") {
jreVersion = "jre8"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
test {
useJUnitPlatform {
excludeTags (hasProperty('excludedGroups') ? excludedGroups : 'xSQLv15','xGradle','NTLM','reqExternalSetup','MSI','clientCertAuth','fedAuth','xJDBC42')
}
}
}
jar.archiveFileName = "${archivesBaseName}-${version}.${jreVersion}${releaseExt}.jar"
jar {
manifest {
attributes 'Title': "Microsoft JDBC Driver ${archiveVersion} for SQL Server",
'Version': archiveVersion,
'Vendor': 'Microsoft Corporation'
}
}
sourceSets {
main {
java {
srcDirs 'src/main/java'
exclude excludedFile
}
resources {
srcDirs "$projectDir"
include 'META-INF/services/java.sql.Driver'
}
}
test {
resources {
srcDirs "AE_Certificates"
output.resourcesDir = testOutputDir
}
}
}
task copyFiles(type: Copy) {
dependsOn "processTestResources"
from 'build/resources/test'
into 'build/classes/java/test'
include '**/*.*'
}
test {
dependsOn "copyFiles"
}
//Get dependencies from Maven central repository
repositories {
mavenCentral()
}
dependencies {
implementation 'org.osgi:org.osgi.core:6.0.0',
'org.osgi:org.osgi.service.jdbc:1.1.0'
compileOnly 'com.azure:azure-security-keyvault-keys:4.7.3',
'com.azure:azure-identity:1.12.2',
'org.antlr:antlr4-runtime:4.9.3',
'com.google.code.gson:gson:2.10.1',
'org.bouncycastle:bcprov-jdk18on:1.78',
'org.bouncycastle:bcpkix-jdk18on:1.78'
testImplementation 'org.junit.platform:junit-platform-console:1.5.2',
'org.junit.platform:junit-platform-commons:1.5.2',
'org.junit.platform:junit-platform-engine:1.5.2',
'org.junit.platform:junit-platform-launcher:1.5.2',
'org.junit.platform:junit-platform-runner:1.5.2',
'org.junit.platform:junit-platform-surefire-provider:1.3.2',
'org.junit.jupiter:junit-jupiter-api:5.8.2',
'org.junit.jupiter:junit-jupiter-engine:5.8.2',
'org.junit.jupiter:junit-jupiter-params:5.8.2',
'com.zaxxer:HikariCP:3.4.2',
'org.apache.commons:commons-dbcp2:2.7.0',
'org.slf4j:slf4j-nop:1.7.30',
'org.antlr:antlr4-runtime:4.9.3',
'org.eclipse.gemini.blueprint:gemini-blueprint-mock:2.1.0.RELEASE',
'com.google.code.gson:gson:2.10.1',
'org.bouncycastle:bcprov-jdk18on:1.78',
'com.azure:azure-security-keyvault-keys:4.7.3',
'com.azure:azure-identity:1.12.2',
'com.h2database:h2:2.2.220'
}