當前位置: 首頁>>代碼示例>>Java>>正文


Java Project.getProjectDir方法代碼示例

本文整理匯總了Java中org.gradle.api.Project.getProjectDir方法的典型用法代碼示例。如果您正苦於以下問題:Java Project.getProjectDir方法的具體用法?Java Project.getProjectDir怎麽用?Java Project.getProjectDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.gradle.api.Project的用法示例。


在下文中一共展示了Project.getProjectDir方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addPropertiesToProject

import org.gradle.api.Project; //導入方法依賴的package包/類
private void addPropertiesToProject(Project project, CachingPropertyApplicator applicator) {
    Properties projectProperties = new Properties();
    File projectPropertiesFile = new File(project.getProjectDir(), Project.GRADLE_PROPERTIES);
    LOGGER.debug("Looking for project properties from: {}", projectPropertiesFile);
    if (projectPropertiesFile.isFile()) {
        projectProperties = GUtil.loadProperties(projectPropertiesFile);
        LOGGER.debug("Adding project properties (if not overwritten by user properties): {}",
            projectProperties.keySet());
    } else {
        LOGGER.debug("project property file does not exists. We continue!");
    }

    // this should really be <String, Object>, however properties loader signature expects a <String, String>
    // even if in practice it was never enforced (one can pass other property types, such as boolean) an
    // fixing the method signature would be a binary breaking change in a public API.
    Map<String, String> mergedProperties = propertiesLoader.mergeProperties(new HashMap(projectProperties));
    for (Map.Entry<String, String> entry : mergedProperties.entrySet()) {
        applicator.configureProperty(project, entry.getKey(), entry.getValue());
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:21,代碼來源:ProjectPropertySettingBuildLoader.java

示例2: setupSession

import org.gradle.api.Project; //導入方法依賴的package包/類
public RepositorySystemSession setupSession(Project project, RepositorySystem system) {
    DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();

    File dir = new File(project.getProjectDir(), "aether/repository");
    LocalRepository localRepo = new LocalRepository(dir);
    session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));

    return session;
}
 
開發者ID:SetoKaiba,項目名稱:aether-gradle-plugin,代碼行數:10,代碼來源:VersionResolverDependencyResolveDetails.java

示例3: buildProjectOutput

import org.gradle.api.Project; //導入方法依賴的package包/類
private DefaultProjectOutcomes buildProjectOutput(Project project, ProjectOutcomes parent) {
    DefaultProjectOutcomes projectOutput = new DefaultProjectOutcomes(project.getName(), project.getPath(),
            project.getDescription(), project.getProjectDir(), getFileOutcomes(project), parent);
    for (Project child : project.getChildProjects().values()) {
        projectOutput.addChild(buildProjectOutput(child, projectOutput));
    }
    return projectOutput;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:9,代碼來源:ProjectOutcomesModelBuilder.java

示例4: createArtifact

import org.gradle.api.Project; //導入方法依賴的package包/類
private static LocalComponentArtifactMetadata createArtifact(String extension, ProjectComponentIdentifier projectId, String projectName, Project project) {
    File projectFile = new File(project.getProjectDir(), "." + extension);
    Task byName = project.getTasks().getByName("eclipseProject");
    String type = "eclipse." + extension;
    PublishArtifact publishArtifact = new DefaultPublishArtifact(projectName, extension, type, null, null, projectFile, byName);
    return new PublishArtifactLocalArtifactMetadata(projectId, publishArtifact);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:8,代碼來源:EclipsePlugin.java

示例5: createImlArtifact

import org.gradle.api.Project; //導入方法依賴的package包/類
private static LocalComponentArtifactMetadata createImlArtifact(ProjectComponentIdentifier projectId, Project project) {
    String moduleName = project.getExtensions().getByType(IdeaModel.class).getModule().getName();
    File imlFile = new File(project.getProjectDir(), moduleName + ".iml");
    Task byName = project.getTasks().getByName("ideaModule");
    PublishArtifact publishArtifact = new DefaultPublishArtifact(moduleName, "iml", "iml", null, null, imlFile, byName);
    return new PublishArtifactLocalArtifactMetadata(projectId, publishArtifact);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:8,代碼來源:IdeaPlugin.java

示例6: configureIdeaModule

import org.gradle.api.Project; //導入方法依賴的package包/類
private void configureIdeaModule(final Project project) {
    final GenerateIdeaModule task = project.getTasks().create("ideaModule", GenerateIdeaModule.class);
    task.setDescription("Generates IDEA module files (IML)");
    IdeaModuleIml iml = new IdeaModuleIml(task.getXmlTransformer(), project.getProjectDir());
    final IdeaModule module = instantiator.newInstance(IdeaModule.class, project, iml);
    task.setModule(module);

    ideaModel.setModule(module);
    ConventionMapping conventionMapping = ((IConventionAware) module).getConventionMapping();
    conventionMapping.map("sourceDirs", new Callable<Set<File>>() {
        @Override
        public Set<File> call() throws Exception {
            return Sets.newHashSet();
        }
    });
    conventionMapping.map("name", new Callable<String>() {
        @Override
        public String call() throws Exception {
            return project.getName();
        }
    });
    conventionMapping.map("contentRoot", new Callable<File>() {
        @Override
        public File call() throws Exception {
            return project.getProjectDir();
        }
    });
    conventionMapping.map("testSourceDirs", new Callable<Set<File>>() {
        @Override
        public Set<File> call() throws Exception {
            return Sets.newHashSet();
        }
    });
    conventionMapping.map("excludeDirs", new Callable<Set<File>>() {
        @Override
        public Set<File> call() throws Exception {
            return Sets.newHashSet(project.getBuildDir(), project.file(".gradle"));
        }
    });

    conventionMapping.map("pathFactory", new Callable<PathFactory>() {
        @Override
        public PathFactory call() throws Exception {
            final PathFactory factory = new PathFactory();
            factory.addPathVariable("MODULE_DIR", task.getOutputFile().getParentFile());
            for (Map.Entry<String, File> entry : module.getPathVariables().entrySet()) {
                factory.addPathVariable(entry.getKey(), entry.getValue());
            }
            return factory;
        }

    });

    addWorker(task);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:56,代碼來源:IdeaPlugin.java

示例7: getBuildCacheDir

import org.gradle.api.Project; //導入方法依賴的package包/類
private File getBuildCacheDir(Project rootProject) {
    if (buildCacheDir != null) {
        return buildCacheDir;
    }
    return new File(rootProject.getProjectDir(), ".gradle");
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:7,代碼來源:DefaultCacheScopeMapping.java

示例8: setupPackageTasks

import org.gradle.api.Project; //導入方法依賴的package包/類
void setupPackageTasks(Project project, Task generateTask) {
	final File buildDir = new File(project.getBuildDir(), "npm_compile");
	final File distDir = getNpmOutputDir(project);

	project.getTasks().create(PublishTypescriptStubsTask.NAME, PublishTypescriptStubsTask.class);
	TSGeneratorConfig config = project.getExtensions().getByType(TSGeneratorConfig.class);

	Copy copySources = project.getTasks().create("processTypescript", Copy.class);
	copySources.from(config.getGenDir());
	copySources.into(buildDir);
	copySources.dependsOn(generateTask);

	// copy .npmrc file from root to working directory if available
	final File npmrcFile = new File(project.getProjectDir(), ".npmrc");
	if (npmrcFile.exists()) {
		copySources.getInputs().file(npmrcFile);
		copySources.doFirst(new Action<Task>() {
			@Override
			public void execute(Task task) {
				File targetFile = new File(buildDir, ".npmrc");
				buildDir.mkdirs();
				TypescriptUtils.copyFile(npmrcFile, targetFile);
			}
		});
	}

	CompileTypescriptStubsTask compileTypescriptTask = project.getTasks().create(CompileTypescriptStubsTask.NAME,
			CompileTypescriptStubsTask.class);
	try {
		NpmInstallTask npmInstall = (NpmInstallTask) project.getTasks().getByName("npmInstall");
		npmInstall.setWorkingDir(buildDir);
		npmInstall.dependsOn(copySources);
		npmInstall.getInputs().file(new File(buildDir, "package.json"));
		npmInstall.getOutputs().dir(new File(buildDir, "node_modules"));
		compileTypescriptTask.dependsOn(npmInstall);
	}
	catch (UnknownTaskException e) {
		LOGGER.warn("task not found, ok in testing", e);
	}

	ConfigurableFileTree fileTree = project.fileTree(buildDir);
	fileTree.include("package.json");
	fileTree.include(".npmrc");
	fileTree.include("**/*.ts");
	fileTree.exclude("**/*.d.ts");
	compileTypescriptTask.getInputs().files(fileTree);
	compileTypescriptTask.setWorkingDir(buildDir);
	compileTypescriptTask.getOutputs().dir(buildDir);

	ConfigurableFileTree assembleFileTree = project.fileTree(new File(buildDir, "src"));
	assembleFileTree.include("**/*.ts");
	assembleFileTree.include("**/*.js");
	assembleFileTree.include("**/*.js.map");

	Copy assembleSources = project.getTasks().create("assembleTypescript", Copy.class);
	assembleSources.from(assembleFileTree);
	assembleSources.from(new File(buildDir, "package.json"));
	assembleSources.into(distDir);
	assembleSources.dependsOn(compileTypescriptTask);
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:61,代碼來源:TSGeneratorPlugin.java


注:本文中的org.gradle.api.Project.getProjectDir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。