mirror of
https://github.com/hexedtech/codemp.git
synced 2024-10-22 17:59:20 +02:00
152 lines
3.3 KiB
Groovy
152 lines
3.3 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
id "com.vanniktech.maven.publish" version "0.29.0"
|
|
id 'com.google.osdetector' version '1.7.3'
|
|
}
|
|
|
|
group = 'mp.code'
|
|
version = '0.7.3'
|
|
|
|
tasks.register('windowsJar', Jar) {
|
|
outputs.upToDateWhen { false }
|
|
archiveClassifier = 'windows-x86_64'
|
|
from sourceSets.main.runtimeClasspath
|
|
from('artifacts') {
|
|
include('*.dll')
|
|
into('natives/')
|
|
}
|
|
doFirst {
|
|
if(!(new File('artifacts/codemp.dll').exists())) {
|
|
throw new GradleException("The required file does not exist!")
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('macosJar', Jar) {
|
|
outputs.upToDateWhen { false }
|
|
archiveClassifier = 'osx-aarch_64'
|
|
from sourceSets.main.runtimeClasspath
|
|
from('artifacts') {
|
|
include('*.dylib')
|
|
into('natives/')
|
|
}
|
|
doFirst {
|
|
if(!(new File('artifacts/libcodemp.dylib').exists())) {
|
|
throw new GradleException("The required file does not exist!")
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('linuxJar', Jar) {
|
|
outputs.upToDateWhen { false }
|
|
archiveClassifier = 'linux-x86_64'
|
|
from sourceSets.main.runtimeClasspath
|
|
from('artifacts') {
|
|
include('*.so')
|
|
into('natives/')
|
|
}
|
|
doFirst {
|
|
if(!(new File('artifacts/libcodemp.so').exists())) {
|
|
throw new GradleException("The required file does not exist! Maybe you need to `cargo build` the main library first?")
|
|
}
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
windowsJar {
|
|
canBeConsumed = true
|
|
canBeResolved = false
|
|
extendsFrom implementation, runtimeOnly
|
|
}
|
|
linuxJar {
|
|
canBeConsumed = true
|
|
canBeResolved = false
|
|
extendsFrom implementation, runtimeOnly
|
|
}
|
|
macosJar {
|
|
canBeConsumed = true
|
|
canBeResolved = false
|
|
extendsFrom implementation, runtimeOnly
|
|
}
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11
|
|
artifacts {
|
|
windowsJar(windowsJar)
|
|
macosJar(macosJar)
|
|
linuxJar(linuxJar)
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
sourceSets {
|
|
main.java.srcDirs = ['src/']
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly 'org.projectlombok:lombok:1.18.34'
|
|
annotationProcessor 'org.projectlombok:lombok:1.18.34'
|
|
}
|
|
|
|
tasks.register('cargoBuild', Exec) {
|
|
workingDir '.'
|
|
commandLine 'cargo', 'build', '--release', '--features=java'
|
|
}
|
|
|
|
def rustDir = projectDir.toPath()
|
|
.parent
|
|
.parent
|
|
.resolve('target')
|
|
.resolve('release')
|
|
.toFile()
|
|
|
|
tasks.register('nativeBuild', Jar) {
|
|
archiveClassifier = osdetector.classifier
|
|
dependsOn cargoBuild
|
|
from sourceSets.main.runtimeClasspath
|
|
from(rustDir) {
|
|
include('*.dll')
|
|
include('*.so')
|
|
include('*dylib')
|
|
into('natives/')
|
|
}
|
|
}
|
|
|
|
import com.vanniktech.maven.publish.SonatypeHost
|
|
import com.vanniktech.maven.publish.JavaLibrary
|
|
import com.vanniktech.maven.publish.JavadocJar
|
|
mavenPublishing {
|
|
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) //, true) // TODO re-enable autopublish!
|
|
signAllPublications()
|
|
coordinates(project.group, rootProject.name, project.version)
|
|
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
|
|
|
|
pom {
|
|
name = rootProject.name
|
|
description = "A collaborative editor plugin ecosystem"
|
|
inceptionYear = "2022"
|
|
url = "https://code.mp/"
|
|
licenses {
|
|
license {
|
|
name = "The GNU General Public License v3.0"
|
|
url = "https://www.gnu.org/licenses/gpl-3.0.txt"
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id = "zaaarf"
|
|
name = "zaaarf"
|
|
email = "zaaarf@codemp.dev"
|
|
}
|
|
}
|
|
scm {
|
|
url = "https://github.com/hexedtech/codemp/"
|
|
connection = "scm:git:git://github.com/hexedtech/codemp.git"
|
|
developerConnection = "scm:git:ssh://git@github.com/hexedtech/codemp.git"
|
|
}
|
|
}
|
|
}
|