-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathbuild.gradle
More file actions
113 lines (91 loc) · 3.42 KB
/
build.gradle
File metadata and controls
113 lines (91 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//version: 1707058017
plugins {
id 'com.gtnewhorizons.gtnhconvention'
id 'idea'
id "dts.typescript-generator"
}
version = "1.11.1"
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', 'src/main/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
patchesDirectory = "dts-patches"
implementationPackages = [
'noppes.npcs.scripted',
'noppes.npcs.controllers.data',
'noppes.npcs.entity.data',
'noppes.npcs.quests',
'kamkeel.npcs.controllers.data'
] as Set
}
processResources.dependsOn generateTypeScriptDefinitions
sourcesJar.dependsOn generateTypeScriptDefinitions
// Javadoc configuration
javadoc {
options.encoding = 'UTF-8'
options.charSet = 'UTF-8'
options.docEncoding = 'UTF-8'
options.tags = [
'hookName:a:Hook Name:'
]
options.stylesheetFile = file('.github/javadoc/javadoc-theme.css')
options.header = file('.github/javadoc/javadoc-header.html').text.replaceAll('\\s+', ' ').trim()
options.addBooleanOption('-allow-script-in-comments', true)
options.footer = file('.github/javadoc/javadoc-footer.html').text.replaceAll('\\s+', ' ').trim()
// Only document the public API, not net.minecraft stubs
include 'noppes/npcs/api/**'
options.links(
'https://docs.oracle.com/en/java/javase/11/docs/api/'
)
javadocTool = javaToolchains.javadocToolFor {
languageVersion = JavaLanguageVersion.of(11)
}
}
// Modify the existing 'build' task to depend on 'updateAPI'
//tasks.apiClasses.dependsOn 'updateAPI'