Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Omico authored Mar 30, 2024
0 parents commit f6aa93e
Show file tree
Hide file tree
Showing 30 changed files with 666 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text eol=lf
*.bat text eol=crlf
*.jar binary
42 changes: 42 additions & 0 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Gradle Build

on:
pull_request:
push:
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: true

jobs:
gradle-wrapper-validation:
name: Gradle Wrapper validation
uses: OmicoDev/gradle-project-initializer-template/.github/workflows/gradle-wrapper-validation.yml@main

gradle-build:
name: Gradle Build
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- gradle-wrapper-validation
env:
DEPENDENCY_GRAPH_EXCLUDE_PROJECTS: ':(gradm|initialization|project)'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
dependency-graph: generate-and-submit

- run: ./gradlew build --no-daemon --stacktrace
12 changes: 12 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Gradle Wrapper validation

on:
workflow_call:

jobs:
gradle-wrapper-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: gradle/wrapper-validation-action@v2
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
/.gradle
/.idea
/build
/local.properties

!/.idea/detekt.xml
12 changes: 12 additions & 0 deletions .idea/detekt.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Gradle Project Initializer template

A generated project template which suitable for my own purposes.

> **Note**
> This project is generated by GPI (Gradle Project Initializer) CLI. Issues only, don't create any pull requests.
2 changes: 2 additions & 0 deletions build-logic/gradm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gradle
/build
13 changes: 13 additions & 0 deletions build-logic/gradm/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
`kotlin-dsl`
id("me.omico.gradm") version "4.0.0-beta03"
}

repositories {
mavenCentral()
}

gradm {
pluginId = "gpi.gradm"
debug = true
}
33 changes: 33 additions & 0 deletions build-logic/gradm/gradm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
versions:
consensus: "0.9.0"
gradle: "8.7"
kotlin: "1.9.23"
plugins:
gradle.enterprise: "3.16.2"
spotless: "6.25.0"

repositories:
omico:
mavenCentral:
gradlePluginPortal:

plugins:
gradlePluginPortal:
com.diffplug.spotless: ${versions.plugins.spotless}
com.gradle.enterprise: ${versions.plugins.gradle.enterprise}
omico:
me.omico.consensus.api: ${versions.consensus}
me.omico.consensus.git: ${versions.consensus}
me.omico.consensus.spotless: ${versions.consensus}

dependencies:
mavenCentral:
org.jetbrains.kotlin:
kotlin-gradle-plugin:
alias: kotlinGradlePlugin
version: ${versions.kotlin}
omico:
me.omico.consensus:
consensus-dsl:
alias: me.omico.consensus.dsl
version: ${versions.consensus}
8 changes: 8 additions & 0 deletions build-logic/gradm/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rootProject.name = "gpi-gradm"

pluginManagement {
repositories {
maven(url = "https://maven.omico.me")
gradlePluginPortal()
}
}
2 changes: 2 additions & 0 deletions build-logic/initialization/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gradle
/build
8 changes: 8 additions & 0 deletions build-logic/initialization/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
`kotlin-dsl`
}

dependencies {
implementation(com.gradle.enterprise)
implementation(gradmGeneratedJar)
}
9 changes: 9 additions & 0 deletions build-logic/initialization/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rootProject.name = "gpi-initialization"

pluginManagement {
includeBuild("../gradm")
}

plugins {
id("gpi.gradm")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id("com.gradle.enterprise")
}

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishAlwaysIf(!gradle.startParameter.isOffline)
}
}
13 changes: 13 additions & 0 deletions build-logic/initialization/src/main/kotlin/gpi.settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import me.omico.gradle.initialization.includeAllSubprojectModules
import me.omico.gradm.addDeclaredRepositories

addDeclaredRepositories()

plugins {
id("gpi.gradm")
id("gpi.gradle-enterprise")
}

includeBuild("build-logic/project")

includeAllSubprojectModules("gpi")
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package me.omico.gradle.initialization

import org.gradle.api.initialization.Settings
import java.io.File

internal fun Settings.includeAllSubprojectModules(projectName: String): Unit =
rootDir.resolve(projectName).walk()
.filter(File::isDirectory)
.filter { it.resolve("build.gradle.kts").exists() }
.forEach { moduleDirectory ->
val moduleName = moduleDirectory.relativeTo(rootDir).path.replace(File.separator, "-")
include(":$moduleName")
project(":$moduleName").projectDir = moduleDirectory
}
2 changes: 2 additions & 0 deletions build-logic/project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gradle
/build
13 changes: 13 additions & 0 deletions build-logic/project/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
`kotlin-dsl`
}

dependencies {
implementation(com.diffplug.spotless)
implementation(gradmGeneratedJar)
implementation(kotlinGradlePlugin)
implementation(me.omico.consensus.api)
implementation(me.omico.consensus.dsl)
implementation(me.omico.consensus.git)
implementation(me.omico.consensus.spotless)
}
9 changes: 9 additions & 0 deletions build-logic/project/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rootProject.name = "gpi-project"

pluginManagement {
includeBuild("../gradm")
}

plugins {
id("gpi.gradm")
}
23 changes: 23 additions & 0 deletions build-logic/project/src/main/kotlin/gpi.root.git.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import me.omico.consensus.dsl.requireRootProject

plugins {
id("me.omico.consensus.git")
}

requireRootProject()

consensus {
git {
hooks {
preCommit {
appendLine("#!/bin/sh")
appendLine()
if (file("gradlew").exists()) {
appendLine("# Give gradlew execute permission")
appendLine("git ls-files \"*gradlew\" | xargs git update-index --add --chmod=+x")
appendLine()
}
}
}
}
}
21 changes: 21 additions & 0 deletions build-logic/project/src/main/kotlin/gpi.root.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import me.omico.consensus.dsl.requireRootProject

plugins {
id("gpi.gradm")
id("gpi.root.git")
id("gpi.root.spotless")
}

requireRootProject()

consensus {
allprojects {
group = gradleProperty("project.group")
version = gradleProperty("project.version")
}
}

val wrapper: Wrapper by tasks.named<Wrapper>("wrapper") {
gradleVersion = versions.gradle
distributionType = Wrapper.DistributionType.BIN
}
25 changes: 25 additions & 0 deletions build-logic/project/src/main/kotlin/gpi.root.spotless.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import me.omico.consensus.dsl.requireRootProject
import me.omico.consensus.spotless.ConsensusSpotlessTokens

plugins {
id("me.omico.consensus.spotless")
}

requireRootProject()

consensus {
spotless {
rootProject {
freshmark()
gradleProperties()
}
allprojects {
kotlin(
targets = ConsensusSpotlessTokens.Kotlin.targets + setOf(
"build-logic/**/src/main/kotlin/**/*.kt",
),
)
kotlinGradle()
}
}
}
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id("gpi.root")
}
11 changes: 11 additions & 0 deletions detekt/detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
complexity:
LongParameterList:
active: false
TooManyFunctions:
active: false

style:
MagicNumber:
ignoreLocalVariableDeclaration: true
ReturnCount:
active: false
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
org.gradle.caching=true
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -XX:+UseParallelGC
org.gradle.kotlin.dsl.allWarningsAsErrors=true
org.gradle.parallel=true

project.group=me.omico.gpi
project.version=0.1.0-SNAPSHOT
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit f6aa93e

Please sign in to comment.