Skip to content

Commit

Permalink
Upgrade assertj-gradle. Migrate to gradle-cthing-publishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
baron1405 committed Feb 2, 2025
1 parent 3a0fce6 commit b9661be
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
18 changes: 12 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ plugins {
jacoco
signing
alias(libs.plugins.cthingVersioning)
alias(libs.plugins.cthingPublishing)
alias(libs.plugins.dependencyAnalysis)
alias(libs.plugins.pluginPublish)
alias(libs.plugins.spotbugs)
Expand Down Expand Up @@ -163,7 +164,7 @@ tasks {

publishPlugins {
doFirst {
if (!project.hasProperty("gradle.publish.key") || !project.hasProperty("gradle.publish.secret")) {
if (!cthingPublishing.hasGradlePluginPortalCredentials()) {
throw GradleException("Gradle Plugin Portal credentials not defined")
}
}
Expand Down Expand Up @@ -192,7 +193,7 @@ tasks {

withType<Sign>().configureEach {
onlyIf("Signing credentials are present") {
hasProperty("signing.keyId") && hasProperty("signing.password") && hasProperty("signing.secretKeyRingFile")
cthingPublishing.canSign()
}
}

Expand All @@ -209,16 +210,21 @@ tasks {
}

publishing {
val repoUrl = if ((version as ProjectVersion).isSnapshotBuild)
findProperty("cthing.nexus.snapshotsUrl") else findProperty("cthing.nexus.candidatesUrl")
afterEvaluate {
publications.withType<MavenPublication> {
pom(cthingPublishing.createPomAction())
}
}

val repoUrl = cthingRepo.repoUrl
if (repoUrl != null) {
repositories {
maven {
name = "CThingMaven"
setUrl(repoUrl)
credentials {
username = property("cthing.nexus.user") as String
password = property("cthing.nexus.password") as String
username = cthingRepo.user
password = cthingRepo.password
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ spotbugs = "4.8.6"
xmlUnit = "2.10.0"

[plugins]
cthingPublishing = { id = "org.cthing.cthing-publishing", version = "1.0.0" }
cthingVersioning = { id = "org.cthing.cthing-versioning", version = "3.0.0" }
dependencyAnalysis = { id = "com.autonomousapps.dependency-analysis", version = "2.6.0" }
pluginPublish = { id = "com.gradle.plugin-publish", version = "1.3.0" }
Expand All @@ -16,7 +17,7 @@ versions = { id = "com.github.ben-manes.versions", version = "0.51.0" }

[libraries]
assertJ = "org.assertj:assertj-core:3.26.3"
assertJGradle = "org.cthing:assertj-gradle:1.0.0"
assertJGradle = "org.cthing:assertj-gradle:3.0.0"
commonsIO = "commons-io:commons-io:2.18.0"
cthingAnnots = "org.cthing:cthing-annotations:2.0.0"
escapers = "org.cthing:escapers:2.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.github.fge.jsonschema.processors.syntax.SyntaxValidator;

import static org.assertj.core.api.Assertions.assertThat;
import static org.cthing.assertj.gradle.GradleProjectAssert.assertThat;
import static org.cthing.assertj.gradle.GradleAssertions.assertThat;


public class PluginApplyTest {
Expand All @@ -40,12 +40,12 @@ public void testApply() {
assertThat(project).hasTaskWithReports(LoccPlugin.TASK_NAME);
final Task task = project.getTasks().getByName(LoccPlugin.TASK_NAME);
final LoccReports reports = ((LoccTask)task).getReports();
assertThat(reports.getXml().getRequired().get()).isTrue();
assertThat(reports.getHtml().getRequired().get()).isTrue();
assertThat(reports.getYaml().getRequired().get()).isFalse();
assertThat(reports.getJson().getRequired().get()).isFalse();
assertThat(reports.getCsv().getRequired().get()).isFalse();
assertThat(reports.getText().getRequired().get()).isFalse();
assertThat(reports.getXml().getRequired()).contains(true);
assertThat(reports.getHtml().getRequired()).contains(true);
assertThat(reports.getYaml().getRequired()).contains(false);
assertThat(reports.getJson().getRequired()).contains(false);
assertThat(reports.getCsv().getRequired()).contains(false);
assertThat(reports.getText().getRequired()).contains(false);
}

@Test
Expand Down

0 comments on commit b9661be

Please sign in to comment.