Skip to content

Commit e79b556

Browse files
authored
Merge pull request #1 from Strumenta/chore/publish-to-maven-central
Update configuration
2 parents 5f4b434 + 473e5f0 commit e79b556

16 files changed

Lines changed: 509 additions & 213 deletions

File tree

.github/workflows/check.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Check
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
java: [ '11', '17', '21' ]
12+
name: Java ${{ matrix.Java }} Check
13+
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Setup java
17+
uses: actions/setup-java@v2
18+
with:
19+
distribution: 'adopt'
20+
java-version: ${{ matrix.java }}
21+
- name: Test
22+
env:
23+
STRUMENTA_PACKAGES_USER: ${{ secrets.STRUMENTA_PACKAGES_USER }}
24+
STRUMENTA_PACKAGES_TOKEN: ${{ secrets.STRUMENTA_PACKAGES_TOKEN }}
25+
run: ./gradlew check --stacktrace

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.idea
2+
build
3+
.gradle

build.gradle.kts

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
plugins {
2+
`java-library`
3+
alias(libs.plugins.vanniktech.publish)
4+
signing
5+
id("antlr")
6+
id("com.diffplug.spotless") version "5.1.0"
7+
id("net.researchgate.release") version "3.0.2"
8+
}
9+
10+
group = "com.strumenta.antlr4-c3"
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+
}
18+
19+
repositories {
20+
mavenCentral()
21+
}
22+
23+
val junitVersion = "5.14.0"
24+
val antlrVersion = "4.13.2"
25+
26+
dependencies {
27+
implementation("org.antlr:antlr4-runtime:$antlrVersion")
28+
antlr("org.antlr:antlr4:$antlrVersion")
29+
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
30+
testImplementation("org.junit.jupiter:junit-jupiter")
31+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
32+
}
33+
34+
tasks.test {
35+
useJUnitPlatform()
36+
}
37+
38+
sourceSets {
39+
named("test") {
40+
java.srcDir("$buildDir/generated-test-sources/antlr4")
41+
}
42+
}
43+
44+
tasks.named<AntlrTask>("generateTestGrammarSource") {
45+
arguments = arguments + listOf("-visitor", "-listener", "-package", "com.strumenta.antlr4c3")
46+
outputDirectory = file("$buildDir/generated-test-sources/antlr4")
47+
}
48+
tasks.named("compileTestJava").configure {
49+
dependsOn(tasks.named("generateTestGrammarSource"))
50+
}
51+
52+
mavenPublishing {
53+
publishToMavenCentral()
54+
signAllPublications()
55+
56+
pom {
57+
name.set("antlr4-c3")
58+
description.set(project.description)
59+
url.set("https://github.com/Strumenta/antlr4-c3-java")
60+
61+
licenses {
62+
license {
63+
name.set("MIT License")
64+
url.set("https://opensource.org/licenses/MIT")
65+
distribution.set("repo")
66+
}
67+
}
68+
69+
scm {
70+
connection.set("scm:git:strumenta/antlr4-c3-java.git")
71+
developerConnection.set("scm:git:git@github.com:strumenta/antlr4-c3-java.git")
72+
url.set("https://github.com/strumenta/antlr4-c3-java.git")
73+
tag.set("HEAD")
74+
}
75+
76+
developers {
77+
developer {
78+
id.set("nicks")
79+
name.set("Nick Stephen")
80+
email.set("nicks _at_ vmware.com")
81+
organization.set("VMware")
82+
timezone.set("Europe/Paris")
83+
}
84+
developer {
85+
id.set("tiagobstr")
86+
name.set("Tiago Baptista")
87+
email.set("tiago _at_ strumenta.com")
88+
organization.set("Strumenta")
89+
timezone.set("Europe/Lisbon")
90+
}
91+
developer {
92+
id.set("ftomassetti")
93+
name.set("Federico Tomassetti")
94+
email.set("federico _at_ strumenta.com")
95+
organization.set("Strumenta")
96+
timezone.set("Europe/Rome")
97+
}
98+
}
99+
}
100+
}
101+
102+
signing {
103+
val pub = publishing.publications.findByName("mavenJava")
104+
if (pub != null && (findProperty("signing.keyId") != null || System.getenv("SIGNING_KEY_ID") != null)) {
105+
sign(pub)
106+
}
107+
}
108+
109+
release {
110+
buildTasks = listOf("publish")
111+
versionPropertyFile = "./gradle.properties"
112+
git {
113+
requireBranch.set("main")
114+
pushToRemote.set("origin")
115+
}
116+
}
117+
118+
tasks.named("sourcesJar").configure {
119+
dependsOn(tasks.named("generateGrammarSource"))
120+
}
121+
//tasks.named("generateMetadataFileForMavenPublication").configure {
122+
// dependsOn(tasks.named("plainJavadocJar"))
123+
//}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version=1.2.0-SNAPSHOT

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[plugins]
2+
vanniktech-publish = { id = "com.vanniktech.maven.publish", version = "0.34.0" }

gradle/wrapper/gradle-wrapper.jar

42.7 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)