Java 类org.springframework.boot.loader.tools.LibraryScope 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ProjectLibraries.java   
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
    Set<GradleLibrary> custom = getLibraries(this.customConfigurationName,
            LibraryScope.CUSTOM);
    if (custom != null) {
        libraries(custom, callback);
    }
    else {
        Set<GradleLibrary> runtime = getLibraries("runtime", LibraryScope.RUNTIME);
        Set<GradleLibrary> provided = getLibraries(this.providedConfigurationName,
                LibraryScope.PROVIDED);
        if (provided != null) {
            runtime = minus(runtime, provided);
        }
        libraries(runtime, callback);
        libraries(provided, callback);
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ProjectLibraries.java   
private Set<GradleLibrary> getLibrariesForFileDependencies(
        Configuration configuration, LibraryScope scope) {
    Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
    for (Dependency dependency : configuration.getIncoming().getDependencies()) {
        if (dependency instanceof FileCollectionDependency) {
            FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
            for (File file : fileDependency.resolve()) {
                libraries.add(
                        new GradleLibrary(fileDependency.getGroup(), file, scope));
            }
        }
        else if (dependency instanceof ProjectDependency) {
            ProjectDependency projectDependency = (ProjectDependency) dependency;
            libraries.addAll(getLibrariesForFileDependencies(
                    projectDependency.getProjectConfiguration(), scope));
        }
    }
    return libraries;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArtifactsLibraries.java   
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
    Set<String> duplicates = getDuplicates(this.artifacts);
    for (Artifact artifact : this.artifacts) {
        LibraryScope scope = SCOPES.get(artifact.getScope());
        if (scope != null && artifact.getFile() != null) {
            String name = artifact.getFile().getName();
            if (duplicates.contains(name)) {
                this.log.debug("Duplicate found: " + name);
                name = artifact.getGroupId() + "-" + name;
                this.log.debug("Renamed to: " + name);
            }
            callback.library(new Library(name, artifact.getFile(), scope,
                    isUnpackRequired(artifact)));
        }
    }
}
项目:spring-boot-concourse    文件:ProjectLibraries.java   
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
    Set<GradleLibrary> custom = getLibraries(this.customConfigurationName,
            LibraryScope.CUSTOM);
    if (custom != null) {
        libraries(custom, callback);
    }
    else {
        Set<GradleLibrary> runtime = getLibraries("runtime", LibraryScope.RUNTIME);
        Set<GradleLibrary> provided = getLibraries(this.providedConfigurationName,
                LibraryScope.PROVIDED);
        if (provided != null) {
            runtime = minus(runtime, provided);
        }
        libraries(runtime, callback);
        libraries(provided, callback);
    }
}
项目:spring-boot-concourse    文件:ProjectLibraries.java   
private Set<GradleLibrary> getLibrariesForFileDependencies(
        Configuration configuration, LibraryScope scope) {
    Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
    for (Dependency dependency : configuration.getIncoming().getDependencies()) {
        if (dependency instanceof FileCollectionDependency) {
            FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
            for (File file : fileDependency.resolve()) {
                libraries.add(
                        new GradleLibrary(fileDependency.getGroup(), file, scope));
            }
        }
        else if (dependency instanceof ProjectDependency) {
            ProjectDependency projectDependency = (ProjectDependency) dependency;
            libraries.addAll(getLibrariesForFileDependencies(
                    projectDependency.getProjectConfiguration(), scope));
        }
    }
    return libraries;
}
项目:spring-boot-concourse    文件:ArtifactsLibraries.java   
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
    Set<String> duplicates = getDuplicates(this.artifacts);
    for (Artifact artifact : this.artifacts) {
        LibraryScope scope = SCOPES.get(artifact.getScope());
        if (scope != null && artifact.getFile() != null) {
            String name = artifact.getFile().getName();
            if (duplicates.contains(name)) {
                this.log.debug("Duplicate found: " + name);
                name = artifact.getGroupId() + "-" + name;
                this.log.debug("Renamed to: " + name);
            }
            callback.library(new Library(name, artifact.getFile(), scope,
                    isUnpackRequired(artifact)));
        }
    }
}
项目:cft    文件:JarArchivingUIHandler.java   
protected void bootRepackage(final IPackageFragmentRoot[] roots, File packagedFile) throws CoreException {
    Repackager bootRepackager = new Repackager(packagedFile);
    try {
        bootRepackager.repackage(new Libraries() {

            public void doWithLibraries(LibraryCallback callBack) throws IOException {
                for (IPackageFragmentRoot root : roots) {

                    if (root.isArchive()) {

                        File rootFile = new File(root.getPath().toOSString());
                        if (rootFile.exists()) {
                            callBack.library(new Library(rootFile, LibraryScope.COMPILE));
                        }
                    }
                }
            }
        });
    } catch (IOException e) {
        errorHandler.handleApplicationDeploymentFailure(
                NLS.bind(Messages.JavaCloudFoundryArchiver_ERROR_REPACKAGE_SPRING, e.getMessage()));
    }
}
项目:contestparser    文件:ProjectLibraries.java   
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
    Set<GradleLibrary> custom = getLibraries(this.customConfigurationName,
            LibraryScope.CUSTOM);
    if (custom != null) {
        libraries(custom, callback);
    }
    else {
        Set<GradleLibrary> compile = getLibraries("compile", LibraryScope.COMPILE);
        Set<GradleLibrary> runtime = getLibraries("runtime", LibraryScope.RUNTIME);
        runtime = minus(runtime, compile);
        Set<GradleLibrary> provided = getLibraries(this.providedConfigurationName,
                LibraryScope.PROVIDED);
        if (provided != null) {
            compile = minus(compile, provided);
            runtime = minus(runtime, provided);
        }
        libraries(compile, callback);
        libraries(runtime, callback);
        libraries(provided, callback);
    }
}
项目:contestparser    文件:ProjectLibraries.java   
private Set<GradleLibrary> getLibrariesForFileDependencies(
        Configuration configuration, LibraryScope scope) {
    Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
    for (Dependency dependency : configuration.getIncoming().getDependencies()) {
        if (dependency instanceof FileCollectionDependency) {
            FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
            for (File file : fileDependency.resolve()) {
                libraries.add(
                        new GradleLibrary(fileDependency.getGroup(), file, scope));
            }
        }
        else if (dependency instanceof ProjectDependency) {
            ProjectDependency projectDependency = (ProjectDependency) dependency;
            libraries.addAll(getLibrariesForFileDependencies(
                    projectDependency.getProjectConfiguration(), scope));
        }
    }
    return libraries;
}
项目:contestparser    文件:ArtifactsLibraries.java   
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
    Set<String> duplicates = getDuplicates(this.artifacts);
    for (Artifact artifact : this.artifacts) {
        LibraryScope scope = SCOPES.get(artifact.getScope());
        if (scope != null && artifact.getFile() != null) {
            String name = artifact.getFile().getName();
            if (duplicates.contains(name)) {
                this.log.debug("Duplicate found: " + name);
                name = artifact.getGroupId() + "-" + name;
                this.log.debug("Renamed to: " + name);
            }
            callback.library(new Library(name, artifact.getFile(), scope,
                    isUnpackRequired(artifact)));
        }
    }
}
项目:syndesis    文件:ModuleLayoutFactory.java   
@Override
public Layout getLayout(File file) {
    return new Layout() {
        @Override
        public String getLauncherClassName() {
            return null;
        }

        @Override
        public String getLibraryDestination(String libraryName, LibraryScope scope) {
            if (LIB_DESTINATION_SCOPES.contains(scope)) {
                return "lib/";
            }

            return null;
        }

        @Override
        public String getClassesLocation() {
            return null;
        }

        @Override
        public boolean isExecutable() {
            return false;
        }
    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:WarCommand.java   
@Override
protected LibraryScope getLibraryScope(File file) {
    String fileName = file.getName();
    if (fileName.contains("tomcat-embed")
            || fileName.contains("spring-boot-starter-tomcat")) {
        return LibraryScope.PROVIDED;
    }
    return LibraryScope.COMPILE;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArchiveCommand.java   
private List<Library> addClasspathEntries(JarWriter writer,
        List<MatchedResource> entries) throws IOException {
    List<Library> libraries = new ArrayList<Library>();
    for (MatchedResource entry : entries) {
        if (entry.isRoot()) {
            libraries.add(new Library(entry.getFile(), LibraryScope.COMPILE));
        }
        else {
            writer.writeEntry(entry.getName(),
                    new FileInputStream(entry.getFile()));
        }
    }
    return libraries;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ProjectLibraries.java   
private Set<GradleLibrary> getLibraries(String configurationName,
        LibraryScope scope) {
    Configuration configuration = (configurationName == null ? null
            : this.project.getConfigurations().findByName(configurationName));
    if (configuration == null) {
        return null;
    }
    Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
    for (ResolvedArtifact artifact : configuration.getResolvedConfiguration()
            .getResolvedArtifacts()) {
        libraries.add(new ResolvedArtifactLibrary(artifact, scope));
    }
    libraries.addAll(getLibrariesForFileDependencies(configuration, scope));
    return libraries;
}
项目:syndesis-rest    文件:ModuleLayoutFactory.java   
@Override
public Layout getLayout(File file) {
    return new Layout() {
        @Override
        public String getLauncherClassName() {
            return null;
        }

        @Override
        public String getLibraryDestination(String libraryName, LibraryScope scope) {
            if (LIB_DESTINATION_SCOPES.contains(scope)) {
                return "lib/";
            }

            return null;
        }

        @Override
        public String getClassesLocation() {
            return null;
        }

        @Override
        public boolean isExecutable() {
            return false;
        }
    };
}
项目:spring-boot-concourse    文件:WarCommand.java   
@Override
protected LibraryScope getLibraryScope(File file) {
    String fileName = file.getName();
    if (fileName.contains("tomcat-embed")
            || fileName.contains("spring-boot-starter-tomcat")) {
        return LibraryScope.PROVIDED;
    }
    return LibraryScope.COMPILE;
}
项目:spring-boot-concourse    文件:ArchiveCommand.java   
private List<Library> addClasspathEntries(JarWriter writer,
        List<MatchedResource> entries) throws IOException {
    List<Library> libraries = new ArrayList<Library>();
    for (MatchedResource entry : entries) {
        if (entry.isRoot()) {
            libraries.add(new Library(entry.getFile(), LibraryScope.COMPILE));
        }
        else {
            writer.writeEntry(entry.getName(),
                    new FileInputStream(entry.getFile()));
        }
    }
    return libraries;
}
项目:spring-boot-concourse    文件:ProjectLibraries.java   
private Set<GradleLibrary> getLibraries(String configurationName,
        LibraryScope scope) {
    Configuration configuration = (configurationName == null ? null
            : this.project.getConfigurations().findByName(configurationName));
    if (configuration == null) {
        return null;
    }
    Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
    for (ResolvedArtifact artifact : configuration.getResolvedConfiguration()
            .getResolvedArtifacts()) {
        libraries.add(new ResolvedArtifactLibrary(artifact, scope));
    }
    libraries.addAll(getLibrariesForFileDependencies(configuration, scope));
    return libraries;
}
项目:contestparser    文件:WarCommand.java   
@Override
protected LibraryScope getLibraryScope(File file) {
    String fileName = file.getName();
    if (fileName.contains("tomcat-embed")
            || fileName.contains("spring-boot-starter-tomcat")) {
        return LibraryScope.PROVIDED;
    }
    return LibraryScope.COMPILE;
}
项目:contestparser    文件:ArchiveCommand.java   
private List<Library> addClasspathEntries(JarWriter writer,
        List<MatchedResource> entries) throws IOException {
    List<Library> libraries = new ArrayList<Library>();
    for (MatchedResource entry : entries) {
        if (entry.isRoot()) {
            libraries.add(new Library(entry.getFile(), LibraryScope.COMPILE));
        }
        else {
            writer.writeEntry(entry.getName(),
                    new FileInputStream(entry.getFile()));
        }
    }
    return libraries;
}
项目:contestparser    文件:ProjectLibraries.java   
private Set<GradleLibrary> getLibraries(String configurationName,
        LibraryScope scope) {
    Configuration configuration = (configurationName == null ? null
            : this.project.getConfigurations().findByName(configurationName));
    if (configuration == null) {
        return null;
    }
    Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
    for (ResolvedArtifact artifact : configuration.getResolvedConfiguration()
            .getResolvedArtifacts()) {
        libraries.add(new ResolvedArtifactLibrary(artifact, scope));
    }
    libraries.addAll(getLibrariesForFileDependencies(configuration, scope));
    return libraries;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JarCommand.java   
@Override
protected LibraryScope getLibraryScope(File file) {
    return LibraryScope.COMPILE;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ProjectLibraries.java   
GradleLibrary(String group, File file, LibraryScope scope) {
    super(file, scope);
    this.group = group;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ProjectLibraries.java   
ResolvedArtifactLibrary(ResolvedArtifact artifact, LibraryScope scope) {
    super(artifact.getModuleVersion().getId().getGroup(), artifact.getFile(),
            scope);
    this.artifact = artifact;
}
项目:spring-boot-concourse    文件:JarCommand.java   
@Override
protected LibraryScope getLibraryScope(File file) {
    return LibraryScope.COMPILE;
}
项目:spring-boot-concourse    文件:ProjectLibraries.java   
GradleLibrary(String group, File file, LibraryScope scope) {
    super(file, scope);
    this.group = group;
}
项目:spring-boot-concourse    文件:ProjectLibraries.java   
ResolvedArtifactLibrary(ResolvedArtifact artifact, LibraryScope scope) {
    super(artifact.getModuleVersion().getId().getGroup(), artifact.getFile(),
            scope);
    this.artifact = artifact;
}
项目:contestparser    文件:JarCommand.java   
@Override
protected LibraryScope getLibraryScope(File file) {
    return LibraryScope.COMPILE;
}
项目:contestparser    文件:ProjectLibraries.java   
GradleLibrary(String group, File file, LibraryScope scope) {
    super(file, scope);
    this.group = group;
}
项目:contestparser    文件:ProjectLibraries.java   
ResolvedArtifactLibrary(ResolvedArtifact artifact, LibraryScope scope) {
    super(artifact.getModuleVersion().getId().getGroup(), artifact.getFile(),
            scope);
    this.artifact = artifact;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArchiveCommand.java   
protected abstract LibraryScope getLibraryScope(File file);
项目:spring-boot-concourse    文件:ArchiveCommand.java   
protected abstract LibraryScope getLibraryScope(File file);
项目:contestparser    文件:ArchiveCommand.java   
protected abstract LibraryScope getLibraryScope(File file);