Skip to content

Commit

Permalink
initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
cdsap committed Jun 19, 2023
0 parents commit df7ec7e
Show file tree
Hide file tree
Showing 17 changed files with 1,099 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Run Gradle on PRs
on:
pull_request:
push:
branches: [main]
jobs:
prBranch:
timeout-minutes: 300
strategy:
matrix:
os: [ubuntu-latest,macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute Gradle build
run: ./gradlew test -PexcludeTests=*.InfoGradleProcessPluginTest
env:
GE_URL: ${{ secrets.GE_URL }}
GE_API_KEY: ${{ secrets.GE_API_KEY }}

integrationJavaTests:
timeout-minutes: 300
strategy:
matrix:
os: [ubuntu-latest,macos-latest]
version: [11, 17, 19]
vendor: [temurin, zulu, liberica]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: ${{ matrix.vendor }}
java-version: ${{ matrix.version }}

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute Gradle build
run: ./gradlew test --tests io.github.cdsap.gradleprocess.InfoGradleProcessPluginTest
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Iñaki Villar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Info Gradle Process Plugin
Includes information about Gradle processes in the Build Scans or in the build output.
The plugin is compatible with configuration cache.

## Usage
Apply the plugin in the main `build.gradle(.kts)` configuration file:

#### Kotlin
Using the plugins DSL:
``` groovy
plugins {
id("io.github.cdsap.gradleprocess") version "0.1.5"
}
```

Using legacy plugin application:
``` groovy
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("io.github.cdsap:infogradleprocess:0.1.5")
}
}
apply(plugin = "io.github.cdsap.gradleprocess")
```

#### Groovy
Using the plugins DSL:
``` groovy
plugins {
id "io.github.cdsap.gradleprocess" version "0.1.5"
}
```

Using legacy plugin application:
``` groovy
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath "io.github.cdsap:infogradleprocess:0.1.5"
}
}
apply plugin: "io.github.cdsap.gradleprocess"
```
## Output
### Build Scans
If you are using Gradle Enterprise, the information about the Gradle processes will be included as custom value in the
Build Scan:

![](images/buildscan.png)

### Build Output
If you are not using Gradle Enterprise, the information about the Gradle processes will be included at the end of the build:
```
> Task :core:ui:compileProdDebugKotlin
┌─────────────────────────────────────────────────────────────────────────────┐
│ Gradle processes │
├─────────┬──────────┬───────────┬────────────┬───────────────┬───────────────┤
│ PID │ Max │ Usage │ Capacity │ GC Time │ Uptime │
├─────────┼──────────┼───────────┼────────────┼───────────────┼───────────────┤
│ 10865 │ 1.0 Gb │ 0.66 Gb │ 1.0 Gb │ 0.0 minutes │ 0.0 minutes │
├─────────┼──────────┼───────────┼────────────┼───────────────┼───────────────┤
│ 9011 │ 0.5 Gb │ 0.2 Gb │ 0.5 Gb │ 0.0 minutes │ 0.0 minutes │
└─────────┴──────────┴───────────┴────────────┴───────────────┴───────────────┘
BUILD SUCCESSFUL in 35s
```

## Requirements
* Gradle 7.5

## Libraries
* com.gradle.enterprise:com.gradle.enterprise.gradle.plugin
* com.jakewharton.picnic:picnic
108 changes: 108 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
plugins {
`java-gradle-plugin`
`maven-publish`
`kotlin-dsl`
id("com.gradle.plugin-publish") version "1.0.0-rc-1"
}

group = "io.github.cdsap"
version = "0.1.0"

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

dependencies {
implementation("io.github.cdsap:jdk-tools-parser:0.1.0")
implementation("io.github.cdsap:commandline-value-source:0.1.0")
implementation("com.jakewharton.picnic:picnic:0.6.0")
implementation("com.gradle.enterprise:com.gradle.enterprise.gradle.plugin:3.12.3")
testImplementation("junit:junit:4.13.2")
}
tasks.withType<Test>().configureEach {
filter {

if (project.hasProperty("excludeTests")) {
excludeTest(project.property("excludeTests").toString(),"")
}
}
}
gradlePlugin {
plugins {
create("InfoGradleProcessPlugin") {
id = "io.github.cdsap.gradleprocess"
displayName = "Info Gradle Processes"
description = "Retrieve information of the Gradle processes after the build execution"
implementationClass = "io.github.cdsap.gradleprocess.InfoGradleProcessPlugin"
}
}
}

pluginBundle {
website = "https://github.com/cdsap/InfoGradleProcess"
vcsUrl = "https://github.com/cdsap/InfoGradleProcess"
tags = listOf("process")
}

publishing {
repositories {
maven {
name = "Snapshots"
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")

credentials {
username = System.getenv("USERNAME_SNAPSHOT")
password = System.getenv("PASSWORD_SNAPSHOT")
}
}
maven {
name = "Release"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")

credentials {
username = System.getenv("USERNAME_SNAPSHOT")
password = System.getenv("PASSWORD_SNAPSHOT")
}
}
}
publications {
create<MavenPublication>("gradleProcessPublication") {
from(components["java"])
artifactId = "gradleprocess"
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
scm {
connection.set("scm:git:git://github.com/cdsap/InfoGradleProcess/")
url.set("https://github.com/cdsap/InfoGradleProcess/")
}
name.set("InfoGradleProcess")
url.set("https://github.com/cdsap/InfoGradleProcess/")
description.set(
"Retrieve information of the Gradle process in your Build Scan or console"
)
licenses {
license {
name.set("The MIT License (MIT)")
url.set("https://opensource.org/licenses/MIT")
distribution.set("repo")
}
}
developers {
developer {
id.set("cdsap")
name.set("Inaki Villar")
}
}
}
}
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kotlin.code.style=official
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit df7ec7e

Please sign in to comment.