Skip to content

Commit

Permalink
re-enable forbidden apis
Browse files Browse the repository at this point in the history
  • Loading branch information
rjernst committed Sep 18, 2015
1 parent c55e556 commit a8f8f15
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
17 changes: 16 additions & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import org.apache.tools.ant.filters.ReplaceTokens

apply plugin: 'groovy'
// TODO: move common IDE configuration to a common file to include
apply plugin: 'idea'
apply plugin: 'eclipse'
idea {
project {
languageLevel = '1.8'
vcs = 'Git'
}
}

if (System.getenv().get('JAVA_HOME') == null) {
throw new InvalidUserDataException('JAVA_HOME must be set')
Expand All @@ -19,14 +28,20 @@ repositories {
}
}

configurations.all {
// check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

dependencies {
compile gradleApi()
compile localGroovy()
compile "com.carrotsearch.randomizedtesting:junit4-ant:2.2.0-snapshot-${randomizedRunnerSnapshotRevision}"
compile(group: 'junit', name: 'junit', version: '4.11') {
transitive = false
}
compile 'de.thetaphi:forbiddenapis:2.0-SNAPSHOT'
//compile 'de.thetaphi:forbiddenapis:2.0-SNAPSHOT'
compile group: 'de.thetaphi', name: 'forbiddenapis', version: '2.0-SNAPSHOT', changing: true
}

Properties props = new Properties()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ class BuildPlugin implements Plugin<Project> {

@Override
void apply(Project project) {
//getClass().getResource('/forbidden/core-signatures.txt').openConnection().setDefaultUseCaches(false)

This comment has been minimized.

Copy link
@uschindler

uschindler Sep 19, 2015

Contributor

Hi did you find a solution to the problem - because the hack is disabled here?
I opened policeman-tools/forbidden-apis#75 about that.

project.pluginManager.apply('java')
project.pluginManager.apply('carrotsearch.randomizedtesting')
//project.pluginManager.apply('de.thetaphi.forbiddenapis')
project.pluginManager.apply('de.thetaphi.forbiddenapis')
// TODO: license checker

Closure testConfig = createSharedTestConfig(project)
RandomizedTestingTask test = configureTest(project.tasks, testConfig)
RandomizedTestingTask integTest = configureIntegTest(project.tasks, getIntegTestClass(), test, testConfig)

List<Task> precommitTasks = new ArrayList<>()
//precommitTasks.add(configureForbiddenApis(project))
precommitTasks.add(configureForbiddenApis(project))
precommitTasks.add(configureForbiddenPatterns(project.tasks))

Map precommitOptions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ForbiddenPatternsTask extends DefaultTask {
Pattern allPatterns = Pattern.compile('(' + patterns.values().join(')|(') + ')')
List<String> failures = new ArrayList<>()
for (File f : files()) {
f.eachLine { line, lineNumber ->
f.eachLine('UTF-8') { line, lineNumber ->
if (allPatterns.matcher(line).find()) {
addErrorMessages(failures, f, (String)line, (int)lineNumber)
}
Expand Down

0 comments on commit a8f8f15

Please sign in to comment.