Skip to content

Commit

Permalink
Publish v0.0.1
Browse files Browse the repository at this point in the history
- Add `FeatureFlag` structure to generate Flag transfer objects. They
are based on [golang flag pgk](https://golang.org/pkg/flag/)
- Add `FeatureFlagProvider` contract that will decide if a given feature
is enabled / disabled.
- Add missing concept, which will abide the default feature behavior. A
missing feature is still enabled or disabled, it simply wasn't found at
the provider and was a default value.
- Add priority provider, which groups providers based on a comparator
priority
- Add safe copy to providers in priority provider to avoid runtime
changes
- Add creational methods to easily construct results
- Add functional scopes for reacting to an enabled / disabled / missing
result
- Make functional scopes inline
- Use contracts API to ensure only one time it will be called a scope
- Add testapp with code samples
- Add dokka for javadoc
- Add publishing plugins to bintray and maven central
- Add SCA tools (detekt / ktlint)
  • Loading branch information
saantiaguilera committed Feb 7, 2020
1 parent 40e510f commit 6f97b41
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ buildscript {
classpath plugin.sca
classpath plugin.detekt
classpath plugin.ktlint
classpath plugin.bintray
}
}

Expand Down
2 changes: 2 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 = [
Expand Down
3 changes: 3 additions & 0 deletions feature-flags/Module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Module feature-flags

A Feature Toggle (aka Feature Flags) Kotlin implementation
63 changes: 63 additions & 0 deletions feature-flags/bintray.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
}
}
}
1 change: 1 addition & 0 deletions feature-flags/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 13 additions & 2 deletions feature-flags/javadoc.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
87 changes: 87 additions & 0 deletions feature-flags/publishing.gradle
Original file line number Diff line number Diff line change
@@ -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:[email protected]: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'

0 comments on commit 6f97b41

Please sign in to comment.