Fix publishing and classes.jar

This commit is contained in:
CranberrySoup 2024-04-04 19:04:46 +02:00
parent 6940e0d224
commit 20a61584df
2 changed files with 30 additions and 17 deletions

View file

@ -1,5 +1,6 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream
import java.net.URL
@ -240,16 +241,31 @@ dependencies {
})
}
tasks.register("androidSourcesJar", Jar::class) {
tasks.register<Jar>("androidSourcesJar") {
archiveClassifier.set("sources")
from(android.sourceSets.getByName("main").java.srcDirs) // Full Sources
}
// For GradLew Plugin
tasks.register("makeJar", Copy::class) {
from("build/intermediates/compile_app_classes_jar/prereleaseDebug")
into("build")
include("classes.jar")
tasks.register<Copy>("copyJar") {
from(
"build/intermediates/compile_app_classes_jar/prereleaseDebug",
"../library/build/libs"
)
into("build/app-classes")
include("classes.jar", "library-jvm*.jar")
// Remove the version
rename("library-jvm.*.jar", "library-jvm.jar")
}
// Merge the app classes and the library classes into classes.jar
tasks.register<Jar>("makeJar") {
dependsOn(tasks.getByName("copyJar"))
from(
zipTree("build/app-classes/classes.jar"),
zipTree("build/app-classes/library-jvm.jar")
)
destinationDirectory.set(layout.buildDirectory)
archivesName = "classes"
}
tasks.withType<KotlinCompile> {

View file

@ -8,6 +8,7 @@ plugins {
}
kotlin {
version = "1.0.0"
androidTarget()
jvm()
@ -58,14 +59,10 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}
}
//publishing {
// publications {
// create<MavenPublication>("maven") {
// groupId = "com.lagradost"
// artifactId = "api"
// version = "0.1.0"
// from(components["java"])
// }
// }
//}
publishing {
publications {
withType<MavenPublication> {
groupId = "com.lagradost.api"
}
}
}