-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
149 lines (135 loc) · 3.18 KB
/
build.gradle
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
plugins {
id "java-gradle-plugin"
id "groovy"
id "maven-publish"
id "eclipse"
}
group = "info.u-team.gradle_files"
base.archivesName = "gradle_files"
version = "4.0.1"
description = "Gradle plugin for special gradle files used for mods by u-team"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
withSourcesJar()
withJavadocJar()
}
sourceSets {
main {
java {
srcDirs = []
}
groovy {
srcDirs = [
"src/main/java",
"src/main/groovy"
]
}
}
}
gradlePlugin {
plugins {
gradleFilesPlugin {
id = "info.u_team.gradle_files"
implementationClass = "info.u_team.gradle_files_plugin.GradleFilesPlugin"
}
signJarPlugin {
id = "info.u_team.sign_jar"
implementationClass = "info.u_team.sign_jar_plugin.SignJarPlugin"
}
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
// Fix no sources for gradle api (https://stackoverflow.com/questions/22694199/gradle-api-sources-and-doc-when-writing-gradle-plugins)
plugins.withType(EclipsePlugin) {
plugins.withType(JavaBasePlugin) {
eclipse {
classpath {
file {
whenMerged { classpath ->
final def gradleHome = gradle.getGradleHomeDir().absolutePath.replace(File.separator, "/")
final def gradleSourceDirectory = "${gradleHome}/src"
classpath.entries.each { entry ->
if (entry in org.gradle.plugins.ide.eclipse.model.AbstractLibrary && entry.library.path.contains('generated-gradle-jars')) {
entry.sourcePath = new org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory().fromPath(gradleSourceDirectory)
}
}
}
}
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation group: "org.apache.commons", name: "commons-lang3", version: "3.17.0"
implementation group: "com.google.guava", name: "guava", version: "33.3.0-jre"
}
jar.manifest.mainAttributes([
"Implementation-Title": project.name,
"Implementation-Version": project.version
])
[compileJava, compileGroovy].each {
it.options.encoding = "UTF-8"
it.options.deprecation = true
it.options.fork = true
}
compileGroovy {
groovyOptions.optimizationOptions.indy = true
}
publishing {
repositories {
maven {
url "https://repo.u-team.info"
credentials {
username = "maven"
password = getValue("maven.password")
}
}
}
publications {
pluginMaven(MavenPublication) {
artifactId = base.archivesName.get()
pom {
name = base.archivesName.get()
description = project.description
url = "https://github.com/MC-U-Team/Gradle-Files"
scm {
url = "https://github.com/MC-U-Team/Gradle-Files"
connection = "scm:git:git://github.com/MC-U-Team/Gradle-Files.git"
developerConnection = "scm:git:[email protected]:MC-U-Team/Gradle-Files.git"
}
issueManagement {
system = "github"
url = "https://github.com/MC-U-Team/Gradle-Files/issues"
}
licenses {
license {
name = "All rights reserved"
}
}
developers {
developer {
name = "HyCraftHD"
}
}
}
}
}
}
def getValue(name) {
def envVariable = System.getenv(name)
if(envVariable != null) {
return envVariable
} else {
if (project.hasProperty(name)) {
return project.getProperty(name)
}
}
return null
}