Skip to content

Commit b46c4d1

Browse files
committed
Merge pull request #1 from functionaljava/master
merge fj master
2 parents 0f0145d + adb381d commit b46c4d1

291 files changed

Lines changed: 12700 additions & 4645 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ build
1111
.classpath
1212
.project
1313
.DS_Store
14-
14+
MANIFEST.MF
15+
*/bin/**
16+
*~

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: java
2+
3+
sudo: false
4+
5+
jdk:
6+
- oraclejdk8
7+
8+
addons:
9+
apt:
10+
packages:
11+
- oracle-java8-installer
12+
13+
script:
14+
- jdk_switcher use oraclejdk7 && export JAVA7_HOME=$JAVA_HOME
15+
- jdk_switcher use oraclejdk8 && export JAVA8_HOME=$JAVA_HOME
16+
- ./gradlew build coverage -s -i
17+
18+
after_success:
19+
- ./gradlew coverage coveralls -s -i

README.adoc

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,74 @@
11
= Functional Java
22

3+
image:https://travis-ci.org/functionaljava/functionaljava.svg?branch=master["Build Status", link="https://travis-ci.org/functionaljava/functionaljava"]
4+
35
image::http://www.functionaljava.org/img/logo-600x144.png[]
46

57
Functional Java is an open source library facilitating functional programming in Java. The library implements numerous basic and advanced programming abstractions that assist composition oriented development. Functional Java also serves as a platform for learning functional programming concepts by introducing these concepts using a familiar language.
68

7-
The library is intended for use in production applications and is thoroughly tested using the technique of automated specification-based testing with ScalaCheck. Functional Java is compiled with Java 8 targeting Java 7 bytecode. The use of lambdas within the project are backported with the Retro Lambda library, supporting Java versions 5 to 8.
9+
The library is intended for use in production applications and is thoroughly tested using the technique of automated specification-based testing with ScalaCheck and Functional Java's quickcheck module. Functional Java is compiled with Java 8 targeting Java 7 bytecode. The use of lambdas within the project are backported with the Retro Lambda library, supporting Java versions 5 to 8.
810

911
Functional Java provides abstractions for the following types:
1012

1113
* Basic Data Structures - total and partial functions, products, unit, option, unbiased and right biased unions (either and validation).
1214
* Immutable Collections - array, list, vector, stream, set, map, finger tree, heterogenous list.
13-
* Other Abstractions - monoid, semigroup, natural, random number generator, reader, writer, state, input/output, parser, zipper, specification based testing, actors, concurrency and type conversion.
15+
* Other Abstractions - monoid, semigroup, natural, random number generator, reader, writer, state, input/output, parser, zipper, specification based testing (quickcheck), actors, optics (lens, prism, fold, traversal and others), concurrency and type conversion.
1416
1517
== URLs
1618

1719
Important URLs for the project are:
1820

1921
* Website, http://www.functionaljava.org
2022
* Website repository, http://github.com/functionaljava/functionaljava.github.io
23+
* Travis continuous integration build, https://travis-ci.org/functionaljava/functionaljava
24+
* Sonatype Repository, https://oss.sonatype.org/content/groups/public/org/functionaljava/
25+
* Jenkins Cloudbees CI build, https://functionaljava.ci.cloudbees.com
2126

2227
== Downloading
2328

2429
The recommended way to download and use the project is through your build tool.
2530

26-
The Functional Java artifact is published to Maven Central using the group `org.functionaljava` with two published artifacts:
31+
The Functional Java artifact is published to Maven Central using the group `org.functionaljava` with three published artifacts:
2732

2833
* the core library (`functionaljava`)
2934
* Java 8 specific support (`functionaljava-java8`)
35+
* property based testing (`functionaljava-quickcheck`)
3036

31-
The latest version is `4.2`. This can be added to your Gradle project by adding the dependencies:
37+
The latest stable version is `4.4`. This can be added to your Gradle project by adding the dependencies:
3238
----
33-
compile "org.functionaljava:functionaljava:4.2"
34-
compile "org.functionaljava:functionaljava-java8:4.2"
39+
compile "org.functionaljava:functionaljava:4.4"
40+
compile "org.functionaljava:functionaljava-java8:4.4"
41+
compile "org.functionaljava:functionaljava-quickcheck:4.4"
3542
----
3643

3744
and in Maven:
3845
----
3946
<dependency>
4047
<groupId>org.functionaljava</groupId>
4148
<artifactId>functionaljava</artifactId>
42-
<version>4.2</version>
49+
<version>4.4</version>
4350
</dependency>
4451
<dependency>
4552
<groupId>org.functionaljava</groupId>
4653
<artifactId>functionaljava-java8</artifactId>
47-
<version>4.2</version>
54+
<version>4.4</version>
55+
</dependency>
56+
<dependency>
57+
<groupId>org.functionaljava</groupId>
58+
<artifactId>functionaljava-quickcheck</artifactId>
59+
<version>4.4</version>
4860
</dependency>
4961
----
5062

5163
== Building
5264

5365
FunctionalJava uses the Retro Lambda project to backport Java 8 lambdas to Java 7 bytecode. This requires access to both JDK 7 and 8. The build system requires the environment variables `JAVA7_HOME` and `JAVA8_HOME` to refer to the appropriate directories.
5466

55-
Building is done using Gradle 2.2.1. In the root directory run:
67+
Building is done using Gradle 2.4. In the root directory run:
5668
----
5769
./gradlew
5870
----
59-
This will download the Gradle build tool and necessary dependencies and build FunctionalJava.
71+
This requires access to Java and will download the Gradle build tool and necessary dependencies and build FunctionalJava.
6072

6173
== Features
6274

@@ -95,7 +107,8 @@ A more complete description of the features mentioned above are:
95107
** Zipper implementations for streams and trees.
96108
** Automated specification-based testing framework (`fj.test`).
97109
** Fully operational Actors for parallel computations (`fj.control.parallel`) and layered abstractions such as parallel-map, map-reduce, parallel-zip.
110+
** Optics for updating immutable data including lens, prism, iso, optional, traversal, getter, fold and setter. Inspired by the Scala Monocle library (https://github.com/julien-truffaut/Monocle) and the Haskell lens library (https://github.com/ekmett/lens).
98111

99112
== License
100113

101-
link:etc/LICENCE[The Functional Java license] uses the BSD 3 license (3-clause license) available at https://en.wikipedia.org/wiki/BSD_licenses[].
114+
link:etc/LICENCE[The Functional Java license] uses the BSD 3 license (3-clause license) available at https://en.wikipedia.org/wiki/BSD_licenses[].

build.gradle

Lines changed: 120 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ defaultTasks 'build'
44
ext {
55
}
66

7+
buildscript {
8+
ext {
9+
uptodateVersion = "1.6.0"
10+
retrolambdaVersion = "3.2.0"
11+
}
12+
13+
repositories {
14+
mavenLocal()
15+
jcenter()
16+
mavenCentral()
17+
}
18+
19+
dependencies {
20+
classpath "com.ofg:uptodate-gradle-plugin:$uptodateVersion"
21+
classpath "me.tatarka:gradle-retrolambda:$retrolambdaVersion"
22+
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.4.0'
23+
}
24+
}
25+
26+
27+
apply plugin: "jacoco"
28+
apply plugin: 'com.github.kt3k.coveralls'
29+
30+
731
if (JavaVersion.current().isJava8Compatible()) {
832
allprojects {
933
tasks.withType(Javadoc) {
@@ -14,15 +38,24 @@ if (JavaVersion.current().isJava8Compatible()) {
1438

1539
allprojects {
1640

41+
42+
43+
jacoco {
44+
toolVersion = "0.7.1.201405082137"
45+
}
46+
47+
defaultTasks "build"
48+
1749
ext {
1850
isSnapshot = true
19-
fjBaseVersion = "4.3"
51+
fjBaseVersion = "4.5"
2052

2153
snapshotAppendix = "-SNAPSHOT"
2254
fjVersion = fjBaseVersion + (isSnapshot ? snapshotAppendix : "")
23-
fjConsumeVersion = "4.2"
55+
fjConsumeVersion = "4.4"
2456

2557
signModule = false
58+
useRetroLambda = false
2659

2760
projectTitle = "Functional Java"
2861
projectName = "functionaljava"
@@ -40,39 +73,95 @@ allprojects {
4073
sonatypeUploadUrl = isSnapshot ? sonatypeSnapshotUrl : sonatypeReleaseUrl
4174
primaryEmail = "functionaljava@googlegroups.com"
4275

43-
dependencyJunit = "junit:junit:4.11"
76+
dependencyJunit = "junit:junit:4.12"
77+
78+
displayCompilerWarnings = true
79+
80+
newJdkEnvVar = "JAVA8_HOME"
81+
oldJdkEnvVar = "JAVA7_HOME"
82+
retroLambdaTarget = JavaVersion.VERSION_1_7
83+
}
84+
85+
repositories {
86+
jcenter()
87+
mavenCentral()
88+
mavenLocal()
4489
}
4590

4691
version = fjVersion
4792
group = "org.functionaljava"
93+
4894
}
4995

5096
subprojects {
5197

52-
defaultTasks "build"
5398

5499
buildscript {
55100
repositories {
56101
mavenCentral()
57102
}
58103

59104
dependencies {
60-
classpath 'me.tatarka:gradle-retrolambda:2.5.0'
105+
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
61106
}
62107
}
63108

64-
repositories {
65-
mavenCentral()
109+
apply plugin: "jacoco"
110+
apply plugin: 'com.github.kt3k.coveralls'
111+
112+
apply from: "$rootDir/lib.gradle"
113+
apply plugin: "java"
114+
apply plugin: "eclipse"
115+
apply plugin: "com.ofg.uptodate"
116+
117+
repositories {
118+
mavenLocal()
119+
jcenter()
120+
mavenCentral()
66121
maven {
67122
url sonatypeRepositoryUrl
68123
}
124+
}
69125

126+
if (displayCompilerWarnings) {
127+
tasks.withType(JavaCompile) {
128+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
129+
}
70130
}
71131

72-
apply from: "$rootDir/lib.gradle"
132+
jacocoTestReport {
133+
reports {
134+
html.enabled = true
135+
xml.enabled = true
136+
csv.enabled = false
137+
// html.destination "${buildDir}/jacocoHtml"
138+
}
139+
}
140+
141+
142+
task coverage(dependsOn: ["test", "jacocoTestReport"]) << {
143+
144+
}
145+
146+
}
147+
148+
task coverage(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
149+
dependsOn = subprojects.test
150+
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
151+
classDirectories = files(subprojects.sourceSets.main.output)
152+
executionData = files(subprojects.jacocoTestReport.executionData)
153+
reports {
154+
html.enabled = true
155+
xml.enabled = true
156+
csv.enabled = false
157+
}
158+
}
159+
160+
configure(subprojects.findAll { it.name != "props-core" }) {
161+
73162
apply plugin: "maven"
74-
apply plugin: "java"
75163
apply plugin: "signing"
164+
apply plugin: "osgi"
76165

77166
sourceCompatibility = "1.8"
78167

@@ -95,16 +184,33 @@ subprojects {
95184
jar {
96185
version project.fjVersion
97186
manifest {
98-
attributes 'Signature-Version': project.fjVersion
187+
name = 'Functional Java'
188+
instruction 'Signature-Version', project.fjVersion
189+
instruction 'Bundle-ActivationPolicy', 'lazy'
190+
instruction 'Bundle-Vendor', 'functionaljava.org'
191+
if(project.name != "core") {
192+
instruction 'Require-Bundle', 'org.functionaljava;bundle-version="'+project.fjBaseVersion+'"'
193+
}
99194
}
100195
}
101196

102-
}
197+
eclipse {
198+
project {
199+
natures 'org.eclipse.pde.PluginNature'
200+
buildCommand 'org.eclipse.pde.ManifestBuilder'
201+
buildCommand 'org.eclipse.pde.SchemaBuilder'
202+
}
203+
}
103204

104-
task wrapper(type: Wrapper) {
105-
gradleVersion = '2.0'
205+
// Output MANIFEST.MF statically so eclipse can see it for plugin development
206+
task eclipsePluginManifest(dependsOn: jar) << {
207+
file("META-INF").mkdirs()
208+
jar.manifest.writeTo(file("META-INF/MANIFEST.MF"))
209+
}
210+
211+
eclipseProject.dependsOn eclipsePluginManifest
106212
}
107213

108214
task env << {
109215
println System.getenv()
110-
}
216+
}

consume/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
archivesBaseName = "${project.projectName}-${project.name}"
3+
24
dependencies {
35
compile("$group:$projectName:$fjConsumeVersion")
6+
7+
testCompile dependencyJunit
48
}
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package fj.consume.euler;
22

3-
import fj.F;
4-
import fj.data.Stream;
5-
63
import static fj.data.List.range;
74
import static fj.function.Integers.sum;
85

@@ -14,13 +11,11 @@
1411
public class Problem1 {
1512

1613
public static void main(final String[] args) {
17-
java7();
14+
calc();
1815
}
1916

20-
public static void java7() {
21-
out.println(sum(range(0, 1000).filter(new F<Integer, Boolean>() {
22-
public Boolean f(final Integer a) { return a % 3 == 0 || a % 5 == 0;}
23-
})));
17+
public static void calc() {
18+
out.println(sum(range(0, 1000).filter(a -> a % 3 == 0 || a % 5 == 0)));
2419
}
2520

2621
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package fj;
2+
3+
import org.junit.Ignore;
4+
import org.junit.Test;
5+
6+
import org.junit.Assert;
7+
8+
/**
9+
* Created by MarkPerry on 30/08/2015.
10+
*/
11+
public class EmptyTest {
12+
13+
@Ignore @Test
14+
public void missing() {
15+
Assert.fail("not implemented");
16+
17+
}
18+
}

core/build.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11

2-
apply plugin: 'me.tatarka.retrolambda'
3-
42
ext {
53
signModule = true
64
}
@@ -16,8 +14,4 @@ configureUpload(signingEnabled, signModule)
1614

1715
uploadArchives.enabled = true
1816

19-
retrolambda {
20-
jdk System.getenv("JAVA8_HOME")
21-
oldJdk System.getenv("JAVA7_HOME")
22-
javaVersion JavaVersion.VERSION_1_7
23-
}
17+
configureAllRetroLambda()

0 commit comments

Comments
 (0)