| /* |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you 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. |
| */ |
| |
| defaultTasks 'addJava7TargetDir' |
| |
| ext.retrolambdaVersion = '2.1.0' |
| ext.retrolambdaJarName = "retrolambda-${retrolambdaVersion}.jar" |
| |
| dependencies { |
| // TODO try the retrolambda gradle plugin! |
| addProjectExtDependency 'compile', "net.orfjackal.retrolambda:retrolambda:$retrolambdaVersion" |
| } |
| |
| // Avoid creating/staging an empty jar (this is a 'java' subproject) |
| jar { |
| deleteAllActions() |
| } |
| |
| // let the existing ant script do some of the work |
| |
| ant.importBuild('build.xml') { antTargetName -> |
| 'ant_' + antTargetName |
| } |
| |
| ant.properties['edgent'] = rootProject.projectDir |
| ant.properties['edgent8.target'] = target_java8_dir |
| ant.properties['edgent7.target'] = target_java7_dir |
| ant.properties['ext.dir'] = target_java8_ext_dir |
| |
| clean { |
| dependsOn ant_clean |
| } |
| |
| task preAntTask << { |
| // recompute/set other inputs to the ant tasks |
| ant.path(id: 'edgent.classpath') { |
| fileset(dir: target_java8_ext_dir) { |
| exclude(name: '**/slf4j-jdk*.jar') |
| } |
| } |
| ant.properties.qcp = ant.references['edgent.classpath'] |
| |
| // make retrolambda available to the ant tooling |
| copyProjectExtJarsFn2 "$external_jars_dir/tools" |
| ant.properties['retrolambda.jar'] = "$external_jars_dir/tools/$retrolambdaJarName" |
| |
| // make android.jar available to the ant tooling |
| def hwProj = project(':android:hardware') |
| hwProj.copyProjectExtJarsFn "$external_jars_dir" |
| ant.properties['android.sdk.platform.jar'] = |
| "$external_jars_dir/${hwProj.targetRelProjExtDir}/" + mkJarNameFromSpec(hwProj.androidJarSpec) |
| } |
| |
| ant_retro7.doFirst { |
| println "Performing a longer running ant task (e.g., ~30sec; run with --info to see it all)..." |
| } |
| |
| task addJava7TargetDir { |
| description = "Assemble distribution artifacts for java7 (from java8 artifacts - run with JAVA_HOME==java8-VM)" |
| dependsOn ':assemble', clean, preAntTask, ant_retro7 |
| ant_retro7.mustRunAfter = [ clean, ':assemble', preAntTask ] |
| } |
| |
| // unlike the above, this has the benefit(?) of producing the ant output to stdout |
| // But it requires 'ant' to be in the path and doesn't (can't?) use |
| // the ant that's embedded with gradle hmm... |
| // |
| //task java7XXX(type: Exec) { |
| // description = "Assemble distribution artifacts for java7 (from java8 artifacts)" |
| // dependsOn ':assemble' |
| // workingDir 'platform/java7' |
| // commandLine 'ant', 'clean', 'retro7', |
| // '-Dedgent8.target=../../build/distributions/java8', |
| // '-Dedgent7.target=../../build/distributions/java7', |
| // '-Dext.dir=../../build/distributions/java8/ext', |
| // '-Dslf4j.ext.dir=""', |
| // '-Dgson.ext.dir=""', |
| // '-Dmetrics.ext.dir=""' |
| //} |
| |
| // N.B. for java7 testing, use the test7Compile and test7Run tasks |
| // |
| // <edgentRepo>/gradlew :platform:java7:test7Compile (or just test7Compile) -- run with JAVA_HOME==java8-VM to check the java7 jars |
| // <edgentRepo>/gradlew test7Run (or <project>:test7Run for individual project) -- run with JAVA_HOME==java7-VM (can run w/j8 to smoketest the process). |
| |
| task verifyJava7Built { |
| dependsOn 'ant_verify.java7.built' |
| } |
| |
| task preAntTest7Setup { |
| description = "Stage the java8 built test classes where ant_test7.setup expects them" |
| dependsOn filteredSubprojects*.compileTestJava, preAntTask |
| doLast { |
| println "N.B. test7Compile must be run after the 'release' task (which creates the 'java7' tree in the targetdir)" |
| // copy java8 test classes where ant_test7.setup expects them |
| filteredSubprojects.each { project -> |
| ant.delete(dir: "$project.projectDir/test.classes") |
| copy { |
| from project.sourceSets.test.output.classesDir |
| into "$project.projectDir/test.classes" |
| } |
| } |
| // recompute/set other inputs to the ant tasks |
| ant.path(id: 'tc.classes') { |
| dirset(dir: rootProject.projectDir) { |
| include(name: '**/test.classes') |
| } |
| } |
| ant.properties['tccp'] = ant.references['tc.classes'] |
| } |
| } |
| |
| task test7Compile { |
| description = "Compile the test classes for java7 (run with JAVA_HOME==java8-VM)" |
| dependsOn preAntTest7Setup, 'ant_test7.setup' |
| tasks.getByName('ant_test7.setup').mustRunAfter preAntTest7Setup |
| doLast { |
| // copy ant_test7.setup generated classes to their project.buildDir/classes/java7Test |
| filteredSubprojects.each { project -> |
| ant.delete(dir: project.j7TestClassesDir) |
| copy { |
| from "$project.projectDir/test.classes" |
| into project.j7TestClassesDir |
| } |
| ant.delete(dir: "$project.projectDir/test.classes") |
| } |
| } |
| } |