Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocarvalho777 committed Mar 20, 2020
2 parents 16c86fc + 323655c commit d7c9819
Show file tree
Hide file tree
Showing 693 changed files with 211,795 additions and 5,035 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
*.class
target/
logs/
transformed-apps/
results/
metrics/
test-output/
gen-metrics/

# Package Files #
*.jar

# Gradle specific #
.gradle/
build/
out/
!gradle/wrapper/gradle-wrapper.jar

# IDE Files #
.classpath
.project
Expand Down
23 changes: 9 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,21 @@ cache:
directories:
- .autoconf
- $HOME/.m2
- $HOME/.gradle

jdk:
- oraclejdk8
- openjdk8

branches:
only:
- develop
- butterfly_3

install:
- mvn install
- ./gradlew build jacocoRootReport jacocoTestCoverageVerification --scan

after_script:
# Installing Codacy code coverage reporter upload tool
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then wget https://github.com/codacy/codacy-coverage-reporter/releases/download/1.0.13/codacy-coverage-reporter-1.0.13-assembly.jar -O ccr.jar; fi'
# Uploading Cobertura report to Codacy
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-cli/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-cli-package/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-core/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-extensions-api/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-facade/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-metrics-couchdb/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-metrics-file/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./butterfly-utilities/target/site/cobertura/coverage.xml --projectToken $CODACY_PROJECT_TOKEN; fi'
# Installing Codacy code coverage reporter upload tool and uploading Cobertura report to Codacy
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
wget https://github.com/codacy/codacy-coverage-reporter/releases/download/1.0.13/codacy-coverage-reporter-1.0.13-assembly.jar -O ccr.jar;
java -cp ccr.jar com.codacy.CodacyCoverageReporter -l Java -r ./build/reports/jacoco/coverage.xml --projectToken $CODACY_PROJECT_TOKEN;
fi
3 changes: 2 additions & 1 deletion .travis_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ branches:
before_install:
- openssl aes-256-cbc -K $encrypted_dd05710e44e2_key -iv $encrypted_dd05710e44e2_iv -in secring.gpg.enc -out secring.gpg -d
- gpg --import secring.gpg
- export SECRING_FILE="$PWD/secring.gpg"

install:
- mvn -s settings.xml deploy -Possrh
- ./gradlew uploadArchives --scan
2 changes: 1 addition & 1 deletion .travis_snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
install:
- mvn -s settings.xml deploy -Possrh
- ./gradlew uploadArchives --scan
277 changes: 277 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@

plugins {
id 'com.gradle.build-scan' version '2.1'
}

description = "Butterfly - Application transformation tool"

allprojects {
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: "jacoco"

group = 'com.paypal.butterfly'
version = '3.0.0'

repositories {
mavenLocal()
mavenCentral()
}

buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}

Set testModules = [
"integration-tests",
"tests"
]

subprojects {

apply plugin: 'java'

def javaVersion = JavaVersion.VERSION_1_8
sourceCompatibility = javaVersion
targetCompatibility = javaVersion

test {
testLogging {
events "failed"
// events "started", "passed", "skipped", "failed", "standardError"

// outputs.upToDateWhen {false}
// showStandardStreams = true
}
}

// compileJava {
// options.compilerArgs += ["-Xlint:deprecation", "-Xlint:unchecked"]
// }

ext {
ossrhUsername = System.getenv('SONATYPE_USER')
ossrhPassword = System.getenv('SONATYPE_PASSWORD')
}

jar {
manifest {
attributes 'Implementation-Version': version,
'Implementation-Name': name,
'Implementation-Vendor': 'PayPal'
}
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

if (version.endsWith("SNAPSHOT")) {
if (!name.equals("butterfly-cli-package")) {
artifacts {
archives sourcesJar
}
}
} else if (System.getenv("SECRING_FILE") != null) {
if (!name.equals("butterfly-cli-package")) {
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

artifacts {
archives javadocJar, sourcesJar
}
}

project.ext['signing.keyId'] = "$System.env.GPG_KEYNAME"
project.ext['signing.password'] = "$System.env.GPG_PASSPHRASE"
project.ext['signing.secretKeyRingFile'] = "$System.env.SECRING_FILE"

signing {
sign configurations.archives
}
}

// Publishing non test modules
if (!testModules.contains(name)) {
uploadArchives {
repositories {
mavenDeployer {
if (!version.endsWith("SNAPSHOT") && System.getenv("SECRING_FILE") != null) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name project.name
description project.description
packaging 'jar'

url 'https://github.com/paypal/butterfly'

scm {
connection 'scm:git:[email protected]:paypal/butterfly.git'
developerConnection 'scm:git:[email protected]:paypal/butterfly.git'
url '[email protected]:paypal/butterfly.git'
}

licenses {
license {
name 'MIT'
url 'https://opensource.org/licenses/MIT'
}
}

developers {
developer {
id 'fabiocarvalho777'
name 'Fabio Carvalho'
email '[email protected]'
organization 'PayPal'
organizationUrl 'http://www.paypal.com'
}
}
}
}
}
}
}

jacocoTestCoverageVerification {
violationRules {
rule { element = 'PACKAGE'; limit { minimum = 0.28 }; includes = ['com.paypal.butterfly.cli'] }
rule { element = 'PACKAGE'; limit { minimum = 0.71 }; includes = ['com.paypal.butterfly.cli.logging'] }
rule { element = 'PACKAGE'; limit { minimum = 0.41 }; includes = ['com.paypal.butterfly.core*'] }
rule { element = 'PACKAGE'; limit { minimum = 0.54 }; includes = ['com.paypal.butterfly.extensions.api'] }
rule { element = 'PACKAGE'; limit { minimum = 0.00 }; includes = ['com.paypal.butterfly.extensions.api*'] }
rule { element = 'PACKAGE'; limit { minimum = 1.00 }; includes = ['com.paypal.butterfly.extensions.springboot*'] }
rule { element = 'PACKAGE'; limit { minimum = 0.00 }; includes = ['com.paypal.butterfly.persist*'] }
rule { element = 'PACKAGE'; limit { minimum = 0.63 }; includes = ['com.paypal.butterfly.test*'] }
rule { element = 'PACKAGE'; limit { minimum = 0.82 }; includes = ['com.paypal.butterfly.utilities*'] }
}
}

}

task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
def coverageProjects = subprojects.stream().filter({sb -> !(sb.name in [
// Projects without Java code
'butterfly-bom',
'butterfly-cli-package',
'extensions-catalog',

// API projects without concrete classes, or relevant classes, to be tested
'butterfly-api',
'butterfly-rest-api',

// Test projects
'tests',
'integration-tests'
])}).collect()

additionalSourceDirs = files(coverageProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(coverageProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(coverageProjects.sourceSets.main.output)
executionData = files(coverageProjects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false

html.destination file("${buildDir}/reports/jacoco/html")
xml.destination file("${buildDir}/reports/jacoco/coverage.xml")
}
}

// Returns the hash number of the latest commit
ext.getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--pretty=%H'
standardOutput = stdout
}
return stdout.toString().trim()
}

// Returns a String made of project version and commit hash number as a suffix,
// used to tag SNAPSHOT Docker images
ext.getCommitProjectVersion = { version ->
if (version.endsWith('SNAPSHOT')) {
return version + "-" + getGitHash()
} else {
return version
}
}

// Docker repository
// Leaving it empty intentionally, so it defaults to Docker public DTR
ext.docker_repo = ''

// Dependencies version management
ext.lib = [

// Java specs
annotation_api: "javax.annotation:javax.annotation-api:1.3.2",
jaxrs: "javax.ws.rs:javax.ws.rs-api:2.1",
bean_validation: "javax.validation:validation-api:2.0.1.Final",

// Spring
spring_context: "org.springframework:spring-context:4.3.2.RELEASE",
spring_boot_starter: "org.springframework.boot:spring-boot-starter:1.4.0.RELEASE",
spring_boot_autoconfigure: "org.springframework.boot:spring-boot-autoconfigure:1.4.0.RELEASE",
spring_test: "org.springframework:spring-test:4.3.2.RELEASE",

// Maven
maven_model: "org.apache.maven:maven-model:3.5.4",
maven_invoker: "org.apache.maven.shared:maven-invoker:3.0.1",

// Parsers
gson: "com.google.code.gson:gson:2.7",
woodstox_core: "com.fasterxml.woodstox:woodstox-core:5.0.3",
xmlunit: "xmlunit:xmlunit:1.5",
yamlbeans: "com.esotericsoftware.yamlbeans:yamlbeans:1.08",
javaparser_core: "com.github.javaparser:javaparser-core:3.15.14",
jackson: "com.fasterxml.jackson.core:jackson-annotations:2.9.8",
jackson_databind: "com.fasterxml.jackson.core:jackson-databind:2.9.8",

// Drivers
lightcouch: "org.lightcouch:lightcouch:0.1.8",

// Utilities
annotations: "com.google.code.findbugs:annotations:3.0.0",
commons_io: "commons-io:commons-io:2.5",
commons_lang3: "org.apache.commons:commons-lang3:3.7",
commons_collections4: "org.apache.commons:commons-collections4:4.0",
guava: "com.google.guava:guava:15.0",
jopt_simple: "net.sf.jopt-simple:jopt-simple:5.0.2",
plexus_utils: "org.codehaus.plexus:plexus-utils:3.1.0",
reflections: "org.reflections:reflections:0.9.10",
slf4j_api: "org.slf4j:slf4j-api:1.7.21",
logback: "ch.qos.logback:logback-classic:1.1.7",
zip4j: "net.lingala.zip4j:zip4j:1.3.2",

// Swagger
swagger_annotations: "io.swagger.core.v3:swagger-annotations:2.0.8",

// Tests
testng: "org.testng:testng:6.14.2",
mockito_all: "org.mockito:mockito-all:1.10.19",
powermock_module_testng: "org.powermock:powermock-module-testng:1.6.5",
powermock_api_mockito: "org.powermock:powermock-api-mockito:1.6.5",

// Jersey
jersey_core: "org.glassfish.jersey.core:jersey-client:2.26",
jersey_inject: "org.glassfish.jersey.inject:jersey-hk2:2.26",

]
5 changes: 5 additions & 0 deletions butterfly-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apply plugin: 'java-library'

dependencies {
api project(':butterfly-extensions-api')
}
Loading

0 comments on commit d7c9819

Please sign in to comment.