2023-07-26 22:18:20 +02:00
import fr.altarik.ReportDiscord
2023-03-02 14:07:48 +01:00
plugins {
2024-01-06 21:42:25 +01:00
id 'fabric-loom' version '1.4-SNAPSHOT' apply false
2022-11-07 00:38:54 +01:00
}
2023-06-13 21:02:46 +02:00
Properties local = new Properties ( )
2023-07-20 19:17:19 +02:00
try {
local . load ( new FileInputStream ( rootProject . file ( "local.properties" ) ) )
} catch ( IOException ignored ) { }
2023-07-26 22:18:20 +02:00
group = project . maven_group
version = project . maven_version
String webhookId = getEnv ( "DISCORD_PUB_ID" , local . getProperty ( "discord_pub_id" ) )
String webhookToken = getEnv ( "DISCORD_PUB_TOKEN" , local . getProperty ( "discord_pub_token" ) )
String repoUrl = "https://repo.altarik.fr/#/" + ( project . version . endsWith ( 'SNAPSHOT' ) ? 'snapshots/' : 'releases/' ) + project . group . replace ( "." , "/" ) + "/" + project . rootProject . name + "/" + project . version
2023-07-26 23:33:01 +02:00
var reportConfig = new ReportDiscord . ReportData ( "https://discord.com/api/" , webhookId , webhookToken , project . rootProject . name , "Update " + project . version + " has been published" , repoUrl ) ;
2023-06-13 21:02:46 +02:00
2023-03-02 14:07:48 +01:00
allprojects {
2022-11-07 00:09:52 +01:00
apply plugin: 'maven-publish'
2023-03-19 19:38:08 +01:00
apply plugin: 'fabric-loom'
2023-03-02 14:07:48 +01:00
group = project . maven_group
version = project . maven_version
2022-11-07 00:09:52 +01:00
2023-03-02 14:07:48 +01:00
repositories {
maven {
name 'altarik-snapshots'
url 'https://repo.altarik.fr/snapshots/'
}
maven {
name 'altarik-releases'
url 'https://repo.altarik.fr/releases/'
}
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral ( )
}
2022-11-07 00:09:52 +01:00
publishing {
publications {
mavenJava ( MavenPublication ) {
2023-03-02 14:07:48 +01:00
from components . java
2022-11-07 00:09:52 +01:00
}
2023-03-23 01:33:03 +01:00
}
2022-11-07 00:09:52 +01:00
repositories {
maven {
name 'altarik'
2022-11-07 00:38:54 +01:00
url 'https://repo.altarik.fr/' . concat ( project . version . endsWith ( 'SNAPSHOT' ) ? 'snapshots/' : 'releases/' )
2022-11-07 00:09:52 +01:00
credentials {
2023-07-20 19:17:19 +02:00
username = getEnv ( "REPO_USERNAME" , local . getProperty ( "repo_username" ) )
password = getEnv ( "REPO_PASSWORD" , local . getProperty ( "repo_password" ) )
2022-11-07 00:09:52 +01:00
}
}
2022-09-19 23:52:14 +02:00
}
}
2023-03-02 14:07:48 +01:00
2023-03-19 19:38:08 +01:00
processResources {
inputs . property "version" , project . version
2024-01-06 21:42:25 +01:00
inputs . property "minecraftVersion" , project . minecraft_version
inputs . property "loaderVersion" , project . loader_version
2023-03-19 19:38:08 +01:00
filesMatching ( "fabric.mod.json" ) {
2024-01-06 21:42:25 +01:00
expand inputs . properties
2023-03-19 19:38:08 +01:00
}
}
tasks . withType ( JavaCompile ) . configureEach {
it . options . encoding = "UTF-8"
2024-01-06 21:42:25 +01:00
it . options . release = 17
2023-03-19 19:38:08 +01:00
}
2022-11-07 00:09:52 +01:00
2023-02-27 00:13:09 +01:00
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:${project.junit_version}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${project.junit_version}"
2023-03-19 19:38:08 +01:00
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
2023-02-27 00:13:09 +01:00
}
2023-02-03 12:31:51 +01:00
java {
withSourcesJar ( )
withJavadocJar ( )
2024-01-06 21:42:25 +01:00
sourceCompatibility = JavaVersion . VERSION_17
targetCompatibility = JavaVersion . VERSION_17
2023-02-03 12:31:51 +01:00
}
2023-02-27 00:13:09 +01:00
test {
useJUnitPlatform ( )
}
2023-02-03 12:31:51 +01:00
2023-03-02 14:07:48 +01:00
}
2022-11-07 00:09:52 +01:00
2023-03-19 19:38:08 +01:00
dependencies {
2024-01-06 21:42:25 +01:00
implementation project ( path: ":Core" , configuration: "namedElements" )
implementation project ( path: ":Database" , configuration: "namedElements" )
implementation project ( path: ":Pagination" , configuration: "namedElements" )
implementation project ( path: ":Tasks" , configuration: "namedElements" )
2023-03-23 01:33:03 +01:00
include subprojects . collect { project - > project }
2023-03-19 19:38:08 +01:00
}
2023-07-20 19:17:19 +02:00
static def getEnv ( String envName , String defaultValue ) {
2023-07-20 19:17:58 +02:00
String r = System . getenv ( envName )
2023-07-20 19:17:19 +02:00
if ( r ! = null ) {
2023-07-20 19:17:58 +02:00
return r
2023-07-20 19:17:19 +02:00
} else {
2023-07-20 19:17:58 +02:00
return defaultValue
2023-07-20 19:17:19 +02:00
}
}
2023-07-26 22:18:20 +02:00
tasks . register ( "reportToDiscord" , ReportDiscord ) {
config . set ( reportConfig )
}
2023-03-19 19:38:08 +01:00
/ * jar {
2023-03-02 14:07:48 +01:00
dependsOn subprojects . jar
subprojects . each { project - >
from ( project . jar ) {
into ( "META-INF/jars/" )
}
2022-09-19 23:52:14 +02:00
}
2023-03-19 19:38:08 +01:00
} * /