Java Code Examples for org.gradle.api.Project#getParent()
The following examples show how to use
org.gradle.api.Project#getParent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FirebaseLibraryExtension.java From firebase-android-sdk with Apache License 2.0 | 6 votes |
@Inject public FirebaseLibraryExtension(Project project, LibraryType type) { this.project = project; this.type = type; this.testLab = new FirebaseTestLabExtension(project.getObjects()); this.artifactId = project.getObjects().property(String.class); this.groupId = project.getObjects().property(String.class); if ("ktx".equals(project.getName()) && project.getParent() != null) { artifactId.set(new DefaultProvider<>(() -> project.getParent().getName() + "-ktx")); groupId.set(new DefaultProvider<>(() -> project.getParent().getGroup().toString())); } else { artifactId.set(new DefaultProvider<>(project::getName)); groupId.set(new DefaultProvider<>(() -> project.getGroup().toString())); } this.staticAnalysis = initializeStaticAnalysis(project); }
Example 2
Source File: ReleasePlugin.java From curiostack with MIT License | 6 votes |
@Override public void apply(Project project) { if (project.getParent() != null) { throw new IllegalStateException( "gradle-release-plugin can only be applied to the root project."); } if (!project.hasProperty("version") || "unspecified".equals(project.findProperty("version"))) { String version = determineVersion(project); project.setProperty("version", version); project.subprojects( proj -> { if (!proj.hasProperty("version") || "unspecified".equals(proj.findProperty("version"))) { proj.setProperty("version", version); } }); project.getLogger().quiet("Automatically determined version: " + version); } }
Example 3
Source File: ShipkitConfigurationPlugin.java From shipkit with MIT License | 6 votes |
public void apply(final Project project) { if (project.getParent() == null) { //root project, add the extension project.getPlugins().apply(InitPlugin.class); project.getPlugins().apply(VersioningPlugin.class); VersionInfo info = project.getExtensions().getByType(VersionInfo.class); conf = project.getRootProject().getExtensions() .create("shipkit", ShipkitConfiguration.class); loadConfigFromFile(project.getRootProject(), getShipkitFile(project), conf); if (project.hasProperty(DRY_RUN_PROPERTY)) { conf.setDryRun(true); //TODO (maybe) we can actually implement it so that we automatically preconfigure everything by command line parameters //e.g. shipkit.gitHub.repository is also a property } conf.setPreviousReleaseVersion(info.getPreviousVersion()); } else { //not root project, get extension from root project conf = project.getRootProject().getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration(); } }
Example 4
Source File: DetectCiPlugin.java From reactor-core with Apache License 2.0 | 6 votes |
@Override public void apply(Project project) { //ignore subprojects if (project.getParent() != null) { return; } Set<String> detected = new HashSet<>(CI_SERVERS); detected.retainAll(environmentSupplier.get()); boolean isCiServer = !detected.isEmpty(); if (isCiServer) { System.out.println("Detected CI environment: " + detected); } project.getExtensions().add(FLAG_EXTENSION, isCiServer); project.getExtensions().add(DETECTED_EXTENSION, detected); }
Example 5
Source File: GradleBuildBuilder.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private BasicGradleProject convert(Project project, Map<Project, BasicGradleProject> convertedProjects) { BasicGradleProject converted = new BasicGradleProject().setName(project.getName()).setPath(project.getPath()); converted.setProjectDirectory(project.getProjectDir()); if (project.getParent() != null) { converted.setParent(convertedProjects.get(project.getParent())); } convertedProjects.put(project, converted); for (Project child : project.getChildProjects().values()) { converted.addChild(convert(child, convertedProjects)); } return converted; }
Example 6
Source File: GradleBuildBuilder.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private BasicGradleProject convert(Project project, Map<Project, BasicGradleProject> convertedProjects) { BasicGradleProject converted = new BasicGradleProject().setName(project.getName()).setPath(project.getPath()); converted.setProjectDirectory(project.getProjectDir()); if (project.getParent() != null) { converted.setParent(convertedProjects.get(project.getParent())); } convertedProjects.put(project, converted); for (Project child : project.getChildProjects().values()) { converted.addChild(convert(child, convertedProjects)); } return converted; }
Example 7
Source File: ProjectUtil.java From shipkit with MIT License | 5 votes |
public static void requireRootProject(final Project project, final Class<?> clazz, final String explanation) { if (project.getParent() != null) { throw new GradleException("Plugin '" + clazz.getSimpleName() + "' is intended to be applied only root project.\n" + (explanation != null ? explanation + "\n" : "" ) + "Please apply this plugin to the root project instead of '" + project.getPath() + "'."); } }
Example 8
Source File: GradleBuildBuilder.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private BasicGradleProject convert(Project project, Map<Project, BasicGradleProject> convertedProjects) { BasicGradleProject converted = new BasicGradleProject().setName(project.getName()).setPath(project.getPath()); converted.setProjectDirectory(project.getProjectDir()); if (project.getParent() != null) { converted.setParent(convertedProjects.get(project.getParent())); } convertedProjects.put(project, converted); for (Project child : project.getChildProjects().values()) { converted.addChild(convert(child, convertedProjects)); } return converted; }
Example 9
Source File: GradleBuildBuilder.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private BasicGradleProject convert(Project project, Map<Project, BasicGradleProject> convertedProjects) { BasicGradleProject converted = new BasicGradleProject().setName(project.getName()).setPath(project.getPath()); converted.setProjectDirectory(project.getProjectDir()); if (project.getParent() != null) { converted.setParent(convertedProjects.get(project.getParent())); } convertedProjects.put(project, converted); for (Project child : project.getChildProjects().values()) { converted.addChild(convert(child, convertedProjects)); } return converted; }