From 7886a58cf28ce91c16364bd2945974be176b0bc3 Mon Sep 17 00:00:00 2001 From: Matthew Tovbin Date: Thu, 16 May 2019 10:53:06 -0700 Subject: [PATCH] Correctly pass main class for CLI sub project (#321) --- build.gradle | 11 ++++------- cli/build.gradle | 8 +++++--- helloworld/build.gradle | 3 +-- templates/simple/build.gradle.template | 6 ++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 88e55a1c4b..bde7161a44 100644 --- a/build.gradle +++ b/build.gradle @@ -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' @@ -92,8 +91,6 @@ configure(allProjs) { akkaSlf4jVersion = '2.3.11' mleapVersion = '0.13.0' memoryFilesystemVersion = '2.1.0' - - mainClassName = 'com.salesforce.Main' } configurations { @@ -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) @@ -225,7 +222,7 @@ configure(allProjs) { shadowJar { zip64 = true - exclude 'META-INF/maven/**' + exclude 'META-INF/**' baseName = jar.baseName } shadowJar.dependsOn(createVersionProperties) diff --git a/cli/build.gradle b/cli/build.gradle index cdb625b5d1..3062917744 100644 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -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" @@ -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, diff --git a/helloworld/build.gradle b/helloworld/build.gradle index 8cc9630508..4aff3ea152 100644 --- a/helloworld/build.gradle +++ b/helloworld/build.gradle @@ -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' @@ -42,7 +42,6 @@ ext { transmogrifaiVersion ='0.5.3' collectionsVersion = '3.2.2' scoveragePluginVersion = '1.3.1' - mainClassName = "com.salesforce.dummy.DummyMain" } //noinspection GroovyAssignabilityCheck diff --git a/templates/simple/build.gradle.template b/templates/simple/build.gradle.template index 6bd3f5d314..a9bb81153d 100644 --- a/templates/simple/build.gradle.template +++ b/templates/simple/build.gradle.template @@ -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 { @@ -40,8 +40,6 @@ ext { scalaTestVersion = '$scalaTestVersion' transmogrifaiVersion = '$transmogrifaiVersion' collectionsVersion = '$collectionsVersion' - - mainClassName = 'com.salesforce.app.Simple' /* << MAIN_CLASS */ } configurations { @@ -111,7 +109,7 @@ compileTestScala { scalaCompileOptions.additionalParameters = ["-Yrangepos"] } jar { manifest.attributes "Main-Class": "\$mainClassName" - baseName="\${rootProject.name}" + baseName="\$rootProject.name" } shadowJar {