-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
141 lines (117 loc) · 4.13 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* Copyright (c) 2022 - present. New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
buildscript {
apply from: "${rootDir}/buildconfig.gradle"
repositories {
mavenCentral()
google()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/comnewrelic-${project.versions.agent}" }
}
dependencies {
classpath "org.jacoco:org.jacoco.core:${versions.test.jacoco}"
}
}
plugins {
id("base")
id("io.github.gradle-nexus.publish-plugin")
}
description 'The New Relic Android Agent'
wrapper {
gradleVersion = project.versions.gradle
}
project.tasks.register("checkJavaVersion") {
def localVersion = System.properties['java.version']
if (localVersion.toString().isEmpty()) {
throw new GradleException("Version not specified:")
}
if (localVersion.toString() < project.versions.java.minVersion.toString()) {
throw new GradleException("Unsupported Java version: ${localVersion}. Make sure the version of the Java compiler is ${project.versions.java.minVersion}.")
}
}
allprojects { project ->
version = project.versions.agent
group = 'com.newrelic.agent.android'
task allDeps(type: DependencyReportTask) {}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/comnewrelic-" + newrelic.agent.snapshot }
mavenCentral()
google()
}
// The libsDir method has been deprecated. This is scheduled to be removed in Gradle 6.0.
ext.projectLibsDir = project.file("${project.buildDir}/${project.libsDirName}").getAbsolutePath()
apply plugin: 'jacoco'
}
subprojects { project ->
tasks.withType(JavaCompile) {
options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:static"]
options.encoding = "UTF-8"
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
if (project.fullReport) {
// apply static analysis tools
logger.quiet("[newrelic] Applying static analysis tools to project[$project.name]")
}
}
def deployableProjects = [":agent", ":instrumentation", ":plugins:gradle"]
deployableProjects.each {
project(it) {
tasks.withType(Jar) {
manifest {
attributes(
"Created-By": "New Relic, Inc.",
"Built-Date": project.buildDate
)
}
}
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from 'sonatype'
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from 'sonatype'
}
}
}
project.afterEvaluate {
/**
* Build the test app using generated artifacts:
*/
project.tasks.register("prepareIntegration", Exec) {
dependsOn project.tasks.assemble
description "Cache the build artifacts to local M2-REPO"
group "test"
workingDir rootProject.rootDir
environment "M2_REPO", mavenLocal
commandLine "./gradlew", "-Pnewrelic.agent.version=$project.versions.agent", "publish"
}
project.tasks.register("integrationTest", Exec) {
dependsOn project.tasks.prepareIntegration
description "Build the test app using generated artifacts"
group "test"
workingDir "$rootProject.rootDir/samples/agent-test-app"
environment "M2_REPO", mavenLocal
commandLine "./gradlew", "-Pnewrelic.agent.version=$project.versions.agent", "-PagentRepo=${mavenLocal}", "clean", "build"
enabled prepareIntegration.enabled
}
check.dependsOn(['integrationTest'])
}
project.tasks.register("cleanRoot", Delete) {
delete rootProject.buildDir
delete "$rootDir/samples/agent-test-app/build"
}
clean.finalizedBy cleanRoot
if (project.findProperty("sonatypeUsername") != null && project.findProperty("sonatypePassword") != null) {
nexusPublishing {
repositories {
sonatype {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}