Skip to content

Commit

Permalink
Correctly pass main class for CLI sub project (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
tovbinm authored May 16, 2019
1 parent 6f55dee commit 7886a58
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
11 changes: 4 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ configure(allProjs) {
sourceCompatibility = 1.8
targetCompatibility = 1.8

// Set this to the main class for cli.
// Could not figure out how to configure it just for the cli subproject.
mainClassName = "com.salesforce.op.cli.CLI"
// The main class for the application plugin and is currently unused. Setting a dummy one.
mainClassName = "please.set.main.class.in.build.gradle"

ext {
scalaVersion = '2.11'
Expand Down Expand Up @@ -92,8 +91,6 @@ configure(allProjs) {
akkaSlf4jVersion = '2.3.11'
mleapVersion = '0.13.0'
memoryFilesystemVersion = '2.1.0'

mainClassName = 'com.salesforce.Main'
}

configurations {
Expand Down Expand Up @@ -158,7 +155,7 @@ configure(allProjs) {

jar {
manifest.attributes "Main-Class": "$mainClassName"
baseName = "${rootProject.name}"
baseName = "$rootProject.name"
}
if (System.getenv("CI") != 'true') {
jar.dependsOn(createVersionProperties)
Expand Down Expand Up @@ -225,7 +222,7 @@ configure(allProjs) {

shadowJar {
zip64 = true
exclude 'META-INF/maven/**'
exclude 'META-INF/**'
baseName = jar.baseName
}
shadowJar.dependsOn(createVersionProperties)
Expand Down
8 changes: 5 additions & 3 deletions cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ ext {
templateResourcesDir = "$project.buildDir/template-resources"
}

application {
// Set this to the main class for cli.
mainClassName = "com.salesforce.op.cli.CLI"
}

task copySpark(type: Copy) {
from '../templates/simple/gradle'
into "$templateResourcesDir/templates/simple/gradle"
Expand Down Expand Up @@ -64,9 +69,6 @@ task copyTemplates(type: Copy) {
fileName.replace(".gradle.template", ".gradle")
}
expand([
artifactory_user: '$artifactory_user',
artifactory_password: '$artifactory_password',
artifactory_contextUrl: '$artifactory_contextUrl',
databaseHostname: 'db.company.com',
version: scalaVersion,
scalaVersion: scalaVersion,
Expand Down
3 changes: 1 addition & 2 deletions helloworld/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

// The main class for the application plugin and is currently unused. Setting a dummy one.
mainClassName = "com.salesforce.dummy.DummyMain"
mainClassName = "please.set.main.class.in.build.gradle"

ext {
scalaVersion = '2.11'
Expand All @@ -42,7 +42,6 @@ ext {
transmogrifaiVersion ='0.5.3'
collectionsVersion = '3.2.2'
scoveragePluginVersion = '1.3.1'
mainClassName = "com.salesforce.dummy.DummyMain"
}

//noinspection GroovyAssignabilityCheck
Expand Down
6 changes: 2 additions & 4 deletions templates/simple/build.gradle.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ apply from: 'spark.gradle'
sourceCompatibility = 1.8
targetCompatibility = 1.8

// The main class for the application plugin and is currently unused. Setting a dummy one.
// The main class for the application plugin
mainClassName = "com.salesforce.app.Simple" /* << MAIN_CLASS */

ext {
Expand All @@ -40,8 +40,6 @@ ext {
scalaTestVersion = '$scalaTestVersion'
transmogrifaiVersion = '$transmogrifaiVersion'
collectionsVersion = '$collectionsVersion'

mainClassName = 'com.salesforce.app.Simple' /* << MAIN_CLASS */
}

configurations {
Expand Down Expand Up @@ -111,7 +109,7 @@ compileTestScala { scalaCompileOptions.additionalParameters = ["-Yrangepos"] }

jar {
manifest.attributes "Main-Class": "\$mainClassName"
baseName="\${rootProject.name}"
baseName="\$rootProject.name"
}

shadowJar {
Expand Down

0 comments on commit 7886a58

Please sign in to comment.