49 lines
1.5 KiB
Groovy
49 lines
1.5 KiB
Groovy
import org.gradle.api.credentials.HttpHeaderCredentials
|
|
import org.gradle.authentication.http.HttpHeaderAuthentication
|
|
|
|
apply plugin: 'maven-publish'
|
|
|
|
group = 'com.ttstd'
|
|
version = rootProject.ext.publishVersion
|
|
|
|
def giteaToken = project.findProperty('giteaToken') ?: System.getenv('GITEA_TOKEN')
|
|
|
|
task sourcesJar(type: Jar) {
|
|
archiveClassifier.set('sources')
|
|
from android.sourceSets.main.java.srcDirs
|
|
}
|
|
|
|
afterEvaluate {
|
|
publishing {
|
|
publications {
|
|
release(MavenPublication) {
|
|
from components.release
|
|
artifact sourcesJar
|
|
artifactId = 'tts-speaker-sdk'
|
|
|
|
pom {
|
|
name = 'TtsSpeaker SDK'
|
|
description = 'HTTP online TTS synthesis, cancellable playback and WAV file rendering without an installed TTS engine.'
|
|
}
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
name = 'gitea'
|
|
url = 'https://gitea.ttstd.com/api/packages/maven/maven'
|
|
|
|
if (!giteaToken) {
|
|
throw new GradleException("缺少 giteaToken:请写入 ~/.gradle/gradle.properties 或设置环境变量 GITEA_TOKEN")
|
|
}
|
|
credentials(HttpHeaderCredentials) {
|
|
name = 'Authorization'
|
|
value = "token ${giteaToken}"
|
|
}
|
|
authentication {
|
|
header(HttpHeaderAuthentication)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|