|
| 1 | +plugins { |
| 2 | + `java-library` |
| 3 | + `maven-publish` |
| 4 | + signing |
| 5 | + id("antlr") |
| 6 | + id("com.diffplug.spotless") version "5.1.0" |
| 7 | +} |
| 8 | + |
| 9 | +group = "com.strumenta.antlr4-c3" |
| 10 | +version = "1.2.0-SNAPSHOT" |
| 11 | +description = "A code completion core implementation for ANTLR4 based parsers" |
| 12 | + |
| 13 | +java { |
| 14 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 15 | + targetCompatibility = JavaVersion.VERSION_11 |
| 16 | + withSourcesJar() |
| 17 | + withJavadocJar() |
| 18 | +} |
| 19 | + |
| 20 | +repositories { |
| 21 | + mavenCentral() |
| 22 | +} |
| 23 | + |
| 24 | +val junitVersion = "5.14.0" |
| 25 | +val antlrVersion = "4.13.2" |
| 26 | + |
| 27 | +dependencies { |
| 28 | + implementation("org.antlr:antlr4-runtime:$antlrVersion") |
| 29 | + antlr("org.antlr:antlr4:$antlrVersion") |
| 30 | + testImplementation(platform("org.junit:junit-bom:$junitVersion")) |
| 31 | + testImplementation("org.junit.jupiter:junit-jupiter") |
| 32 | + testRuntimeOnly("org.junit.platform:junit-platform-launcher") |
| 33 | +} |
| 34 | + |
| 35 | +tasks.test { |
| 36 | + useJUnitPlatform() |
| 37 | +} |
| 38 | + |
| 39 | +sourceSets { |
| 40 | + named("test") { |
| 41 | + java.srcDir("$buildDir/generated-test-sources/antlr4") |
| 42 | + } |
| 43 | +} |
| 44 | + |
| 45 | +tasks.named<AntlrTask>("generateTestGrammarSource") { |
| 46 | + arguments = arguments + listOf("-visitor", "-listener", "-package", "com.strumenta.antlr4c3") |
| 47 | + outputDirectory = file("$buildDir/generated-test-sources/antlr4") |
| 48 | +} |
| 49 | +tasks.named("compileTestJava").configure { |
| 50 | + dependsOn(tasks.named("generateTestGrammarSource")) |
| 51 | +} |
| 52 | +publishing { |
| 53 | + publications { |
| 54 | + create<MavenPublication>("mavenJava") { |
| 55 | + from(components["java"]) |
| 56 | + |
| 57 | + pom { |
| 58 | + name.set("antlr4-c3") |
| 59 | + description.set(project.description) |
| 60 | + url.set("https://github.com/Strumenta/antlr4-c3-java") |
| 61 | + |
| 62 | + licenses { |
| 63 | + license { |
| 64 | + name.set("MIT License") |
| 65 | + url.set("https://opensource.org/licenses/MIT") |
| 66 | + distribution.set("repo") |
| 67 | + } |
| 68 | + } |
| 69 | + |
| 70 | + scm { |
| 71 | + connection.set("scm:git:strumenta/antlr4-c3-java.git") |
| 72 | + developerConnection.set("scm:git:git@github.com:strumenta/antlr4-c3-java.git") |
| 73 | + url.set("https://github.com/strumenta/antlr4-c3-java.git") |
| 74 | + tag.set("HEAD") |
| 75 | + } |
| 76 | + |
| 77 | + developers { |
| 78 | + developer { |
| 79 | + id.set("nicks") |
| 80 | + name.set("Nick Stephen") |
| 81 | + email.set("nicks _at_ vmware.com") |
| 82 | + organization.set("VMware") |
| 83 | + timezone.set("Europe/Paris") |
| 84 | + } |
| 85 | + developer { |
| 86 | + id.set("tiagobstr") |
| 87 | + name.set("Tiago Baptista") |
| 88 | + email.set("tiago _at_ strumenta.com") |
| 89 | + organization.set("Strumenta") |
| 90 | + timezone.set("Europe/Lisbon") |
| 91 | + } |
| 92 | + developer { |
| 93 | + id.set("ftomassetti") |
| 94 | + name.set("Federico Tomassetti") |
| 95 | + email.set("federico _at_ strumenta.com") |
| 96 | + organization.set("Strumenta") |
| 97 | + timezone.set("Europe/Rome") |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | +} |
| 104 | + |
| 105 | +signing { |
| 106 | + val pub = publishing.publications.findByName("mavenJava") |
| 107 | + if (pub != null && (findProperty("signing.keyId") != null || System.getenv("SIGNING_KEY_ID") != null)) { |
| 108 | + sign(pub) |
| 109 | + } |
| 110 | +} |
0 commit comments