Java 类org.gradle.api.tasks.bundling.Zip 实例源码

项目:Reer    文件:PublishArtifactToFileBuildOutcomeTransformer.java   
private String getTypeIdentifier(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
        AbstractArchiveTask task = publishArtifact.getArchiveTask();

        // There is an inheritance hierarchy in play here, so the order
        // of the clauses is very important.

        if (task instanceof War) {
            return WAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Ear) {
            return EAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Jar) {
            return JAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Zip) {
            return ZIP_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Tar) {
            return TAR_ARTIFACT.getTypeIdentifier();
        } else {
            // we don't know about this kind of archive task
            return ARCHIVE_ARTIFACT.getTypeIdentifier();
        }
    } else {
        // This could very well be a zip (or something else we understand), but we can't know for sure.
        // The client may try to infer from the file extension.
        return UNKNOWN_ARTIFACT.getTypeIdentifier();
    }
}
项目:Reer    文件:DistributionPlugin.java   
@Override
public void apply(final ProjectInternal project) {
    project.getPluginManager().apply(BasePlugin.class);
    DefaultDistributionContainer distributions = project.getExtensions().create("distributions", DefaultDistributionContainer.class, Distribution.class, instantiator, fileOperations);

    // TODO - refactor this action out so it can be unit tested
    distributions.all(new Action<Distribution>() {
        @Override
        public void execute(final Distribution dist) {
            ((IConventionAware) dist).getConventionMapping().map("baseName", new Callable<Object>() {
                @Override
                public Object call() throws Exception {
                    return dist.getName().equals(MAIN_DISTRIBUTION_NAME) ? project.getName() : String.format("%s-%s", project.getName(), dist.getName());
                }
            });

            dist.getContents().from("src/" + dist.getName() + "/dist");
            String zipTaskName = MAIN_DISTRIBUTION_NAME.equals(dist.getName()) ? TASK_DIST_ZIP_NAME : dist.getName() + "DistZip";
            Task zipTask = configureArchiveTask(project, zipTaskName, dist, Zip.class);
            String tarTaskName = MAIN_DISTRIBUTION_NAME.equals(dist.getName()) ? TASK_DIST_TAR_NAME : dist.getName() + "DistTar";
            Task tarTask = configureArchiveTask(project, tarTaskName, dist, Tar.class);
            addAssembleTask(project, dist, zipTask, tarTask);
            addInstallTask(project, dist);
        }
    });
    distributions.create(MAIN_DISTRIBUTION_NAME);
}
项目:atlas    文件:AndroidComponetCreator.java   
public void createAndroidComponent(Zip bundleTask) {
    //Add a components. Android
    if (atlasExtension.getBundleConfig().isAwbBundle()) {
        Configuration compileConfiguration = project.getConfigurations()
            .getByName(COMPILE_CONFIGURATION_NAME);
        ArchivePublishArtifact bundleArtifact = new ArchivePublishArtifact(bundleTask);
        compileConfiguration.getArtifacts().add(bundleArtifact);
    }
}
项目:atlas    文件:JarExtractTask.java   
/**
 * Create a basic AWB task
 */
public void generateJarArtifict(final Zip bundleTask) {

    bundleTask.doLast(new Action<Task>() {

        @Override
        public void execute(Task task) {

            File outputFile = new File(bundleTask.getDestinationDir(),
                                       bundleTask.getArchiveName());

            if (!outputFile.exists()) {
                return;
            }

            File f = ZipUtils.extractZipFileToFolder(outputFile,
                                                     "classes.jar",
                                                     outputFile.getParentFile());

            if (null != f && f.exists()) {
                File jar = new File(new File(bundleTask.getDestinationDir().getParentFile(), "jar"),
                                    FilenameUtils.getBaseName(bundleTask.getArchiveName()) +
                                        ".jar");
                jar.getParentFile().mkdirs();
                f.renameTo(jar);

            }

        }
    });
}
项目:atlas    文件:LibVariantContext.java   
public List<Zip> getZipTasks() {
    List<Zip> zipTasks = TaskQueryHelper.findTask(project, Zip.class, getBaseVariantData());
    List<Zip> result = new ArrayList<Zip>();
    if (null != zipTasks) {
        for (Zip zipTask : zipTasks) {
            if (zipTask.getName().contains("bundle")) {
                result.add(zipTask);
            }
        }
    }
    return result;
}
项目:aws-sam-gradle    文件:AwsSamDeployPlugin.java   
private void createTasks() {
    log.info("Creating tasks using config {}", config);
    final Zip zipTask = createBuildZipTask();
    final S3UploadTask uploadZipTask = createUploadZipTask(zipTask);
    S3UploadTask uploadSwaggerTask = null;
    if (config.getSwaggerDefinition() != null) {
        final ReplacePlaceholerTask updateSwaggerTask = createUpdateSwaggerTask(config.getSwaggerDefinition());
        uploadSwaggerTask = createUploadSwaggerTask(updateSwaggerTask);
    }
    final DeployTask deployTask = createDeployTask(uploadZipTask, uploadSwaggerTask);
    createWriteStackOutputTask(deployTask);
    createDeleteStackTask();
}
项目:aws-sam-gradle    文件:AwsSamDeployPlugin.java   
private S3UploadTask createUploadZipTask(final Zip zipTask) {
    final S3UploadTask task = createTask("uploadZip", S3UploadTask.class);
    task.setDescription("Upload lambda zip to s3");
    task.setGroup(TASK_GROUP);
    task.dependsOn(zipTask);
    task.config = config;
    task.file = zipTask.getOutputs().getFiles().getSingleFile();
    return task;
}
项目:aws-sam-gradle    文件:AwsSamDeployPlugin.java   
private Zip createBuildZipTask() {
    final Zip task = createTask("buildZip", Zip.class);
    task.setDescription("Build lambda zip");
    task.setGroup(TASK_GROUP);
    task.setBaseName(project.getName());
    task.into("lib", closure(task, CopySpec.class, (delegate) -> {
        delegate.from(project.getConfigurations().getByName("runtime"));
    }));
    task.into("", closure(task, CopySpec.class, (delegate) -> {
        delegate.from(project.getTasks().getByName("compileJava"),
                project.getTasks().getByName("processResources"));
    }));
    return task;
}
项目:atlas    文件:AtlasLibTaskManager.java   
private void createDexTask(LibVariantContext libVariantContext, Zip bundleTask) {

        List<MtlTaskContext> mtlTaskContexts = new ArrayList<MtlTaskContext>();

        mtlTaskContexts.add(new MtlTaskContext(bundleTask));

        mtlTaskContexts.add(new MtlTaskContext(PrepareAPTask.ConfigAction.class, null));

        mtlTaskContexts.add(new MtlTaskContext(PrepareMainDexJarsTask.ConfigAction.class, null));

        mtlTaskContexts.add(new MtlTaskContext(DexBuildTask.ConfigAction.class, null));

        mtlTaskContexts.add(new MtlTaskContext(DexInstallTask.ConfigAction.class, null));

        mtlTaskContexts.add(new MtlTaskContext(AssemblePatchTask.ConfigAction.class, null));

        new MtlTaskInjector(libVariantContext).injectTasks(mtlTaskContexts, tAndroidBuilder);
    }
项目:atlas    文件:LibVariantContext.java   
public Zip getBundleTask() {
    return bundleTask;
}
项目:atlas    文件:LibVariantContext.java   
public void setBundleTask(Zip bundleTask) {
    this.bundleTask = bundleTask;
}
项目:intellij-ce-playground    文件:LibraryVariantOutputImpl.java   
@Nullable
@Override
public Zip getPackageLibrary() {
    return variantOutputData.packageLibTask;
}
项目:intellij-ce-playground    文件:LibraryVariantOutput.java   
/**
 * Returns the Library AAR packaging task.
 */
@Nullable
Zip getPackageLibrary();
项目:atlas    文件:AtlasLibTaskManager.java   
private void createAwoTask(LibVariantContext libVariantContext, Zip bundleTask) {

        List<MtlTaskContext> mtlTaskContexts = new ArrayList<MtlTaskContext>();

        mtlTaskContexts.add(new MtlTaskContext(bundleTask));

        mtlTaskContexts.add(new MtlTaskContext(PrepareAPTask.ConfigAction.class, null));

        //Judgment depends on conflicts in AP and reduces the dependency on awb in apk
        mtlTaskContexts.add(new MtlTaskContext(DiffDependencyTask.ConfigAction.class, null));

        mtlTaskContexts.add(new MtlTaskContext(PrepareAwoBundleTask.ConfigAction.class, null));

        //mergeManifest
        mtlTaskContexts.add(new MtlTaskContext(MergeAwoManifests.ConfigAction.class, null));

        //MergeAssets
        mtlTaskContexts.add(new MtlTaskContext(MergeAwbAssetConfigAction.class, null));

        mtlTaskContexts.add(new MtlTaskContext(CopyAwoSolibTask.ConfigAction.class, null));

        //MergeRes
        mtlTaskContexts.add(new MtlTaskContext(MergeAwbResourceConfigAction.class, null));

        //Awb processRes
        mtlTaskContexts.add(new MtlTaskContext(ProcessAwoAndroidResources.ConfigAction.class,
                                               null));

        mtlTaskContexts.add(new MtlTaskContext(AwoJavaCompileConfigAction.class, null));

        //Dex
        mtlTaskContexts.add(new MtlTaskContext(AwbDexTask.ConfigAction.class, null));

        //mtlTaskContexts.add(new MtlTaskContext(PrePackageConfigAction.class, null));

        //package
        mtlTaskContexts.add(new MtlTaskContext(AwoPackageTask.ConfigAction.class, null));

        //Installation to mobile phone
        mtlTaskContexts.add(new MtlTaskContext(AwoInstallTask.ConfigAction.class, null));

        mtlTaskContexts.add(new MtlTaskContext(AssemblePatchTask.ConfigAction.class, null));

        //Signature & zipalign
        //        mtlTaskContexts.add(new MtlTaskContext(AwoFullApkBuildTask.ConfigAction.class, null));

        //mtlTaskContexts.add(new MtlTaskContext(libVariantContext.getBaseVariantData().assembleVariantTask));

        new MtlTaskInjector(libVariantContext).injectTasks(mtlTaskContexts, tAndroidBuilder);
    }