Skip to content

Commit

Permalink
Merge branch 'master' into mt/pretty-prints
Browse files Browse the repository at this point in the history
  • Loading branch information
tovbinm committed Jun 27, 2018
2 parents 7642841 + 4f66823 commit 5ac0ccb
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 85 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,22 @@ You can simply add OP as a regular dependency to your existing project. Example

```groovy
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven {
url "https://raw.githubusercontent.com/salesforce/op/mvn-repo/releases"
credentials {
// Generate github api token here - https://goo.gl/ANZ9oz
// and then set it as an environment variable `export GITHUB_API_TOKEN=<MY_TOKEN>`
username = System.getenv("GITHUB_API_TOKEN") // use your token as a username
password "" // leave the password blank
}
authentication { digest(BasicAuthentication) }
url "s3:https://op-repo/releases"
credentials(AwsCredentials) {
// user: op-repo-reader
accessKey "AKIAJ6AZFFSFRJI3IKHQ"
secretKey "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"
}
}
}
ext {
scalaVersion = '2.11'
scalaVersionRevision = '8'
sparkVersion = '2.2.1'
opVersion = '3.3.1'
opVersion = '3.3.3'
}
dependencies {
// Scala
Expand All @@ -154,7 +154,11 @@ dependencies {
// Octopus Prime
compile "com.salesforce:optimus-prime-core_$scalaVersion:$opVersion"
// Pretrained models used in Octopus Prime, e.g. OpenNLP POS/NER models etc. (optional)
// compile "com.salesforce:optimus-prime-models_$scalaVersion:$opVersion"
// All your other depdendecies go below
// ...
}
```

Expand Down
73 changes: 26 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ buildscript {
}
dependencies {
classpath 'org.github.ngbinh.scalastyle:gradle-scalastyle-plugin_2.11:0.9.0'
classpath 'com.amazonaws:aws-java-sdk-core:1.11.353'
}
}

plugins {
id 'com.commercehub.gradle.plugin.avro' version '0.8.0'
id 'org.scoverage' version '2.1.0'
id 'com.jfrog.artifactory' version '3.1.1'
id 'net.minecrell.licenser' version '0.3'
id 'com.github.unafraid.gradle.git-repo-plugin' version '2.0.4'
id 'com.github.jk1.dependency-license-report' version '0.5.0'
}

apply from: 'gradle/artifactory.gradle'
apply from: 'gradle/version-properties.gradle'
allprojects {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}

apply from: 'gradle/version-properties.gradle'

def allProjs = allprojects - project(':templates').subprojects - project(':docs')
def subProjs = subprojects - project(':templates').subprojects - project(':docs')
Expand All @@ -37,11 +41,9 @@ configure(allProjs) {
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'project-report'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.commercehub.gradle.plugin.avro'
apply plugin: 'net.minecrell.licenser'
apply plugin: 'com.github.jk1.dependency-license-report'
apply plugin: 'com.github.unafraid.gradle.git-repo-plugin'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -231,29 +233,6 @@ configure(allProjs) {
println sourceSets.main.runtimeClasspath.asPath
}
}

//****************************************************************************************************
// Publish to Github repository as a maven repo:
// ./gradlew publishToGithub -Dorg.ajoberstar.grgit.auth.ssh.private=~/.ssh/id_rsa
//
// Then repo can be used as a maven repository:
// repositories {
// maven {
// url "https://raw.githubusercontent.com/salesforce/op/mvn-repo/releases"
// credentials {
// username "<YOUR_PERSONAL_ACCESS_TOKEN" // Generate one here - https://goo.gl/ANZ9oz
// password "" // leave the password empty
// }
// authentication { digest(BasicAuthentication) }
// }
// }
gitPublishConfig {
org = 'salesforce'
repo = 'op'
upstream = 'origin'
branch = 'mvn-repo'
}
//****************************************************************************************************
}

task wrapper(type: Wrapper) {
Expand All @@ -265,20 +244,26 @@ task aggregateScoverage(type: org.scoverage.ScoverageAggregate) {
description 'Aggregates scoverage reports of all subprojects.'
}

artifactoryPublish {
doFirst {
println "Overriding repository based on project version (snapshot/release) version=$project.version"
clientConfig.publisher.repoKey = "libs-${project.version.endsWith('-SNAPSHOT') ? 'snapshot' : 'release'}-local"
println("Publishing to ${clientConfig.publisher.repoKey}")
}
}
import com.amazonaws.auth.*
import com.amazonaws.auth.profile.*

configure(subProjs) {
apply from: "$rootProject.projectDir/gradle/tests.gradle"
apply from: "$rootProject.projectDir/gradle/spark.gradle"

jar.baseName = "$rootProject.name-$project.name"

def fetchAwsCredentials = {
String profile = "op-repo-admin"
try {
return new ProfileCredentialsProvider(profile).credentials
} catch (Exception e) {
logger.debug("Unable to retrieve AWS credentials from '$profile' profile, publishing to S3 will not be available.", e)
return new BasicAWSCredentials("unknown-key", "unknown-secret")
}
}
AWSCredentials awsCredentials = fetchAwsCredentials()

publishing {
publications {
mavenJava(MavenPublication) {
Expand All @@ -289,7 +274,11 @@ configure(subProjs) {
}
repositories {
maven {
url "file:https://${gitPublishConfig.home}/${gitPublishConfig.org}/${gitPublishConfig.repo}/releases"
url "s3:https://op-repo/releases"
credentials(AwsCredentials) {
accessKey awsCredentials.AWSAccessKeyId
secretKey awsCredentials.AWSSecretKey
}
}
}
}
Expand All @@ -301,14 +290,4 @@ configure(subProjs) {
sourcesJar.baseName = jar.baseName

artifacts { archives sourcesJar }

artifactoryPublish.dependsOn(jar, sourcesJar)
}

// Skip publishing the root project
artifactoryPublish.skip = true

// Send the version number to TeamCity
if (System.env.TEAMCITY_VERSION) {
println("##teamcity[setParameter name='env.OP_VERSION' value='$project.version']")
}
6 changes: 0 additions & 6 deletions gradle/artifactory.gradle

This file was deleted.

19 changes: 10 additions & 9 deletions helloworld/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven {
url "https://raw.githubusercontent.com/salesforce/op/mvn-repo/releases"
credentials {
// Generate github api token here - https://goo.gl/ANZ9oz
// and then set it as an environment variable `export GITHUB_API_TOKEN=<MY_TOKEN>`
username = System.getenv("GITHUB_API_TOKEN")
password "" // leave the password empty
}
authentication { digest(BasicAuthentication) }
url "s3:https://op-repo/releases"
credentials(AwsCredentials) {
// user: op-repo-reader
accessKey "AKIAJ6AZFFSFRJI3IKHQ"
secretKey "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"
}
}
}

Expand Down Expand Up @@ -50,7 +48,7 @@ ext {
junitVersion = '4.11'
sparkVersion = '2.2.1'
scalatestVersion = '3.0.0'
opVersion='3.3.1'
opVersion='3.3.3'
mainClassName = "com.salesforce.dummy.DummyMain"
}

Expand All @@ -77,6 +75,9 @@ dependencies {
// Optimus Prime
compile "com.salesforce:optimus-prime-core_$scalaVersion:$opVersion"

// Pretrained models used in Octopus Prime, e.g. OpenNLP POS/NER models etc. (optional)
// compile "com.salesforce:optimus-prime-models_$scalaVersion:$opVersion"

// Test
testCompile "org.scalatest:scalatest_$scalaVersion:$scalatestVersion"
testCompile "junit:junit:${junitVersion}"
Expand Down
19 changes: 10 additions & 9 deletions templates/simple/build.gradle.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven {
url "https://raw.githubusercontent.com/salesforce/op/mvn-repo/releases"
credentials {
// Generate github api token here - https://goo.gl/ANZ9oz
// and then set it as an environment variable `export GITHUB_API_TOKEN=<MY_TOKEN>`
username = System.getenv("GITHUB_API_TOKEN")
password "" // leave the password empty
}
authentication { digest(BasicAuthentication) }
url "s3:https://op-repo/releases"
credentials(AwsCredentials) {
// user: op-repo-reader
accessKey "AKIAJ6AZFFSFRJI3IKHQ"
secretKey "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"
}
}
}

Expand Down Expand Up @@ -72,6 +70,9 @@ dependencies {
// Optimus Prime
compile "com.salesforce:optimus-prime-core_$scalaVersion:$opVersion"

// Pretrained models used in Octopus Prime, e.g. OpenNLP POS/NER models etc. (optional)
// compile "com.salesforce:optimus-prime-models_$scalaVersion:$opVersion"

// Test
testCompile ("org.scalatest:scalatest_$scalaVersion:${scalatestVersion}")
testCompile "junit:junit:$junitVersion"
Expand Down Expand Up @@ -135,6 +136,6 @@ task repl(type: JavaExec) {
}

task wrapper(type: Wrapper) {
gradleVersion = '4.5.1'
gradleVersion = '4.7'
description "Sets the Gradle wrapper version."
}
Binary file modified templates/simple/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions templates/simple/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\:https://services.gradle.org/distributions/gradle-4.5.1-bin.zip
distributionSha256Sum=3e2ea0d8b96605b7c528768f646e0975bd9822f06df1f04a64fd279b1a17805e
distributionUrl=https\:https://services.gradle.org/distributions/gradle-4.7-bin.zip
distributionSha256Sum=fca5087dc8b50c64655c000989635664a73b11b9bd3703c7d6cabd31b7dcdb04
6 changes: 3 additions & 3 deletions templates/simple/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand Down Expand Up @@ -155,7 +155,7 @@ if $cygwin ; then
fi

# Escape application args
save ( ) {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
Expand Down

0 comments on commit 5ac0ccb

Please sign in to comment.