-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to latest gradle version
- Loading branch information
Showing
63 changed files
with
673 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
|
||
/.project | ||
/.gradle | ||
/.settings | ||
/bin | ||
/build | ||
build/ | ||
/.classpath | ||
/.classpath.idea/ | ||
/.java-version | ||
DbSetup.iml | ||
*.iml | ||
.idea | ||
out | ||
classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
apply plugin : 'pmd' | ||
apply plugin : 'findbugs' | ||
apply plugin : 'jacoco' | ||
|
||
description = 'Helps you setup your database with test data' | ||
|
||
check.dependsOn tasks.getByName("jacocoTestReport") | ||
|
||
dependencies { | ||
compile 'com.google.code.findbugs:jsr305:2.0.0' | ||
compile 'net.sourceforge.findbugs:annotations:1.3.2' | ||
testCompile 'junit:junit:4.+' | ||
testCompile 'org.mockito:mockito-all:1.9.0' | ||
testCompile 'org.hsqldb:hsqldb:2.3.3' | ||
} | ||
|
||
configurations { | ||
compile.transitive = false | ||
testCompile.transitive = false | ||
runtime.transitive = false | ||
testRuntime.transitive = false | ||
} | ||
|
||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' | ||
|
||
pmd { | ||
sourceSets = [sourceSets.main] | ||
} | ||
|
||
pmdMain { | ||
ignoreFailures = true | ||
ruleSetFiles = files('config/pmd/ruleset.xml') | ||
} | ||
|
||
findbugs { | ||
sourceSets = [sourceSets.main] | ||
ignoreFailures = true | ||
} | ||
|
||
findbugsMain { | ||
reports { | ||
xml { | ||
enabled = false | ||
} | ||
html { | ||
enabled = true | ||
} | ||
} | ||
} | ||
|
||
jar { | ||
manifest { | ||
instruction 'Bundle-Vendor', 'ninja-squad.com' | ||
instructionReplace 'Export-Package', | ||
'com.ninja_squad.dbsetup', | ||
'com.ninja_squad.dbsetup.bind', | ||
'com.ninja_squad.dbsetup.destination', | ||
'com.ninja_squad.dbsetup.generator', | ||
'com.ninja_squad.dbsetup.operation' | ||
instruction 'Import-Package', '!javax.annotation.*', '*' | ||
} | ||
} | ||
|
||
javadoc { | ||
options.overview file('src/main/java/com/ninja_squad/dbsetup/overview.html').path | ||
options.noTimestamp true | ||
options.linkSource true | ||
options.addBooleanOption('Xdoclint:all,-missing', true) | ||
} | ||
|
||
def configurePomDependencies(pom) { | ||
// we don't care about test dependencies | ||
pom.dependencies = pom.dependencies.findAll {it.scope != 'test'} | ||
// we don't care about findbugs annotations | ||
pom.dependencies = pom.dependencies.findAll {it.groupId != 'net.sourceforge.findbugs' && it.artifactId != 'annotations'} | ||
// we don't care about JSR305 annotations | ||
pom.dependencies = pom.dependencies.findAll {it.groupId != 'com.google.code.findbugs' && it.artifactId != 'jsr305'} | ||
// all dependencies are compile time dependencies, and there is no need to say it | ||
pom.dependencies*.scope = null | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.2" | ||
} | ||
} | ||
|
||
apply plugin: 'kotlin' | ||
|
||
description = 'Kotlin extensions for DbSetup' | ||
|
||
dependencies { | ||
compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.2" | ||
compile project(':DbSetup') | ||
testCompile 'junit:junit:4.11' | ||
} | ||
|
||
checkstyleMain { | ||
source sourceSets.main.kotlin | ||
} | ||
|
||
def configurePomDependencies(pom) { | ||
// we don't care about test dependencies | ||
pom.dependencies = pom.dependencies.findAll {it.scope != 'test'} | ||
// all dependencies are compile time dependencies, and there is no need to say it | ||
pom.dependencies*.scope = null | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
|
||
<!DOCTYPE module PUBLIC | ||
"-//Puppy Crawl//DTD Check Configuration 1.1//EN" | ||
"http:https://www.puppycrawl.com/dtds/configuration_1_1.dtd"> | ||
|
||
<module name="Checker"> | ||
<property name="severity" value="warning"/> | ||
|
||
<module name="Header"> | ||
<property name="headerFile" value="${headerFile}"/> | ||
<property name="ignoreLines" value="4"/> | ||
<property name="fileExtensions" value="kt"/> | ||
</module> | ||
</module> |
52 changes: 52 additions & 0 deletions
52
DbSetup-kotlin/src/main/kotlin/com/ninja_squad/dbsetup_kotlin/DbSetup.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2016, Ninja Squad | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package com.ninja_squad.dbsetup_kotlin | ||
|
||
import com.ninja_squad.dbsetup.DbSetup | ||
import com.ninja_squad.dbsetup.DbSetupTracker | ||
|
||
/** | ||
* Extension function of DbSetup allowing to launch it with a tracker. This allows launching the setup in an easier way: | ||
* instead of doing | ||
* | ||
* ``` | ||
* val theSetup = dbSetup { | ||
* ... | ||
* } | ||
* tracker.launchIfNecessary(theSetup) | ||
* ``` | ||
* | ||
* you can simply do | ||
* | ||
* ``` | ||
* dbSetup { | ||
* ... | ||
* }.launchWith(tracker) | ||
* ``` | ||
* | ||
* @author JB Nizet | ||
*/ | ||
fun DbSetup.launchWith(tracker: DbSetupTracker) { | ||
tracker.launchIfNecessary(this) | ||
} |
Oops, something went wrong.