/* ### * IP: GHIDRA * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" apply from: "$rootProject.projectDir/gradle/javadoc.gradle" apply plugin: 'eclipse' eclipse.project.name = 'Framework SoftwareModeling' apply plugin: 'antlr' rootProject.createJavadocs.exclude '**/pcodeCPort/**' rootProject.createJsondocs.exclude '**/pcodeCPort/**' // make sure antlr code gets built during prepdev so that the directories are created and // eclipse doesn't complain about missing src directories. rootProject.prepDev.dependsOn compileJava dependencies { api project(':Project') api project(':Graph') api "msv:msv:20050913" api "msv:xsdlib:20050913" api "org.antlr:antlr-runtime:3.5.2" runtimeOnly "msv:relaxngDatatype:20050913" api "msv:isorelax:20050913" // Must specify the specific antlr implementation to use or it will default to trying to find // version 2.7.7 (which we don't have) antlr "org.antlr:antlr:3.5.2" // need to add in the antlr dependencies for when we build from flat jar dirs antlr "org.antlr:antlr-runtime:3.5.2" antlr "org.antlr:ST4:4.0.8" } def genSrcDir = 'generated-src/antlr/main' generateGrammarSource { // This one stands alone, it looks like include "ghidra/sleigh/grammar/BooleanExpression.g" include "ghidra/sleigh/grammar/SleighLexer.g" // Dummy, and must compile first include "ghidra/sleigh/grammar/BaseLexer.g" include "ghidra/sleigh/grammar/DisplayLexer.g" include "ghidra/sleigh/grammar/SemanticLexer.g" // This is the root parser, it will import its children without building them individually. include "ghidra/sleigh/grammar/SleighParser.g" // This is a debug tree parser include "ghidra/sleigh/grammar/SleighEcho.g" // This is the real compiler tree parser include "ghidra/sleigh/grammar/SleighCompiler.g" // README: See src/main/antlr/ghidra/sleigh/grammar/README.txt for an explanation of this. doFirst { // Ensure that SleighLexar.tokens is rebuilt by removing it if any of the // contributing grammar files have changed. Antlr plugin does not know // about the SleighLexar.tokens dependency on changes to BaseLexer.g, // DisplayLexer.g or SemanticLexer.g delete file("$buildDir/${genSrcDir}/ghidra/sleigh/grammar/SleighLexer.tokens") } doLast { // SleighLexar.g is only needed to produce SleighLexar.tokens. // Remove its generated java artifacts which may conflict delete fileTree("$buildDir/${genSrcDir}/ghidra/sleigh/grammar") { include "SleighLexer*.java" } // antlr src directories cause generated java files to output // into the correct package directories, however we need to add // the appropriate java package statement which is missing. fileTree("$buildDir/${genSrcDir}/ghidra/sleigh/grammar") { include "*.java" }.each { File src -> def lines = src.readLines() if (lines.get(0) != 'package ghidra.sleigh.grammar;') { src.withWriter { wr -> wr.println('package ghidra.sleigh.grammar;'); lines.each { line -> wr.println line } } } } } } // must generate grammar before zipping if we want to include it in the source zip zipSourceSubproject.dependsOn generateGrammarSource