101 строка
3.1 KiB
Groovy
101 строка
3.1 KiB
Groovy
plugins {
|
|
id "net.linguica.maven-settings" version "0.5" apply false
|
|
id "com.gradle.plugin-publish" version "0.15.0" apply false
|
|
id "nu.studer.credentials" version "2.1" apply false
|
|
id "com.github.ben-manes.versions" version "0.39.0" apply false
|
|
id "io.freefair.aspectj.post-compile-weaving" version "6.0.0-m2"
|
|
}
|
|
|
|
class PrepareResourceTask extends DefaultTask {
|
|
@Option(option = "release", description = "whether this build is a release build.")
|
|
Boolean release;
|
|
|
|
Project currentProject
|
|
|
|
@TaskAction
|
|
void prepare() {
|
|
def templateFile = new File(project.projectDir, "src/main/resources/ApplicationInsightsTemplate.xml");
|
|
def targetFile = new File(project.projectDir, "src/main/resources/ApplicationInsights.xml");
|
|
if (templateFile.exists()) {
|
|
targetFile.text = templateFile.text.replaceAll("\\{AI_KEY}",
|
|
(release != null && release) ? "435bdea7-d399-49ee-8d2d-b2792aa060d2" : "fda156f5-2eb8-48ab-8a3c-3e06b3c64b49")
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'java'
|
|
apply plugin: 'checkstyle'
|
|
apply plugin: 'project-report'
|
|
|
|
sourceCompatibility = 1.8
|
|
targetCompatibility = 1.8
|
|
|
|
ext {
|
|
azureToolkitVersion = "0.24.0"
|
|
}
|
|
|
|
checkstyle {
|
|
toolVersion '8.36.1';
|
|
|
|
// Whether or not to allow the build to continue if there are warnings.
|
|
ignoreFailures = false
|
|
|
|
// Whether or not rule violations are to be displayed on the console.
|
|
showViolations = true
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: 'javadoc') {
|
|
from javadoc.destinationDir
|
|
archiveClassifier = 'javadoc'
|
|
}
|
|
|
|
task sourceJar(type: Jar) {
|
|
from sourceSets.main.allJava
|
|
archiveClassifier = "sources"
|
|
}
|
|
|
|
compileJava.doFirst {
|
|
if (targetCompatibility != '1.8') throw new RuntimeException("This project shall be compiled with targetCompatibility = 1.8 " +
|
|
"but targetCompatibility is actually "
|
|
+ targetCompatibility)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
configure(subprojects.findAll {it.name != 'azure-gradle-plugins-common'}) {
|
|
apply plugin: 'java-gradle-plugin'
|
|
apply plugin: 'com.gradle.plugin-publish'
|
|
apply plugin: "nu.studer.credentials"
|
|
|
|
task prepareResources(type: PrepareResourceTask) {
|
|
currentProject = project
|
|
}
|
|
|
|
task prepareReleaseResources(type: PrepareResourceTask) {
|
|
currentProject = project
|
|
release = true
|
|
}
|
|
|
|
task setupPluginPublishSecret {
|
|
doLast {
|
|
def key = credentials['gradle.publish.key']
|
|
def secret = credentials['gradle.publish.secret']
|
|
if( !key || !secret) {
|
|
throw new RuntimeException("gradlePublishKey and/or gradlePublishSecret are not defined")
|
|
}
|
|
|
|
System.properties.setProperty("gradle.publish.key", key)
|
|
System.properties.setProperty("gradle.publish.secret", secret)
|
|
}
|
|
}
|
|
tasks.publishPlugins.dependsOn tasks.setupPluginPublishSecret
|
|
}
|