/* * 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. */ // // $Id$ // package buildharness.commands.tck import buildharness.commands.CommandSupport import java.util.UUID class report extends CommandSupport { /** The ID of the workflow being executed for uniqness in the buildlife. */ int workflowId /** The file where sections are loaded from. */ def sections /** The directory where test inputs for the report live. */ def inputDir /** The directory where the report will be written. */ def reportDir def execute() { workflowId = context.getRequiredAsInt('workflow_id') println "Using workflow ID: ${workflowId}" sections = context.getRequiredAsFile('sections') println "Using sections file: ${sections}" assert sections.exists() : "Missing sections file: ${sections}" inputDir = context.resolveFile("reports/tck/${workflowId}") println "Using input dir: ${inputDir}" assert inputDir.exists() : "Missing report input dir: ${inputDir}" reportDir = context.resolveFile('reports/tck/html') println "Generating reports in dir: ${reportDir}" ant.mkdir(dir: reportDir) // Setup the repository def repoDir = context.resolveFile('repository') println "Using repository: ${repoDir}" // Copy all summary properties to a tempdir for soaking up def summariesDir = context.resolveFile('temp/summaries') ant.mkdir(dir: summariesDir) def scanner = ant.fileScanner { fileset(dir: inputDir) { include(name: '*/summary.properties') } } for (file in scanner) { def uuid = UUID.randomUUID() ant.copy(file: file, tofile: "${summariesDir}/${uuid}.properties") } // Generate a report from captured TCK output def runDir = sections.getParentFile() // must run from the dir where sections props lives ant.exec(executable: 'mvn', dir: runDir, failonerror: true) { // Assume that our repo is filled with the right bits arg(value: '--offline') arg(value: '--batch-mode') arg(value: '--errors') arg(value: "-Dmaven.repo.local=${repoDir}") arg(value: 'j2eetck:generate-report') arg(value: "-DsectionsFile=${sections}") arg(value: "-DsummariesDirectory=${summariesDir}") arg(value: "-DreportsDirectory=ignored") arg(value: "-DoutputDirectory=${reportDir}") } } }