Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions build-support/prepare-sources.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,15 @@ if (command == 'generate-serializer') {
def compilerOut = new File(generated, 'org/apache/xalan/xsltc/compiler')
compilerOut.mkdirs()
def codegen = new File(moduleTarget, 'codegen')
def cupJar = codegen.listFiles().find { it.name.startsWith('java-cup-') && !it.name.startsWith('java-cup-runtime-') }
def cupRuntimeJar = codegen.listFiles().find { it.name.startsWith('java-cup-runtime-') }
def jlexJar = codegen.listFiles().find { it.name.contains('jlex') || it.name.contains('JLex') }
if (!cupJar || !cupRuntimeJar || !jlexJar) {
throw new IllegalStateException("Maven codegen jars are missing from ${codegen}")
def cupJar = codegen.listFiles().find { it.name.startsWith('java-cup-') && it.name.endsWith('.jar') }
def jlexJar = new File(repo, 'tools/JLex.jar')
if (!cupJar?.isFile() || !jlexJar.isFile()) {
throw new IllegalStateException("CUP or tools/JLex.jar is missing")
}
run([
javaBin.absolutePath,
'-cp',
cupJar.absolutePath + File.pathSeparator + cupRuntimeJar.absolutePath,
cupJar.absolutePath,
'java_cup.Main',
'-parser', 'XPathParser',
'-expect', '0',
Expand All @@ -138,17 +137,19 @@ if (command == 'generate-serializer') {
new File(repo, 'src/org/apache/xalan/xsltc/compiler/xpath.lex').toPath(),
lexCopy.toPath(),
StandardCopyOption.REPLACE_EXISTING)
def lexer = new File(compilerOut, 'XPathLexer.java')
run([
javaBin.absolutePath,
'-cp', jlexJar.absolutePath,
'jlex.Main',
lexCopy.absolutePath,
lexer.absolutePath
'JLex.Main',
'-static',
lexCopy.absolutePath
], compilerOut)
if (!lexer.isFile()) {
throw new IllegalStateException("JLex did not write XPathLexer.java")
def generatedLexer = new File(compilerOut, 'xpath.lex.java')
def lexer = new File(compilerOut, 'XPathLexer.java')
if (!generatedLexer.isFile()) {
throw new IllegalStateException("JLex did not write xpath.lex.java")
}
Files.move(generatedLexer.toPath(), lexer.toPath(), StandardCopyOption.REPLACE_EXISTING)
lexCopy.delete()
} else {
throw new IllegalArgumentException("Unknown command ${command}")
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<xml-apis.version>1.4.01</xml-apis.version>
<bcel.version>6.7.0</bcel.version>
<regexp.version>1.3</regexp.version>
<java-cup.version>11b-20160615-3</java-cup.version>
<java-cup.version>10k</java-cup.version>
</properties>

<dependencyManagement>
Expand All @@ -68,8 +68,8 @@
<version>${regexp.version}</version>
</dependency>
<dependency>
<groupId>com.github.vbmacher</groupId>
<artifactId>java-cup-runtime</artifactId>
<groupId>edu.princeton.cup</groupId>
<artifactId>java-cup</artifactId>
<version>${java-cup.version}</version>
</dependency>
</dependencies>
Expand Down
16 changes: 3 additions & 13 deletions xalan/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
<artifactId>regexp</artifactId>
</dependency>
<dependency>
<groupId>com.github.vbmacher</groupId>
<artifactId>java-cup-runtime</artifactId>
<groupId>edu.princeton.cup</groupId>
<artifactId>java-cup</artifactId>
</dependency>
</dependencies>

Expand Down Expand Up @@ -90,20 +90,10 @@
<outputDirectory>${project.build.directory}/codegen</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>com.github.vbmacher</groupId>
<groupId>edu.princeton.cup</groupId>
<artifactId>java-cup</artifactId>
<version>${java-cup.version}</version>
</artifactItem>
<artifactItem>
<groupId>com.github.vbmacher</groupId>
<artifactId>java-cup-runtime</artifactId>
<version>${java-cup.version}</version>
</artifactItem>
<artifactItem>
<groupId>net.sourceforge.maven-jlex</groupId>
<artifactId>maven-jlex-plugin</artifactId>
<version>1.0</version>
</artifactItem>
</artifactItems>
</configuration>
</execution>
Expand Down