1
- import dev.silenium.libs.jni.NativePlatform
2
1
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3
2
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
4
3
5
- buildscript {
6
- repositories {
7
- maven(" https://reposilite.silenium.dev/releases" ) {
8
- name = " silenium-releases"
9
- }
10
- }
11
- dependencies {
12
- classpath(libs.jni.utils)
13
- }
14
- }
15
-
16
4
plugins {
17
5
alias(libs.plugins.kotlin)
18
6
`maven- publish`
@@ -33,60 +21,6 @@ dependencies {
33
21
}
34
22
35
23
val deployKotlin = (findProperty(" deploy.kotlin" ) as String? )?.toBoolean() ? : true
36
- val deployNative = (findProperty(" deploy.native" ) as String? )?.toBoolean() ? : true
37
- val withGPL: Boolean = findProperty(" ffmpeg.gpl" ).toString().toBoolean()
38
- val platformExtension = " -gpl" .takeIf { withGPL }.orEmpty()
39
- val platform = NativePlatform .platform(platformExtension)
40
-
41
- val compileNative = if (deployNative) {
42
- tasks.register<Exec >(" compileNative" ) {
43
- enabled = deployNative
44
- commandLine(
45
- " bash" ,
46
- layout.projectDirectory.file(" cppbuild.sh" ).asFile.absolutePath,
47
- " -extension" , platform.extension,
48
- " -platform" , platform.osArch,
49
- " install" , " ffmpeg" ,
50
- )
51
- workingDir(layout.projectDirectory.asFile)
52
-
53
- inputs.property(" platform" , platform)
54
- inputs.files(layout.projectDirectory.files(" cppbuild.sh" ))
55
- inputs.files(layout.projectDirectory.files(" detect-platform.sh" ))
56
- inputs.files(layout.projectDirectory.files(" ffmpeg/cppbuild.sh" ))
57
- inputs.files(layout.projectDirectory.files(" ffmpeg/*.patch" ))
58
- inputs.files(layout.projectDirectory.files(" ffmpeg/*.diff" ))
59
- outputs.dir(layout.projectDirectory.dir(" ffmpeg/cppbuild/${platform} " ))
60
- outputs.cacheIf { true }
61
- }
62
- } else null
63
-
64
- val nativesJar = if (deployNative) {
65
- tasks.register<Jar >(" nativesJar" ) {
66
- val platform = NativePlatform .platform(platformExtension)
67
-
68
- from(compileNative!! .get().outputs.files) {
69
- include(" lib/*.so" )
70
- include(" lib/*.dll" )
71
- include(" lib/*.dylib" )
72
- eachFile {
73
- path = " natives/$platform /$name "
74
- }
75
- into(" natives/$platform /" )
76
- }
77
- }
78
- } else null
79
-
80
- val zipBuild = if (deployNative) {
81
- tasks.register<Zip >(" zipBuild" ) {
82
- from(compileNative!! .get().outputs.files) {
83
- include(" bin/**/*" )
84
- include(" include/**/*" )
85
- include(" lib/**/*" )
86
- include(" share/**/*" )
87
- }
88
- }
89
- } else null
90
24
91
25
kotlin {
92
26
compilerOptions {
@@ -100,23 +34,7 @@ java {
100
34
withSourcesJar()
101
35
}
102
36
103
- publishing {
104
- publications {
105
- if (deployNative) {
106
- create<MavenPublication >(" native${platform.capitalized} " ) {
107
- artifact(nativesJar)
108
- artifact(zipBuild)
109
- artifactId = " ffmpeg-natives-${platform} "
110
- }
111
- }
112
- if (deployKotlin) {
113
- create<MavenPublication >(" kotlin" ) {
114
- from(components[" java" ])
115
- artifactId = " ffmpeg-natives"
116
- }
117
- }
118
- }
119
-
37
+ allprojects {
120
38
repositories {
121
39
maven(System .getenv(" REPOSILITE_URL" ) ? : " https://reposilite.silenium.dev/snapshots" ) {
122
40
name = " reposilite"
@@ -129,3 +47,14 @@ publishing {
129
47
}
130
48
}
131
49
}
50
+
51
+ publishing {
52
+ publications {
53
+ if (deployKotlin) {
54
+ create<MavenPublication >(" kotlin" ) {
55
+ from(components[" java" ])
56
+ artifactId = " ffmpeg-natives"
57
+ }
58
+ }
59
+ }
60
+ }
0 commit comments