|
| 1 | +plugins { |
| 2 | + id 'java-library' |
| 3 | + id 'maven-publish' |
| 4 | + id 'signing' |
| 5 | + id "com.diffplug.spotless" version "6.13.0" |
| 6 | +} |
| 7 | + |
| 8 | +group = 'cloud.eppo' |
| 9 | +version = '2.5.0-SNAPSHOT' |
| 10 | +ext.isReleaseVersion = !version.endsWith("SNAPSHOT") |
| 11 | + |
| 12 | +import org.apache.tools.ant.filters.ReplaceTokens |
| 13 | + |
| 14 | +processResources { |
| 15 | + with copySpec { |
| 16 | + from 'src/main/filteredResources' |
| 17 | + filter(ReplaceTokens, tokens: [version: project.properties.version]) |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +repositories { |
| 22 | + mavenCentral() |
| 23 | + mavenLocal() |
| 24 | + maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } |
| 25 | +} |
| 26 | + |
| 27 | +dependencies { |
| 28 | + implementation 'cloud.eppo:sdk-common-jvm:1.0.0' |
| 29 | + implementation 'com.github.zafarkhaja:java-semver:0.10.2' |
| 30 | + implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.1' |
| 31 | + implementation 'org.apache.httpcomponents:httpclient:4.5.14' |
| 32 | + implementation 'org.ehcache:ehcache:3.9.8' |
| 33 | + implementation 'org.slf4j:slf4j-api:2.0.13' |
| 34 | + // Logback classic 1.3.x is compatible with java 8 |
| 35 | + implementation 'ch.qos.logback:logback-classic:1.3.14' |
| 36 | + |
| 37 | + testImplementation 'org.projectlombok:lombok:1.18.24' |
| 38 | + testImplementation platform('org.junit:junit-bom:5.10.0') |
| 39 | + testImplementation 'org.junit.jupiter:junit-jupiter' |
| 40 | + testImplementation 'com.github.tomakehurst:wiremock-jre8:2.35.2' |
| 41 | + testImplementation 'org.mockito:mockito-core:4.11.0' |
| 42 | +} |
| 43 | + |
| 44 | +test { |
| 45 | + useJUnitPlatform() |
| 46 | +} |
| 47 | + |
| 48 | +spotless { |
| 49 | + ratchetFrom 'origin/main' |
| 50 | + |
| 51 | + format 'misc', { |
| 52 | + // define the files to apply `misc` to |
| 53 | + target '*.gradle', '.gitattributes', '.gitignore' |
| 54 | + |
| 55 | + // define the steps to apply to those files |
| 56 | + trimTrailingWhitespace() |
| 57 | + indentWithSpaces(2) // or spaces. Takes an integer argument if you don't like 4 |
| 58 | + endWithNewline() |
| 59 | + } |
| 60 | + java { |
| 61 | + // apply a specific flavor of google-java-format |
| 62 | + googleJavaFormat('1.7') |
| 63 | + // fix formatting of type annotations |
| 64 | + formatAnnotations() |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +java { |
| 69 | + withJavadocJar() |
| 70 | + withSourcesJar() |
| 71 | +} |
| 72 | + |
| 73 | +publishing { |
| 74 | + publications { |
| 75 | + mavenJava(MavenPublication) { |
| 76 | + artifactId = 'eppo-server-sdk' |
| 77 | + from components.java |
| 78 | + versionMapping { |
| 79 | + usage('java-api') { |
| 80 | + fromResolutionOf('runtimeClasspath') |
| 81 | + } |
| 82 | + usage('java-runtime') { |
| 83 | + fromResolutionResult() |
| 84 | + } |
| 85 | + } |
| 86 | + pom { |
| 87 | + name = 'Eppo JVM SDK' |
| 88 | + description = 'Eppo SDK for JVM' |
| 89 | + url = 'https://github.com/Eppo-exp/java-server-sdk' |
| 90 | + licenses { |
| 91 | + license { |
| 92 | + name = 'MIT License' |
| 93 | + url = 'http://www.opensource.org/licenses/mit-license.php' |
| 94 | + } |
| 95 | + } |
| 96 | + developers { |
| 97 | + developer { |
| 98 | + name = 'Eppo' |
| 99 | + email = 'https://geteppo.com' |
| 100 | + } |
| 101 | + } |
| 102 | + scm { |
| 103 | + connection = 'scm:git:git://github.com/Eppo-exp/java-server-sdk' |
| 104 | + developerConnection = 'scm:git:ssh://github.com/Eppo-exp/java-server-sdk' |
| 105 | + url = 'http://github.com/Eppo-exp/java-server-sdk' |
| 106 | + } |
| 107 | + } |
| 108 | + } |
| 109 | + } |
| 110 | + repositories { |
| 111 | + maven { |
| 112 | + def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" |
| 113 | + def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" |
| 114 | + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl |
| 115 | + credentials { |
| 116 | + username = ossrhUsername |
| 117 | + password = ossrhPassword |
| 118 | + } |
| 119 | + } |
| 120 | + } |
| 121 | +} |
| 122 | + |
| 123 | +signing { |
| 124 | + sign publishing.publications.mavenJava |
| 125 | + if (System.env['CI']) { |
| 126 | + useInMemoryPgpKeys(System.env.GPG_PRIVATE_KEY, System.env.GPG_PASSPHRASE) |
| 127 | + } |
| 128 | +} |
| 129 | + |
| 130 | + |
| 131 | +javadoc { |
| 132 | + if (JavaVersion.current().isJava9Compatible()) { |
| 133 | + options.addBooleanOption('html5', true) |
| 134 | + } |
| 135 | +} |
0 commit comments