当前位置: 首页>>代码示例>>Java>>正文


Java GradleVersion类代码示例

本文整理汇总了Java中org.gradle.util.GradleVersion的典型用法代码示例。如果您正苦于以下问题:Java GradleVersion类的具体用法?Java GradleVersion怎么用?Java GradleVersion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GradleVersion类属于org.gradle.util包,在下文中一共展示了GradleVersion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetch

import org.gradle.util.GradleVersion; //导入依赖的package包/类
private static void fetch(File buildDir, File gradleInstallDir, boolean embedded) {
    System.out.println("* Fetching model for " + buildDir);
    System.out.println("* Using tooling API " + GradleVersion.current().getVersion());

    Timer timer = new Timer();

    GradleConnector gradleConnector = GradleConnector.newConnector();
    gradleConnector.forProjectDirectory(buildDir);
    ((DefaultGradleConnector) gradleConnector).embedded(embedded);
    if (gradleInstallDir != null) {
        gradleConnector.useInstallation(gradleInstallDir);
    }

    ProjectConnection connect = gradleConnector.connect();
    try {
        for (int i = 0; i < 5; i++) {
            SyncAction.withProjectConnection(connect, null);
        }
    } finally {
        connect.close();
    }

    timer.stop();
    System.out.println("total time: " + timer.duration());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:Main.java

示例2: getUserAgentString

import org.gradle.util.GradleVersion; //导入依赖的package包/类
public static String getUserAgentString() {
    String osName = System.getProperty("os.name");
    String osVersion = System.getProperty("os.version");
    String osArch = System.getProperty("os.arch");
    String javaVendor = System.getProperty("java.vendor");
    String javaVersion = SystemProperties.getInstance().getJavaVersion();
    String javaVendorVersion = System.getProperty("java.vm.version");
    return String.format("Gradle/%s (%s;%s;%s) (%s;%s;%s)",
            GradleVersion.current().getVersion(),
            osName,
            osVersion,
            osArch,
            javaVendor,
            javaVersion,
            javaVendorVersion);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:UriTextResource.java

示例3: wrapperCanExecute

import org.gradle.util.GradleVersion; //导入依赖的package包/类
public boolean wrapperCanExecute(GradleVersion version) {
    if (version.equals(GradleVersion.version("0.8")) || isVersion("0.8")) {
        // There was a breaking change after 0.8
        return false;
    }
    if (isVersion("0.9.1")) {
        // 0.9.1 couldn't handle anything with a timestamp whose timezone was behind GMT
        return version.getVersion().matches(".*+\\d{4}");
    }
    if (isSameOrNewer("0.9.2") && isSameOrOlder("1.0-milestone-2")) {
        // These versions couldn't handle milestone patches
        if (version.getVersion().matches("1.0-milestone-\\d+[a-z]-.+")) {
            return false;
        }
    }
    return true;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:DefaultGradleDistribution.java

示例4: run

import org.gradle.util.GradleVersion; //导入依赖的package包/类
public void run() {
    GradleVersion currentVersion = GradleVersion.current();

    final StringBuilder sb = new StringBuilder();
    sb.append("\n------------------------------------------------------------\nGradle ");
    sb.append(currentVersion.getVersion());
    sb.append("\n------------------------------------------------------------\n\nBuild time:   ");
    sb.append(currentVersion.getBuildTime());
    sb.append("\nRevision:     ");
    sb.append(currentVersion.getRevision());
    sb.append("\n\nGroovy:       ");
    sb.append(GroovySystem.getVersion());
    sb.append("\nAnt:          ");
    sb.append(Main.getAntVersion());
    sb.append("\nJVM:          ");
    sb.append(Jvm.current());
    sb.append("\nOS:           ");
    sb.append(OperatingSystem.current());
    sb.append("\n");

    System.out.println(sb.toString());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:CommandLineActionFactory.java

示例5: run

import org.gradle.util.GradleVersion; //导入依赖的package包/类
public Object run(String modelName, BuildCancellationToken cancellationToken, ProviderOperationParameters providerParameters) {
    List<String> tasks = providerParameters.getTasks();
    if (modelName.equals(ModelIdentifier.NULL_MODEL) && tasks == null) {
        throw new IllegalArgumentException("No model type or tasks specified.");
    }
    Parameters params = initParams(providerParameters);
    Class<?> type = new ModelMapping().getProtocolTypeFromModelName(modelName);
    if (type == InternalBuildEnvironment.class) {
        //we don't really need to launch the daemon to acquire information needed for BuildEnvironment
        if (tasks != null) {
            throw new IllegalArgumentException("Cannot run tasks and fetch the build environment model.");
        }
        return new DefaultBuildEnvironment(
                new DefaultBuildIdentifier(providerParameters.getProjectDir()),
                params.gradleUserhome,
                GradleVersion.current().getVersion(),
                params.daemonParams.getEffectiveJvm().getJavaHome(),
                params.daemonParams.getEffectiveJvmArgs());
    }

    StartParameter startParameter = new ProviderStartParameterConverter().toStartParameter(providerParameters, params.properties);
    ProgressListenerConfiguration listenerConfig = ProgressListenerConfiguration.from(providerParameters);
    BuildAction action = new BuildModelAction(startParameter, modelName, tasks != null, listenerConfig.clientSubscriptions);
    return run(action, cancellationToken, listenerConfig, providerParameters, params);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:ProviderConnection.java

示例6: createProjectConnection

import org.gradle.util.GradleVersion; //导入依赖的package包/类
private ProjectConnection createProjectConnection(ComparableGradleBuildExecuter executer) {
    GradleConnector connector = GradleConnector.newConnector();
    connector.forProjectDirectory(executer.getSpec().getProjectDir());
    File gradleUserHomeDir = gradle.getStartParameter().getGradleUserHomeDir();
    if (gradleUserHomeDir != null) {
        connector.useGradleUserHomeDir(gradleUserHomeDir);
    }

    GradleVersion gradleVersion = executer.getGradleVersion();
    if (gradleVersion.equals(GradleVersion.current())) {
        connector.useInstallation(gradle.getGradleHomeDir());
    } else {
        connector.useGradleVersion(gradleVersion.getVersion());
    }

    return connector.connect();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:GradleBuildComparison.java

示例7: renderProject

import org.gradle.util.GradleVersion; //导入依赖的package包/类
private void renderProject(Project project, JsonBuilder json) {

        Map<String, Object> overall = Maps.newLinkedHashMap();
        overall.put("gradleVersion", GradleVersion.current().toString());
        overall.put("generationDate", new Date().toString());

        Map<String, Object> projectOut = Maps.newLinkedHashMap();
        projectOut.put("name", project.getName());
        projectOut.put("description", project.getDescription());
        projectOut.put("configurations", createConfigurations(project));
        overall.put("project", projectOut);

        json.call(overall);
    }
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:JsonProjectDependencyRenderer.java

示例8: printDefaultHelp

import org.gradle.util.GradleVersion; //导入依赖的package包/类
private void printDefaultHelp(StyledTextOutput output, BuildClientMetaData metaData) {
    output.println();
    output.formatln("Welcome to Gradle %s.", GradleVersion.current().getVersion());
    output.println();
    output.text("To run a build, run ");
    metaData.describeCommand(output.withStyle(UserInput), "<task> ...");
    output.println();
    output.println();
    output.text("To see a list of available tasks, run ");
    metaData.describeCommand(output.withStyle(UserInput), "tasks");
    output.println();
    output.println();
    output.text("To see a list of command-line options, run ");
    metaData.describeCommand(output.withStyle(UserInput), "--help");
    output.println();
    output.println();
    output.text("To see more detail about a task, run ");
    metaData.describeCommand(output.withStyle(UserInput), "help --task <task>");
    output.println();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:Help.java

示例9: collectKnownClassLoaders

import org.gradle.util.GradleVersion; //导入依赖的package包/类
private static Map<ClassLoader, String> collectKnownClassLoaders(ClassLoaderRegistry registry) {
    Map<ClassLoader, String> knownClassLoaders = Maps.newHashMap();

    String javaVmVersion = String.format("%s|%s|%s", System.getProperty("java.vm.name"), System.getProperty("java.vm.vendor"), System.getProperty("java.vm.vendor"));
    ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
    if (systemClassLoader != null) {
        addClassLoader(knownClassLoaders, systemClassLoader, "system-app" + javaVmVersion);
        addClassLoader(knownClassLoaders, systemClassLoader.getParent(), "system-ext" + javaVmVersion);
    }

    String gradleVersion = GradleVersion.current().getVersion();
    addClassLoader(knownClassLoaders, registry.getRuntimeClassLoader(), "runtime:" + gradleVersion);
    addClassLoader(knownClassLoaders, registry.getGradleApiClassLoader(), "gradle-api:" + gradleVersion);
    addClassLoader(knownClassLoaders, registry.getGradleCoreApiClassLoader(), "gradle-core-api:" + gradleVersion);
    addClassLoader(knownClassLoaders, registry.getPluginsClassLoader(), "plugins:" + gradleVersion);

    return knownClassLoaders;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:RegistryAwareClassLoaderHierarchyHasher.java

示例10: render

import org.gradle.util.GradleVersion; //导入依赖的package包/类
@Override
public void render(final T model, SimpleHtmlWriter htmlWriter) throws
        IOException {
    this.model = model;
    htmlWriter.startElement("head")
            .startElement("meta").attribute("http-equiv", "Content-Type").attribute("content", "text/html; charset=utf-8").endElement()
            .startElement("title").characters(getPageTitle()).endElement()
            .startElement("link").attribute("href", "css/base-style.css").attribute("rel", "stylesheet").attribute("type", "text/css").endElement()
            .startElement("link").attribute("href", "css/style.css").attribute("rel", "stylesheet").attribute("type", "text/css").endElement()
            .startElement("script").attribute("src", "js/report.js").attribute("type", "text/javascript").characters("").endElement() //html does not like <a name="..."/>
            .endElement();

    htmlWriter.startElement("body")
            .startElement("div").attribute("id", "content")
            .startElement("h1").characters(getTitle()).endElement();
    getHeaderRenderer().render(model, htmlWriter);
    getContentRenderer().render(model, htmlWriter);
    htmlWriter.startElement("div").attribute("id", "footer")
            .startElement("p").characters("Generated by ")
            .startElement("a").attribute("href", "http://www.gradle.org").characters(String.format("Gradle %s", GradleVersion.current().getVersion())).endElement()
            .characters(String.format(" at %s", DateFormat.getDateTimeInstance().format(new Date())))
            .endElement()
            .endElement()
            .endElement();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TabbedPageRenderer.java

示例11: getAndroidProject

import org.gradle.util.GradleVersion; //导入依赖的package包/类
/**
 * Returns the {@link com.android.builder.model.AndroidProject} given the gradle project root.
 * Note that this works only single module projects (only one build.gradle)
 */
@Nullable
private static AndroidProject getAndroidProject(String projectPath) {
  File androidPlugin = new File(AndroidTestBase.getAndroidPluginHome());
  File projectDir = new File(androidPlugin, BASE_PATH + projectPath);
  GradleConnector connector = GradleConnector.newConnector();
  connector.forProjectDirectory(projectDir);
  connector.useDistribution(new DistributionLocator().getDistributionFor(GradleVersion.version("2.2.1")));

  AndroidProject model = null;
  ProjectConnection connection = connector.connect();
  try {
    model = connection.getModel(AndroidProject.class);
  } finally {
    connection.close();
  }

  return model;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ExportSignedPackageTest.java

示例12: setupGradleBuildFile

import org.gradle.util.GradleVersion; //导入依赖的package包/类
@Nullable
private VirtualFile setupGradleBuildFile(@NotNull VirtualFile modelContentRootDir)
  throws ConfigurationException {
  final VirtualFile file = getOrCreateExternalProjectConfigFile(modelContentRootDir.getPath(), GradleConstants.DEFAULT_SCRIPT_NAME);

  if (file != null) {
    final String templateName = getExternalProjectSettings().getDistributionType() == DistributionType.WRAPPED
                                ? TEMPLATE_GRADLE_BUILD_WITH_WRAPPER
                                : DEFAULT_TEMPLATE_GRADLE_BUILD;
    Map<String, String> attributes = ContainerUtil.newHashMap();
    if (myProjectId != null) {
      attributes.put(TEMPLATE_ATTRIBUTE_MODULE_VERSION, myProjectId.getVersion());
      attributes.put(TEMPLATE_ATTRIBUTE_MODULE_GROUP, myProjectId.getGroupId());
      attributes.put(TEMPLATE_ATTRIBUTE_GRADLE_VERSION, GradleVersion.current().getVersion());
    }
    saveFile(file, templateName, attributes);
  }
  return file;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GradleModuleBuilder.java

示例13: getUserAgentString

import org.gradle.util.GradleVersion; //导入依赖的package包/类
public static String getUserAgentString() {
    String osName = System.getProperty("os.name");
    String osVersion = System.getProperty("os.version");
    String osArch = System.getProperty("os.arch");
    String javaVendor = System.getProperty("java.vendor");
    String javaVersion = SystemProperties.getJavaVersion();
    String javaVendorVersion = System.getProperty("java.vm.version");
    return String.format("Gradle/%s (%s;%s;%s) (%s;%s;%s)",
            GradleVersion.current().getVersion(),
            osName,
            osVersion,
            osArch,
            javaVendor,
            javaVersion,
            javaVendorVersion);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:17,代码来源:UriResource.java

示例14: run

import org.gradle.util.GradleVersion; //导入依赖的package包/类
public void run() {
    GradleVersion currentVersion = GradleVersion.current();

    final StringBuilder sb = new StringBuilder();
    sb.append("\n------------------------------------------------------------\nGradle ");
    sb.append(currentVersion.getVersion());
    sb.append("\n------------------------------------------------------------\n\nBuild time:   ");
    sb.append(currentVersion.getBuildTime());
    sb.append("\nBuild number: ");
    sb.append(currentVersion.getBuildNumber());
    sb.append("\nRevision:     ");
    sb.append(currentVersion.getRevision());
    sb.append("\n\nGroovy:       ");
    sb.append(GroovySystem.getVersion());
    sb.append("\nAnt:          ");
    sb.append(Main.getAntVersion());
    sb.append("\nJVM:          ");
    sb.append(Jvm.current());
    sb.append("\nOS:           ");
    sb.append(OperatingSystem.current());
    sb.append("\n");

    System.out.println(sb.toString());
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:25,代码来源:CommandLineActionFactory.java

示例15: run

import org.gradle.util.GradleVersion; //导入依赖的package包/类
public Object run(String modelName, BuildCancellationToken cancellationToken, ProviderOperationParameters providerParameters) {
    List<String> tasks = providerParameters.getTasks();
    if (modelName.equals(ModelIdentifier.NULL_MODEL) && tasks == null) {
        throw new IllegalArgumentException("No model type or tasks specified.");
    }
    Parameters params = initParams(providerParameters);
    Class<?> type = new ModelMapping().getProtocolTypeFromModelName(modelName);
    if (type == InternalBuildEnvironment.class) {
        //we don't really need to launch the daemon to acquire information needed for BuildEnvironment
        if (tasks != null) {
            throw new IllegalArgumentException("Cannot run tasks and fetch the build environment model.");
        }
        return new DefaultBuildEnvironment(
                GradleVersion.current().getVersion(),
                params.daemonParams.getEffectiveJavaHome(),
                params.daemonParams.getEffectiveJvmArgs());
    }

    BuildAction<BuildActionResult> action = new BuildModelAction(modelName, tasks != null);
    return run(action, cancellationToken, providerParameters, params.properties);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:22,代码来源:ProviderConnection.java


注:本文中的org.gradle.util.GradleVersion类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。