-
Notifications
You must be signed in to change notification settings - Fork 466
Expand file tree
/
Copy pathbuild.gradle
More file actions
183 lines (164 loc) · 5.9 KB
/
build.gradle
File metadata and controls
183 lines (164 loc) · 5.9 KB
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
/****************************************************************
* 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
*
* Default profile (no -PbuildProfile specified): jre26
* Requires JDK 26+ installed to build without specifying a profile.
*
* For Excluding Groups in command line:
* PS> gradle build -PbuildProfile=jre11 "-PexcludedGroups=['xSQLv15','xGradle']"
****************************************************************/
plugins {
id 'java'
}
version = '13.5.0'
def releaseExt = '-preview'
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','vectorTest','JSONTest','vectorFloat16Test','legacyFx','legacyFx_Xa')
}
}
// Common configuration for all JDBC 4.3 profiles (JRE 11+)
def jdbc43Profiles = ['jre11', 'jre17', 'jre21', 'jre25', 'jre26']
def currentProfile = hasProperty('buildProfile') ? buildProfile : 'jre26' // Default to latest JRE profile if not specified
// Apply common configuration for JDBC 4.3 profiles
if (jdbc43Profiles.contains(currentProfile)) {
jreVersion = currentProfile
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
jar {
manifest {
attributes 'Automatic-Module-Name': 'com.microsoft.sqlserver.jdbc'
}
}
// Set Java version based on profile
def versionMap = [
'jre11': JavaVersion.VERSION_11,
'jre17': JavaVersion.VERSION_17,
'jre21': JavaVersion.VERSION_21,
'jre25': JavaVersion.VERSION_25,
'jre26': JavaVersion.VERSION_26
]
java {
sourceCompatibility = versionMap[currentProfile]
targetCompatibility = versionMap[currentProfile]
}
test {
useJUnitPlatform {
excludeTags(hasProperty('excludedGroups') ? excludedGroups : 'vectorTest','JSONTest','vectorFloat16Test', 'legacyFx','legacyFx_Xa')
}
}
}
if (currentProfile == "jre8") {
jreVersion = "jre8"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
test {
useJUnitPlatform {
excludeTags (hasProperty('excludedGroups') ? excludedGroups : 'xSQLv15','xGradle','NTLM','reqExternalSetup','MSI','clientCertAuth','fedAuth','xJDBC42','vectorTest','JSONTest','vectorFloat16Test','legacyFx','legacyFx_Xa')
}
}
}
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.10.5',
'com.azure:azure-identity:1.18.2',
'org.antlr:antlr4-runtime:4.9.1',
'com.google.code.gson:gson:2.11.0',
'org.bouncycastle:bcprov-jdk18on:1.79',
'org.bouncycastle:bcpkix-jdk18on:1.79'
testImplementation 'org.junit.platform:junit-platform-console:1.11.4',
'org.junit.platform:junit-platform-commons:1.11.4',
'org.junit.platform:junit-platform-engine:1.11.4',
'org.junit.platform:junit-platform-launcher:1.11.4',
'org.junit.platform:junit-platform-runner:1.11.4',
'org.junit.platform:junit-platform-surefire-provider:1.3.2',
'org.junit.jupiter:junit-jupiter-api:5.11.4',
'org.junit.jupiter:junit-jupiter-engine:5.11.4',
'org.junit.jupiter:junit-jupiter-params:5.11.4',
'com.zaxxer:HikariCP:3.4.2',
'org.apache.commons:commons-dbcp2:2.13.0',
'org.slf4j:slf4j-nop:1.7.36',
'org.antlr:antlr4-runtime:4.9.3',
'org.eclipse.gemini.blueprint:gemini-blueprint-mock:3.0.0.M01',
'com.google.code.gson:gson:2.11.0',
'org.bouncycastle:bcprov-jdk18on:1.79',
'com.azure:azure-security-keyvault-keys:4.10.5',
'com.azure:azure-identity:1.18.2',
'com.h2database:h2:2.2.220'
// Mockito and Byte Buddy dependencies based on JRE version
if (hasProperty('buildProfile') && buildProfile == "jre8") {
// JRE 8 profile
testImplementation 'org.mockito:mockito-core:4.11.0',
'org.mockito:mockito-inline:4.11.0',
'net.bytebuddy:byte-buddy:1.15.11',
'net.bytebuddy:byte-buddy-agent:1.15.11'
} else if (hasProperty('buildProfile') && (buildProfile == "jre25" || buildProfile == "jre26")) {
// JRE 25 and 26 profile (uses same versions)
testImplementation 'org.mockito:mockito-core:5.20.0',
'net.bytebuddy:byte-buddy:1.18.2',
'net.bytebuddy:byte-buddy-agent:1.18.2'
} else {
// JRE 11, 17, 21 profiles (all use same versions)
testImplementation 'org.mockito:mockito-core:5.14.2',
'net.bytebuddy:byte-buddy:1.17.5',
'net.bytebuddy:byte-buddy-agent:1.17.5'
}
}