Package org.gradle.api

Examples of org.gradle.api.Project


    }

    @Nullable
    private static Project getProject(File outputFile, Set<Project> gradleProjects) {
        // search for a project that contains this file in its output folder.
        Project projectMatch = null;
        for (Project project : gradleProjects) {
            File buildDir = project.getBuildDir();
            if (contains(buildDir, outputFile)) {
                projectMatch = project;
                break;
View Full Code Here


            jars = Lists.newArrayListWithExpectedSize(jarDeps.size() + localDeps.size());
            projects = Lists.newArrayList();

            for (JarDependency jarDep : jarDeps) {
                File jarFile = jarDep.getJarFile();
                Project projectMatch = getProject(jarFile, gradleProjects);
                if (projectMatch != null) {
                    projects.add(projectMatch.getPath());
                } else {
                    jars.add(jarFile);
                }
            }
            for (JarDependency jarDep : localDeps) {
View Full Code Here

    @NonNull
    private static AndroidLibrary getAndroidLibrary(@NonNull LibraryDependency libImpl,
                                                    @NonNull Set<Project> gradleProjects) {
        File bundle = libImpl.getBundle();
        Project projectMatch = getProject(bundle, gradleProjects);

        List<LibraryDependency> deps = libImpl.getDependencies();
        List<AndroidLibrary> clonedDeps = Lists.newArrayListWithCapacity(deps.size());
        for (LibraryDependency child : deps) {
            AndroidLibrary clonedLib = getAndroidLibrary(child, gradleProjects);
            clonedDeps.add(clonedLib);
        }

        return new AndroidLibraryImpl(libImpl, clonedDeps,
                projectMatch != null ? projectMatch.getPath() : null);
    }
View Full Code Here

    }

    @Nullable
    private static Project getProject(File outputFile, Set<Project> gradleProjects) {
        // search for a project that contains this file in its output folder.
        Project projectMatch = null;
        for (Project project : gradleProjects) {
            File buildDir = project.getBuildDir();
            if (contains(buildDir, outputFile)) {
                projectMatch = project;
                break;
View Full Code Here

        for (JarDependency jarDep : jarDeps) {
            boolean customArtifact = jarDep instanceof ClassifiedJarDependency &&
                    ((ClassifiedJarDependency)jarDep).getClassifier() != null;

            File jarFile = jarDep.getJarFile();
            Project projectMatch;
            if (!customArtifact && (projectMatch = getProject(jarFile, gradleProjects)) != null) {
                projects.add(projectMatch.getPath());
            } else {
                jars.add(jarFile);
            }
        }
View Full Code Here

    @NonNull
    private static AndroidLibrary getAndroidLibrary(@NonNull LibraryDependency libImpl,
                                                    @NonNull Set<Project> gradleProjects) {
        File bundle = libImpl.getBundle();
        Project projectMatch = getProject(bundle, gradleProjects);

        List<LibraryDependency> deps = libImpl.getDependencies();
        List<AndroidLibrary> clonedDeps = Lists.newArrayListWithCapacity(deps.size());
        for (LibraryDependency child : deps) {
            AndroidLibrary clonedLib = getAndroidLibrary(child, gradleProjects);
            clonedDeps.add(clonedLib);
        }

        return new AndroidLibraryImpl(libImpl, clonedDeps,
                projectMatch != null ? projectMatch.getPath() : null,
                libImpl.getProjectVariant());
    }
View Full Code Here

    }

    @Nullable
    private static Project getProject(File outputFile, Set<Project> gradleProjects) {
        // search for a project that contains this file in its output folder.
        Project projectMatch = null;
        for (Project project : gradleProjects) {
            File buildDir = project.getBuildDir();
            if (contains(buildDir, outputFile)) {
                projectMatch = project;
                break;
View Full Code Here

*/
public class FindMainClassTask extends DefaultTask {

  @TaskAction
  public void setMainClassNameProperty() {
    Project project = getProject();
    if (project.property("mainClassName") == null) {
      project.setProperty("mainClassName", findMainClass());
    }
  }
View Full Code Here

      project.setProperty("mainClassName", findMainClass());
    }
  }

  private String findMainClass() {
    Project project = getProject();

    String mainClass = null;

    // Try the SpringBoot extension setting
    SpringBootPluginExtension bootExtension = project.getExtensions().getByType(
        SpringBootPluginExtension.class);
    if (bootExtension.getMainClass() != null) {
      mainClass = bootExtension.getMainClass();
    }

    ApplicationPluginConvention application = (ApplicationPluginConvention) project
        .getConvention().getPlugins().get("application");
    // Try the Application extension setting
    if (mainClass == null && application.getMainClassName() != null) {
      mainClass = application.getMainClassName();
    }

    Task runTask = getProject().getTasks().getByName("run");
    if (mainClass == null && runTask.hasProperty("main")) {
      mainClass = (String) runTask.property("main");
    }

    if (mainClass == null) {
      // Search
      SourceSet mainSourceSet = SourceSets.findMainSourceSet(project);
      if (mainSourceSet != null) {
        project.getLogger().debug(
            "Looking for main in: "
                + mainSourceSet.getOutput().getClassesDir());
        try {
          mainClass = MainClassFinder.findSingleMainClass(mainSourceSet
              .getOutput().getClassesDir());
          project.getLogger().info("Computed main class: " + mainClass);
        }
        catch (IOException ex) {
          throw new IllegalStateException("Cannot find main class", ex);
        }
      }
    }

    project.getLogger().info("Found main: " + mainClass);

    if (bootExtension.getMainClass() == null) {
      bootExtension.setMainClass(mainClass);
    }
    if (application.getMainClassName() == null) {
View Full Code Here

    this.classifier = classifier;
  }

  @TaskAction
  public void repackage() {
    Project project = getProject();
    SpringBootPluginExtension extension = project.getExtensions().getByType(
        SpringBootPluginExtension.class);
    ProjectLibraries libraries = getLibraries();
    project.getTasks().withType(Jar.class, new RepackageAction(extension, libraries));
  }
View Full Code Here

TOP

Related Classes of org.gradle.api.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.