-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 42 audit get automated code coverage working (#234)
- Loading branch information
Showing
11 changed files
with
379 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
gradle.projectsLoaded { | ||
rootProject { | ||
afterEvaluate { project -> | ||
if (!project.repositories.any{it.name == 'MavenRepo'}) { | ||
project.repositories { | ||
// To be able to load org.codehaus.groovy:groovy-groovysh | ||
mavenCentral() | ||
} | ||
} | ||
|
||
project.configurations { | ||
groovyshdependencies | ||
} | ||
|
||
project.dependencies { | ||
groovyshdependencies("org.codehaus.groovy:groovy-groovysh:${GroovySystem.version}") { | ||
exclude group: 'org.codehaus.groovy' | ||
} | ||
} | ||
|
||
project.tasks.register('groovysh') { | ||
group 'debug' | ||
description 'Runs an interactive shell in the context of the project.' | ||
doLast { | ||
URLClassLoader groovyObjectClassLoader = GroovyObject.class.classLoader | ||
def groovyshClass | ||
def groovyShell | ||
|
||
// Add dependency jars to classloader | ||
configurations.groovyshdependencies.each {File file -> | ||
groovyObjectClassLoader.addURL(file.toURL()) | ||
} | ||
Class.forName('jline.console.history.FileHistory', true, groovyObjectClassLoader) | ||
groovyshClass = Class.forName('org.codehaus.groovy.tools.shell.Groovysh', true, groovyObjectClassLoader) | ||
|
||
if (groovyshClass) { | ||
groovyShell = groovyshClass.newInstance() | ||
} | ||
if (groovyShell) { | ||
groovyShell.interp.context.variables.put("gradle", gradle) | ||
groovyShell.interp.context.variables.put("settings", gradle.settings) | ||
groovyShell.interp.context.variables.put("project", project) | ||
groovyShell.run('') | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
gradle.projectsLoaded { | ||
rootProject { | ||
afterEvaluate { project -> | ||
if (!project.repositories.any{it.name == 'MavenRepo'}) { | ||
project.repositories { | ||
// To be able to load org.apache.groovy:groovy-groovysh and dependencies | ||
mavenCentral { | ||
content { | ||
includeGroup 'org.apache.groovy' | ||
includeGroup 'jline' | ||
includeGroup 'com.github.javaparser' | ||
includeGroup 'org.ow2.asm' | ||
includeGroup 'org.abego.treelayout' | ||
includeGroup 'org.apache.ivy' | ||
} | ||
} | ||
} | ||
} | ||
project.configurations { | ||
groovyshdependencies | ||
} | ||
|
||
project.dependencies { | ||
groovyshdependencies "org.apache.groovy:groovy-groovysh:4.0.13" | ||
} | ||
|
||
project.tasks.register('groovysh') { | ||
group 'debug' | ||
description 'Runs an interactive shell in the context of the project. Use :inspect command to inspect project, gradle, settings or other objects.' | ||
doLast { | ||
URLClassLoader groovyshClassLoader = new URLClassLoader(); | ||
configurations.groovyshdependencies.each {File file -> | ||
groovyshClassLoader.addURL(file.toURI().toURL()) | ||
} | ||
|
||
def fileHistoryClass | ||
def groovyshClass | ||
def groovyShell | ||
fileHistoryClass = Class.forName('jline.console.history.FileHistory', true, groovyshClassLoader) | ||
groovyshClass = Class.forName('org.apache.groovy.groovysh.Groovysh', true, groovyshClassLoader) | ||
if (groovyshClass) { | ||
groovyShell = groovyshClass.newInstance() | ||
if (groovyShell) { | ||
groovyShell.interp.context.variables.put("gradle", gradle) | ||
groovyShell.interp.context.variables.put("settings", gradle.settings) | ||
groovyShell.interp.context.variables.put("project", project) | ||
groovyShell.run('# Available objects: gradle, settings, project\n# Try :inspect project') | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.