Skip to content

Commit

Permalink
chore(apollo): Fix publishing errors with apollo-appsync (#2913)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcreaser authored Sep 9, 2024
1 parent e6ff508 commit e605a14
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 56 deletions.
1 change: 1 addition & 0 deletions apollo/apollo-appsync/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ plugins {

java {
withSourcesJar()
withJavadocJar()
}

kotlin {
Expand Down
112 changes: 57 additions & 55 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -119,82 +119,84 @@ subprojects {
}

@Suppress("ExpiredTargetSdkVersion")
fun Project.configureAndroid() = pluginManager.withPlugin("com.android.library") {
val sdkVersionName = findProperty("VERSION_NAME") ?: rootProject.findProperty("VERSION_NAME")

fun Project.configureAndroid() {
if (hasProperty("signingKeyId")) {
println("Getting signing info from protected source.")
extra["signing.keyId"] = findProperty("signingKeyId")
extra["signing.password"] = findProperty("signingPassword")
extra["signing.inMemoryKey"] = findProperty("signingInMemoryKey")
}

configure<LibraryExtension> {
buildToolsVersion = "30.0.3"
compileSdk = 34
pluginManager.withPlugin("com.android.library") {
val sdkVersionName = findProperty("VERSION_NAME") ?: rootProject.findProperty("VERSION_NAME")

buildFeatures {
// Allow specifying custom buildConfig fields
buildConfig = true
}
configure<LibraryExtension> {
buildToolsVersion = "30.0.3"
compileSdk = 34

defaultConfig {
minSdk = 24
targetSdk = 30
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments += "clearPackageData" to "true"
consumerProguardFiles += rootProject.file("configuration/consumer-rules.pro")

testOptions {
animationsDisabled = true
unitTests {
isIncludeAndroidResources = true
}
buildFeatures {
// Allow specifying custom buildConfig fields
buildConfig = true
}

buildConfigField("String", "VERSION_NAME", "\"$sdkVersionName\"")
}
defaultConfig {
minSdk = 24
targetSdk = 30
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments += "clearPackageData" to "true"
consumerProguardFiles += rootProject.file("configuration/consumer-rules.pro")

testOptions {
animationsDisabled = true
unitTests {
isIncludeAndroidResources = true
}
}

lint {
warningsAsErrors = true
abortOnError = true
enable += listOf("UnusedResources", "NewerVersionAvailable")
}
buildConfigField("String", "VERSION_NAME", "\"$sdkVersionName\"")
}

compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
lint {
warningsAsErrors = true
abortOnError = true
enable += listOf("UnusedResources", "NewerVersionAvailable")
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

// Needed when running integration tests. The oauth2 library uses relies on two
// dependencies (Apache's httpcore and httpclient), both of which include
// META-INF/DEPENDENCIES. Tried a couple other options to no avail.
packagingOptions {
resources.excludes.addAll(
listOf(
"META-INF/DEPENDENCIES",
"META-INF/LICENSE.md",
"META-INF/LICENSE-notice.md"
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

// Needed when running integration tests. The oauth2 library uses relies on two
// dependencies (Apache's httpcore and httpclient), both of which include
// META-INF/DEPENDENCIES. Tried a couple other options to no avail.
packagingOptions {
resources.excludes.addAll(
listOf(
"META-INF/DEPENDENCIES",
"META-INF/LICENSE.md",
"META-INF/LICENSE-notice.md"
)
)
)
}
}

publishing {
singleVariant("release") {
withSourcesJar()
publishing {
singleVariant("release") {
withSourcesJar()
}
}
}
}

dependencies {
add("coreLibraryDesugaring", libs.android.desugartools)
dependencies {
add("coreLibraryDesugaring", libs.android.desugartools)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion configuration/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ afterEvaluate { project ->
from(components.named("release").get())
}
project.pluginManager.withPlugin("java-library") {
from(components["java"])
from(components.named("java").get())
}

pom {
Expand Down

0 comments on commit e605a14

Please sign in to comment.