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

Misc build logic improvements #5

Merged
merged 5 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
registries:
gradle-plugin-portal:
type: maven-repository
url: https://plugins.gradle.org/m2
username: dummy # Required by dependabot
password: dummy # Required by dependabot
updates:
- package-ecosystem: "gradle"
directory: "/"
registries:
- gradle-plugin-portal
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
10 changes: 10 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
29 changes: 29 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Verify'

on:
push:
branches-ignore:
- gh-pages
pull_request:
branches:
- '*'

jobs:
build-and-verify:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- name: 'Set up JDK 8'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
- name: 'Set up JDK 21'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: 'Build'
uses: gradle/gradle-build-action@v3
with:
arguments: "build"
pshevche marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repositories {
gradlePluginPortal()
}

plugins {
`kotlin-dsl`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package develocity.adapters

import org.gradle.api.Project
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.SourceSetOutput
import org.gradle.kotlin.dsl.the

fun Project.sourceSetOutput(name: String): SourceSetOutput = the<SourceSetContainer>().getByName(name).output
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import develocity.adapters.sourceSetOutput

plugins {
java
}

repositories {
mavenCentral()
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}

sourceSets {
create("compatibilityApi")
create("enterpriseCompatibility")
create("develocityCompatibility")
}

tasks.jar {
from(sourceSetOutput("compatibilityApi"))
from(sourceSetOutput("enterpriseCompatibility"))
from(sourceSetOutput("develocityCompatibility"))
}
Comment on lines +17 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you use something like this?

val compatibilityApi by sourceSets.creating
///...
tasks.jar {
    from(compatibilityApi.output)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can. But I prefer that the plugin uses the same notation as its consumers (i.e., sourceSetOutput extension function).

31 changes: 7 additions & 24 deletions develocity-gradle-plugin-adapters/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import develocity.adapters.sourceSetOutput

plugins {
java
id("develocity.adapters-library")
}

repositories {
Expand All @@ -12,33 +14,14 @@ repositories {
}
}

sourceSets {
create("compatibilityApi")
create("enterpriseCompatibility")
create("develocityCompatibility")
}

dependencies {
"compatibilityApiCompileOnly"(gradleApi())

"enterpriseCompatibilityCompileOnly"(gradleApi())
"enterpriseCompatibilityCompileOnly"("com.gradle:gradle-enterprise-gradle-plugin:3.16.2")
"enterpriseCompatibilityImplementation"(sourceSets["compatibilityApi"].output)
"enterpriseCompatibilityCompileOnly"(libs.gradle.enterprise.plugin)
"enterpriseCompatibilityImplementation"(sourceSetOutput("compatibilityApi"))

"develocityCompatibilityCompileOnly"(gradleApi())
"develocityCompatibilityCompileOnly"("com.gradle:develocity-gradle-plugin:3.17-rc-4")
"develocityCompatibilityImplementation"(sourceSets["compatibilityApi"].output)
"develocityCompatibilityCompileOnly"(libs.develocity.plugin)
"develocityCompatibilityImplementation"(sourceSetOutput("compatibilityApi"))
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}

tasks.jar {
from(sourceSets["compatibilityApi"].output)
from(sourceSets["enterpriseCompatibility"].output)
from(sourceSets["develocityCompatibility"].output)
}

31 changes: 10 additions & 21 deletions develocity-maven-extension-adapters/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import develocity.adapters.sourceSetOutput

plugins {
java
id("develocity.adapters-library")
}

repositories {
mavenCentral()
maven {
url = uri("https://repo.grdev.net/artifactory/public")
content {
Expand All @@ -12,26 +13,14 @@ repositories {
}
}

sourceSets {
create("compatibilityApi")
create("enterpriseCompatibility")
create("develocityCompatibility")
}

dependencies {
"compatibilityApiCompileOnly"("org.apache.maven:maven-core:3.9.6")
"compatibilityApiCompileOnly"(libs.maven.core)

"enterpriseCompatibilityCompileOnly"("org.apache.maven:maven-core:3.9.6")
"enterpriseCompatibilityCompileOnly"("com.gradle:gradle-enterprise-maven-extension:1.20.1")
"enterpriseCompatibilityImplementation"(sourceSets["compatibilityApi"].output)

"develocityCompatibilityCompileOnly"("org.apache.maven:maven-core:3.9.6")
"develocityCompatibilityCompileOnly"("com.gradle:develocity-maven-extension:1.21-rc-5")
"develocityCompatibilityImplementation"(sourceSets["compatibilityApi"].output)
}
"enterpriseCompatibilityCompileOnly"(libs.maven.core)
"enterpriseCompatibilityCompileOnly"(libs.gradle.enterprise.extension)
"enterpriseCompatibilityImplementation"(sourceSetOutput("compatibilityApi"))

tasks.jar {
from(sourceSets["compatibilityApi"].output)
from(sourceSets["enterpriseCompatibility"].output)
from(sourceSets["develocityCompatibility"].output)
"develocityCompatibilityCompileOnly"(libs.maven.core)
"develocityCompatibilityCompileOnly"(libs.develocity.extension)
"develocityCompatibilityImplementation"(sourceSetOutput("compatibilityApi"))
}
13 changes: 5 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[versions]
commons-math3 = "3.6.1"
guava = "32.1.2-jre"
junit-jupiter = "5.10.0"

[libraries]
commons-math3 = { module = "org.apache.commons:commons-math3", version.ref = "commons-math3" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
gradle-enterprise-plugin = { module = "com.gradle:gradle-enterprise-gradle-plugin", version = "3.16.2" }
develocity-plugin = { module = "com.gradle:develocity-gradle-plugin", version = "3.17-rc-4" }
maven-core = { module = "org.apache.maven:maven-core", version = "3.9.6" }
gradle-enterprise-extension = { module = "com.gradle:gradle-enterprise-maven-extension", version = "1.20.1" }
develocity-extension = { module = "com.gradle:develocity-maven-extension", version = "1.21-rc-5" }
11 changes: 2 additions & 9 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
pluginManagement {
plugins {
id("com.gradle.enterprise") version "3.16.2"
id("com.gradle.enterprise.gradle-enterprise-conventions-plugin") version "0.7.5"
}
}

plugins {
id("com.gradle.enterprise")
id("com.gradle.enterprise.gradle-enterprise-conventions-plugin")
id("com.gradle.enterprise") version "3.16.2"
id("com.gradle.enterprise.gradle-enterprise-conventions-plugin") version "0.7.5"
}

rootProject.name = "develocity-agent-adapters"
Expand Down