本文整理汇总了Java中org.gradle.jvm.JvmLibrarySpec类的典型用法代码示例。如果您正苦于以下问题:Java JvmLibrarySpec类的具体用法?Java JvmLibrarySpec怎么用?Java JvmLibrarySpec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JvmLibrarySpec类属于org.gradle.jvm包,在下文中一共展示了JvmLibrarySpec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createJarBinarySpecLocalComponentMetaData
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void createJarBinarySpecLocalComponentMetaData(EnumMap<UsageKind, List<PublishArtifact>> artifacts, JarBinarySpecInternal jarBinarySpec, EnumMap<UsageKind, Iterable<DependencySpec>> dependenciesPerUsage, boolean toAssembly) {
JarFile apiJar = jarBinarySpec.getApiJar();
configureUsageMetadata(UsageKind.API,
jarBinarySpec.getApiDependencies(),
dependenciesPerUsage);
JarFile runtimeJar = jarBinarySpec.getRuntimeJar();
JvmLibrarySpec library = jarBinarySpec.getLibrary();
configureUsageMetadata(UsageKind.RUNTIME,
library != null ? collectDependencies(jarBinarySpec, library, library.getDependencies().getDependencies(), jarBinarySpec.getApiDependencies()) : Collections.<DependencySpec>emptyList(),
dependenciesPerUsage);
if (!toAssembly) {
addArtifact(UsageKind.API, apiJar, artifacts);
addArtifact(UsageKind.RUNTIME, runtimeJar, artifacts);
}
}
示例2: execute
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
public void execute(JvmLibrarySpec jvmLibrary) {
List<String> targetPlatforms = jvmLibrary.getTargetPlatforms();
// TODO:DAZ We should have a generic (JVM + Native) way to get the 'best' platform to build when no target is defined.
// This logic needs to inspect the available platforms and find the closest one matching the current platform
if (targetPlatforms.isEmpty()) {
targetPlatforms = Collections.singletonList(new DefaultJavaPlatform(JavaVersion.current()).getName());
}
List<JavaPlatform> selectedPlatforms = platforms.select(JavaPlatform.class, targetPlatforms);
for (JavaPlatform platform: selectedPlatforms) {
JavaToolChain toolChain = toolChains.getForPlatform(platform);
BinaryNamingSchemeBuilder componentBuilder = namingSchemeBuilder
.withComponentName(jvmLibrary.getName())
.withTypeString("jar");
if (selectedPlatforms.size() > 1) { //Only add variant dimension for multiple jdk targets to avoid breaking the default naming scheme
componentBuilder = componentBuilder.withVariantDimension(platform.getName());
}
BinaryNamingScheme namingScheme = componentBuilder.build(); //TODO freekh: move out?
factory.createJarBinaries(jvmLibrary, namingScheme, toolChain, platform); //TODO: createJarBinaries is mutable! We should not be doing this - execute could return a list instead
}
}
示例3: apply
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
public void apply(final Project project) {
project.getPlugins().apply(ComponentModelBasePlugin.class);
ComponentSpecContainer componentSpecs = project.getExtensions().getByType(ComponentSpecContainer.class);
final ProjectSourceSet sources = project.getExtensions().getByType(ProjectSourceSet.class);
componentSpecs.registerFactory(JvmLibrarySpec.class, new NamedDomainObjectFactory<JvmLibrarySpec>() {
public JvmLibrarySpec create(String name) {
ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(project.getPath(), name);
return new DefaultJvmLibrarySpec(id, sources.maybeCreate(name));
}
});
final NamedDomainObjectContainer<JvmLibrarySpec> jvmLibraries = componentSpecs.containerWithType(JvmLibrarySpec.class);
project.getExtensions().create("jvm", DefaultJvmComponentExtension.class, jvmLibraries);
}
示例4: createBinaries
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
@Mutate
public void createBinaries(BinaryContainer binaries, PlatformContainer platforms, BinaryNamingSchemeBuilder namingSchemeBuilder,
NamedDomainObjectCollection<JvmLibrarySpec> libraries, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) {
Instantiator instantiator = serviceRegistry.get(Instantiator.class);
List<Action<? super JarBinarySpec>> actions = Lists.newArrayList();
actions.add(new JarBinarySpecInitializer(buildDir));
actions.add(new MarkBinariesBuildable());
Action<JarBinarySpec> initAction = Actions.composite(actions);
JarBinariesFactory factory = new DefaultJarBinariesFactory(instantiator, initAction);
Action<JvmLibrarySpec> createBinariesAction =
new JvmLibrarySpecInitializer(factory, namingSchemeBuilder, toolChains, platforms);
for (JvmLibrarySpec jvmLibrary : libraries) {
createBinariesAction.execute(jvmLibrary);
binaries.addAll(jvmLibrary.getBinaries());
}
}
示例5: getLibrary
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
@Override
public JvmLibrarySpec getLibrary() {
return getComponentAs(JvmLibrarySpec.class);
}
示例6: register
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
@ComponentType
public void register(TypeBuilder<JvmLibrarySpec> builder) {
builder.defaultImplementation(DefaultJvmLibrarySpec.class);
builder.internalView(JvmLibrarySpecInternal.class);
}
示例7: namingSchemeFor
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
private BinaryNamingScheme namingSchemeFor(JvmLibrarySpec jvmLibrary, List<JavaPlatform> selectedPlatforms, JavaPlatform platform) {
return DefaultBinaryNamingScheme.component(jvmLibrary.getName())
.withBinaryType("Jar")
.withRole("jar", true)
.withVariantDimension(platform, selectedPlatforms);
}
示例8: createJarBinaries
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
public void createJarBinaries(JvmLibrarySpec jvmLibrary, BinaryNamingScheme namingScheme, JavaToolChain toolChain, JavaPlatform platform) {
DefaultJarBinarySpec jarBinary = instantiator.newInstance(DefaultJarBinarySpec.class, jvmLibrary, namingScheme, toolChain, platform);
setupDefaults(jarBinary);
jarBinary.source(jvmLibrary.getSource());
jvmLibrary.getBinaries().add(jarBinary);
}
示例9: DefaultJarBinarySpec
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
public DefaultJarBinarySpec(JvmLibrarySpec library, BinaryNamingScheme namingScheme, JavaToolChain toolChain, JavaPlatform platform) {
this.library = library;
this.namingScheme = namingScheme;
this.toolChain = toolChain;
this.platform = platform;
}
示例10: getLibrary
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
public JvmLibrarySpec getLibrary() {
return library;
}
示例11: DefaultJvmComponentExtension
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
public DefaultJvmComponentExtension(NamedDomainObjectContainer<JvmLibrarySpec> libraries) {
this.libraries = libraries;
}
示例12: getLibraries
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
public NamedDomainObjectContainer<JvmLibrarySpec> getLibraries() {
return libraries;
}
示例13: libraries
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
public void libraries(Action<? super NamedDomainObjectContainer<? super JvmLibrarySpec>> action) {
action.execute(libraries);
}
示例14: jvmLibraries
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
@Model
NamedDomainObjectCollection<JvmLibrarySpec> jvmLibraries(ComponentSpecContainer components) {
return components.withType(JvmLibrarySpec.class);
}
示例15: addLibrarySourceSets
import org.gradle.jvm.JvmLibrarySpec; //导入依赖的package包/类
@Defaults
public void addLibrarySourceSets(@Each JvmLibrarySpec component) {
component.getSources().create("clojure", ClojureSourceSet.class);
}