|
| 1 | +plugins { |
| 2 | + id 'java-library' |
| 3 | + id 'maven-publish' |
| 4 | + id 'signing' |
| 5 | + id 'com.github.spotbugs' version '6.4.8' |
| 6 | +} |
| 7 | + |
| 8 | +group 'com.microsoft' |
| 9 | +version = '1.8.0' |
| 10 | +archivesBaseName = 'durabletask-azure-blob-payloads' |
| 11 | + |
| 12 | +def grpcVersion = '1.78.0' |
| 13 | +def azureCoreVersion = '1.57.1' |
| 14 | +def azureStorageBlobVersion = '12.29.1' |
| 15 | + |
| 16 | +// Java 11 is used to compile and run all tests. Set the JDK_11 env var to your |
| 17 | +// local JDK 11 home directory, e.g. C:/Program Files/Java/openjdk-11.0.12_7/ |
| 18 | +// If unset, falls back to the current JDK running Gradle. |
| 19 | +def rawJdkPath = System.env.JDK_11 ?: System.getProperty("java.home") |
| 20 | +def PATH_TO_TEST_JAVA_RUNTIME = rawJdkPath |
| 21 | +if (rawJdkPath != null) { |
| 22 | + def f = new File(rawJdkPath) |
| 23 | + if (f.isFile()) { |
| 24 | + PATH_TO_TEST_JAVA_RUNTIME = f.parentFile.parentFile.absolutePath |
| 25 | + } |
| 26 | +} |
| 27 | +def isWindows = System.getProperty("os.name").toLowerCase().contains("win") |
| 28 | +def exeSuffix = isWindows ? ".exe" : "" |
| 29 | + |
| 30 | +dependencies { |
| 31 | + api project(':client') |
| 32 | + |
| 33 | + // Azure Storage Blobs |
| 34 | + implementation "com.azure:azure-storage-blob:${azureStorageBlobVersion}" |
| 35 | + |
| 36 | + // TokenCredential abstraction (from azure-core) — 'api' because |
| 37 | + // LargePayloadStorageOptions exposes TokenCredential in its public API. |
| 38 | + api "com.azure:azure-core:${azureCoreVersion}" |
| 39 | + |
| 40 | + // gRPC interceptor API |
| 41 | + implementation "io.grpc:grpc-api:${grpcVersion}" |
| 42 | + implementation "io.grpc:grpc-protobuf:${grpcVersion}" |
| 43 | + implementation "io.grpc:grpc-stub:${grpcVersion}" |
| 44 | + |
| 45 | + // NOTE: azure-identity is NOT included here. Users who need |
| 46 | + // DefaultAzureCredential should add it to their own project. |
| 47 | + |
| 48 | + testImplementation 'org.mockito:mockito-core:5.21.0' |
| 49 | + testImplementation 'org.mockito:mockito-junit-jupiter:5.21.0' |
| 50 | + testImplementation project(':azuremanaged') |
| 51 | +} |
| 52 | + |
| 53 | +compileJava { |
| 54 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 55 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 56 | +} |
| 57 | +compileTestJava { |
| 58 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 59 | + targetCompatibility = JavaVersion.VERSION_11 |
| 60 | + options.fork = true |
| 61 | + options.forkOptions.executable = "${PATH_TO_TEST_JAVA_RUNTIME}/bin/javac${exeSuffix}" |
| 62 | +} |
| 63 | + |
| 64 | +tasks.withType(Test) { |
| 65 | + executable = new File("${PATH_TO_TEST_JAVA_RUNTIME}", "bin/java${exeSuffix}") |
| 66 | +} |
| 67 | + |
| 68 | +test { |
| 69 | + useJUnitPlatform { |
| 70 | + // Skip tests tagged as "integration" since those require |
| 71 | + // external dependencies (DTS emulator + Azurite). |
| 72 | + excludeTags "integration" |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +// Integration tests require DTS emulator (default localhost:4001) and Azurite on localhost:10000. |
| 77 | +task integrationTest(type: Test) { |
| 78 | + useJUnitPlatform { |
| 79 | + includeTags 'integration' |
| 80 | + } |
| 81 | + dependsOn build |
| 82 | + shouldRunAfter test |
| 83 | + testLogging.showStandardStreams = true |
| 84 | + ignoreFailures = false |
| 85 | +} |
| 86 | + |
| 87 | +spotbugs { |
| 88 | + toolVersion = '4.9.8' |
| 89 | + effort = com.github.spotbugs.snom.Effort.valueOf('MAX') |
| 90 | + reportLevel = com.github.spotbugs.snom.Confidence.valueOf('HIGH') |
| 91 | + ignoreFailures = true |
| 92 | + excludeFilter = file('spotbugs-exclude.xml') |
| 93 | +} |
| 94 | + |
| 95 | +spotbugsMain { |
| 96 | + reports { |
| 97 | + html { |
| 98 | + required = true |
| 99 | + stylesheet = 'fancy-hist.xsl' |
| 100 | + } |
| 101 | + xml { |
| 102 | + required = true |
| 103 | + } |
| 104 | + } |
| 105 | +} |
| 106 | + |
| 107 | +spotbugsTest { |
| 108 | + reports { |
| 109 | + html { |
| 110 | + required = true |
| 111 | + stylesheet = 'fancy-hist.xsl' |
| 112 | + } |
| 113 | + xml { |
| 114 | + required = true |
| 115 | + } |
| 116 | + } |
| 117 | +} |
| 118 | + |
| 119 | +publishing { |
| 120 | + repositories { |
| 121 | + maven { |
| 122 | + url "file://$project.rootDir/repo" |
| 123 | + } |
| 124 | + } |
| 125 | + publications { |
| 126 | + mavenJava(MavenPublication) { |
| 127 | + from components.java |
| 128 | + artifactId = archivesBaseName |
| 129 | + pom { |
| 130 | + name = 'Durable Task Azure Blob Payloads for Java' |
| 131 | + description = 'This package provides externalized payload storage using Azure Blob Storage for the Durable Task Java SDK.' |
| 132 | + url = "https://github.com/microsoft/durabletask-java/tree/main/azure-blob-payloads" |
| 133 | + licenses { |
| 134 | + license { |
| 135 | + name = "MIT License" |
| 136 | + url = "https://opensource.org/licenses/MIT" |
| 137 | + distribution = "repo" |
| 138 | + } |
| 139 | + } |
| 140 | + developers { |
| 141 | + developer { |
| 142 | + id = "Microsoft" |
| 143 | + name = "Microsoft Corporation" |
| 144 | + } |
| 145 | + } |
| 146 | + scm { |
| 147 | + connection = "scm:git:https://github.com/microsoft/durabletask-java" |
| 148 | + developerConnection = "scm:git:git@github.com:microsoft/durabletask-java" |
| 149 | + url = "https://github.com/microsoft/durabletask-java/tree/main/azure-blob-payloads" |
| 150 | + } |
| 151 | + withXml { |
| 152 | + project.configurations.compileOnly.allDependencies.each { dependency -> |
| 153 | + asNode().dependencies[0].appendNode("dependency").with { |
| 154 | + it.appendNode("groupId", dependency.group) |
| 155 | + it.appendNode("artifactId", dependency.name) |
| 156 | + it.appendNode("version", dependency.version) |
| 157 | + it.appendNode("scope", "provided") |
| 158 | + } |
| 159 | + } |
| 160 | + } |
| 161 | + } |
| 162 | + } |
| 163 | + } |
| 164 | +} |
| 165 | + |
| 166 | +signing { |
| 167 | + required = !project.hasProperty("skipSigning") |
| 168 | + sign publishing.publications.mavenJava |
| 169 | +} |
| 170 | + |
| 171 | +java { |
| 172 | + withSourcesJar() |
| 173 | + withJavadocJar() |
| 174 | +} |
0 commit comments