-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into run_build_on_main_merge
- Loading branch information
Showing
4 changed files
with
71 additions
and
37 deletions.
There are no files selected for viewing
78 changes: 48 additions & 30 deletions
78
buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,70 @@ | ||
import com.android.build.api.dsl.LibraryExtension | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import java.net.URI | ||
|
||
plugins { | ||
id("com.android.library") | ||
id("maven-publish") | ||
id("signing") | ||
} | ||
|
||
val isARelease = project.hasProperty("release") && project.property("release") == "true" | ||
|
||
val variantToPublish = "release" | ||
android { | ||
lint { | ||
warningsAsErrors = true | ||
// A newer version of androidx.appcompat:appcompat than 1.3.1 is available: 1.4.1 [GradleDependency] | ||
// we rely on dependabot for dependency updates | ||
disable.add("GradleDependency") | ||
} | ||
} | ||
|
||
val sourcesJar by tasks.registering(Jar::class) { | ||
|
||
from(android.sourceSets.named("main").get().java.srcDirs) | ||
archiveClassifier.set("sources") | ||
} | ||
|
||
project.afterEvaluate { | ||
|
||
// note: we need to declare this here in afterEvaluate because the android plugin doesn't | ||
// resolve dependencies early enough to make the libraryVariants hack work until here. | ||
val javadoc by tasks.registering(Javadoc::class) { | ||
source = android.sourceSets.named("main").get().java.getSourceFiles() | ||
classpath += project.files(android.bootClasspath) | ||
publishing { | ||
singleVariant(variantToPublish) { | ||
|
||
// grab the library variants, because apparently this is where the real classpath lives that | ||
// is needed for javadoc generation. | ||
val firstVariant = project.android.libraryVariants.toList().first() | ||
val javaCompile = firstVariant.javaCompileProvider.get() | ||
classpath += javaCompile.classpath | ||
classpath += javaCompile.outputs.files | ||
// Adding sources and javadoc artifacts only during a release. | ||
if (isARelease) { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
} | ||
} | ||
} | ||
|
||
val javadocJar by tasks.registering(Jar::class) { | ||
dependsOn(javadoc) | ||
archiveClassifier.set("javadoc") | ||
from(javadoc.get().destinationDir) | ||
} | ||
afterEvaluate { | ||
publishing.publications { | ||
val maven = create<MavenPublication>("maven") { | ||
from(components.findByName(variantToPublish)) | ||
pom { | ||
val repoUrl = "https://github.com/open-telemetry/opentelemetry-android" | ||
name.set("OpenTelemetry Android") | ||
description.set(project.description) | ||
url.set(repoUrl) | ||
licenses { | ||
license { | ||
name.set("The Apache Software License, Version 2.0") | ||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
scm { | ||
val scmUrl = "scm:git:[email protected]:open-telemetry/opentelemetry-android.git" | ||
connection.set(scmUrl) | ||
developerConnection.set(scmUrl) | ||
url.set(repoUrl) | ||
tag.set("HEAD") | ||
} | ||
developers { | ||
developer { | ||
id.set("opentelemetry") | ||
name.set("OpenTelemetry") | ||
url.set("https://github.com/open-telemetry/community") | ||
} | ||
} | ||
} | ||
} | ||
|
||
val component = project.components.findByName("release") | ||
publishing { | ||
publications { | ||
// Signing only during a release. | ||
if (isARelease) { | ||
signing.sign(maven) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:base" | ||
], | ||
"packageRules": [ | ||
{ | ||
// navigation-fragment 2.7.0 and above require android api 34+, which we are not ready for | ||
// yet due to android gradle plugin only supporting min 33. | ||
"matchPackagePrefixes": ["androidx.navigation"], | ||
"matchUpdateTypes": ["major", "minor"], | ||
"enabled": false | ||
}, | ||
{ | ||
// navigation-fragment 2.7.0 and above require android api 34+, which we are not ready for | ||
// yet due to android gradle plugin only supporting min 33. | ||
"matchPackageNames": ["androidx.browser:browser"], | ||
"matchUpdateTypes": ["major", "minor"], | ||
"enabled": false | ||
} | ||
] | ||
} |