Update build.gradle

This commit is contained in:
Aleksey 2021-05-25 17:38:02 +03:00
parent 6a600bf285
commit d2bbcf32cd

View file

@ -1,133 +1,133 @@
plugins { plugins {
id 'fabric-loom' version '0.7-SNAPSHOT' id 'fabric-loom' version '0.7-SNAPSHOT'
//id 'maven-publish' //id 'maven-publish'
} }
apply plugin: 'maven' apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
group = project.maven_group group = project.maven_group
repositories { repositories {
maven { url "https://maven.dblsaiko.net/" } maven { url "https://maven.dblsaiko.net/" }
maven { url "http://server.bbkr.space:8081/artifactory/libs-release/" } maven { url "http://server.bbkr.space:8081/artifactory/libs-release/" }
maven { url "https://maven.fabricmc.net/" } maven { url "https://maven.fabricmc.net/" }
maven { url 'https://maven.blamejared.com' } maven { url 'https://maven.blamejared.com' }
maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.shedaniel.me/" }
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
} }
dependencies { dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings minecraft.officialMojangMappings() mappings minecraft.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
useApi "vazkii.patchouli:Patchouli:1.16.4-${project.patchouli_version}" useApi "vazkii.patchouli:Patchouli:1.16.4-${project.patchouli_version}"
} }
def useOptional(String dep) { def useOptional(String dep) {
dependencies.modRuntime (dep) { dependencies.modRuntime (dep) {
exclude group: "net.fabricmc.fabric-api" exclude group: "net.fabricmc.fabric-api"
exclude group: "net.fabricmc" exclude group: "net.fabricmc"
if (!dep.contains("me.shedaniel")) { if (!dep.contains("me.shedaniel")) {
exclude group: "me.shedaniel" exclude group: "me.shedaniel"
} }
} }
dependencies.modCompileOnly (dep) { dependencies.modCompileOnly (dep) {
exclude group: "net.fabricmc.fabric-api" exclude group: "net.fabricmc.fabric-api"
exclude group: "net.fabricmc" exclude group: "net.fabricmc"
if (!dep.contains("me.shedaniel")) { if (!dep.contains("me.shedaniel")) {
exclude group: "me.shedaniel" exclude group: "me.shedaniel"
} }
} }
} }
def useApi(String dep) { def useApi(String dep) {
dependencies.modApi (dep) { dependencies.modApi (dep) {
exclude group: "net.fabricmc.fabric-api" exclude group: "net.fabricmc.fabric-api"
exclude group: "net.fabricmc" exclude group: "net.fabricmc"
if (!dep.contains("me.shedaniel")) { if (!dep.contains("me.shedaniel")) {
exclude group: "me.shedaniel" exclude group: "me.shedaniel"
} }
} }
} }
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json" include "fabric.mod.json"
expand "version": project.version expand "version": project.version
} }
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json" exclude "fabric.mod.json"
} }
} }
// ensure that the encoding is set to UTF-8, no matter what the system default is // ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly // this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.encoding = "UTF-8" options.encoding = "UTF-8"
} }
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present. // if it is present.
// If you remove this task, sources will not be generated. // If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) { task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources" classifier = "sources"
from sourceSets.main.allSource from sourceSets.main.allSource
} }
task javadocJar(type: Jar, dependsOn: javadoc) { task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc' classifier = 'javadoc'
from javadoc.destinationDir from javadoc.destinationDir
} }
jar { jar {
from "LICENSE" from "LICENSE"
} }
artifacts { artifacts {
archives sourcesJar archives sourcesJar
archives javadocJar archives javadocJar
} }
install { install {
repositories.mavenInstaller { repositories.mavenInstaller {
pom.project { pom.project {
licenses { licenses {
license { license {
name 'MIT License' name 'MIT License'
url 'https://raw.githubusercontent.com/paulevsGitch/BCLib/main/LICENSE' url 'https://raw.githubusercontent.com/paulevsGitch/BCLib/main/LICENSE'
distribution 'repo' distribution 'repo'
} }
} }
} }
} }
} }
// configure the maven publication // configure the maven publication
//publishing { //publishing {
// publications { // publications {
// mavenJava(MavenPublication) { // mavenJava(MavenPublication) {
// artifact(remapJar) { // artifact(remapJar) {
// builtBy remapJar // builtBy remapJar
// } // }
// artifact(sourcesJar) { // artifact(sourcesJar) {
// builtBy remapSourcesJar // builtBy remapSourcesJar
// } // }
// } // }
// } // }
// //
// // select the repositories you want to publish to // // select the repositories you want to publish to
// repositories { // repositories {
// mavenLocal() // mavenLocal()
// } // }
//} //}