Java Code Examples for org.gradle.util.DeprecationLogger#nagUserOfDeprecated()

The following examples show how to use org.gradle.util.DeprecationLogger#nagUserOfDeprecated() . 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: GradlePomModuleDescriptorBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void addMainArtifact(String artifactId, String packaging) {
    if ("pom".equals(packaging)) {
        return;
    }

    if (!isKnownJarPackaging(packaging)) {
        ModuleComponentIdentifier componentIdentifier = DefaultModuleComponentIdentifier.newId(mrid.getOrganisation(), mrid.getName(), mrid.getRevision());
        DefaultArtifact artifact = new DefaultArtifact(mrid, new Date(), artifactId, packaging, packaging);
        ModuleVersionArtifactMetaData artifactMetaData = new DefaultModuleVersionArtifactMetaData(componentIdentifier, artifact);
        if (parserSettings.artifactExists(artifactMetaData)) {
            ivyModuleDescriptor.addArtifact("master", artifact);

            DeprecationLogger.nagUserOfDeprecated("Relying on packaging to define the extension of the main artifact");
            return;
        }
    }

    ivyModuleDescriptor.addArtifact("master", new DefaultArtifact(mrid, new Date(), artifactId, packaging, "jar"));
}
 
Example 2
Source File: StatementLabelsDeprecationLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void log(String label, String sample) {
    DeprecationLogger.nagUserOfDeprecated(
            "Usage of statement labels in build scripts",
            String.format(
                    "In case you tried to configure a property named '%s', replace ':' with '=' or ' '. Otherwise it will not have the desired effect. \n\n%s",
                    label, sample
            )
    );
}
 
Example 3
Source File: DefaultExcludeRule.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Map<String, String> getExcludeArgs() {
    DeprecationLogger.nagUserOfDeprecated("The getExcludeArgs method", "Please use the getGroup() method or the getModule() method instead");
    Map excludeArgsAsMap = new HashMap();
    excludeArgsAsMap.put(ExcludeRule.GROUP_KEY, group);
    excludeArgsAsMap.put(ExcludeRule.MODULE_KEY, module);
    return excludeArgsAsMap;
}
 
Example 4
Source File: DefaultRepositoryHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public MavenArtifactRepository mavenCentral(Map<String, ?> args) {
    Map<String, Object> modifiedArgs = new HashMap<String, Object>(args);
    if (modifiedArgs.containsKey("urls")) {
        DeprecationLogger.nagUserOfDeprecated(
                "The 'urls' property of the RepositoryHandler.mavenCentral() method",
                "You should use the 'artifactUrls' property to define additional artifact locations"
        );
        List<?> urls = flattenCollections(modifiedArgs.remove("urls"));
        modifiedArgs.put("artifactUrls", urls);
    }

    return addRepository(repositoryFactory.createMavenCentralRepository(), DEFAULT_MAVEN_CENTRAL_REPO_NAME, new ConfigureByMapAction<MavenArtifactRepository>(modifiedArgs));
}
 
Example 5
Source File: TaskStatusNagger.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void warn(String method) {
    if (executingleftShiftAction) {
        DeprecationLogger.nagUserOfDeprecated(String.format(DEPRECATION_MESSAGE, method), String.format(EXPLANAITION_WITH_HINT, taskInternal));
    } else {
        DeprecationLogger.nagUserOfDeprecated(String.format(DEPRECATION_MESSAGE, method), String.format(EXPLANAITION, taskInternal));
    }
}
 
Example 6
Source File: DefaultTaskContainer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Task resolveTask(Object path) {
    if (!GUtil.isTrue(path)) {
        throw new InvalidUserDataException("A path must be specified!");
    }
    if (!(path instanceof CharSequence)) {
        DeprecationLogger.nagUserOfDeprecated(
                String.format("Converting class %s to a task dependency using toString()", path.getClass().getName()),
                "Please use org.gradle.api.Task, java.lang.String, org.gradle.api.Buildable, org.gradle.tasks.TaskDependency or a Closure to declare your task dependencies"
        );
    }
    return getByPath(path.toString());
}
 
Example 7
Source File: DefaultMavenFileLocations.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Nullable
public File getGlobalMavenDir() {
    String m2Home = System.getenv("M2_HOME");
    if (m2Home == null) {
        m2Home = System.getProperty("M2_HOME");
        if(m2Home==null){
            return null;
        }
        DeprecationLogger.nagUserOfDeprecated("Found defined M2_HOME system property. Handling M2_HOME system property", "Please use the M2_HOME environment variable instead");
    }
    return new File(m2Home);
}
 
Example 8
Source File: DefaultResolvedArtifact.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ResolvedDependency getResolvedDependency() {
    DeprecationLogger.nagUserOfDeprecated(
            "ResolvedArtifact.getResolvedDependency()",
            "For version info use ResolvedArtifact.getModuleVersion(), to access the dependency graph use ResolvedConfiguration.getFirstLevelModuleDependencies()"
    );
    //resolvedDependency is expensive so lazily create it
    return ownerSource.create();
}
 
Example 9
Source File: DefaultExcludeRule.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Map<String, String> getExcludeArgs() {
    DeprecationLogger.nagUserOfDeprecated("The getExcludeArgs method", "Please use the getGroup() method or the getModule() method instead");
    Map excludeArgsAsMap = new HashMap();
    excludeArgsAsMap.put(ExcludeRule.GROUP_KEY, group);
    excludeArgsAsMap.put(ExcludeRule.MODULE_KEY, module);
    return excludeArgsAsMap;
}
 
Example 10
Source File: DefaultRepositoryHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public MavenArtifactRepository mavenCentral(Map<String, ?> args) {
    Map<String, Object> modifiedArgs = new HashMap<String, Object>(args);
    if (modifiedArgs.containsKey("urls")) {
        DeprecationLogger.nagUserOfDeprecated(
                "The 'urls' property of the RepositoryHandler.mavenCentral() method",
                "You should use the 'artifactUrls' property to define additional artifact locations"
        );
        List<?> urls = flattenCollections(modifiedArgs.remove("urls"));
        modifiedArgs.put("artifactUrls", urls);
    }

    return addRepository(repositoryFactory.createMavenCentralRepository(), DEFAULT_MAVEN_CENTRAL_REPO_NAME, new ConfigureByMapAction<MavenArtifactRepository>(modifiedArgs));
}
 
Example 11
Source File: TaskStatusNagger.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void warn(String method) {
    if (executingleftShiftAction) {
        DeprecationLogger.nagUserOfDeprecated(String.format(DEPRECATION_MESSAGE, method), String.format(EXPLANAITION_WITH_HINT, taskInternal));
    } else {
        DeprecationLogger.nagUserOfDeprecated(String.format(DEPRECATION_MESSAGE, method), String.format(EXPLANAITION, taskInternal));
    }
}
 
Example 12
Source File: DefaultTaskContainer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Task resolveTask(Object path) {
    if (!GUtil.isTrue(path)) {
        throw new InvalidUserDataException("A path must be specified!");
    }
    if (!(path instanceof CharSequence)) {
        DeprecationLogger.nagUserOfDeprecated(
                String.format("Converting class %s to a task dependency using toString()", path.getClass().getName()),
                "Please use org.gradle.api.Task, java.lang.String, org.gradle.api.Buildable, org.gradle.tasks.TaskDependency or a Closure to declare your task dependencies"
        );
    }
    return getByPath(path.toString());
}
 
Example 13
Source File: StatementLabelsDeprecationLogger.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void log(String label, String sample) {
    DeprecationLogger.nagUserOfDeprecated(
            "Usage of statement labels in build scripts",
            String.format(
                    "In case you tried to configure a property named '%s', replace ':' with '=' or ' '. Otherwise it will not have the desired effect. \n\n%s",
                    label, sample
            )
    );
}
 
Example 14
Source File: DefaultMavenFileLocations.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Nullable
public File getGlobalMavenDir() {
    String m2Home = System.getenv("M2_HOME");
    if (m2Home == null) {
        m2Home = System.getProperty("M2_HOME");
        if(m2Home==null){
            return null;
        }
        DeprecationLogger.nagUserOfDeprecated("Found defined M2_HOME system property. Handling M2_HOME system property", "Please use the M2_HOME environment variable instead");
    }
    return new File(m2Home);
}
 
Example 15
Source File: DefaultResolvedArtifact.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ResolvedDependency getResolvedDependency() {
    DeprecationLogger.nagUserOfDeprecated(
            "ResolvedArtifact.getResolvedDependency()",
            "For version info use ResolvedArtifact.getModuleVersion(), to access the dependency graph use ResolvedConfiguration.getFirstLevelModuleDependencies()"
    );
    //resolvedDependency is expensive so lazily create it
    return ownerSource.create();
}
 
Example 16
Source File: DefaultScript.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileTree fileTree(Closure closure) {
    DeprecationLogger.nagUserOfDeprecated("fileTree(Closure)", "Use fileTree((Object){ baseDir }) to have the closure used as the file tree base directory");
    //noinspection deprecation
    return fileOperations.fileTree(closure);
}
 
Example 17
Source File: DefaultScript.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileTree fileTree(Closure closure) {
    DeprecationLogger.nagUserOfDeprecated("fileTree(Closure)", "Use fileTree((Object){ baseDir }) to have the closure used as the file tree base directory");
    //noinspection deprecation
    return fileOperations.fileTree(closure);
}
 
Example 18
Source File: AbstractArtifactRepository.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setName(String name) {
    if (isPartOfContainer) {
        DeprecationLogger.nagUserOfDeprecated("Changing the name of an ArtifactRepository that is part of a container", "Set the name when creating the repository");
    }
    this.name = name;
}
 
Example 19
Source File: AbstractProject.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigurableFileTree fileTree(Closure closure) {
    DeprecationLogger.nagUserOfDeprecated("fileTree(Closure)", "Use fileTree((Object){ baseDir }) to have the closure used as the file tree base directory");
    return fileOperations.fileTree(closure);
}
 
Example 20
Source File: AbstractArtifactRepository.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setName(String name) {
    if (isPartOfContainer) {
        DeprecationLogger.nagUserOfDeprecated("Changing the name of an ArtifactRepository that is part of a container", "Set the name when creating the repository");
    }
    this.name = name;
}