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
40 changes: 40 additions & 0 deletions .github/workflows/archrules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# action for evaluating archrules on a single project repo
name: Nebula ArchRules
on:
push:
branches:
- 'main'
pull_request:

jobs:
buildmultijdk:
runs-on: ubuntu-latest
name: ArchRules
steps:
- uses: actions/checkout@v6
- name: Setup git user
run: |
git config --global user.name "Nebula Plugin Maintainers"
git config --global user.email "nebula-plugins-oss@netflix.com"
- name: Set up JDKs
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 21
java-package: jdk
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
with:
cache-overwrite-existing: true
build-scan-publish: true
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
build-scan-terms-of-use-agree: 'yes'
- name: Gradle run archrules
run: ./gradlew --stacktrace archRulesConsoleReport archRulesMarkdownReport
- name: Arch Rule Reports stop summary
run: cat build/reports/archrules/report.md > $GITHUB_STEP_SUMMARY
- name: PR Comment
if: github.event_name == 'pull_request'
run: gh pr comment ${{ github.event.number }} -F build/reports/archrules/report.md
env:
GH_TOKEN: ${{ github.token }}
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
git config --global user.name "Nebula Plugin Maintainers"
git config --global user.email "nebula-plugins-oss@netflix.com"
- name: Set up JDKs
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
git config --global user.name "Nebula Plugin Maintainers"
git config --global user.email "nebula-plugins-oss@netflix.com"
- name: Set up JDKs
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/refresh-locks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
git config --global user.name "Nebula Plugin Maintainers"
git config --global user.email "nebula-plugins-oss@netflix.com"
- name: Set up JDKs
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 21
Expand Down
11 changes: 8 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contacts {

dependencies {
compileOnly("io.github.gradle-nexus:publish-plugin:2.0.0")
implementation("com.netflix.nebula:nebula-archrules-gradle-plugin:0.+")
implementation("com.netflix.nebula:nebula-archrules-gradle-plugin:1.+")
implementation("com.netflix.nebula:nebula-oss-publishing-plugin:latest.release")
implementation("com.netflix.nebula:gradle-contacts-plugin:latest.release")
implementation("com.netflix.nebula:gradle-dependency-lock-plugin:latest.release")
Expand Down Expand Up @@ -64,19 +64,24 @@ gradlePlugin {
implementationClass = "nebula.plugin.plugin.NebulaPluginPlugin"
tags.set(listOf("nebula", "nebula-plugin"))
}
create("libraryPlugin") {
create("com.netflix.nebula.library") {
id = "com.netflix.nebula.library"
displayName = "Nebula Library Plugin"
description = "Sets up publishing and release process for Nebula Libraries"
implementationClass = "nebula.plugin.plugin.NebulaLibraryPlugin"
tags.set(listOf("nebula"))
}
create("rootPlugin") {
create("com.netflix.nebula.root") {
id = "com.netflix.nebula.root"
displayName = "Nebula Root Plugin"
description = "Sets up publishing and release process for Nebula Multiproject Repos"
implementationClass = "nebula.plugin.plugin.NebulaRootPlugin"
tags.set(listOf("nebula"))
compatibility {
features {
configurationCache = true
}
}
}
create("com.netflix.nebula.oss.settings") {
id = "com.netflix.nebula.oss.settings"
Expand Down
6 changes: 3 additions & 3 deletions gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ com.netflix.nebula:gradle-contacts-plugin:8.1.0=compileClasspath,runtimeClasspat
com.netflix.nebula:gradle-dependency-lock-plugin:17.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:gradle-info-plugin:16.2.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:gradle-java-cross-compile-plugin:8.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-archrules-core:0.18.1=runtimeClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-archrules-gradle-plugin:0.18.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-archrules-core:1.0.1=runtimeClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-archrules-gradle-plugin:1.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-dependencies-comparison:0.2.1=runtimeClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-gradle-interop:3.1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-oss-publishing-plugin:4.1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-project-plugin:13.1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-project-plugin:13.1.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-publishing-plugin:23.1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-release-plugin:21.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.netflix.nebula:nebula-test:12.3.0=testCompileClasspath,testRuntimeClasspath
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/nebula/plugin/plugin/NebulaRootPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nebula.plugin.plugin;
package nebula.plugin.plugin

import io.github.gradlenexus.publishplugin.AbstractNexusStagingRepositoryTask
import nebula.plugin.publishing.NebulaOssPublishingExtension
Expand All @@ -35,6 +35,7 @@ class NebulaRootPlugin : Plugin<Project> {
project.plugins.apply("com.netflix.nebula.info")
project.plugins.apply("com.netflix.nebula.release")
project.plugins.apply("com.netflix.nebula.oss-publishing")
project.plugins.apply("com.netflix.nebula.archrules.aggregate")
project.extensions.findByType<NebulaOssPublishingExtension>()?.apply {
packageGroup.set("com.netflix")
netflixOssRepository.set("gradle-plugins")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package com.netflix.nebula
import nebula.test.dsl.Gradle

enum class SupportedGradleVersion(val version: Gradle) {
MIN(Gradle.ofVersion("9.0.0")),
GRADLE_9_1(Gradle.ofVersion("9.1.0")),
CURRENT(Gradle.current())
}
88 changes: 88 additions & 0 deletions src/test/kotlin/nebula/plugin/plugin/NebulaRootPluginTest.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,102 @@
package nebula.plugin.plugin

import com.netflix.nebula.SupportedGradleVersion
import nebula.test.dsl.TestKitAssertions.assertThat
import nebula.test.dsl.plugins
import nebula.test.dsl.properties
import nebula.test.dsl.rootProject
import nebula.test.dsl.run
import nebula.test.dsl.subProject
import nebula.test.dsl.testProject
import nebula.test.dsl.withGradle
import org.gradle.testfixtures.ProjectBuilder
import org.gradle.testkit.runner.TaskOutcome
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.io.TempDir
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.EnumSource
import java.io.File

class NebulaRootPluginTest {
@TempDir
lateinit var projectDir: File

@Test
fun `plugin sets group`() {
val project = ProjectBuilder.builder().build()
project.plugins.apply("com.netflix.nebula.root")
assertThat(project.group).isEqualTo("com.netflix.nebula")
}

@Test
fun `plugin applies archrules aggregate`() {
val project = ProjectBuilder.builder().build()
project.plugins.apply("com.netflix.nebula.root")
assertThat(project.plugins.findPlugin("com.netflix.nebula.archrules.aggregate")).isNotNull
}

@ParameterizedTest
@EnumSource(SupportedGradleVersion::class)
fun `archrules aggregate`(gradle: SupportedGradleVersion) {
val runner = testProject(projectDir) {
properties {
buildCache(true)
configurationCache(true)
}
rootProject {
plugins {
id("com.netflix.nebula.root")
}
}
subProject(":sub1") {
plugins {
id("java")
id("com.netflix.nebula.library")
}
}
}
val result = runner.run("build", "--stacktrace") {
withGradle(gradle.version)
}
assertThat(result)
.hasNoMutableStateWarnings()
.hasNoDeprecationWarnings()
assertThat(result.task(":sub1:archRulesConsoleReport"))
.hasOutcome(TaskOutcome.SUCCESS)
assertThat(result.task(":archRulesAggregateMarkdownReport"))
.`as`("aggregate reports do not run by default")
.isNull()
}

@ParameterizedTest
@EnumSource(SupportedGradleVersion::class)
fun `archrules aggregate markdown`(gradle: SupportedGradleVersion) {
val runner = testProject(projectDir) {
properties {
buildCache(true)
configurationCache(true)
}
rootProject {
plugins {
id("com.netflix.nebula.root")
}
}
subProject(":sub1") {
plugins {
id("java")
id("com.netflix.nebula.library")
}
}
}

val result = runner.run("archRulesAggregateMarkdownReport") {
forwardOutput()
withGradle(gradle.version)
}
assertThat(result)
.hasNoMutableStateWarnings()
.hasNoDeprecationWarnings()
assertThat(result.task(":archRulesAggregateMarkdownReport"))
.hasOutcome(TaskOutcome.SUCCESS)
}
}