Java 类org.springframework.boot.cli.command.options.SourceOptions 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:GrabCommand.java   
@Override
protected ExitStatus run(OptionSet options) throws Exception {
    SourceOptions sourceOptions = new SourceOptions(options);

    List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory
            .createDefaultRepositoryConfiguration();

    GroovyCompilerConfiguration configuration = new OptionSetGroovyCompilerConfiguration(
            options, this, repositoryConfiguration);

    if (System.getProperty("grape.root") == null) {
        System.setProperty("grape.root", ".");
    }

    GroovyCompiler groovyCompiler = new GroovyCompiler(configuration);
    groovyCompiler.compile(sourceOptions.getSourcesArray());
    return ExitStatus.OK;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RunCommand.java   
@Override
protected synchronized ExitStatus run(OptionSet options) throws Exception {
    synchronized (this.monitor) {
        if (this.runner != null) {
            throw new RuntimeException(
                    "Already running. Please stop the current application before running another (use the 'stop' command).");
        }

        SourceOptions sourceOptions = new SourceOptions(options);

        List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory
                .createDefaultRepositoryConfiguration();
        repositoryConfiguration.add(0, new RepositoryConfiguration("local",
                new File("repository").toURI(), true));

        SpringApplicationRunnerConfiguration configuration = new SpringApplicationRunnerConfigurationAdapter(
                options, this, repositoryConfiguration);

        this.runner = new SpringApplicationRunner(configuration,
                sourceOptions.getSourcesArray(), sourceOptions.getArgsArray());
        this.runner.compileAndRun();

        return ExitStatus.OK;
    }
}
项目:spring-boot-concourse    文件:GrabCommand.java   
@Override
protected ExitStatus run(OptionSet options) throws Exception {
    SourceOptions sourceOptions = new SourceOptions(options);

    List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory
            .createDefaultRepositoryConfiguration();

    GroovyCompilerConfiguration configuration = new OptionSetGroovyCompilerConfiguration(
            options, this, repositoryConfiguration);

    if (System.getProperty("grape.root") == null) {
        System.setProperty("grape.root", ".");
    }

    GroovyCompiler groovyCompiler = new GroovyCompiler(configuration);
    groovyCompiler.compile(sourceOptions.getSourcesArray());
    return ExitStatus.OK;
}
项目:spring-boot-concourse    文件:RunCommand.java   
@Override
protected synchronized ExitStatus run(OptionSet options) throws Exception {

    if (this.runner != null) {
        throw new RuntimeException(
                "Already running. Please stop the current application before running another (use the 'stop' command).");
    }

    SourceOptions sourceOptions = new SourceOptions(options);

    List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory
            .createDefaultRepositoryConfiguration();
    repositoryConfiguration.add(0, new RepositoryConfiguration("local",
            new File("repository").toURI(), true));

    SpringApplicationRunnerConfiguration configuration = new SpringApplicationRunnerConfigurationAdapter(
            options, this, repositoryConfiguration);

    this.runner = new SpringApplicationRunner(configuration,
            sourceOptions.getSourcesArray(), sourceOptions.getArgsArray());
    this.runner.compileAndRun();

    return ExitStatus.OK;
}
项目:contestparser    文件:GrabCommand.java   
@Override
protected ExitStatus run(OptionSet options) throws Exception {
    SourceOptions sourceOptions = new SourceOptions(options);

    List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory
            .createDefaultRepositoryConfiguration();

    GroovyCompilerConfiguration configuration = new OptionSetGroovyCompilerConfiguration(
            options, this, repositoryConfiguration);

    if (System.getProperty("grape.root") == null) {
        System.setProperty("grape.root", ".");
    }

    GroovyCompiler groovyCompiler = new GroovyCompiler(configuration);
    groovyCompiler.compile(sourceOptions.getSourcesArray());
    return ExitStatus.OK;
}
项目:contestparser    文件:RunCommand.java   
@Override
protected synchronized ExitStatus run(OptionSet options) throws Exception {

    if (this.runner != null) {
        throw new RuntimeException(
                "Already running. Please stop the current application before running another (use the 'stop' command).");
    }

    SourceOptions sourceOptions = new SourceOptions(options);

    List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory
            .createDefaultRepositoryConfiguration();
    repositoryConfiguration.add(0, new RepositoryConfiguration("local",
            new File("repository").toURI(), true));

    SpringApplicationRunnerConfiguration configuration = new SpringApplicationRunnerConfigurationAdapter(
            options, this, repositoryConfiguration);

    this.runner = new SpringApplicationRunner(configuration,
            sourceOptions.getSourcesArray(), sourceOptions.getArgsArray());
    this.runner.compileAndRun();

    return ExitStatus.OK;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArchiveCommand.java   
@Override
protected ExitStatus run(OptionSet options) throws Exception {
    List<?> nonOptionArguments = new ArrayList<Object>(
            options.nonOptionArguments());
    Assert.isTrue(nonOptionArguments.size() >= 2, "The name of the resulting "
            + this.type + " and at least one source file must be specified");

    File output = new File((String) nonOptionArguments.remove(0));
    Assert.isTrue(output.getName().toLowerCase().endsWith("." + this.type),
            "The output '" + output + "' is not a " + this.type.toUpperCase()
                    + " file.");
    deleteIfExists(output);

    GroovyCompiler compiler = createCompiler(options);

    List<URL> classpath = getClassPathUrls(compiler);
    List<MatchedResource> classpathEntries = findMatchingClasspathEntries(
            classpath, options);

    String[] sources = new SourceOptions(nonOptionArguments).getSourcesArray();
    Class<?>[] compiledClasses = compiler.compile(sources);

    List<URL> dependencies = getClassPathUrls(compiler);
    dependencies.removeAll(classpath);

    writeJar(output, compiledClasses, classpathEntries, dependencies);
    return ExitStatus.OK;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:TestCommand.java   
@Override
protected ExitStatus run(OptionSet options) throws Exception {
    SourceOptions sourceOptions = new SourceOptions(options);
    TestRunnerConfiguration configuration = new TestRunnerConfigurationAdapter(
            options, this);
    this.runner = new TestRunner(configuration, sourceOptions.getSourcesArray(),
            sourceOptions.getArgsArray());
    this.runner.compileAndRunTests();
    return ExitStatus.OK.hangup();
}
项目:spring-boot-concourse    文件:ArchiveCommand.java   
@Override
protected ExitStatus run(OptionSet options) throws Exception {
    List<?> nonOptionArguments = new ArrayList<Object>(
            options.nonOptionArguments());
    Assert.isTrue(nonOptionArguments.size() >= 2, "The name of the resulting "
            + this.type + " and at least one source file must be specified");

    File output = new File((String) nonOptionArguments.remove(0));
    Assert.isTrue(output.getName().toLowerCase().endsWith("." + this.type),
            "The output '" + output + "' is not a " + this.type.toUpperCase()
                    + " file.");
    deleteIfExists(output);

    GroovyCompiler compiler = createCompiler(options);

    List<URL> classpath = getClassPathUrls(compiler);
    List<MatchedResource> classpathEntries = findMatchingClasspathEntries(
            classpath, options);

    String[] sources = new SourceOptions(nonOptionArguments).getSourcesArray();
    Class<?>[] compiledClasses = compiler.compile(sources);

    List<URL> dependencies = getClassPathUrls(compiler);
    dependencies.removeAll(classpath);

    writeJar(output, compiledClasses, classpathEntries, dependencies);
    return ExitStatus.OK;
}
项目:spring-boot-concourse    文件:TestCommand.java   
@Override
protected ExitStatus run(OptionSet options) throws Exception {
    SourceOptions sourceOptions = new SourceOptions(options);
    TestRunnerConfiguration configuration = new TestRunnerConfigurationAdapter(
            options, this);
    this.runner = new TestRunner(configuration, sourceOptions.getSourcesArray(),
            sourceOptions.getArgsArray());
    this.runner.compileAndRunTests();
    return ExitStatus.OK.hangup();
}
项目:contestparser    文件:ArchiveCommand.java   
@Override
protected ExitStatus run(OptionSet options) throws Exception {
    List<?> nonOptionArguments = new ArrayList<Object>(
            options.nonOptionArguments());
    Assert.isTrue(nonOptionArguments.size() >= 2, "The name of the resulting "
            + this.type + " and at least one source file must be specified");

    File output = new File((String) nonOptionArguments.remove(0));
    Assert.isTrue(output.getName().toLowerCase().endsWith("." + this.type),
            "The output '" + output + "' is not a " + this.type.toUpperCase()
                    + " file.");
    deleteIfExists(output);

    GroovyCompiler compiler = createCompiler(options);

    List<URL> classpath = getClassPathUrls(compiler);
    List<MatchedResource> classpathEntries = findMatchingClasspathEntries(
            classpath, options);

    String[] sources = new SourceOptions(nonOptionArguments).getSourcesArray();
    Class<?>[] compiledClasses = compiler.compile(sources);

    List<URL> dependencies = getClassPathUrls(compiler);
    dependencies.removeAll(classpath);

    writeJar(output, compiledClasses, classpathEntries, dependencies);
    return ExitStatus.OK;
}
项目:contestparser    文件:TestCommand.java   
@Override
protected ExitStatus run(OptionSet options) throws Exception {
    SourceOptions sourceOptions = new SourceOptions(options);
    TestRunnerConfiguration configuration = new TestRunnerConfigurationAdapter(
            options, this);
    this.runner = new TestRunner(configuration, sourceOptions.getSourcesArray(),
            sourceOptions.getArgsArray());
    this.runner.compileAndRunTests();
    return ExitStatus.OK.hangup();
}