Skip to content

Commit

Permalink
Merge 030c38e into 37f4bb8
Browse files Browse the repository at this point in the history
  • Loading branch information
lazaroclapp authored Jun 23, 2023
2 parents 37f4bb8 + 030c38e commit a130bf1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.21.0'
// This restriction is needed due to our mix of Android and Java modules;
// without it, the build fails with a weird error.
// See https://stackoverflow.com/questions/70217853/how-to-include-android-project-in-a-gradle-multi-project-build
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=uber
POM_DEVELOPER_NAME=Uber Technologies
POM_DEVELOPER_URL=https://uber.com

# Publishing configuration for vanniktech/gradle-maven-publish-plugin
SONATYPE_HOST=DEFAULT
RELEASE_SIGNING_ENABLED=true
32 changes: 30 additions & 2 deletions jar-infer/jar-infer-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ dependencies {
}
}

java {
withJavadocJar()
withSourcesJar()
}

jar {
manifest {
attributes(
Expand All @@ -41,6 +46,7 @@ shadowJar {
shadowJar.dependsOn jar
assemble.dependsOn shadowJar


// We disable the default maven publications to make sure only
// our custom shadow publication is used. Since we use the empty
// classifier for our fat jar, it would otherwise clash with the
Expand All @@ -67,8 +73,8 @@ publishing {
// Since we are skipping the default maven publication, we append the `:sources` and
// `:javadoc` artifacts here. They are also required for Maven Central validation.
afterEvaluate {
artifact project.sourcesJar
artifact project.javadocsJar
artifact project.javaSourcesJar
artifact project.javadocJar
}
// The shadow publication does not auto-configure the pom.xml file for us, so we need to
// set it up manually. We use the opportunity to change the name and description from
Expand Down Expand Up @@ -98,5 +104,27 @@ publishing {
}
}
}
}

afterEvaluate {
// Below is a series of hacks needed to get publication to work with
// gradle-maven-publish-plugin >= 0.15.0 (itself needed after the upgrade to Gradle 8.0.2).
// Not sure why e.g. publishShadowPublicationToMavenCentralRepository must depend on signMavenPublication
// (rather than just signShadowPublication)
project.tasks.named('generateMetadataFileForMavenPublication').configure {
dependsOn 'javaSourcesJar'
dependsOn 'simpleJavadocJar'
}
project.tasks.named('signShadowPublication').configure {
dependsOn 'sourcesJar'
dependsOn 'simpleJavadocJar'
}
project.tasks.named('publishShadowPublicationToMavenCentralRepository').configure {
dependsOn 'signMavenPublication'
}
project.tasks.named('publishShadowPublicationToMavenLocal').configure {
dependsOn 'javaSourcesJar'
dependsOn 'simpleJavadocJar'
}
}
}

0 comments on commit a130bf1

Please sign in to comment.