|
| 1 | +plugins { |
| 2 | + java |
| 3 | + `maven-publish` |
| 4 | +} |
| 5 | + |
| 6 | +val semver: String by project |
| 7 | +val packageGroup = "li.cil.sedna" |
| 8 | + |
| 9 | +fun getGitRef(): String { |
| 10 | + return providers.exec { |
| 11 | + commandLine("git", "rev-parse", "--short", "HEAD") |
| 12 | + isIgnoreExitValue = true |
| 13 | + }.standardOutput.asText.get().trim() |
| 14 | +} |
| 15 | + |
| 16 | +version = "${semver}+${getGitRef()}" |
| 17 | +group = packageGroup |
| 18 | + |
| 19 | +java.toolchain.languageVersion = JavaLanguageVersion.of(17) |
| 20 | + |
| 21 | +repositories { |
| 22 | + mavenCentral() |
| 23 | + maven { |
| 24 | + url = uri("https://maven.pkg.github.com/fnuecke/ceres") |
| 25 | + credentials { |
| 26 | + username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") |
| 27 | + password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") |
| 28 | + } |
| 29 | + content { includeGroup("li.cil.ceres") } |
| 30 | + } |
| 31 | +} |
| 32 | + |
| 33 | +dependencies { |
| 34 | + compileOnly("com.google.code.findbugs:jsr305:3.0.2") |
| 35 | + testCompileOnly("com.google.code.findbugs:jsr305:3.0.2") |
| 36 | + |
| 37 | + implementation("commons-io:commons-io:2.11.0") |
| 38 | + implementation("it.unimi.dsi:fastutil:8.5.6") |
| 39 | + implementation("org.apache.commons:commons-lang3:3.12.0") |
| 40 | + implementation("org.apache.logging.log4j:log4j-api:2.15.0") |
| 41 | + implementation("org.apache.logging.log4j:log4j-core:2.15.0") |
| 42 | + implementation("org.ow2.asm:asm-commons:9.1") |
| 43 | + implementation("org.ow2.asm:asm:9.1") |
| 44 | + |
| 45 | + implementation("li.cil.ceres:ceres:0.0.4") |
| 46 | + |
| 47 | + testImplementation("org.mockito:mockito-core:4.1.0") |
| 48 | + testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") |
| 49 | + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2") |
| 50 | +} |
| 51 | + |
| 52 | +publishing { |
| 53 | + publications { |
| 54 | + create<MavenPublication>("mavenJava") { |
| 55 | + groupId = packageGroup |
| 56 | + artifactId = project.name |
| 57 | + version = semver |
| 58 | + from(components["java"]) |
| 59 | + } |
| 60 | + } |
| 61 | + repositories { |
| 62 | + maven { |
| 63 | + name = "GitHubPackages" |
| 64 | + url = uri(System.getenv("GITHUB_MAVEN_URL") ?: "") |
| 65 | + credentials { |
| 66 | + username = System.getenv("GITHUB_ACTOR") |
| 67 | + password = System.getenv("GITHUB_TOKEN") |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +tasks.test { |
| 74 | + useJUnitPlatform() |
| 75 | +} |
0 commit comments