Java Code Examples for org.gradle.api.artifacts.Configuration#setTransitive()

The following examples show how to use org.gradle.api.artifacts.Configuration#setTransitive() . 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: ApDependency.java    From atlas with Apache License 2.0 6 votes vote down vote up
private File getBaseApFile(Project project, TBuildType tBuildType) {
    File apBaseFile;
    File buildTypeBaseApFile = tBuildType.getBaseApFile();
    if (null != buildTypeBaseApFile && buildTypeBaseApFile.exists()) {
        apBaseFile = buildTypeBaseApFile;
    } else if (!isNullOrEmpty(tBuildType.getBaseApDependency())) {
        String apDependency = tBuildType.getBaseApDependency();
        // Preconditions.checkNotNull(apDependency,
        //                            "You have to specify the baseApFile property or the baseApDependency
        // dependency");
        Dependency dependency = project.getDependencies().create(apDependency);
        Configuration configuration = project.getConfigurations().detachedConfiguration(dependency);
        configuration.setTransitive(false);
        apBaseFile = Iterables.getOnlyElement(Collections2.filter(configuration.getFiles(), new Predicate<File>() {
            @Override
            public boolean apply(@Nullable File file) {
                return file.getName().endsWith(".ap");
            }
        }));
    } else {
        throw new IllegalStateException("AP is missing");
    }
    return apBaseFile;
}
 
Example 2
Source File: PlayJavaScriptPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
private Configuration createCompilerConfiguration(Project project) {
    Configuration compilerConfiguration = project.getConfigurations().create(COMPILER_CONFIGURATION_NAME);
    compilerConfiguration.setVisible(false);
    compilerConfiguration.setTransitive(true);
    compilerConfiguration.setDescription("The JavaScript compiler library used to minify assets.");
    return compilerConfiguration;
}
 
Example 3
Source File: PlayRoutesPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
private Configuration createRoutesCompilerConfiguration(Project project) {
    Configuration compilerConfiguration = project.getConfigurations().create(ROUTES_COMPILER_CONFIGURATION_NAME);
    compilerConfiguration.setVisible(false);
    compilerConfiguration.setTransitive(true);
    compilerConfiguration.setDescription("The routes compiler library used to generate Scala source from routes templates.");
    return compilerConfiguration;
}
 
Example 4
Source File: PlayTwirlPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
private Configuration createTwirlCompilerConfiguration(Project project) {
    Configuration twirlCompilerConfiguration = project.getConfigurations().create(TWIRL_COMPILER_CONFIGURATION_NAME);
    twirlCompilerConfiguration.setVisible(false);
    twirlCompilerConfiguration.setTransitive(true);
    twirlCompilerConfiguration.setDescription("The Twirl compiler library used to generate Scala source from Twirl templates.");
    return twirlCompilerConfiguration;
}
 
Example 5
Source File: ScottPlugin.java    From scott with MIT License 5 votes vote down vote up
private Configuration configureAgentDependencies(Project project, ScottPluginExtension extension) {
    Configuration agentConf = project.getConfigurations().create(AGENT_CONFIGURATION_NAME);
    agentConf.setVisible(false);
    agentConf.setTransitive(true);
    agentConf.setDescription("The Scott agent to use detailed failure reports and hassle free assertions for Java tests");
    agentConf.defaultDependencies(dependencies ->
        dependencies.add(project.getDependencies().create("hu.advancedweb:scott:" + extension.getToolVersion()))
    );
    return agentConf;
}
 
Example 6
Source File: CpdPlugin.java    From gradle-cpd-plugin with Apache License 2.0 5 votes vote down vote up
private void createConfiguration(Project project, CpdExtension extension) {
    Configuration configuration = project.getConfigurations().create("cpd");
    configuration.setDescription("The CPD libraries to be used for this project.");
    configuration.setTransitive(true);
    configuration.setVisible(false);

    configuration.defaultDependencies(d ->
            d.add(project.getDependencies().create("net.sourceforge.pmd:pmd-dist:" + extension.getToolVersion())));
}
 
Example 7
Source File: JavaccPlugin.java    From javaccPlugin with MIT License 5 votes vote down vote up
private Configuration createJavaccConfiguration(Project project) {
    Configuration configuration = project.getConfigurations().create("javacc");
    configuration.setVisible(false);
    configuration.setTransitive(true);
    configuration.setDescription("The javacc dependencies to be used.");
    return configuration;
}
 
Example 8
Source File: PrepareAPTask.java    From atlas with Apache License 2.0 4 votes vote down vote up
/**
 * Directory of so
 */
@TaskAction
void generate() throws IOException, DocumentException {

    Project project = getProject();
    File apBaseFile = null;

    File apFile = getApFile();
    if (null != apFile && apFile.exists()) {
        apBaseFile = apFile;
    } else {
        String apDependency = getApDependency();
        if (StringUtils.isNotBlank(apContext.getApDependency())) {
            Dependency dependency = project.getDependencies().create(apDependency);
            Configuration configuration = project.getConfigurations().detachedConfiguration(dependency);
            configuration.setTransitive(false);
            configuration.getResolutionStrategy().cacheChangingModulesFor(0, TimeUnit.MILLISECONDS);
            configuration.getResolutionStrategy().cacheDynamicVersionsFor(0, TimeUnit.MILLISECONDS);
            for (File file : configuration.getFiles()) {
                if (file.getName().endsWith(".ap")) {
                    apBaseFile = file;
                    break;
                }
            }
        }
    }

    if (null != apBaseFile && apBaseFile.exists()) {

        try {
            explodedDir = getExplodedDir();
            BetterZip.unzipDirectory(apBaseFile, explodedDir);
            apContext.setApExploredFolder(explodedDir);
            Set<String> awbBundles = getAwbBundles();
            if (awbBundles != null) {
                // Unzip the baseline Bundle
                for (String awbBundle : awbBundles) {
                    File awbFile = BetterZip.extractFile(new File(explodedDir, AP_INLINE_APK_FILENAME),
                                                         "lib/armeabi/" + awbBundle,
                                                         new File(explodedDir, AP_INLINE_AWB_EXTRACT_DIRECTORY));
                    File awbExplodedDir = new File(new File(explodedDir, AP_INLINE_AWB_EXPLODED_DIRECTORY),
                                                   FilenameUtils.getBaseName(awbBundle));
                    BetterZip.unzipDirectory(awbFile, awbExplodedDir);
                    FileUtils.renameTo(new File(awbExplodedDir, FN_APK_CLASSES_DEX),
                                       new File(awbExplodedDir, "classes2.dex"));
                }
                // Preprocessing increment androidmanifest.xml
                ManifestFileUtils.updatePreProcessBaseManifestFile(
                    FileUtils.join(explodedDir, "manifest-modify", ANDROID_MANIFEST_XML),
                    new File(explodedDir, ANDROID_MANIFEST_XML));
            }
            if (explodedDir.listFiles().length == 0){
                throw new RuntimeException("unzip ap exception, no files found");
            }
        }catch (Throwable e){
            FileUtils.deleteIfExists(apBaseFile);
            throw new GradleException(e.getMessage(),e);

        }
    }
}