Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP : Porting over from grabbit #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gradlew -crlf
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*.vlt
*.tmp
.DS_Store
*.iml
*.ipr
*.iws
*.jar
.gradle
.gradletasknamecache
.project
.settings
.idea
.classpath
.metadata/
dist/
atlassian-ide-plugin.xml
install/
out/
build/
bin/
.cache
test-output/
classes/
generated/
.vagrant/
target/
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: groovy

#Yeah, we are going to want to cache our build dependencies so our builds aren't held up downloading for every container
cache:
directories:
- $HOME/.gradle

jdk:
- oraclejdk7
- oraclejdk8
- openjdk7

# Allow running on a container instead of a traditional VM
sudo: false

#There is currently an issue in Gradle where a forked JVM will ignore any no-daemon flag (--no-daemon, org.gradle.daemon) for the forked process if jvm args are supplied.
#We remove them to get around this
env:
global:
- GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=''"

before_install:
- bash install_protoc_from_source.sh
install: ./gradlew assemble
script: ./gradlew check


226 changes: 226 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
buildscript {
repositories {
jcenter()

//Provides cq-gradle-plugins and jackalope
maven {
url "http://dl.bintray.com/twcable/aem"
}
mavenLocal()
}

dependencies {
classpath "com.twcable.gradle:cq-gradle-plugins:${gradle_plugins_version}"


classpath "commons-io:commons-io:2.4"
}
}

plugins {
id "com.jfrog.bintray" version "1.3.1"
}

apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven'

repositories {
jcenter()

//Provides cq-gradle-plugins and jackalope
maven {
url "http://dl.bintray.com/twcable/aem"
}

maven {
url "http://dl.bintray.com/twcable/osgi"
}

//Provides all Adobe AEM specific repos (like cq-workflow-console)
maven {
url "http://repo.adobe.com/nexus/content/groups/public"
}

// hack to allow getting to a working version of AEM 6.1 workflow-console jar
// without running afoul of licensing restrictions
flatDir { dirs rootProject.projectDir }
}

ext.vendor = 'Time Warner Cable - Converged Technology Group - CMS Team'
ext.organization = "Time Warner Cable"
ext.providerUrl = "https://www.timewarnercable.com"
ext.providerLink = "https://github.com/TWCable/grabbit"

apply plugin: 'groovy'
apply from: "${rootProject.projectDir}/gradle/dependencies.gradle"
apply from: "${rootProject.projectDir}/testutils/gradle/testing.gradle"

jar.manifest {
attributes 'Specification-Version': project.version
attributes 'Bundle-Vendor': project.vendor
attributes 'Implementation-Title': project.name
attributes 'Implementation-Version': project.version
attributes 'Implementation-Vendor': project.vendor

instruction 'Import-Package', 'org.joda.time; version="[2,3)"'
instruction 'Import-Package', 'org.joda.time.base; version="[2,3)"'
instruction 'Import-Package', 'org.joda.time.format; version="[2,3)"'
}

afterEvaluate {
if (project.hasProperty('sourceCompatibility')) {
project.sourceCompatibility = 1.7
}
if (project.hasProperty('targetCompatibility')) {
project.targetCompatibility = 1.7
}
if (project.hasProperty('bundleName')) {
jar.manifest {
attributes 'Bundle-Name': project.bundleName
attributes 'Bundle-SymbolicName': project.symbolicName
attributes 'Bundle-Description': project.bundleDescription
}
}

if(project.hasProperty('slingServers')) {
project.slingServers.retryWaitMs = 500
project.slingServers.maxWaitValidateBundlesMs = 90000
}
// http://forums.gradle.org/gradle/topics/classpath_order_generated_by_eclipse_plugin_causes_problems
if (project.plugins.hasPlugin('java')) {
project.eclipse.classpath.file.whenMerged { classpath ->
def projectRefs = classpath.entries.findAll { entry -> entry.kind == 'src' && entry.path.startsWith('/') }
//move the project references to the end of the list:
classpath.entries.removeAll(projectRefs)
classpath.entries.addAll(projectRefs)
}
}
}

idea.project.ipr {
withXml { provider ->
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
def codeStyleNode = provider.node.component.find { it.@name == 'ProjectCodeStyleSettingsManager' }
if (codeStyleNode == null) {
codeStyleNode = provider.node.appendNode('component', [name: 'ProjectCodeStyleSettingsManager'])
}
codeStyleNode.replaceNode { node ->
component(name: 'ProjectCodeStyleSettingsManager') {
option(name: "PER_PROJECT_SETTINGS") {
value {
option(name: "OTHER_INDENT_OPTIONS") {
value {
option(name: "INDENT_SIZE", value: "4")
option(name: "CONTINUATION_INDENT_SIZE", value: "4")
option(name: "TAB_SIZE", value: "4")
option(name: "USE_TAB_CHARACTER", value: "false")
option(name: "SMART_TABS", value: "false")
option(name: "LABEL_INDENT_SIZE", value: "0")
option(name: "LABEL_INDENT_ABSOLUTE", value: "false")
option(name: "USE_RELATIVE_INDENTS", value: "false")
}
}
option(name: "CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND", value: "9999")
option(name: "NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND", value: "9999")
XML {
option(name: "XML_LEGACY_SETTINGS_IMPORTED", value: "true")
}

// this is needed in addition to the one below, for import settings
GroovyCodeStyleSettings {
option(name: "CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND", value: "9999")
option(name: "NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND", value: "9999")
}

// oddly, both "JAVA" and "Java" are used...
['Groovy', 'JAVA', 'Java', 'Scala'].each {
codeStyleSettings(language: it) {
option(name: "CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND", value: "9999")
option(name: "NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND", value: "9999")
option(name: "BLANK_LINES_AROUND_METHOD", value: "2")
//option(name: "BLANK_LINES_BEFORE_METHOD_BODY", value: "1")
option(name: "ELSE_ON_NEW_LINE", value: "true")
option(name: "CATCH_ON_NEW_LINE", value: "true")
option(name: "FINALLY_ON_NEW_LINE", value: "true")
option(name: "SPACE_AFTER_TYPE_CAST", value: "false")
option(name: "INDENT_SIZE", value: "2")
option(name: "TAB_SIZE", value: "4")

// both this level and 'indentOptions' are used
option(name: "CONTINUATION_INDENT_SIZE", value: "4")
indentOptions {
option(name: "CONTINUATION_INDENT_SIZE", value: "4")
}
}
}
}
}
option(name: "USE_PER_PROJECT_SETTINGS0", value: "true")
}
}
}
}

apply from: "${rootProject.projectDir}/gradle/verifyComponentConfig.gradle"
apply from: "${rootProject.projectDir}/gradle/utils.gradle"

apply plugin: 'osgi'
apply plugin: 'scr'
apply plugin: 'sling-bundle'

// remove "mvn install" since it's not needed and causes a conflict
def installTask = tasks.findByPath('install')
if (installTask != null) tasks.remove(installTask)

apply from: "${rootProject.projectDir}/gradle/bundle.gradle"
apply from: "${rootProject.projectDir}/gradle/packageExclusions.gradle"
apply from: "${rootProject.projectDir}/gradle/idea.gradle"

gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(bintrayUpload)) {
if (!project.hasProperty('bintray.user') || !project.hasProperty('bintray.key')) {
throw new IllegalArgumentException((String)"Please define 'bintray.user' and " +
"'bintray.key' properties. (Such as in ~/.gradle/gradle.properties)")
}
}
}

version = new com.twcable.grabbit.Version(version as String)

bintray {
user = project.properties['bintray.user']
key = project.properties['bintray.key']
filesSpec {
from tasks.getByPath('createPackage').archivePath
into '.'
}

publish = version.status == 'release'

pkg {
userOrg = 'twcable'
repo = 'aem'
name = 'Grabbit'

desc = 'The purpose of this project is to provide a reliable and fast solution for copying content from a Source to Destination. Source and destination can be any AEM instances.'

websiteUrl = 'https://github.com/TWCable/grabbit'
issueTrackerUrl = 'https://github.com/TWCable/grabbit/issues'
vcsUrl = 'https://github.com/TWCable/grabbit.git'
licenses = ['Apache-2.0']
labels = ['AEM', 'CQ', 'Content Copy', 'Data Migration']
attributes = ['plat': ['aem', 'cq']]

publicDownloadNumbers = true

//noinspection GroovyAssignabilityCheck
version {
//noinspection GrReassignedInClosureLocalVar
name = project.version.bintrayVersion
vcsTag = 'v' + project.version
}
}
}

bintrayUpload.dependsOn('createPackage')
11 changes: 11 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apply plugin: 'groovy'

dependencies {
testCompile('org.spockframework:spock-core:1.0-groovy-2.3') {
exclude module: 'groovy-all'
}
}

repositories {
mavenCentral()
}
65 changes: 65 additions & 0 deletions buildSrc/src/main/groovy/com/twcable/spring/batch/Version.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* Copyright 2015 Time Warner Cable, Inc.
*
* 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.
*/

package com.twcable.spring.batch

// **************************************************************************
//
// VERSION CLASS
//
// **************************************************************************


class Version {
String originalVersion
String thisVersion
String status
Date buildTime


Version(String versionValue) {
buildTime = new Date()
originalVersion = versionValue
if (originalVersion.endsWith('-SNAPSHOT')) {
status = 'integration'
thisVersion = originalVersion - 'SNAPSHOT' + getTimestamp()
}
else {
status = 'release'
thisVersion = versionValue
}
}


@SuppressWarnings("UnnecessaryQualifiedReference")
String getTimestamp() {
// Convert local file timestamp to UTC
def format = new java.text.SimpleDateFormat('yyyyMMddHHmmss')
format.setCalendar(Calendar.getInstance(TimeZone.getTimeZone('UTC')));
return format.format(buildTime)
}


String toString() {
originalVersion
}


String getBintrayVersion() {
thisVersion
}

}
Loading