Skip to content

Commit

Permalink
Fix duplication of sources
Browse files Browse the repository at this point in the history
Cleanup build script
Change published artifact to: net.minecraft:gradleutils
Out maven repo is pretty dirty with case sensitive versions of this project, but this follows our expected standards.
Remove TeamCity related things
Add getPom() to the gradleutils extension to allow easier access.
  • Loading branch information
LexManos committed Nov 13, 2023
1 parent efced38 commit 859240d
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 647 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
java: 8
gradle_tasks: "publish"
artifact_name: "GradleUtils"
artifact_name: "gradleutils"
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PROMOTE_ARTIFACT_WEBHOOK: ${{ secrets.PROMOTE_ARTIFACT_WEBHOOK }}
Expand Down
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,3 @@ out
*.idea
*.iml

# src
src/main/groovy/net/minecraftforge/gradleutils/GradleUtils.groovy
src/main/groovy/net/minecraftforge/gradleutils/ChangelogUtils.groovy
src/main/groovy/net/minecraftforge/gradleutils/tasks/GenerateChangelogTask.java
src/main/groovy/net/minecraftforge/gradleutils/tasks/ExtractTeamCityProjectConfigurationTask.java
src/main/resources/.teamcity.zip
68 changes: 16 additions & 52 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import net.minecraftforge.gradleutils.ChangelogUtils
import net.minecraftforge.gradleutils.GradleUtils
import net.minecraftforge.gradleutils.PomUtils

import net.minecraftforge.gradleutils.tasks.ExtractTeamCityProjectConfigurationTask

plugins {
id 'java-gradle-plugin'
id 'groovy'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.6.1'
id 'net.minecraftforge.gradleutils'
}

group 'net.minecraftforge.gradleutils'
version GradleUtils.getTagOffsetVersion(GradleUtils.gitInfo(file('.')))
group 'net.minecraftforge'
version gradleutils.tagOffsetVersion
println "Version: $version"

repositories {
Expand All @@ -30,44 +25,10 @@ java {
withSourcesJar()
}

tasks.register('copyGradleUtilsGroovy', Copy) {
outputs.upToDateWhen { false }
into 'src/main/groovy'
from('buildSrc/src/main/groovy') {
include '**/*.groovy'
include '**/*.java'
}
}

tasks.register('copyGradleUtilsResources', Copy) {
outputs.upToDateWhen { false }
into 'src/main/resources'
from('buildSrc/build/extraresources') {
include '**/*.zip'
}
}

tasks.withType(GroovyCompile).configureEach {
dependsOn 'copyGradleUtilsResources', 'copyGradleUtilsGroovy'
groovyOptions.optimizationOptions.indy = true
}

tasks.named('checkLicenseMain').configure {
dependsOn 'copyGradleUtilsResources', 'copyGradleUtilsGroovy'
}

tasks.named('processResources', ProcessResources).configure {
dependsOn 'copyGradleUtilsResources'
}

tasks.named('sourcesJar', Jar).configure {
dependsOn 'copyGradleUtilsResources', 'copyGradleUtilsGroovy'
}

tasks.register('setupTeamCityProject', ExtractTeamCityProjectConfigurationTask) {}

GradleUtils.setupCITasks(project)

license {
header = file('LICENSE-header.txt')
newLine = false
Expand All @@ -83,30 +44,33 @@ gradlePlugin {
}
}

ChangelogUtils.setupChangelogGenerationFromTag(project, '1.0')
changelog {
fromTag '1.0'
publishAll = false
}

publishing {
publications.register('pluginMaven', MavenPublication) { mavenPublication ->
ChangelogUtils.setupChangelogGenerationForPublishing(project, mavenPublication)

publications.register('pluginMaven', MavenPublication) {
changelog.publish(it)
pom {
artifactId = 'gradleutils'
name = 'Gradle Utils'
description = 'Used by MinecraftForge projects as a util library for Gradle buildscripts'
url = 'https://github.com/MinecraftForge/GradleUtils'

PomUtils.setGitHubDetails(pom, 'GradleUtils')
gradleutils.pom.setGitHubDetails(pom, 'GradleUtils')

license PomUtils.Licenses.LGPLv2_1
license gradleutils.pom.licenses.LGPLv2_1

developers {
developer PomUtils.Developers.LexManos
developer PomUtils.Developers.SizableShrimp
developer PomUtils.Developers.Paint_Ninja
developer gradleutils.pom.Developers.LexManos
developer gradleutils.pom.Developers.SizableShrimp
developer gradleutils.pom.Developers.Paint_Ninja
}
}
}

repositories {
maven GradleUtils.getPublishingForgeMaven(project)
maven gradleutils.publishingForgeMaven
}
}
36 changes: 16 additions & 20 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
plugins {
id 'java-gradle-plugin'
id 'org.cadixdev.licenser' version '0.6.1'
}

repositories {
mavenCentral()
}

java.toolchain.languageVersion = JavaLanguageVersion.of(8)

dependencies {
implementation 'org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r'
}

license {
header = new File(projectDir.parentFile, 'LICENSE-header.txt')
newLine = false
exclude '**/*.properties'
}

final extraResources = new File(layout.buildDirectory.getAsFile().get(), 'extraresources')

sourceSets.main.resources.srcDir(extraResources)

tasks.register('teamcityTemplateZip', Zip) {
from(project.file('../teamcityTemplate'))
archiveFileName.set('.teamcity.zip')
destinationDirectory.set(extraResources)
}

tasks.named('processResources').configure {
dependsOn 'teamcityTemplateZip'
sourceSets {
main {
groovy {
srcDirs = ['../src/main/groovy']
}
}
}

tasks.named('classes').configure {
dependsOn 'teamcityTemplateZip'
gradlePlugin {
plugins {
gradleutils {
id = 'net.minecraftforge.gradleutils'
implementationClass = 'net.minecraftforge.gradleutils.GradleUtilsPlugin'
}
}
}

This file was deleted.

Loading

0 comments on commit 859240d

Please sign in to comment.