eagler-teavm-fork/build-logic/build.gradle.kts

95 lines
2.9 KiB
Plaintext
Raw Normal View History

2023-01-03 06:29:13 -08:00
/*
* Copyright 2023 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
`java-gradle-plugin`
checkstyle
}
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
dependencies {
implementation(libs.shadowPlugin)
implementation(libs.maven.plugin.tools.api)
implementation(libs.maven.plugin.tools.generators)
implementation(libs.maven.plugin.tools.annotations)
implementation(libs.maven.embedder)
implementation(libs.maven.compat)
}
gradlePlugin {
plugins {
create("teavm-publish") {
id = "teavm-publish"
implementationClass = "org.teavm.buildutil.PublishTeaVMPlugin"
}
create("dependency-relocation") {
id = "dependency-relocation"
implementationClass = "org.teavm.buildutil.DependencyRelocationPlugin"
}
create("shadowApply") {
id = "shadowApply"
implementationClass = "org.teavm.buildutil.ShadowApplyPlugin"
}
create("mavenPlugin") {
id = "mavenPlugin"
implementationClass = "org.teavm.buildutil.MavenPluginPlugin"
}
create("javaVersion") {
id = "javaVersion"
implementationClass = "org.teavm.buildutil.JavaVersionPlugin"
}
2023-01-03 06:29:13 -08:00
}
}
checkstyle {
toolVersion = libs.versions.checkstyle.get()
configDirectory.set(project.layout.projectDirectory.dir("../config/checkstyle"))
}
java {
sourceCompatibility = JavaVersion.VERSION_11
2023-01-03 06:29:13 -08:00
}
val generatedConfigDir = project.layout.buildDirectory.dir("generated/config").get()
val generateConfig by tasks.registering {
val file = generatedConfigDir.file("org/teavm/buildutil/Config.java").asFile
outputs.file(file)
doLast {
file.parentFile.mkdirs()
file.writeText("""
package org.teavm.buildutil;
class Config {
static final String MAVEN_PLUGIN_API = "${libs.maven.plugin.api.get()}";
static final String MAVEN_PLUGIN_ANNOTATIONS = "${libs.maven.plugin.annotations.get()}";
static final String MAVEN_ARTIFACT = "${libs.maven.artifact.get()}";
static final String MAVEN_CORE = "${libs.maven.core.get()}";
}
""".trimIndent())
}
}
2023-02-02 01:42:45 -08:00
tasks.compileJava.configure {
dependsOn(generateConfig)
options.encoding = "UTF-8"
}
2023-01-03 06:29:13 -08:00
sourceSets.main.configure { java.srcDir(generatedConfigDir) }