From c1b14224aabd09f99d8b0387f277cb61be348cfe Mon Sep 17 00:00:00 2001 From: Guoli Ma Date: Mon, 8 Jun 2020 15:19:01 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 315364732 Change-Id: I243b8f6badcd71c3f9835c160f6476098e055e2d --- build.gradle | 80 ++++++++++++++++++++++++++++++++++++++++++++++- docs/howto.md | 4 +-- main/build.gradle | 2 +- 3 files changed, 82 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 5ec04b32..f6870844 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,9 @@ plugins { subprojects { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' apply plugin: 'idea' + apply plugin: "signing" apply plugin: 'net.ltgt.errorprone' @@ -103,6 +104,9 @@ subprojects { sourceCompatibility = 1.8 targetCompatibility = 1.8 + java.withJavadocJar() + java.withSourcesJar() + jar.manifest { attributes('Implementation-Title': name, 'Implementation-Version': version, @@ -130,4 +134,78 @@ subprojects { maxHeapSize = '1500m' } } + + plugins.withId('maven-publish') { + publishing { + publications { + maven(MavenPublication) { + from components.java + + pom { + name = project.group + ':' + project.name + url = 'https://github.com/google/tsunami-security-scanner' + afterEvaluate { + // description is not available until evaluated. + description = project.description + } + + licenses { + license { + name = 'Apache 2.0' + url = 'https://opensource.org/licenses/Apache-2.0' + } + } + + scm { + connection = 'scm:git:https://github.com/google/tsunami-security-scanner.git' + developerConnection = 'scm:git:git@github.com:google/tsunami-security-scanner.git' + url = 'https://github.com/google/tsunami-security-scanner' + } + + developers { + developer { + id = 'com.google.tsunami' + name = 'Tsunami Contributors' + email = 'tsunami-security-scanner@googlegroups.com' + url = 'https://github.com/google/tsunami-security-scanner' + organization = 'Tsunami Authors' + organizationUrl = 'https://www.google.com' + } + } + } + } + } + repositories { + maven { + def stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' + def releaseUrl = stagingUrl + def snapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' + url = version.endsWith('SNAPSHOT') ? snapshotUrl : releaseUrl + credentials { + if (rootProject.hasProperty('ossrhUsername') + && rootProject.hasProperty('ossrhPassword')) { + username = rootProject.ossrhUsername + password = rootProject.ossrhPassword + } + } + } + mavenLocal() + } + } + + signing { + required false + sign publishing.publications.maven + } + + plugins.withId('com.github.johnrengelman.shadow') { + publishing { + publications { + maven { + artifact project.tasks.shadowJar + } + } + } + } + } } diff --git a/docs/howto.md b/docs/howto.md index 4bc86803..f77ae379 100644 --- a/docs/howto.md +++ b/docs/howto.md @@ -24,7 +24,7 @@ following command: ``` When the command finishes, the generated scanner `jar` file is located in the -`main/build/libs` folder with the name of `tsunami-cli-[version]-all.jar`. This +`main/build/libs` folder with the name of `tsunami-main-[version]-cli.jar`. This is a fat jar file so can be treated as a standalone binary. To execute the scanner, first you need to install plugins into a chosen folder. @@ -36,7 +36,7 @@ the following command to execute a Tsunami scan: ```shell java \ # Tsunami classpath, as of now plugins must be installed into classpath. - -cp "tsunami-cli.jar:~/tsunami-plugins/*" \ + -cp "tsunami-main-[version]-cli.jar:~/tsunami-plugins/*" \ # Specify the config file of Tsunami, by default Tsunami loads a tsunami.yaml # file from there the command is executed. -Dtsunami.config.location=/path/to/config/tsunami.yaml \ diff --git a/main/build.gradle b/main/build.gradle index 26b846b8..c85ebc88 100644 --- a/main/build.gradle +++ b/main/build.gradle @@ -24,6 +24,6 @@ application { } shadowJar { - baseName = 'tsunami-cli' + classifier = 'cli' exclude '*.proto' }