Skip to content

Commit

Permalink
Switch from mvn-push script to gradle-maven-publish-plugin (#457)
Browse files Browse the repository at this point in the history
Rather than maintaining our own `gradle-mvn-push.gradle` copy,
let's depend upon an existing plug-in, should help avoid
common issues when publishing maven artifacts (such as #456).
  • Loading branch information
lazaroclapp committed Mar 31, 2021
1 parent b5bd1bc commit 0c27e89
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 256 deletions.
2 changes: 1 addition & 1 deletion .buildscript/deploy_snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
else
echo "Deploying snapshot..."
./gradlew clean uploadArchives
./gradlew clean release
echo "Snapshot deployed!"
fi
6 changes: 3 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ jobs:
java-version: 8
- name: 'Publish'
env:
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
run: ./gradlew clean uploadArchives
ORG_GRADLE_PROJECT_mavenCentralRepositoryUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralRepositoryPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
run: ./gradlew clean release
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Releasing
3. Update the `README.md` with the new version.
4. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the new version)
5. `git tag -a vX.Y.Z -m "Version X.Y.Z"` (where X.Y.Z is the new version)
6. `./gradlew clean uploadArchives`
6. `./gradlew clean publish --no-daemon --no-parallel`
7. Update the `gradle.properties` to the next SNAPSHOT version.
8. `git commit -am "Prepare next development version."`
9. `git push && git push --tags`
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import net.ltgt.gradle.errorprone.CheckSeverity
buildscript {
repositories {
mavenCentral()
google() // For Gradle 4.0+
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
}
}
plugins {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=uber
POM_DEVELOPER_NAME=Uber Technologies
POM_DEVELOPER_URL=https://uber.com
225 changes: 0 additions & 225 deletions gradle/gradle-mvn-push.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion jar-infer/android-jarinfer-models-sdk28/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ repositories {
dependencies {
}

apply from: rootProject.file("gradle/gradle-mvn-push.gradle")
apply plugin: 'com.vanniktech.maven.publish'
2 changes: 1 addition & 1 deletion jar-infer/android-jarinfer-models-sdk29/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ repositories {
dependencies {
}

apply from: rootProject.file("gradle/gradle-mvn-push.gradle")
apply plugin: 'com.vanniktech.maven.publish'
25 changes: 6 additions & 19 deletions jar-infer/jar-infer-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,12 @@ shadowJar {
shadowJar.dependsOn jar
assemble.dependsOn shadowJar

apply from: rootProject.file("gradle/gradle-mvn-push.gradle")
apply plugin: 'com.vanniktech.maven.publish'

def configurePomForShadow(pom) {
pom.scopeMappings.mappings.remove(project.configurations.compile)
pom.scopeMappings.mappings.remove(project.configurations.runtime)
pom.scopeMappings.addMapping(MavenPlugin.COMPILE_PRIORITY, project.configurations.shadow, Conf2ScopeMappingContainer.COMPILE)
}

install {
repositories.mavenInstaller {
configurePomForShadow(pom)
}
}
install.dependsOn shadowJar

uploadArchives {
repositories.mavenDeployer {
configurePomForShadow(pom)
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
}
uploadArchives.dependsOn shadowJar

2 changes: 1 addition & 1 deletion jar-infer/jar-infer-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ test {
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}"
}

apply from: rootProject.file("gradle/gradle-mvn-push.gradle")
apply plugin: 'com.vanniktech.maven.publish'
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import com.ibm.wala.util.graph.dominators.Dominators;
import com.ibm.wala.util.graph.impl.GraphInverter;
import com.ibm.wala.util.graph.traverse.DFS;
import com.sun.istack.internal.NotNull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -127,7 +126,6 @@ Set<Integer> analyze() {
return derefedParamList;
}

@NotNull
private Set<Integer> computeDerefParamList(int numParam, int firstParamIndex) {
Set<Integer> derefedParamList = new HashSet<>();
Map<ISSABasicBlock, Set<Integer>> blockToDerefSetMap = new HashMap<>();
Expand Down Expand Up @@ -156,7 +154,6 @@ private Set<Integer> computeDerefParamList(int numParam, int firstParamIndex) {
return derefedParamList;
}

@NotNull
private Set<Integer> computeDerefParamListUsingPDom(int numParam, int firstParamIndex) {
Set<Integer> derefedParamList = new HashSet<>();
// Get Dominator Tree
Expand Down
2 changes: 1 addition & 1 deletion nullaway/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test {
}
}

apply from: rootProject.file("gradle/gradle-mvn-push.gradle")
apply plugin: 'com.vanniktech.maven.publish'

jacoco {
toolVersion = "0.8.2"
Expand Down

0 comments on commit 0c27e89

Please sign in to comment.