Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish jars to maven central #372

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ jobs:
- name: Check Formatting
run: ./gradlew spotlessCheck

javadoc:
name: Validate Javadoc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Check Formatting
run: ./gradlew javadoc

build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,25 @@ jobs:
tag: ${{ needs.release_drafter.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}

publish-maven:
needs: [ release-drafter ]
name: Release Maven Artifacts
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
release-maven-central:
name: Release to Maven Central
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Publish Artifacts
run: ./gradlew publish
- name: Publish with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}
run: ./gradlew publishToSonatype --no-daemon
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
id 'java-library'
id 'org.sonarqube' version '3.4.0.2513'
id "com.diffplug.spotless" version "6.2.0"
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
}

ext {
Expand Down Expand Up @@ -111,6 +113,15 @@ task testReport(type: TestReport) {
reportOn subprojects.collect { it.tasks.withType(Test) }
}

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}

sonarqube {
properties {
property "sonar.projectKey", "MarkusAmshove_natls"
Expand Down
55 changes: 41 additions & 14 deletions libs/natlint/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,54 @@ shadowJar {
jar {
manifest {
attributes(
'Main-Class': 'org.amshove.natlint.App',
'Implementation-Title': project.name,
'Implementation-Version': project.version
'Main-Class': 'org.amshove.natlint.App',
'Implementation-Title': project.name,
'Implementation-Version': project.version
)
}
}

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications {
maven(MavenPublication) {
mavenNatlint(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/markusamshove/natls"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
pom {
name = project.name
description = 'Static code analysis for Software AGs Natural language'
url = 'https://github.com/MarkusAmshove/natls'
scm {
connection = 'scm:git:https://github.com/MarkusAmshove/natls.git'
developerConnection = 'scm:git:git@github.com:MarkusAmshove/natls.git'
url = 'https://github.com/MarkusAmshove/natls'
}

licenses {
license {
name = 'MIT'
url = 'https://github.com/MarkusAmshove/natls/blob/main/LICENSE'
}
}

developers {
developer {
id = 'markusamshove'
name = 'Markus Amshove'
}
}
}
}
}
}
}

signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenNatlint
}

24 changes: 3 additions & 21 deletions libs/natls/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '5.2.0' // do not update unless https://github.com/johnrengelman/shadow/issues/651 is fixed
}

Expand Down Expand Up @@ -27,27 +26,10 @@ configurations.testImplementation {
jar {
manifest {
attributes(
'Main-Class': 'org.amshove.natls.App',
'Implementation-Title': project.name,
'Implementation-Version': project.version
'Main-Class': 'org.amshove.natls.App',
'Implementation-Title': project.name,
'Implementation-Version': project.version
)
}
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/markusamshove/natls"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import java.util.Set;

/**
* Cache of module references base on the {@linkplain ModuleReferenceParser}.</br>
* This is built during indexing phase of a project.</br>
* Cache of module references base on the {@linkplain ModuleReferenceParser}.<br/>
* This is built during indexing phase of a project.<br/>
* Entries will be evicted one a module gets parsed, as the referencing will then be done by the actual
* {@linkplain org.amshove.natparse.parsing.NaturalParser}
*/
Expand Down Expand Up @@ -40,7 +40,7 @@ public static Set<IPosition> retrieveCachedPositions(LanguageServerFile calledFi
}

/**
* Evicts all cache entries pointing to the given file.</br>
* Evicts all cache entries pointing to the given file.<br/>
*/
public static synchronized void evictMyReferences(LanguageServerFile callingFile)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public enum ParseStrategy
{
/**
* Tells the parser to also parse all dependants <strong>if needed</strong>.</br>
* Tells the parser to also parse all dependants <strong>if needed</strong>.<br/>
* The parser will determine itself if the callers have to be parsed.
*/
WITH_CALLERS,
Expand Down
63 changes: 45 additions & 18 deletions libs/natparse/build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,57 @@
plugins {
id 'maven-publish'
id 'maven-publish'
}

dependencies {
implementation libraries.dom4j

testImplementation libraries.mockito
testImplementation libraries.archUnit
testImplementation libraries.slf4j_nop
testImplementation project(':testhelpers')
}

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications {
maven(MavenPublication) {
mavenNatparse(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/markusamshove/natls"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
pom {
name = project.name
url = 'https://github.com/MarkusAmshove/natls'
description = 'Parser for Software AGs Natural language'
scm {
connection = 'scm:git:https://github.com/MarkusAmshove/natls.git'
developerConnection = 'scm:git:git@github.com:MarkusAmshove/natls.git'
url = 'https://github.com/MarkusAmshove/natls'
}

licenses {
license {
name = 'MIT'
url = 'https://github.com/MarkusAmshove/natls/blob/main/LICENSE'
}
}

developers {
developer {
id = 'markusamshove'
name = 'Markus Amshove'
}
}
}
}
}
}

dependencies {
implementation libraries.dom4j

testImplementation libraries.mockito
testImplementation libraries.archUnit
testImplementation libraries.slf4j_nop
testImplementation project(':testhelpers')
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenNatparse
}

Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public String symbolName()
}

/**
* Returns the token source as symbol name (all uppercase) trimmed to the given length.</br>
* This is useful to compare e.g. subroutine names which only have 32 significant characters.</br>
* Returns the token source as symbol name (all uppercase) trimmed to the given length.<br/>
* This is useful to compare e.g. subroutine names which only have 32 significant characters.<br/>
* The resulting name will not contain trailing space.
*/
public String trimmedSymbolName(int maxLength)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public SyntaxToken peek(int offset)
}

/**
* Peeks the token kinds of the following tokens and returns true if they're in the given order.</br>
* Peeks the token kinds of the following tokens and returns true if they're in the given order.<br/>
* Returns false if either the order or the amount of following tokens doesn't match.
*/
public boolean peekKinds(SyntaxKind... kinds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ default boolean isUpperUnbound()
}

/**
* This indicates that the upper bound is V for PDAs, not that the upper bound is a variable.</br>
* This indicates that the upper bound is V for PDAs, not that the upper bound is a variable.<br/>
* <a href=
* "https://documentation.softwareag.com/natural/nat912win/sm/defineda_array.htm#Variable_Arrays_in_a_Parameter_Data_Area">Documentation</a>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ default boolean isAlphaNumericFamily()
}

/**
* Determines if this type fits into the given type. Implicit conversion is taken into account.</br>
* Determines if this type fits into the given type. Implicit conversion is taken into account.<br/>
* <strong>This does not compare by byte size</strong>
*/
default boolean fitsInto(IDataType target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public interface IDefineData extends ISyntaxNode
ReadOnlyList<IUsingNode> globalUsings();

/**
* Returns all {@link IParameterDefinitionNode} in order they've been declared.</br>
* This includes `PARAMETER 1...` and `PARAMETER USING ...` in order. </br>
* Returns all {@link IParameterDefinitionNode} in order they've been declared.<br/>
* This includes `PARAMETER 1...` and `PARAMETER USING ...` in order. <br/>
*
* `USING`s are not "exploded", which means the variables from within the `USING` are not included.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum ComparisonOperator

/**
* Maps a single SyntaxKind to a comparison operator.<br/>
* If multiple SyntaxKinds can result in the same comparison (e.g. GREATER vs GREATER THAN), this returns null.</br>
* If multiple SyntaxKinds can result in the same comparison (e.g. GREATER vs GREATER THAN), this returns null.<br/>
* Nullable because it's used in the hot path.
*/
public static @Nullable ComparisonOperator ofSyntaxKind(SyntaxKind kind)
Expand Down