Skip to content

Commit

Permalink
Update buildscripts/gradle.
Browse files Browse the repository at this point in the history
Move to github actions.
Stop using proguard, and just publish a farjar.
Added a helper message if we run into a SSLException
  • Loading branch information
LexManos committed Nov 6, 2023
1 parent 3896031 commit b3c73d5
Show file tree
Hide file tree
Showing 36 changed files with 414 additions and 882 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish

on:
push:
branches: [ "*" ]

permissions:
contents: read

jobs:
build:
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@main
with:
java: 8
gradle_tasks: "publish"
artifact_name: "installer"
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PROMOTE_ARTIFACT_WEBHOOK: ${{ secrets.PROMOTE_ARTIFACT_WEBHOOK }}
PROMOTE_ARTIFACT_USERNAME: ${{ secrets.PROMOTE_ARTIFACT_USERNAME }}
PROMOTE_ARTIFACT_PASSWORD: ${{ secrets.PROMOTE_ARTIFACT_PASSWORD }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
85 changes: 0 additions & 85 deletions Jenkinsfile

This file was deleted.

18 changes: 2 additions & 16 deletions LICENSE-header.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
Installer
Copyright (c) 2016-2018.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation version 2.1
of the License.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (c) Forge Development LLC
SPDX-License-Identifier: LGPL-2.1-only
File renamed without changes.
208 changes: 58 additions & 150 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,189 +1,97 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath 'com.guardsquare:proguard-gradle:7.1.0'
classpath 'net.minecraftforge:GradleUtils:1.+'
}
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.minecraftforge.gradleutils.PomUtils

plugins {
id 'org.cadixdev.licenser' version '0.6.1'
id 'com.github.johnrengelman.shadow' version '7.0.0'
//id 'maven'
id 'maven-publish'
id 'java'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.6.1'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.github.ben-manes.versions' version '0.49.0'
id 'net.minecraftforge.gradleutils' version '2.+'
}
apply plugin: 'net.minecraftforge.gradleutils'

group = 'net.minecraftforge'
version = gradleutils.tagOffsetVersion
println "Version: $version"

repositories {
mavenCentral()
maven gradleutils.forgeMaven
}

group = 'net.minecraftforge'
archivesBaseName = 'installer'
java.toolchain.languageVersion = JavaLanguageVersion.of(8)

license {
header project.file('LICENSE-header.txt')
include 'net/minecraftforge/installer/**/*.java'
newLine false
header = file('LICENSE-header.txt')
newLine = false
}

version = gradleutils.getTagOffsetBranchVersion(null, 'master', 'HEAD', '2.0')
println('Installer Version: ' + version)

ext {
SPEC_VERSION = gradleutils.gitInfo.tag
MAIN_CLASS = 'net.minecraftforge.installer.SimpleInstaller'
MANIFEST = manifest{
attributes('Main-Class': MAIN_CLASS)
attributes([
'Specification-Title': 'Installer',
'Specification-Vendor': 'Forge Development LLC',
'Specification-Version': SPEC_VERSION,
'Implementation-Title': 'SimpleInstaller',
'Implementation-Version': project.version,
'Implementation-Vendor': 'Forge Development LLC'
] as LinkedHashMap, 'net/minecraftforge/installer/')
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}

dependencies {
implementation 'net.sf.jopt-simple:jopt-simple:5.0.4'
implementation 'com.google.code.gson:gson:2.8.7'
testImplementation(platform('org.junit:junit-bom:5.7.2'))
testImplementation('org.junit.jupiter:junit-jupiter')
withSourcesJar()
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}

compileJava {
options.encoding = 'UTF-8'
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
manifest.from(MANIFEST)
dependencies {
implementation(libs.jopt.simple)
implementation(libs.gson)
testImplementation(libs.junit.api)
testRuntimeOnly(libs.bundles.junit.runtime)
}

shadowJar {
classifier 'fatjar'
manifest.from(MANIFEST)
tasks.named('jar', Jar).configure {
manifest {
attributes('Main-Class': 'net.minecraftforge.installer.SimpleInstaller')
attributes([
'Specification-Title': 'Installer',
'Specification-Vendor': 'Forge Development LLC',
'Specification-Version': gradleutils.gitInfo.tag,
'Implementation-Title': 'SimpleInstaller',
'Implementation-Vendor': 'Forge Development LLC',
'Implementation-Version': project.version
] as LinkedHashMap, 'net/minecraftforge/installer/')
}
}

task pgShrinkJar(type: proguard.gradle.ProGuardTask, dependsOn: shadowJar) {
ext {
inputJar = shadowJar.archiveFile.get().asFile
outDir = file("${buildDir}/proguard")
obfuscatedJar = "${outDir}/${jar.archiveBaseName}.jar"
config = 'proguard.pro'
}
inputs.file inputJar
inputs.file config

outDir.mkdirs()

injars inputJar
outjars obfuscatedJar

// Automatically handle the Java version of this build.
if (System.getProperty('java.version').startsWith('1.')) {
// Before Java 9, the runtime classes were packaged in a single jar file.
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
} else {
// As of Java 9, the runtime classes are packaged in modular jmod files.
libraryjars "${System.getProperty('java.home')}/jmods/java.base.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
libraryjars "${System.getProperty('java.home')}/jmods/java.desktop.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
libraryjars "${System.getProperty('java.home')}/jmods/java.logging.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
libraryjars "${System.getProperty('java.home')}/jmods/jdk.unsupported.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
}
configuration config
tasks.named('shadowJar', ShadowJar).configure {
archiveClassifier = 'fatjar'
minimize()
}

task shrinkJar(type: Jar, dependsOn: pgShrinkJar) {
classifier = 'shrunk'
from zipTree(pgShrinkJar.obfuscatedJar)
manifest.from(MANIFEST)
compileJava {
options.encoding = 'UTF-8'
}

artifacts {
//archives shadowJar
archives sourcesJar
archives shrinkJar
archives shadowJar
}

jar {
manifest.from(MANIFEST)
}
publishing {
publications.register('mavenJava', MavenPublication) {
from components.java

task testJar(type: Jar, dependsOn: shrinkJar) {
from zipTree(shrinkJar.archiveFile.get().asFile)
from sourceSets.test.output
classifier 'test'
manifest.from(MANIFEST)
}
artifactId = 'installer'

publishing {
publications {
mavenJava(MavenPublication) {
artifact sourcesJar
artifact shrinkJar
artifact jar
pom {
name = project.archivesBaseName
packaging = 'jar'
description = 'Minecraft Forge Installer'
url = 'https://github.com/MinecraftForge/Installer'

scm {
url = 'https://github.com/MinecraftForge/Installer'
connection = 'scm:git:git://github.com/MinecraftForge/Installer.git'
developerConnection = 'scm:git:git@github.com:MinecraftForge/Installer.git'
}

issueManagement {
system = 'github'
url = 'https://github.com/MinecraftForge/Installer/issues'
}

developers {
developer {
id = 'cpw'
name = 'cpw'
}
developer {
id = 'LexManos'
name = 'Lex Manos'
}
}
pom {
name = 'Installer'
description = 'Minecraft Forge Installer'
url = 'https://github.com/MinecraftForge/MergeTool'

PomUtils.setGitHubDetails(pom, 'Installer')

license PomUtils.Licenses.LGPLv2_1

developers {
developer PomUtils.Developers.LexManos
}
}
}

repositories {
maven {
if (System.env.MAVEN_USER) {
url 'https://maven.minecraftforge.net/'
authentication {
basic(BasicAuthentication)
}
credentials {
username = System.env.MAVEN_USER ?: 'not'
password = System.env.MAVEN_PASSWORD ?: 'set'
}
} else {
url 'file://' + rootProject.file('repo').getAbsolutePath()
}
}
maven gradleutils.publishingForgeMaven
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit b3c73d5

Please sign in to comment.