Advertisement
Guest User

build. gradle

a guest
Aug 30th, 2019
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 3.79 KB | None | 0 0
  1. buildscript {
  2.     repositories {
  3.         maven { url = 'https://files.minecraftforge.net/maven' }
  4.         maven { url "https://libraries.minecraft.net" }
  5.         maven { url 'https://minecraft.curseforge.com/api/maven/' }
  6.         jcenter()
  7.         mavenCentral()
  8.     }
  9.     dependencies {
  10.         classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
  11.         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.30"
  12.     }
  13. }
  14. apply plugin: 'net.minecraftforge.gradle'
  15. apply plugin: 'eclipse'
  16. apply plugin: 'maven-publish'
  17. apply plugin: 'kotlin'
  18.  
  19. version = '0.0.1'
  20. group = 'com.mairwunnx.projectessentials'
  21. archivesBaseName = 'Project Essentials'
  22.  
  23. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
  24. compileKotlin.kotlinOptions.jvmTarget = compileTestKotlin.kotlinOptions.jvmTarget = '1.8'
  25.  
  26. repositories {
  27.     maven { url 'https://minecraft.curseforge.com/api/maven/' }
  28.     maven { url "https://libraries.minecraft.net" }
  29. }
  30.  
  31. configurations {
  32.     mod
  33. }
  34.  
  35. minecraft {
  36.     mappings channel: 'snapshot', version: '20190719-1.14.3'
  37.  
  38.     runs {
  39.         client {
  40.             workingDirectory project.file('run')
  41.             property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  42.             property 'forge.logging.console.level', 'debug'
  43.             mods {
  44.                 examplemod {
  45.                     source sourceSets.main
  46.                 }
  47.             }
  48.         }
  49.  
  50.         server {
  51.             workingDirectory project.file('run')
  52.             property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  53.             property 'forge.logging.console.level', 'debug'
  54.             mods {
  55.                 examplemod {
  56.                     source sourceSets.main
  57.                 }
  58.             }
  59.         }
  60.  
  61.         data {
  62.             workingDirectory project.file('run')
  63.             property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  64.             property 'forge.logging.console.level', 'debug'
  65.             args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/')
  66.             mods {
  67.                 examplemod {
  68.                     source sourceSets.main
  69.                 }
  70.             }
  71.         }
  72.     }
  73. }
  74.  
  75. dependencies {
  76.     minecraft 'net.minecraftforge:forge:1.14.4-28.0.73'
  77.     compile "kottle:Kottle:$kottleVersion"
  78.     mod "kottle:Kottle:$kottleVersion"
  79.     compile 'com.mojang:brigadier:1.0.17'
  80. }
  81.  
  82. task installMods(type: Copy, dependsOn: "deinstallMods") {
  83.     from { configurations.mod }
  84.     include "**/*.jar"
  85.     into file("run/mods")
  86. }
  87.  
  88. task deinstallMods(type: Delete) {
  89.     delete fileTree(dir: "run/mods", include: "*.jar")
  90. }
  91.  
  92. project.afterEvaluate {
  93.     project.tasks['prepareRuns'].dependsOn(project.tasks['installMods'])
  94. }
  95.  
  96. jar {
  97.     manifest {
  98.         attributes([
  99.             "Specification-Title": "Project Essentials",
  100.             "Specification-Vendor": "MairwunNx (Pavel Erokhin)",
  101.             "Specification-Version": "1", // We are version 1 of ourselves
  102.             "Implementation-Title": project.name,
  103.             "Implementation-Version": "${version}",
  104.             "Implementation-Vendor" :"MairwunNx (Pavel Erokhin)",
  105.             "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  106.         ])
  107.     }
  108. }
  109.  
  110. def reobfFile = file("$buildDir/reobfJar/output.jar")
  111. def reobfArtifact = artifacts.add('default', reobfFile) {
  112.     type 'jar'
  113.     builtBy 'reobfJar'
  114. }
  115.  
  116. publishing {
  117.     publications {
  118.         mavenJava(MavenPublication) {
  119.             artifact reobfArtifact
  120.         }
  121.     }
  122.     repositories {
  123.         maven {
  124.             url "file:///${project.projectDir}/mcmodsrepo"
  125.         }
  126.     }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement