Java 类org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact 实例源码

项目:Reer    文件:JvmLocalLibraryMetaDataAdapter.java   
private static void addArtifact(UsageKind usage, Set<File> directories, EnumMap<UsageKind, List<PublishArtifact>> artifacts, JvmAssembly assembly) {
    List<PublishArtifact> publishArtifacts = artifacts.get(usage);
    for (File dir : directories) {
        DefaultPublishArtifact publishArtifact = new DefaultPublishArtifact("assembly", "", "", "", new Date(dir.lastModified()), dir);
        publishArtifact.builtBy(assembly);
        publishArtifacts.add(publishArtifact);
    }
}
项目:Reer    文件:PublishArtifactNotationParserFactory.java   
@Override
protected ConfigurablePublishArtifact parseType(File file) {
    Module module = metaDataProvider.getModule();
    ArtifactFile artifactFile = new ArtifactFile(file, module.getVersion());
    return instantiator.newInstance(DefaultPublishArtifact.class, artifactFile.getName(), artifactFile.getExtension(),
        artifactFile.getExtension(), artifactFile.getClassifier(), null, file, new Task[0]);
}
项目:Reer    文件:EclipsePlugin.java   
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);
}
项目:Reer    文件:IdeaPlugin.java   
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);
}
项目:Reer    文件:PlayApplicationPlugin.java   
@ComponentBinaries
void createBinaries(ModelMap<PlayApplicationBinarySpec> binaries, final PlayApplicationSpecInternal componentSpec,
                    final PlatformResolvers platforms, final PlayToolChainInternal playToolChainInternal, final PlayPluginConfigurations configurations,
                    @Path("buildDir") final File buildDir, final ProjectIdentifier projectIdentifier) {

    binaries.create("binary", new Action<PlayApplicationBinarySpec>() {
        public void execute(PlayApplicationBinarySpec playBinary) {
            PlayApplicationBinarySpecInternal playBinaryInternal = (PlayApplicationBinarySpecInternal) playBinary;
            final File binaryBuildDir = new File(buildDir, playBinaryInternal.getProjectScopedName());

            final PlayPlatform chosenPlatform = resolveTargetPlatform(componentSpec, platforms);
            initialiseConfigurations(configurations, chosenPlatform);

            playBinaryInternal.setTargetPlatform(chosenPlatform);
            playBinaryInternal.setToolChain(playToolChainInternal);

            File mainJar = new File(binaryBuildDir, "lib/" + projectIdentifier.getName() + ".jar");
            File assetsJar = new File(binaryBuildDir, "lib/" + projectIdentifier.getName() + "-assets.jar");
            playBinaryInternal.setJarFile(mainJar);
            playBinaryInternal.setAssetsJarFile(assetsJar);

            configurations.getPlay().addArtifact(new DefaultPublishArtifact(projectIdentifier.getName(), "jar", "jar", null, new Date(), mainJar, playBinaryInternal));
            configurations.getPlay().addArtifact(new DefaultPublishArtifact(projectIdentifier.getName(), "jar", "jar", "assets", new Date(), assetsJar, playBinaryInternal));

            JvmAssembly jvmAssembly = ((PlayApplicationBinarySpecInternal) playBinary).getAssembly();
            jvmAssembly.getClassDirectories().add(new File(binaryBuildDir, "classes"));
            jvmAssembly.getResourceDirectories().add(new File(binaryBuildDir, "resources"));

            PublicAssets assets = playBinary.getAssets();
            assets.addAssetDir(new File(projectIdentifier.getProjectDir(), "public"));

            playBinaryInternal.setClasspath(configurations.getPlay().getAllArtifacts());
        }
    });
}
项目:Pushjet-Android    文件:PublishArtifactNotationParserFactory.java   
@Override
protected PublishArtifact parseType(File file) {
    Module module = metaDataProvider.getModule();
    ArtifactFile artifactFile = new ArtifactFile(file, module.getVersion());
    return instantiator.newInstance(DefaultPublishArtifact.class, artifactFile.getName(), artifactFile.getExtension(),
                                    artifactFile.getExtension() == null? "":artifactFile.getExtension(),
                                    artifactFile.getClassifier(), null, file, new Task[0]);
}
项目:Pushjet-Android    文件:PublishArtifactNotationParserFactory.java   
@Override
protected PublishArtifact parseType(File file) {
    Module module = metaDataProvider.getModule();
    ArtifactFile artifactFile = new ArtifactFile(file, module.getVersion());
    return instantiator.newInstance(DefaultPublishArtifact.class, artifactFile.getName(), artifactFile.getExtension(),
                                    artifactFile.getExtension() == null? "":artifactFile.getExtension(),
                                    artifactFile.getClassifier(), null, file, new Task[0]);
}
项目:gradle-project-config    文件:Projects.java   
/**
 * Create a {@link PublishArtifact} for a jar created by a {@link Jar} task
 *
 * We use this instead of {@link ArchivePublishArtifact} because we can add the unresolved task dependency by name,
 * thus avoiding a direct dependency on the task.
 *
 * @param project Project to create artifact for
 * @param name Name of the new artifact
 * @param classifier Classifier for new artifact
 * @param type Type of new artifact
 * @param extension Extension of new artifact
 * @param producingTask Task that produces the artifact
 * @return Publish artifact for the jar
 */
public static PublishArtifact createJarPublishArtifact(Project project, String name, @Nullable String classifier,
        String type, String extension, Jar producingTask) {
    BasePluginConvention baseConvention = project.getConvention().getPlugin(BasePluginConvention.class);
    String jarName = FILE_PART_JOINER.join(name, project.getVersion(), classifier) + "." + extension;
    File jarFile = baseConvention.getLibsDir().toPath().resolve(jarName).toFile();
    DefaultPublishArtifact artifact = new DefaultPublishArtifact(name, extension, type, classifier, null, jarFile,
            producingTask);
    return artifact;
}