Search in sources :

Example 11 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules in project peass by DaGeRe.

the class TraceViewGenerator method generateViews.

public boolean generateViews(final ResultsFolders resultsFolders, final TestSet examinedTests) throws IOException, XmlPullParserException, ParseException, ViewNotFoundException, InterruptedException {
    LOG.debug("Generating views for {}", version);
    boolean allWorked = true;
    GitUtils.reset(folders.getProjectFolder());
    ProjectModules modules = dependencyManager.getExecutor().getModules();
    ExecutionConfig executionConfig = dependencyManager.getTestTransformer().getConfig().getExecutionConfig();
    ModuleClassMapping mapping = new ModuleClassMapping(folders.getProjectFolder(), modules, executionConfig);
    List<File> classpathFolders = getClasspathFolders(modules);
    for (TestCase testcase : examinedTests.getTests()) {
        final OneTraceGenerator oneViewGenerator = new OneTraceGenerator(resultsFolders, folders, testcase, traceFileMapping, version, classpathFolders, mapping, kiekerConfig);
        final boolean workedLocal = oneViewGenerator.generateTrace(version);
        allWorked &= workedLocal;
    }
    return allWorked;
}
Also used : ProjectModules(de.dagere.peass.execution.utils.ProjectModules) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) OneTraceGenerator(de.dagere.peass.dependency.traces.OneTraceGenerator) File(java.io.File)

Example 12 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules in project peass by DaGeRe.

the class GradleTestExecutor method isVersionRunning.

@Override
public boolean isVersionRunning(final String version) {
    boolean isRunning = false;
    if (doesBuildfileExist()) {
        boolean isAndroid = false;
        for (final File module : getModules().getModules()) {
            final File buildfile = GradleParseHelper.findGradleFile(module);
            final FindDependencyVisitor visitor = GradleParseUtil.setAndroidTools(buildfile);
            if (visitor.isAndroid()) {
                isAndroid = true;
                if (!visitor.hasVersion()) {
                    return false;
                }
            }
        }
        this.isAndroid = isAndroid;
        ProjectModules modules = getModules();
        replaceAllBuildfiles(modules);
        final String[] vars = new String[] { env.fetchGradleCall(), "--no-daemon", "assemble" };
        ProcessSuccessTester processSuccessTester = new ProcessSuccessTester(folders, testTransformer.getConfig(), env);
        isRunning = processSuccessTester.testRunningSuccess(version, vars);
    }
    return isRunning;
}
Also used : ProjectModules(de.dagere.peass.execution.utils.ProjectModules) ProcessSuccessTester(de.dagere.peass.execution.processutils.ProcessSuccessTester) File(java.io.File)

Example 13 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules in project peass by DaGeRe.

the class SettingsFileParser method getModules.

public static ProjectModules getModules(final File projectFolder) {
    final File settingsFile = new File(projectFolder, "settings.gradle");
    final List<File> modules = new LinkedList<>();
    if (settingsFile.exists()) {
        SettingsFileParser parser = new SettingsFileParser();
        parser.readPrefixAndSuffix(settingsFile);
        parser.readModules(projectFolder, settingsFile, modules);
    } else {
        LOG.debug("settings-file {} not found", settingsFile);
    }
    modules.add(projectFolder);
    return new ProjectModules(modules);
}
Also used : ProjectModules(de.dagere.peass.execution.utils.ProjectModules) File(java.io.File) LinkedList(java.util.LinkedList)

Example 14 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules in project peass by DaGeRe.

the class MavenPomUtil method getModules.

public static ProjectModules getModules(final File pom, final ExecutionConfig config) {
    try {
        ProjectModules modules = new ModuleReader().readModuleFiles(pom);
        if (config.getPl() != null && !"".equals(config.getPl())) {
            List<String> includedModuleNames = getIncludedModuleNames(pom, config);
            for (Iterator<File> moduleIterator = modules.getModules().iterator(); moduleIterator.hasNext(); ) {
                File listFile = moduleIterator.next();
                String fileModuleName = listFile.getName();
                System.out.println("Name: " + fileModuleName + " " + includedModuleNames);
                String fileArtifactId = modules.getArtifactIds().get(listFile);
                System.out.println("Artifactid: " + fileArtifactId);
                if (!includedModuleNames.contains(fileModuleName) && !includedModuleNames.contains(fileArtifactId)) {
                    moduleIterator.remove();
                }
            }
        }
        return modules;
    } catch (IOException | XmlPullParserException e) {
        throw new RuntimeException(e);
    }
}
Also used : ProjectModules(de.dagere.peass.execution.utils.ProjectModules) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) IOException(java.io.IOException) File(java.io.File)

Example 15 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules in project peass by DaGeRe.

the class TestBuildGradle method updateGradleFile.

private String updateGradleFile(final File gradleFile) throws IOException {
    final File destFile = copyGradlefile(gradleFile);
    GradleBuildfileEditor editor = new GradleBuildfileEditor(mockedTransformer, destFile, new ProjectModules(CURRENT));
    editor.addDependencies(new File("xyz"));
    final String gradleFileContents = FileUtils.readFileToString(destFile, Charset.defaultCharset());
    return gradleFileContents;
}
Also used : ProjectModules(de.dagere.peass.execution.utils.ProjectModules) GradleBuildfileEditor(de.dagere.peass.execution.gradle.GradleBuildfileEditor) File(java.io.File)

Aggregations

ProjectModules (de.dagere.peass.execution.utils.ProjectModules)21 File (java.io.File)19 Test (org.junit.jupiter.api.Test)14 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)12 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)5 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)4 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)3 JmhTestTransformer (de.dagere.peass.dependency.jmh.JmhTestTransformer)3 GradleBuildfileEditor (de.dagere.peass.execution.gradle.GradleBuildfileEditor)2 IOException (java.io.IOException)2 LinkedList (java.util.LinkedList)2 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)1 StatisticsConfig (de.dagere.peass.config.StatisticsConfig)1 OneTraceGenerator (de.dagere.peass.dependency.traces.OneTraceGenerator)1 ProcessSuccessTester (de.dagere.peass.execution.processutils.ProcessSuccessTester)1 GitCommit (de.dagere.peass.vcs.GitCommit)1 XmlPullParserException (org.codehaus.plexus.util.xml.pull.XmlPullParserException)1 Test (org.junit.Test)1