Skip to content

Commit 6f97b41

Browse files
Publish v0.0.1
- 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)
1 parent 40e510f commit 6f97b41

File tree

7 files changed

+170
-2
lines changed

7 files changed

+170
-2
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ buildscript {
1414
classpath plugin.sca
1515
classpath plugin.detekt
1616
classpath plugin.ktlint
17+
classpath plugin.bintray
1718
}
1819
}
1920

dependencies.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ext {
88
scaVersion = '1.2'
99
detektVersion = '1.5.1'
1010
ktlintVersion = '9.1.1'
11+
bintrayVersion = '1.8.4'
1112

1213
kotlinCoroutinesVersion = '1.3.3'
1314
junitVersion = '4.12'
@@ -22,6 +23,7 @@ ext {
2223
sca: "com.novoda:gradle-static-analysis-plugin:$scaVersion",
2324
detekt: "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion",
2425
ktlint: "org.jlleitschuh.gradle:ktlint-gradle:$ktlintVersion",
26+
bintray: "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintrayVersion"
2527
]
2628

2729
support = [

feature-flags/Module.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Module feature-flags
2+
3+
A Feature Toggle (aka Feature Flags) Kotlin implementation

feature-flags/bintray.gradle

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
apply plugin: 'com.jfrog.bintray'
2+
3+
def getBintrayUsername() {
4+
return properties.get('bintrayUsername', System.getenv('BINTRAY_USERNAME'))
5+
}
6+
7+
def getBintrayApiKey() {
8+
return properties.get('bintrayApiKey', System.getenv('BINTRAY_KEY'))
9+
}
10+
11+
def getBintrayGpgPassword() {
12+
return properties.get('bintrayGpgPassword', System.getenv('BINTRAY_GPG_PASSWORD'))
13+
}
14+
15+
def getMavenCentralUsername() {
16+
return properties.get('mavenCentralUsername', System.getenv('MAVEN_CENTRAL_USERNAME'))
17+
}
18+
19+
def getMavenCentralPassword() {
20+
return properties.get('mavenCentralPassword', System.getenv('MAVEN_CENTRAL_PASSWORD'))
21+
}
22+
23+
def shouldSyncWithMavenCentral() {
24+
return properties.get('syncWithMavenCentral', false)
25+
}
26+
27+
def dryRunOnly() {
28+
return properties.get('dryRun', false)
29+
}
30+
31+
bintray {
32+
user = getBintrayUsername()
33+
key = getBintrayApiKey()
34+
publications = ['mavenPublication']
35+
36+
pkg {
37+
repo = bintrayRepo
38+
userOrg = bintrayUserOrg
39+
licenses = licenseShortName
40+
name = bintrayName
41+
desc = bintrayDescription
42+
websiteUrl = projectUrl
43+
issueTrackerUrl = issuesUrl
44+
vcsUrl = scmUrl
45+
dryRun = dryRunOnly()
46+
override = true
47+
publish = true
48+
publicDownloadNumbers = true
49+
version {
50+
desc = bintrayDescription
51+
gpg {
52+
sign = false
53+
passphrase = getBintrayGpgPassword()
54+
}
55+
mavenCentralSync {
56+
sync = shouldSyncWithMavenCentral()
57+
user = getMavenCentralUsername()
58+
password = getMavenCentralPassword()
59+
close = '1'
60+
}
61+
}
62+
}
63+
}

feature-flags/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apply plugin: 'kotlin'
22
apply from: 'javadoc.gradle'
33
apply from: 'sca.gradle'
44
apply from: 'jacoco.gradle'
5+
apply from: 'publishing.gradle'
56

67
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
78
kotlinOptions {

feature-flags/javadoc.gradle

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
apply plugin: 'org.jetbrains.dokka'
22

33
dokka {
4-
outputFormat = "html"
5-
outputDirectory = "$rootDir/dokka"
4+
outputFormat = 'gfm'
5+
outputDirectory = "$rootDir/docs/0.x"
6+
67
configuration {
8+
reportUndocumented = false
9+
skipDeprecated = true
10+
jdkVersion = 8
11+
12+
if (project.file('Module.md').exists()) {
13+
includes = ['Module.md']
14+
}
15+
externalDocumentationLink {
16+
url = new URL("https://github.com/saantiaguilera/feature-flags")
17+
}
718
sourceLink {
819
path = "src/main/java"
920
url = "https://github.com/saantiaguilera/feature-flags"

feature-flags/publishing.gradle

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
apply plugin: 'maven-publish'
2+
3+
group = 'com.saantiaguilera.featureflags'
4+
version = '0.0.1'
5+
6+
ext {
7+
bintrayRepo = 'maven'
8+
bintrayUserOrg = 'saantiaguilera'
9+
bintrayName = "$group:$name"
10+
bintrayDescription = "Feature Toggles (often also referred to as Feature Flags) Kotlin implementation"
11+
projectUrl = 'https://github.com/saantiaguilera/feature-flags'
12+
issuesUrl = 'https://github.com/saantiaguilera/feature-flags/issues'
13+
scmUrl = 'https://github.com/saantiaguilera/feature-flags.git'
14+
scmConnection = 'scm:git:https://github.com/saantiaguilera/feature-flags.git'
15+
scmDeveloperConnection = 'scm:git:git@github.com:saantiaguilera/feature-flags.git'
16+
17+
publishedGroupId = group
18+
libraryName = name
19+
artifact = name
20+
21+
developerId = 'saantiaguilera'
22+
developerName = 'saantiaguilera'
23+
24+
licenseShortName = 'GNU-3.0'
25+
}
26+
27+
task sourcesJar(type: Jar, dependsOn: classes) {
28+
classifier = 'sources'
29+
from sourceSets.main.allSource
30+
}
31+
32+
javadoc.failOnError = false
33+
task javadocJar(type: Jar, dependsOn: javadoc) {
34+
classifier = 'javadoc'
35+
from javadoc.destinationDir
36+
}
37+
38+
artifacts {
39+
archives sourcesJar
40+
archives javadocJar
41+
}
42+
43+
def pomConfig = {
44+
licenses {
45+
license {
46+
name 'The GNU General Public License v3.0'
47+
url 'https://www.gnu.org/licenses/gpl-3.0.html'
48+
distribution 'repo'
49+
}
50+
}
51+
developers {
52+
developer {
53+
id developerId
54+
name developerName
55+
}
56+
}
57+
58+
scm {
59+
url scmUrl
60+
}
61+
}
62+
63+
publishing {
64+
publications {
65+
mavenPublication(MavenPublication) {
66+
from components.java
67+
artifact sourcesJar {
68+
classifier "sources"
69+
}
70+
artifact javadocJar {
71+
classifier "javadoc"
72+
}
73+
groupId project.group
74+
artifactId project.name
75+
version project.version
76+
pom.withXml {
77+
def root = asNode()
78+
root.appendNode('description', project.bintrayDescription)
79+
root.appendNode('name', project.name)
80+
root.appendNode('url', project.projectUrl)
81+
root.children().last() + pomConfig
82+
}
83+
}
84+
}
85+
}
86+
87+
apply from: 'bintray.gradle'

0 commit comments

Comments
 (0)