Skip to content

Commit 7899db3

Browse files
committed
Update git ignore and add publishing.
1 parent eb480c5 commit 7899db3

3 files changed

Lines changed: 135 additions & 11 deletions

File tree

‎.gitignore‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1-
/.settings/
2-
/bin/
3-
/build/
4-
/eclipse/
5-
/.gradle/
6-
/.classpath
7-
*.project
8-
/.idea/
1+
# exclude all
2+
/*
3+
4+
# Include Important Folders
5+
!src/
6+
7+
# Other Files.
8+
!LICENSE
9+
!LICENSE-header.txt
10+
!README.md
11+
!Jenkinsfile
12+
13+
# Gradle stuff
14+
!gradle/
15+
!gradlew
16+
!gradlew.bat
17+
!build.gradle
18+
!settings.gradle
19+
20+
# Include git important files
21+
!.gitmodules
22+
!.gitignore

‎Jenkinsfile‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
@Library('forge-shared-library')_
2+
3+
pipeline {
4+
agent {
5+
docker {
6+
image 'gradle:jdk8'
7+
args '-v forgegc:/home/gradle/.gradle'
8+
}
9+
}
10+
environment {
11+
GRADLE_ARGS = '-Dorg.gradle.daemon.idletimeout=5000'
12+
DISCORD_WEBHOOK = credentials('forge-discord-jenkins-webhook')
13+
DISCORD_PREFIX = "Job: LegacyJavaFixer Branch: ${BRANCH_NAME} Build: #${BUILD_NUMBER}"
14+
JENKINS_HEAD = 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png'
15+
}
16+
17+
stages {
18+
stage('notify_start') {
19+
when {
20+
not {
21+
changeRequest()
22+
}
23+
}
24+
steps {
25+
discordSend(
26+
title: "${DISCORD_PREFIX} Started",
27+
successful: true,
28+
result: 'ABORTED', //White border
29+
thumbnail: JENKINS_HEAD,
30+
webhookURL: DISCORD_WEBHOOK
31+
)
32+
}
33+
}
34+
stage('buildandtest') {
35+
steps {
36+
sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue build test'
37+
script {
38+
env.MYGROUP = sh(returnStdout: true, script: './gradlew properties -q | grep "group:" | awk \'{print $2}\'').trim()
39+
env.MYARTIFACT = sh(returnStdout: true, script: './gradlew properties -q | grep "name:" | awk \'{print $2}\'').trim()
40+
env.MYVERSION = sh(returnStdout: true, script: './gradlew properties -q | grep "version:" | awk \'{print $2}\'').trim()
41+
}
42+
}
43+
post {
44+
success {
45+
writeChangelog(currentBuild, 'build/changelog.txt')
46+
}
47+
}
48+
}
49+
stage('publish') {
50+
when {
51+
not {
52+
changeRequest()
53+
}
54+
}
55+
steps {
56+
withCredentials([usernamePassword(credentialsId: 'maven-forge-user', usernameVariable: 'MAVEN_USER', passwordVariable: 'MAVEN_PASSWORD')]) {
57+
withGradle {
58+
sh './gradlew ${GRADLE_ARGS} publish'
59+
}
60+
}
61+
}
62+
post {
63+
success {
64+
build job: 'filegenerator', parameters: [string(name: 'COMMAND', value: "promote ${env.MYGROUP}:${env.MYARTIFACT} ${env.MYVERSION} latest")], propagate: false, wait: false
65+
}
66+
}
67+
}
68+
}
69+
post {
70+
always {
71+
script {
72+
if (env.CHANGE_ID == null) { // This is unset for non-PRs
73+
discordSend(
74+
title: "${DISCORD_PREFIX} Finished ${currentBuild.currentResult}",
75+
description: '```\n' + getChanges(currentBuild) + '\n```',
76+
successful: currentBuild.resultIsBetterOrEqualTo("SUCCESS"),
77+
result: currentBuild.currentResult,
78+
thumbnail: JENKINS_HEAD,
79+
webhookURL: DISCORD_WEBHOOK
80+
)
81+
}
82+
}
83+
}
84+
}
85+
}

‎build.gradle‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ plugins {
44
id 'maven-publish'
55
}
66

7-
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
7+
java.toolchain.languageVersion = JavaLanguageVersion.of(7)
88

9-
version = '1.0'
10-
group = 'net.minecraftforge.lex'
9+
version = '2.0'
10+
group = 'net.minecraftforge'
1111
archivesBaseName = 'legacyjavafixer'
1212

1313
repositories {
@@ -28,3 +28,28 @@ dependencies {
2828
implementation 'com.google.guava:guava:16.0'
2929
implementation 'net.minecraftforge:forge:1.7.10-10.13.1.1225:universal'
3030
}
31+
32+
33+
publishing {
34+
publications {
35+
mavenJava(MavenPublication) {
36+
groupId project.group
37+
artifactId project.archivesBaseName
38+
version project.version
39+
artifact jar
40+
}
41+
}
42+
repositories {
43+
maven {
44+
if (project.hasProperty('forgeMavenPassword')) {
45+
credentials {
46+
username project.properties.forgeMavenUser
47+
password project.properties.forgeMavenPassword
48+
}
49+
url 'https://files.minecraftforge.net/maven/manage/upload'
50+
} else {
51+
url 'file://' + rootProject.file('repo').getAbsolutePath()
52+
}
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)