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

Allow for subprojects that aren't fabric mods #201

Open
wants to merge 3 commits into
base: 1.14.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 4 additions & 157 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'fabric-loom' version '0.5-SNAPSHOT' apply false
id 'net.minecrell.licenser' version '0.4.1'
id "org.ajoberstar.grgit" version "3.1.1"
id 'com.jfrog.bintray' version '1.8.4'
id 'patchwork-api.module-conventions'
}

def ENV = System.getenv()

class Globals {
static def baseVersion = "0.10.0"
static def mcVersion = "1.14.4"
static def yarnVersion = "+build.16"
}
version = Globals.baseVersion //+ "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local") + "-" + getBranch()
version = project.baseVersion //+ "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local") + "-" + getBranch()

logger.lifecycle("Building Patchwork: " + version)

Expand Down Expand Up @@ -44,86 +39,6 @@ def getBranch() {
return branch.substring(branch.lastIndexOf("/") + 1)
}

allprojects {
apply plugin: 'checkstyle'
apply plugin: 'maven-publish'
apply plugin: 'fabric-loom'
apply plugin: 'net.minecrell.licenser'
apply plugin: 'com.jfrog.bintray'
sourceCompatibility = 1.8
targetCompatibility = 1.8

group = "net.patchworkmc.patchwork-api"

loom {
shareCaches = true
}

repositories {
maven { url 'https://dl.bintray.com/patchworkmc/Patchwork-Maven/' }
}

dependencies {
minecraft "com.mojang:minecraft:$Globals.mcVersion"
mappings "net.fabricmc:yarn:${Globals.mcVersion}${Globals.yarnVersion}:v2"
modImplementation "net.fabricmc:fabric-loader:0.10.0+build.208"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.15.1+build.260-1.14"

implementation 'net.patchworkmc:patchwork-eventbus:2.0.1:all'
implementation 'com.google.code.findbugs:jsr305:3.0.2'

// For EventBus
implementation 'net.jodah:typetools:0.6.0'
}

configurations {
dev
}

jar {
classifier = "dev"
}

afterEvaluate {
remapJar {
input = file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar")
archiveName = "${archivesBaseName}-${version}.jar"
}

artifacts {
dev file: file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar"), type: "jar", builtBy: jar
}

processResources {
inputs.property "version", project.version

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

license {
header rootProject.file('HEADER')
include '**/*.java'
}
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

checkstyle {
configFile = rootProject.file("checkstyle.xml")
toolVersion = '8.36.2'
}
}

javadoc {
options.memberLevel = "PACKAGE"
allprojects.each {
Expand All @@ -132,61 +47,6 @@ javadoc {
classpath = sourceSets.main.compileClasspath
}

subprojects {
task remapMavenJar(type: Copy, dependsOn: remapJar) {
afterEvaluate {
from("${project.buildDir}/libs/$archivesBaseName-${version}.jar")
into("${project.buildDir}/libs/")
rename {String fn -> "$archivesBaseName-${version}-maven.jar"}
}
}

publishing {
publications {
create("${archivesBaseName}_mavenJava", MavenPublication) {
afterEvaluate {
artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}-maven.jar")) {
builtBy remapMavenJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
}
}

bintray {
user = project.hasProperty('bintrayUser') ? project.getProperty('bintrayUser') : System.getenv('bintray_user')
key = project.hasProperty('bintrayKey') ? project.getProperty('bintrayKey') : System.getenv('bintray_key')
publish = true
override = true
publications = ["${archivesBaseName}_mavenJava"]
pkg {
repo = project.bintrayRepo
name = archivesBaseName
user = bintray.user
userOrg = project.repoOwner
licenses = [project.codeLicense]
desc = project.description
websiteUrl = "https://github.com/${project.repoOwner}/${project.repoName}"
issueTrackerUrl = "https://github.com/${project.repoOwner}/${project.repoName}/issues"
vcsUrl = "https://github.com/${project.repoOwner}/${project.repoName}.git"
publicDownloadNumbers = true

githubRepo = "${project.repoOwner}/${project.repoName}"
version {
name = project.version
released = new Date()
}
}
}

javadoc.enabled = false
}

subprojects.each { bintrayUpload.dependsOn("${it.path}:bintrayUpload") }

bintray {
user = project.hasProperty('bintrayUser') ? project.getProperty('bintrayUser') : System.getenv('bintray_user')
key = project.hasProperty('bintrayKey') ? project.getProperty('bintrayKey') : System.getenv('bintray_key')
Expand Down Expand Up @@ -247,8 +107,6 @@ publishing {
}

task licenseFormatAll
subprojects {p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat")}
subprojects.each {remapJar.dependsOn("${it.path}:remapJar")}

repositories {
flatDir {
Expand All @@ -259,15 +117,8 @@ repositories {
}

dependencies {
afterEvaluate {
subprojects.each {
compile project(path: ":${it.name}", configuration: "dev")
include project("${it.name}:")
}
}

minecraft "com.mojang:minecraft:$Globals.mcVersion"
mappings "net.fabricmc:yarn:${Globals.mcVersion}${Globals.yarnVersion}:v2"
minecraft "com.mojang:minecraft:$project.mcVersion"
mappings "net.fabricmc:yarn:${project.mcVersion}${project.yarnVersion}:v2"
modImplementation "net.fabricmc:fabric-loader:0.10.0+build.208"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.15.1+build.260-1.14"

Expand All @@ -277,10 +128,6 @@ dependencies {
include 'net.patchworkmc:patchwork-eventbus:2.0.0:all'
}

loom {
shareCaches = true
}


task copyIdeaFiles(type: Copy) {
if (file(".idea/").exists()) {
Expand Down
17 changes: 17 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
id 'groovy-gradle-plugin'
}

repositories {
mavenCentral()
maven { url 'https://dl.bintray.com/patchworkmc/Patchwork-Maven/' }
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenLocal()
}

dependencies {
implementation 'net.fabricmc:fabric-loom:0.5-SNAPSHOT'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
plugins {
// id 'java'
// id 'eclipse'
// id 'idea'
id 'checkstyle'
id 'maven-publish'
id 'fabric-loom'
id 'net.minecrell.licenser' //version '0.4.1'
id 'com.jfrog.bintray' //version '1.8.4'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

group = "net.patchworkmc.patchwork-api"

loom {
shareCaches = true
}

repositories {
maven { url 'https://dl.bintray.com/patchworkmc/Patchwork-Maven/' }
}

dependencies {
minecraft "com.mojang:minecraft:$rootProject.mcVersion"
mappings "net.fabricmc:yarn:${rootProject.mcVersion}${rootProject.yarnVersion}:v2"
modImplementation "net.fabricmc:fabric-loader:0.10.0+build.208"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.15.1+build.260-1.14"

implementation 'net.patchworkmc:patchwork-eventbus:2.0.1:all'
implementation 'com.google.code.findbugs:jsr305:3.0.2'

// For EventBus
implementation 'net.jodah:typetools:0.6.0'
}

configurations {
dev
}

jar {
classifier = "dev"
}

afterEvaluate {
remapJar {
input = file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar")
archiveName = "${archivesBaseName}-${version}.jar"
}

artifacts {
dev file: file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar"), type: "jar", builtBy: jar
}

processResources {
inputs.property "version", project.version

from(project.sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}

from(project.sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

license {
header rootProject.file('HEADER')
include '**/*.java'
}
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from project.sourceSets.main.allSource
}

checkstyle {
configFile = rootProject.file("checkstyle.xml")
toolVersion = '8.36.2'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
plugins {
id 'patchwork-api.module-conventions'
}

task remapMavenJar(type: Copy, dependsOn: remapJar) {
afterEvaluate {
from("${project.buildDir}/libs/$archivesBaseName-${version}.jar")
into("${project.buildDir}/libs/")
rename {String fn -> "$archivesBaseName-${version}-maven.jar"}
}
}

publishing {
publications {
create("${archivesBaseName}_mavenJava", MavenPublication) {
afterEvaluate {
artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}-maven.jar")) {
builtBy remapMavenJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
}
}

bintray {
user = project.hasProperty('bintrayUser') ? project.getProperty('bintrayUser') : System.getenv('bintray_user')
key = project.hasProperty('bintrayKey') ? project.getProperty('bintrayKey') : System.getenv('bintray_key')
publish = true
override = true
publications = ["${archivesBaseName}_mavenJava"]
pkg {
repo = project.bintrayRepo
name = archivesBaseName
user = bintray.user
userOrg = project.repoOwner
licenses = [project.codeLicense]
desc = project.description
websiteUrl = "https://github.com/${project.repoOwner}/${project.repoName}"
issueTrackerUrl = "https://github.com/${project.repoOwner}/${project.repoName}/issues"
vcsUrl = "https://github.com/${project.repoOwner}/${project.repoName}.git"
publicDownloadNumbers = true

githubRepo = "${project.repoOwner}/${project.repoName}"
version {
name = project.version
released = new Date()
}
}
}

rootProject.bintrayUpload.dependsOn(bintrayUpload)

javadoc.enabled = false

rootProject.licenseFormatAll.dependsOn(licenseFormat)

rootProject.remapJar.dependsOn(remapJar)

rootProject.dependencies {
afterEvaluate {
compile project(path: ":${project.name}", configuration: "dev")
include project(":${project.name}:")
}
}
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ repoName=patchwork-api
repoOwner=patchworkmc
bintrayRepo=Patchwork-Maven
codeLicense=LGPL-2.1


baseVersion = 0.10.0
mcVersion = 1.14.4
yarnVersion = +build.16
4 changes: 4 additions & 0 deletions patchwork-api-base/build.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
plugins {
id 'patchwork-api.module-conventions'
}

archivesBaseName = "patchwork-api-base"
version = getSubprojectVersion(project, "0.1.1")
Loading