diff --git a/build.gradle b/build.gradle index 98aaa31..42d82be 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,7 @@ buildscript { classpath plugin.sca classpath plugin.detekt classpath plugin.ktlint + classpath plugin.bintray } } diff --git a/dependencies.gradle b/dependencies.gradle index 111893a..dd6775d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -8,6 +8,7 @@ ext { scaVersion = '1.2' detektVersion = '1.5.1' ktlintVersion = '9.1.1' + bintrayVersion = '1.8.4' kotlinCoroutinesVersion = '1.3.3' junitVersion = '4.12' @@ -22,6 +23,7 @@ ext { sca: "com.novoda:gradle-static-analysis-plugin:$scaVersion", detekt: "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion", ktlint: "org.jlleitschuh.gradle:ktlint-gradle:$ktlintVersion", + bintray: "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintrayVersion" ] support = [ diff --git a/feature-flags/Module.md b/feature-flags/Module.md new file mode 100644 index 0000000..68aaa4f --- /dev/null +++ b/feature-flags/Module.md @@ -0,0 +1,3 @@ +# Module feature-flags + +A Feature Toggle (aka Feature Flags) Kotlin implementation \ No newline at end of file diff --git a/feature-flags/bintray.gradle b/feature-flags/bintray.gradle new file mode 100644 index 0000000..f3aceca --- /dev/null +++ b/feature-flags/bintray.gradle @@ -0,0 +1,63 @@ +apply plugin: 'com.jfrog.bintray' + +def getBintrayUsername() { + return properties.get('bintrayUsername', System.getenv('BINTRAY_USERNAME')) +} + +def getBintrayApiKey() { + return properties.get('bintrayApiKey', System.getenv('BINTRAY_KEY')) +} + +def getBintrayGpgPassword() { + return properties.get('bintrayGpgPassword', System.getenv('BINTRAY_GPG_PASSWORD')) +} + +def getMavenCentralUsername() { + return properties.get('mavenCentralUsername', System.getenv('MAVEN_CENTRAL_USERNAME')) +} + +def getMavenCentralPassword() { + return properties.get('mavenCentralPassword', System.getenv('MAVEN_CENTRAL_PASSWORD')) +} + +def shouldSyncWithMavenCentral() { + return properties.get('syncWithMavenCentral', false) +} + +def dryRunOnly() { + return properties.get('dryRun', false) +} + +bintray { + user = getBintrayUsername() + key = getBintrayApiKey() + publications = ['mavenPublication'] + + pkg { + repo = bintrayRepo + userOrg = bintrayUserOrg + licenses = licenseShortName + name = bintrayName + desc = bintrayDescription + websiteUrl = projectUrl + issueTrackerUrl = issuesUrl + vcsUrl = scmUrl + dryRun = dryRunOnly() + override = true + publish = true + publicDownloadNumbers = true + version { + desc = bintrayDescription + gpg { + sign = false + passphrase = getBintrayGpgPassword() + } + mavenCentralSync { + sync = shouldSyncWithMavenCentral() + user = getMavenCentralUsername() + password = getMavenCentralPassword() + close = '1' + } + } + } +} \ No newline at end of file diff --git a/feature-flags/build.gradle b/feature-flags/build.gradle index 56bd870..1da0519 100644 --- a/feature-flags/build.gradle +++ b/feature-flags/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'kotlin' apply from: 'javadoc.gradle' apply from: 'sca.gradle' apply from: 'jacoco.gradle' +apply from: 'publishing.gradle' tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { diff --git a/feature-flags/javadoc.gradle b/feature-flags/javadoc.gradle index 5b93655..6f5d276 100644 --- a/feature-flags/javadoc.gradle +++ b/feature-flags/javadoc.gradle @@ -1,9 +1,20 @@ apply plugin: 'org.jetbrains.dokka' dokka { - outputFormat = "html" - outputDirectory = "$rootDir/dokka" + outputFormat = 'gfm' + outputDirectory = "$rootDir/docs/0.x" + configuration { + reportUndocumented = false + skipDeprecated = true + jdkVersion = 8 + + if (project.file('Module.md').exists()) { + includes = ['Module.md'] + } + externalDocumentationLink { + url = new URL("https://github.com/saantiaguilera/feature-flags") + } sourceLink { path = "src/main/java" url = "https://github.com/saantiaguilera/feature-flags" diff --git a/feature-flags/publishing.gradle b/feature-flags/publishing.gradle new file mode 100644 index 0000000..552f604 --- /dev/null +++ b/feature-flags/publishing.gradle @@ -0,0 +1,87 @@ +apply plugin: 'maven-publish' + +group = 'com.saantiaguilera.featureflags' +version = '0.0.1' + +ext { + bintrayRepo = 'maven' + bintrayUserOrg = 'saantiaguilera' + bintrayName = "$group:$name" + bintrayDescription = "Feature Toggles (often also referred to as Feature Flags) Kotlin implementation" + projectUrl = 'https://github.com/saantiaguilera/feature-flags' + issuesUrl = 'https://github.com/saantiaguilera/feature-flags/issues' + scmUrl = 'https://github.com/saantiaguilera/feature-flags.git' + scmConnection = 'scm:git:https://github.com/saantiaguilera/feature-flags.git' + scmDeveloperConnection = 'scm:git:git@github.com:saantiaguilera/feature-flags.git' + + publishedGroupId = group + libraryName = name + artifact = name + + developerId = 'saantiaguilera' + developerName = 'saantiaguilera' + + licenseShortName = 'GNU-3.0' +} + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + +javadoc.failOnError = false +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + +def pomConfig = { + licenses { + license { + name 'The GNU General Public License v3.0' + url 'https://www.gnu.org/licenses/gpl-3.0.html' + distribution 'repo' + } + } + developers { + developer { + id developerId + name developerName + } + } + + scm { + url scmUrl + } +} + +publishing { + publications { + mavenPublication(MavenPublication) { + from components.java + artifact sourcesJar { + classifier "sources" + } + artifact javadocJar { + classifier "javadoc" + } + groupId project.group + artifactId project.name + version project.version + pom.withXml { + def root = asNode() + root.appendNode('description', project.bintrayDescription) + root.appendNode('name', project.name) + root.appendNode('url', project.projectUrl) + root.children().last() + pomConfig + } + } + } +} + +apply from: 'bintray.gradle' \ No newline at end of file