Skip to content
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/dependency-submission.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Dependency Submission

on: [ push ]

permissions:
contents: write

jobs:
dependency-submission:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v5
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v5
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
distribution: temurin
java-version: 17.0.16
- uses: gradle/actions/setup-gradle@v5
- run: "./gradlew publishAggregationToCentralPortal -Psign=true"
- run: "./gradlew publishAggregationToCentralPortal"
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
105 changes: 12 additions & 93 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
plugins {
val nmcpVersion = "1.2.0"
val mavenPluginDevVersion = "1.0.3"
plugins { id("org.gradlex.maven-plugin-development") version "1.0.3" }

id("com.gradleup.nmcp") version nmcpVersion
id("com.gradleup.nmcp.aggregation") version nmcpVersion
id("org.gradlex.maven-plugin-development") version mavenPluginDevVersion
id("maven-publish")
id("signing")
id("checkstyle")
}

group = "org.gradlex"
version = "1.2"

val mvnVersion = "3.9.11"
Expand All @@ -21,98 +10,28 @@ dependencies {
compileOnly("org.apache.maven:maven-core:$mvnVersion")
compileOnly("org.apache.maven:maven-plugin-api:$mvnVersion")
compileOnly("org.apache.maven.plugin-tools:maven-plugin-annotations:3.15.2")

nmcpAggregation(project(path))
}

mavenPlugin {
name = "Gradle Module Metadata Maven Plugin"
description = "A Maven plugin to publish Gradle Module Metadata"
helpMojoPackage = "org.gradlex.maven.gmm"
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
withSourcesJar()
withJavadocJar()
}

tasks.compileJava {
options.release = 8
options.compilerArgs.add("-Werror")
configurations.api {
withDependencies { clear() } // remove gradleApi() dependency
}

tasks.javadoc {
options {
this as StandardJavadocDocletOptions
addStringOption("Xdoclint:all,-missing", "-Xwerror")
tags(
"goal:a:Goal:",
"requiresProject:a:Requires Project:",
"threadSafe:a:Thread Safe:"
)
}
}

@Suppress("UnstableApiUsage")
testing.suites.named<JvmTestSuite>("test") {
useJUnitJupiter()
dependencies {
implementation(gradleTestKit())
implementation("org.assertj:assertj-core:3.27.6")
}
}

publishing {
publications.register<MavenPublication>("mavenPlugin") {
from(components["java"])
pom {
name = mavenPlugin.name
description = mavenPlugin.description
url = "https://github.com/gradlex-org/gradle-module-metadata-maven-plugin"
licenses {
license {
name = "Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
scm {
connection = "scm:git:git://github.com/gradlex-org/gradle-module-metadata-maven-plugin.git"
developerConnection = "scm:git:git://github.com/gradlex-org/gradle-module-metadata-maven-plugin.git"
url = "https://github.com/gradlex-org/gradle-module-metadata-maven-plugin"
}
developers {
developer {
name = "Jendrik Johannes"
email = "[email protected]"
}
}
}
tags("goal:a:Goal:", "requiresProject:a:Requires Project:", "threadSafe:a:Thread Safe:")
}
}

signing {
if (providers.gradleProperty("sign").getOrElse("false").toBoolean()) {
useInMemoryPgpKeys(
providers.environmentVariable("SIGNING_KEY").getOrNull(),
providers.environmentVariable("SIGNING_PASSPHRASE").getOrNull()
)
sign(publishing.publications["mavenPlugin"])
}
mavenPlugin {
name = "Gradle Module Metadata Maven Plugin"
description = "A Maven plugin to publish Gradle Module Metadata"
helpMojoPackage = "org.gradlex.maven.gmm"
}

nmcpAggregation {
centralPortal {
username = providers.environmentVariable("MAVEN_CENTRAL_USERNAME")
password = providers.environmentVariable("MAVEN_CENTRAL_PASSWORD")
publishingType = "AUTOMATIC" // "USER_MANAGED"
publishingConventions {
mavenCentral {
displayName = mavenPlugin.name
description = mavenPlugin.description
}
}

checkstyle {
configDirectory = layout.projectDirectory.dir("gradle/checkstyle")
}

tasks.checkstyleMain {
exclude("**/HelpMojo.java")
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.caching=true
org.gradle.configuration-cache=true
23 changes: 0 additions & 23 deletions gradle/checkstyle/checkstyle.xml

This file was deleted.

15 changes: 0 additions & 15 deletions gradle/checkstyle/header.txt

This file was deleted.

21 changes: 1 addition & 20 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
plugins {
id("com.gradle.develocity") version "4.2.2"
}
plugins { id("org.gradlex.internal-build-conventions") version "0.8" }

rootProject.name = "gradle-module-metadata-maven-plugin"

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositories.mavenCentral()
}

develocity {
buildScan {
val isCi = providers.environmentVariable("CI").getOrElse("false").toBoolean()
if (isCi) {
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
} else {
publishing.onlyIf { false }
}
}
}
17 changes: 1 addition & 16 deletions src/main/java/org/gradlex/maven/gmm/Capability.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
/*
* Copyright the GradleX team.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// SPDX-License-Identifier: Apache-2.0
package org.gradlex.maven.gmm;

/**
Expand Down
33 changes: 9 additions & 24 deletions src/main/java/org/gradlex/maven/gmm/GradleModuleMetadataMojo.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
/*
* Copyright the GradleX team.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// SPDX-License-Identifier: Apache-2.0
package org.gradlex.maven.gmm;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import javax.inject.Inject;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
Expand All @@ -25,13 +16,6 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;

import javax.inject.Inject;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;

/**
* Goal that generates Gradle Module Metadata.
*/
Expand Down Expand Up @@ -99,7 +83,8 @@ private void addMarkerToPomIfNotPresent() {
try {
String pomContent = new String(Files.readAllBytes(pomFile.toPath()));
if (!pomContent.contains(marker)) {
String newContent = pomContent.replaceFirst("</modelVersion>", "</modelVersion> <!-- " + marker + " -->");
String newContent =
pomContent.replaceFirst("</modelVersion>", "</modelVersion> <!-- " + marker + " -->");
Files.write(pomFile.toPath(), newContent.getBytes());
}
} catch (IOException e) {
Expand Down
Loading
Loading