mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
75 lines
2.2 KiB
Groovy
75 lines
2.2 KiB
Groovy
//version: 1707058017
|
|
|
|
plugins {
|
|
id 'com.gtnewhorizons.gtnhconvention'
|
|
id 'idea'
|
|
id "dts.typescript-generator"
|
|
}
|
|
|
|
version = "1.11-beta1"
|
|
group= "kamkeel.customnpc-plus"
|
|
archivesBaseName = "CustomNPC-Plus"
|
|
|
|
def embedMixin = !project.hasProperty("nomixin");
|
|
if(!embedMixin){
|
|
version += "-nomixin"
|
|
}
|
|
|
|
// API Task
|
|
tasks.create('updateAPI', Exec) {
|
|
description 'Updates (and Inits) git submodules'
|
|
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
|
|
group 'CustomNPC+'
|
|
}
|
|
|
|
// No Mixin Build Task
|
|
def gradleWrapper = System.getProperty('os.name').toLowerCase().contains('windows') ? 'gradlew.bat' : './gradlew'
|
|
|
|
tasks.create('buildNoMixin', Exec) {
|
|
description 'Builds mod without embed'
|
|
group 'CustomNPC+'
|
|
workingDir project.rootDir
|
|
commandLine gradleWrapper, 'build', '-Pnomixin'
|
|
}
|
|
|
|
// No Nashorn Run Tasks
|
|
tasks.create('runClientNoNashorn', Exec) {
|
|
description 'Runs the client without Nashorn'
|
|
group 'CustomNPC+'
|
|
workingDir project.rootDir
|
|
commandLine gradleWrapper, 'runClient', '-PnoNashorn'
|
|
}
|
|
|
|
tasks.create('runServerNoNashorn', Exec) {
|
|
description 'Runs the server without Nashorn'
|
|
group 'CustomNPC+'
|
|
workingDir project.rootDir
|
|
commandLine gradleWrapper, 'runServer', '-PnoNashorn'
|
|
}
|
|
|
|
sourceSets.main.java {
|
|
def apiDir = file('src/api/java')
|
|
|
|
if (!apiDir.exists()) {
|
|
throw new GradleException("Missing API sources: Run './gradlew updateAPI' or enable checkout submodules in CI.")
|
|
}
|
|
|
|
srcDirs += apiDir
|
|
}
|
|
|
|
// ============================================================================
|
|
// TypeScript Definition Generation Task
|
|
// Generates .d.ts files from Java API sources for scripting IDE support
|
|
// ============================================================================
|
|
// TypeScript plugin is applied above in the main plugins block
|
|
|
|
tasks.named("generateTypeScriptDefinitions").configure {
|
|
sourceDirectories = ['src/api/java']
|
|
outputDirectory = "src/main/resources/assets/${project.property("modId")}/api"
|
|
apiPackages = ['noppes.npcs.api', 'net.minecraft'] as Set
|
|
cleanOutputFirst = true // Clean old generated files before regenerating
|
|
}
|
|
processResources.dependsOn generateTypeScriptDefinitions
|
|
sourcesJar.dependsOn generateTypeScriptDefinitions
|
|
|