1 /* 2 * Copyright 2014 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.gradle.api.plugins.antlr 18 19 import org.gradle.integtests.fixtures.AbstractIntegrationSpec 20 21 abstract class AbstractAntlrIntegrationTest extends AbstractIntegrationSpec { 22 23 def setup() { 24 // So we can assert on which version of ANTLR is used at runtime 25 executer.withArgument("-i") 26 buildFile << """ 27 allprojects { 28 apply plugin: 'java' 29 ${mavenCentralRepository()} 30 tasks.withType(JavaCompile) { 31 options.compilerArgs << "-proc:none" 32 } 33 } 34 project(":grammar-builder") { 35 apply plugin: "antlr" 36 37 dependencies { 38 antlr '$antlrDependency' 39 } 40 } 41 project(":grammar-user") { 42 43 dependencies { 44 implementation project(":grammar-builder") 45 } 46 } 47 """ 48 settingsFile << """ 49 include 'grammar-builder' 50 include 'grammar-user' 51 """ 52 } 53 54 abstract String getAntlrDependency() 55 56 void assertAntlrVersion(int version) { 57 assert output.contains("Processing with ANTLR $version") 58 } 59 }