Skip to content

Commit

Permalink
Merge pull request #57 from RedPillAnalytics/develop
Browse files Browse the repository at this point in the history
Bugfix for maven-publish.
  • Loading branch information
stewartbryson authored Mar 26, 2019
2 parents bd7963c + 190ce75 commit 50b2cd1
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ So let's start preparing our `build.gradle` file. First, we need to apply the `g
```gradle
plugins {
id 'maven-publish'
id "com.redpillanalytics.gradle-confluent" version '1.1.2'
id "com.redpillanalytics.gradle-confluent" version '1.1.7'
}
```
Now we can use the `./gradlew tasks` command to see the new tasks available under the **Confluent** Task Group:
Expand Down Expand Up @@ -253,7 +253,7 @@ If we want to deploy our KSQL pipelines from Maven instead of Git (which let's f
```gradle
plugins {
id 'maven-publish'
id "com.redpillanalytics.gradle-confluent" version '1.1.5'
id "com.redpillanalytics.gradle-confluent" version '1.1.7'
}
publishing {
repositories {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id 'org.unbroken-dome.test-sets' version '2.1.1'
id "com.avast.gradle.docker-compose" version "0.9.1"
id "com.github.ben-manes.versions" version "0.21.0"
id "com.redpillanalytics.gradle-analytics" version "1.2.1"
id "com.redpillanalytics.gradle-analytics" version "1.2.3"
id 'com.adarshr.test-logger' version '1.6.0'
}

Expand Down
16 changes: 8 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ version: '2'
services:
zookeeper:
container_name: zookeeper
image: confluentinc/cp-zookeeper:5.1.0
image: confluentinc/cp-zookeeper:5.1.2
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000

kafka:
container_name: kafka
image: confluentinc/cp-enterprise-kafka:5.1.0
image: confluentinc/cp-enterprise-kafka:5.1.2
depends_on:
- zookeeper
# This would expose 9092 for external connections to the broker
Expand All @@ -36,7 +36,7 @@ services:

schema-registry:
container_name: schema-registry
image: confluentinc/cp-schema-registry:5.1.0
image: confluentinc/cp-schema-registry:5.1.2
depends_on:
- zookeeper
- kafka
Expand All @@ -46,7 +46,7 @@ services:

kafka-connect:
container_name: kafka-connect
image: confluentinc/cp-kafka-connect:5.1.0
image: confluentinc/cp-kafka-connect:5.1.2
ports:
- 8083:8083
depends_on:
Expand Down Expand Up @@ -80,7 +80,7 @@ services:

ksql-server:
container_name: ksql-server
image: confluentinc/cp-ksql-server:5.1.0
image: confluentinc/cp-ksql-server:5.1.2
ports:
- 8088:8088
depends_on:
Expand All @@ -91,11 +91,11 @@ services:
KSQL_BOOTSTRAP_SERVERS: kafka:29092
KSQL_LISTENERS: http://0.0.0.0:8088
KSQL_KSQL_SCHEMA_REGISTRY_URL: http://schema-registry:8081
KSQL_KSQL_SERVICE_ID: confluent_rmoff_01
KSQL_KSQL_SERVICE_ID: kafka-examples

ksql-cli:
container_name: ksql-cli
image: confluentinc/cp-ksql-cli:5.1.0
image: confluentinc/cp-ksql-cli:5.1.2
depends_on:
- ksql-server
entrypoint: /bin/sh
Expand All @@ -114,7 +114,7 @@ services:
# Runs the Kafka KSQL data generator
datagen:
container_name: datagen
image: confluentinc/ksql-examples:5.0.1
image: confluentinc/ksql-examples:5.1.2
depends_on:
- kafka
- schema-registry
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sat Mar 09 20:35:18 EST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
18 changes: 17 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import com.redpillanalytics.gradle.tasks.LoadConfigTask
import groovy.util.logging.Slf4j
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.ApplicationPlugin
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.Sync
import org.gradle.api.tasks.bundling.Zip
Expand Down Expand Up @@ -200,7 +198,7 @@ class ConfluentPlugin implements Plugin<Project> {
}
}

if (enablePipelines && project.tasks.findByName('pipelineZip') && project.rootProject.plugins.findPlugin('maven-publish')) {
if (enablePipelines && project.tasks.findByName('pipelineZip') && project.plugins.findPlugin('maven-publish')) {

project.publishing.publications {

Expand Down
1 change: 1 addition & 0 deletions src/test/groovy/LoadConfigTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class LoadConfigTest extends Specification {
version = '1.0.0'
mainClassName = "streams.TestClass"
confluent.enableStreams = true
""")
}

Expand Down
121 changes: 121 additions & 0 deletions src/test/groovy/PropertiesTest.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import groovy.util.logging.Slf4j
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Title
import spock.lang.Unroll

@Slf4j
@Title("Execute :properties task")
class PropertiesTest extends Specification {
@Shared
File projectDir, buildDir, buildFile, resourcesDir, settingsFile

@Shared
String taskName

@Shared
List tasks

@Shared
BuildResult result

@Shared
String projectName = 'run-properties'

@Shared
AntBuilder ant = new AntBuilder()

def setupSpec() {

projectDir = new File("${System.getProperty("projectDir")}/$projectName")
buildDir = new File(projectDir, 'build')
buildFile = new File(projectDir, 'build.gradle')

resourcesDir = new File('src/test/resources')

ant.copy(todir: projectDir) {
fileset(dir: resourcesDir)
}

buildFile.write("""
|plugins {
| id 'com.redpillanalytics.gradle-confluent'
| id "com.redpillanalytics.gradle-analytics" version "1.2.1"
| id 'maven-publish'
|}
|
|publishing {
| repositories {
| mavenLocal()
| }
|}
|archivesBaseName = 'test'
|group = 'com.redpillanalytics'
|version = '1.0.0'
|
|repositories {
| jcenter()
| mavenLocal()
| maven {
| name 'test'
| url 's3://maven.redpillanalytics.com/demo/maven2'
| authentication {
| awsIm(AwsImAuthentication)
| }
| }
|}
|
|dependencies {
| archives group: 'com.redpillanalytics', name: 'simple-build', version: '+'
| archives group: 'com.redpillanalytics', name: 'simple-build-pipeline', version: '+'
|}
|
|analytics.sinks {
| kafka
|}
|
|""".stripMargin())

settingsFile = new File(projectDir, 'settings.gradle').write("""rootProject.name = '$projectName'""")

}

def executeSingleTask(String taskName, List otherArgs) {

otherArgs.add(0, taskName)

log.warn "runner arguments: ${otherArgs.toString()}"

// execute the Gradle test build
result = GradleRunner.create()
.withProjectDir(projectDir)
.withArguments(otherArgs)
.withPluginClasspath()
.forwardOutput()
.build()
}

def "Execute :properties with enableStreams = true"() {

given:
taskName = 'properties'
result = executeSingleTask(taskName, ['-Si','-Pconfluent.enableStreams=true',"-PmainClassName=streams.TestClass"])

expect:
result.task(":${taskName}").outcome.name() != 'FAILED'

}

def "Execute :properties with enableFunctions = true"() {

given:
taskName = 'properties'
result = executeSingleTask(taskName, ['-Si','-Pconfluent.enableFunctions=true','-Pconfluent.functionPattern = simple-build'])

expect:
result.task(":${taskName}").outcome.name() != 'FAILED'

}
}

0 comments on commit 50b2cd1

Please sign in to comment.