forked from fnuecke/buildroot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
93 lines (80 loc) · 2.3 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
plugins {
id 'java'
id 'maven-publish'
}
def getGitRef() {
try {
final def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (final Throwable ignored) {
return 'unknown'
}
}
version = "${semver}+${getGitRef()}"
group = 'li.cil.sedna'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
repositories {
mavenCentral()
}
import org.apache.tools.ant.taskdefs.condition.Os
task cleanBuildroot(type: Exec) {
if (Os.isFamily(Os.FAMILY_UNIX)) {
commandLine("make", "clean")
}
}
clean.dependsOn cleanBuildroot
task compileBuildroot(type: Exec) {
if (Os.isFamily(Os.FAMILY_UNIX)) {
commandLine("make")
} else {
logger.log(LogLevel.WARN, "Can only make buildroot on Linux. Expecting output files to have been manually placed in [output/images/].")
enabled = false
}
outputs.files "output/images/fw_jump.bin", "output/images/Image", "output/images/rootfs.ext2"
outputs.upToDateWhen { false }
}
task generateLegalInfo(type: Exec) {
if (Os.isFamily(Os.FAMILY_UNIX)) {
commandLine("make", "legal-info")
} else {
enabled = false
}
outputs.dirs "output/legal-info/licenses"
outputs.upToDateWhen { false }
}
task copyBuildrootImages(type: Copy) {
from compileBuildroot.outputs.files
into "src/main/resources/generated/"
}
task copyBuildrootLicenses(type: Copy) {
from generateLegalInfo.outputs.files
into "src/main/resources/licenses/"
}
copyBuildrootImages.dependsOn(compileBuildroot)
copyBuildrootImages.dependsOn(generateLegalInfo)
compileJava.dependsOn(copyBuildrootImages)
compileJava.dependsOn(copyBuildrootLicenses)
publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.group
artifactId = project.name
version = semver
artifact jar
}
}
repositories {
maven {
name = "GitHubPackages"
url = System.getenv("GITHUB_MAVEN_URL") ?: ""
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}