Skip to content

Commit

Permalink
Refactored project structure (also a step towards #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
leventov committed May 28, 2014
1 parent dd96166 commit cb41134
Show file tree
Hide file tree
Showing 256 changed files with 388 additions and 187 deletions.
5 changes: 1 addition & 4 deletions .gitignore
@@ -1,9 +1,6 @@
# Gradle
.gradle
buildSrc/build/
api/build/
impl/build/
benchmarks/build/
build/

# IntelliJ
*.iml
Expand Down
1 change: 1 addition & 0 deletions .idea/dictionaries/leventov.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/modules.xml

This file was deleted.

19 changes: 14 additions & 5 deletions README.md
Expand Up @@ -25,15 +25,24 @@ Then

$ git clone git@github.com:OpenHFT/UntitledCollectionsProject.git collections
$ cd collections
$ gradle :buildMeta
$ gradle buildMain -x test
$ gradle idea
$ cd buildSrc
$ gradle idea

Then you can open the project in IntelliJ IDEA. To build, run
Then you can open the project in IntelliJ IDEA.

To rebuild meta projects (code generators), run from the project root dir:

$ gradle --stop
$ gradle :cleanMeta :buildMeta

To rebuild either the lib, benchmarks or both, run

$ gradle build
$ gradle cleanMain buildMain

from the `lib`, `benchmarks` subdir or the root project dir respectively.

---

Project started as [Trove fork](https://bitbucket.org/leventov/trove) in June 2013.
Project started as [Trove fork](https://bitbucket.org/leventov/trove) in July 2013.

37 changes: 5 additions & 32 deletions benchmarks/build.gradle
@@ -1,35 +1,8 @@
buildscript {
repositories {
mavenCentral()
maven {
name 'Shadow'
url 'http://dl.bintray.com/content/johnrengelman/gradle-plugins'
}
}
subprojects {
setSourceCompatibility(1.8)

dependencies {
classpath 'org.gradle.plugins:shadow:0.7.4'
compile 'org.openjdk.jmh:jmh-core:0.5.6'
compile (project(':lib:api'), project(':lib:impl'))
}
}

apply plugin: 'shadow'

sourceCompatibility = 1.8
idea.module.iml { withXml {
it.asNode().component.find { it.@name == 'NewModuleRootManager' }.@LANGUAGE_LEVEL = 'JDK_1_8'
} }

dependencies {
compile project(':api')
compile project(':impl')
compile 'org.openjdk.jmh:jmh-core:0.5.6'
compile 'org.openjdk.jmh:jmh-generator-annprocess:0.5.6'
compile 'net.openhft:lang:6.3.3'
}

jar.manifest.attributes 'Main-Class': 'org.openjdk.jmh.Main'

shadow.outputFile = new File(libsDir, 'microbenchmarks.jar')

build.doLast {
tasks.shadow.execute()
}
1 change: 1 addition & 0 deletions benchmarks/dimensioned-jmh/build.gradle
@@ -0,0 +1 @@
evaluationDependsOn("$parent.path")
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package net.openhft.benchmarks;
package net.openhft.bench;

import net.openhft.collect.map.ObjIntMap;
import net.openhft.collect.map.ObjObjMapFactory;
Expand Down
File renamed without changes.
34 changes: 34 additions & 0 deletions benchmarks/research/build.gradle
@@ -0,0 +1,34 @@
evaluationDependsOn("$parent.path")

buildscript {
repositories {
mavenCentral()
maven {
name 'Shadow'
url 'http://dl.bintray.com/content/johnrengelman/gradle-plugins'
}
}

dependencies {
classpath project(':jpsg:gradle-plugin')
classpath 'org.gradle.plugins:shadow:0.7.4'
}
}

applyJpsg()
apply plugin: 'shadow'

dependencies {
compile 'org.openjdk.jmh:jmh-generator-annprocess:0.5.6'
compile 'net.openhft:lang:6.3.3'
compile project("$parent.path:dimensioned-jmh")
}

jar.manifest.attributes 'Main-Class': 'org.openjdk.jmh.Main'

shadow.outputFile = new File(libsDir, 'microbenchmarks.jar')

build.doLast {
tasks.shadow.execute()
}

Expand Up @@ -16,7 +16,7 @@

package net.openhft.collect.research.hash;

import net.openhft.benchmarks.DimensionedJmh;
import net.openhft.bench.DimensionedJmh;
import net.openhft.collect.impl.hash.DHashCapacities;
import net.openhft.collect.impl.hash.QHashCapacities;
import org.openjdk.jmh.annotations.*;
Expand Down
Expand Up @@ -16,7 +16,7 @@

package net.openhft.collect.research.hash;

import net.openhft.benchmarks.DimensionedJmh;
import net.openhft.bench.DimensionedJmh;
import net.openhft.collect.impl.hash.DHashCapacities;
import net.openhft.collect.impl.hash.QHashCapacities;
import org.openjdk.jmh.annotations.*;
Expand Down
Expand Up @@ -16,7 +16,7 @@

package net.openhft.collect.research.hash;

import net.openhft.benchmarks.DimensionedJmh;
import net.openhft.bench.DimensionedJmh;
import net.openhft.collect.impl.hash.*;
import net.openhft.collect.set.*;
import net.openhft.collect.set.hash.*;
Expand Down
Expand Up @@ -16,7 +16,7 @@

package net.openhft.collections.research;

import net.openhft.benchmarks.DimensionedJmh;
import net.openhft.bench.DimensionedJmh;
import net.openhft.collect.set.CharSet;
import net.openhft.collect.set.hash.HashCharSets;
import net.openhft.function.IntConsumer;
Expand Down
95 changes: 34 additions & 61 deletions build.gradle
@@ -1,22 +1,18 @@
buildscript {
repositories {
mavenCentral()
maven { url 'http://repo.springsource.org/plugins-release' }
allprojects {
apply plugin: 'idea'

task idea(overwrite: true) {
dependsOn ideaModule
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.5'

task cleanIdea(overwrite: true) {
dependsOn cleanIdeaModule
}
}

subprojects {
def leafProjects = subprojects.findAll { it.subprojects.empty }
configure(leafProjects) {
apply plugin: 'java'
apply plugin: 'propdeps'
apply plugin: 'jpsg' // defined in buildSrc
apply plugin: 'findbugs'
apply plugin: 'idea'
apply plugin: 'propdeps-idea'

sourceCompatibility = 1.6

repositories {
mavenCentral()
Expand All @@ -26,61 +22,38 @@ subprojects {
compile 'com.google.code.findbugs:jsr305:2.0.3'
testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-all:1.3'
provided 'com.google.auto.value:auto-value:1.0-rc1'
}

tasks.withType(net.openhft.jpsg.GeneratorTask).each { gen ->
gen.addProcessor net.openhft.jpsg.collect.MethodGeneratingProcessor
}

compileJava {
// To suppress warnings about usages of sun.misc.Unsafe API
options.compilerArgs << '-XDignore.symbol.file'
options.compilerArgs += ['-Xlint:all', '-Xlint:-unchecked', '-Xlint:-rawtypes',
'-Xlint:-cast', '-Xlint:-deprecation']
options.fork = true
def javac = System.env['JAVA_HOME'] ? System.env['JAVA_HOME'] + '/bin/javac' : 'javac'
options.forkOptions.executable = javac
configure(tasks.withType(AbstractCompile)) {
options.encoding = 'UTF-8'
}

test {
maxParallelForks Math.max((int) (Runtime.runtime.availableProcessors() / 2), 1)
}

findbugs {
toolVersion = '2.0.3'
// check (hence build) task don't depend on FindBugs, because
// benchmarks subproject requires Java 8 compiler, while FindBugs
// crashes on Java 8 - compiled bytecode even with -source 1.6 flag. To find bugs, run
// $ JAVA_HOME=<java-7-home> gradle impl:findBugsMain
// TODO fix when Java 8 - compatible version of FindBugs is out
sourceSets = []
effort = 'max'
reportLevel = 'high'
excludeFilter = file("$rootProject.projectDir/config/findbugs/excludeFilter.xml")
}

idea.module {
excludeDirs = [file('.gradle')]
['docs', 'dependency-cache', 'libs', 'reports', 'resources', 'test-results', 'tmp']
.each { excludeDirs << file("$buildDir/$it") }
// AutoValue implementations are located there
sourceDirs += sourceSets*.output.classesDir
}
apply from: "$rootProject.projectDir/methods.gradle"
}

project(':api').javadoc.options.links 'http://docs.oracle.com/javase/7/docs/api/'
def metaProjects = [':jpsg:core', ':jpsg:gradle-plugin', ':lib:impl-generator']
.collect(this.&project)
metaProjects.each { p -> evaluationDependsOn(p.path) }
task buildMeta { dependsOn metaProjects*.build }
task cleanMeta { dependsOn metaProjects*.clean }

project(':impl') {
def mainProjects = leafProjects - metaProjects - project(':jpsg').subprojects
configure(mainProjects) {
task buildMain { dependsOn build }
task cleanMain { dependsOn clean }
}

dependencies {
compile project(':api')
testCompile 'com.google.guava:guava-testlib:17.0'
testCompile 'org.apache.mahout:mahout-math:0.9'
tasks.idea.dependsOn ideaProject
tasks.idea << {
copy {
from '.'
into '.idea/'
include '*.ipr'
rename { 'modules.xml' }
}
cleanIdeaProject.execute()
}

test {
jvmArgs '-XX:MaxJavaStackTraceDepth=-1'
}
}
cleanIdea << {
delete '.idea/modules.xml'
}
32 changes: 0 additions & 32 deletions buildSrc/build.gradle

This file was deleted.

3 changes: 3 additions & 0 deletions gradle.properties
@@ -0,0 +1,3 @@
org.gradle.configureondemand=true
org.gradle.daemon=true
org.gradle.jvmargs='-ea:net.openhft.jpsg... -server -XX:+AggressiveOpts -XX:+UseParallelOldGC -XX:+UseCompressedOops'
1 change: 1 addition & 0 deletions jpsg/README.md
@@ -0,0 +1 @@
JPSG stands for Java Primitive Specializations Generator
6 changes: 6 additions & 0 deletions jpsg/cli/build.gradle
@@ -0,0 +1,6 @@
setSourceCompatibility(1.7)

dependencies {
compile project("$parent.path:core")
compile 'com.beust:jcommander:1.32'
}
Expand Up @@ -101,7 +101,7 @@ public static void main(String[] args)
jc.usage();
return;
}
GeneratorTask generator = new GeneratorTask();
Generator generator = new Generator();
for (String processor : parsedArgs.processors) {
generator.addProcessor(processor);
}
Expand Down
6 changes: 6 additions & 0 deletions jpsg/core/build.gradle
@@ -0,0 +1,6 @@
setSourceCompatibility(1.7)

dependencies {
compile 'org.slf4j:slf4j-api:1.7.5'
runtime 'org.slf4j:slf4j-simple:1.7.5'
}
Expand Up @@ -20,7 +20,7 @@
import java.util.List;

import static java.lang.String.format;
import static net.openhft.jpsg.GeneratorTask.DIMENSIONS;
import static net.openhft.jpsg.Generator.DIMENSIONS;

public final class Condition {

Expand Down
Expand Up @@ -23,7 +23,7 @@


public class DefinitionProcessor extends TemplateProcessor {
public static final int PRIORITY = GeneratorTask.BlocksProcessor.PRIORITY + 10;
public static final int PRIORITY = Generator.BlocksProcessor.PRIORITY + 10;

private static final Pattern DEF_P = RegexpUtils.compile(
"/[\\*/]\\s*define\\s+(?<name>[a-z_0-9]+)\\s*[\\*/]/" +
Expand Down

0 comments on commit cb41134

Please sign in to comment.