Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updated gradle build to use reflections-0.9.9 and the new dom4j dependency
Tweaks to engine cacheReflections because it randomly started thinking it was always up-to-date on me.
Core and CoreSampleGamePlay also updated to use the new reflections, this will need to be pushed out to other modules and possibly improved in structure.
  • Loading branch information
immortius committed Jun 28, 2015
1 parent 93983b7 commit 225c131
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Expand Up @@ -38,7 +38,8 @@ buildscript {
classpath 'org.ajoberstar:gradle-git:0.6.3'

// Needed for caching reflected data during builds
classpath 'org.reflections:reflections:0.9.9-RC1'
classpath 'org.reflections:reflections:0.9.9'
classpath 'dom4j:dom4j:1.6.1'
}
}

Expand Down
19 changes: 9 additions & 10 deletions engine/build.gradle
Expand Up @@ -153,18 +153,17 @@ jar {
task cacheReflections {
description = 'Caches reflection output to make regular startup faster. May go stale and need cleanup at times.'
inputs.files project.classes.outputs.files
outputs.file file(sourceSets.main.output.classesDir.toString() + "/reflections.cache")
dependsOn classes

doFirst {
// Without the .mkdirs() we might hit a scenario where the classes dir doesn't exist yet
file(sourceSets.main.output.classesDir.toString()).mkdirs()
Reflections reflections = new ConfigurationBuilder()
.addUrls(configurations.runtime.collect { it.toURI().toURL()} + sourceSets.main.output.classesDir.toURI().toURL())
.setScanners(new TypeAnnotationsScanner(), new SubTypesScanner())
.build()
reflections.save(sourceSets.main.output.classesDir.toString() + "/reflections.cache")
}
doLast {
// Without the .mkdirs() we might hit a scenario where the classes dir doesn't exist yet
file(sourceSets.main.output.classesDir.toString()).mkdirs()
Reflections reflections = new org.reflections.Reflections(new org.reflections.util.ConfigurationBuilder()
.addUrls(configurations.compile.collect { it.toURI().toURL()} + sourceSets.main.output.classesDir.toURI().toURL())
.setScanners(new TypeAnnotationsScanner(), new SubTypesScanner()))
reflections.save(sourceSets.main.output.classesDir.toString() + "/reflections.cache")
}

}

task cleanReflections(type: Delete) {
Expand Down
8 changes: 2 additions & 6 deletions modules/Core/build.gradle
Expand Up @@ -28,9 +28,6 @@ buildscript {

// Git plugin for Gradle
classpath 'org.ajoberstar:gradle-git:0.6.3'

// Needed for caching reflected data during builds
classpath 'org.reflections:reflections:0.9.9-RC1'
}
}

Expand Down Expand Up @@ -211,10 +208,9 @@ task cacheReflections {
doFirst {
// Without the .mkdirs() we might hit a scenario where the classes dir doesn't exist yet
dirToReflect.mkdirs()
Reflections reflections = new ConfigurationBuilder()
Reflections reflections = new Reflections(new ConfigurationBuilder()
.addUrls(dirToReflect.toURI().toURL())
.setScanners(new TypeAnnotationsScanner(), new SubTypesScanner())
.build()
.setScanners(new TypeAnnotationsScanner(), new SubTypesScanner()))
reflections.save(sourceSets.main.output.classesDir.toString() + "/reflections.cache")
}
}
Expand Down
8 changes: 2 additions & 6 deletions modules/CoreSampleGameplay/build.gradle
Expand Up @@ -28,9 +28,6 @@ buildscript {

// Git plugin for Gradle
classpath 'org.ajoberstar:gradle-git:0.6.3'

// Needed for caching reflected data during builds
classpath 'org.reflections:reflections:0.9.9-RC1'
}
}

Expand Down Expand Up @@ -211,10 +208,9 @@ task cacheReflections {
doFirst {
// Without the .mkdirs() we might hit a scenario where the classes dir doesn't exist yet
dirToReflect.mkdirs()
Reflections reflections = new ConfigurationBuilder()
Reflections reflections = new Reflections(new ConfigurationBuilder()
.addUrls(dirToReflect.toURI().toURL())
.setScanners(new TypeAnnotationsScanner(), new SubTypesScanner())
.build()
.setScanners(new TypeAnnotationsScanner(), new SubTypesScanner()))
reflections.save(sourceSets.main.output.classesDir.toString() + "/reflections.cache")
}
}
Expand Down

0 comments on commit 225c131

Please sign in to comment.