org.gradle.api.model.ObjectFactory Java Examples
The following examples show how to use
org.gradle.api.model.ObjectFactory.
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: DefaultAvroExtension.java From gradle-avro-plugin with Apache License 2.0 | 6 votes |
@Inject public DefaultAvroExtension(ObjectFactory objects) { this.outputCharacterEncoding = objects.property(String.class); this.stringType = objects.property(String.class).convention(DEFAULT_STRING_TYPE); this.fieldVisibility = objects.property(String.class).convention(DEFAULT_FIELD_VISIBILITY); this.templateDirectory = objects.property(String.class); this.createSetters = objects.property(Boolean.class).convention(DEFAULT_CREATE_SETTERS); this.createOptionalGetters = objects.property(Boolean.class).convention(DEFAULT_CREATE_OPTIONAL_GETTERS); this.gettersReturnOptional = objects.property(Boolean.class).convention(DEFAULT_GETTERS_RETURN_OPTIONAL); this.optionalGettersForNullableFieldsOnly = objects.property(Boolean.class) .convention(DEFAULT_OPTIONAL_GETTERS_FOR_NULLABLE_FIELDS_ONLY); this.enableDecimalLogicalType = objects.property(Boolean.class).convention(DEFAULT_ENABLE_DECIMAL_LOGICAL_TYPE); this.logicalTypeFactories = objects.mapProperty(String.class, Constants.LOGICAL_TYPE_FACTORY_TYPE.getConcreteClass()) .convention(DEFAULT_LOGICAL_TYPE_FACTORIES); this.customConversions = objects.listProperty(Constants.CONVERSION_TYPE.getConcreteClass()).convention(DEFAULT_CUSTOM_CONVERSIONS); }
Example #2
Source File: GenerateAvroJavaTask.java From gradle-avro-plugin with Apache License 2.0 | 6 votes |
@Inject public GenerateAvroJavaTask(ObjectFactory objects) { super(); this.outputCharacterEncoding = objects.property(String.class); this.stringType = objects.property(String.class).convention(DEFAULT_STRING_TYPE); this.fieldVisibility = objects.property(String.class).convention(DEFAULT_FIELD_VISIBILITY); this.templateDirectory = objects.property(String.class); this.createOptionalGetters = objects.property(Boolean.class).convention(DEFAULT_CREATE_OPTIONAL_GETTERS); this.gettersReturnOptional = objects.property(Boolean.class).convention(DEFAULT_GETTERS_RETURN_OPTIONAL); this.optionalGettersForNullableFieldsOnly = objects.property(Boolean.class) .convention(DEFAULT_OPTIONAL_GETTERS_FOR_NULLABLE_FIELDS_ONLY); this.createSetters = objects.property(Boolean.class).convention(DEFAULT_CREATE_SETTERS); this.enableDecimalLogicalType = objects.property(Boolean.class).convention(DEFAULT_ENABLE_DECIMAL_LOGICAL_TYPE); this.stringTypeProvider = getStringType() .map(input -> Enums.parseCaseInsensitive(OPTION_STRING_TYPE, StringType.values(), input)); this.fieldVisibilityProvider = getFieldVisibility() .map(input -> Enums.parseCaseInsensitive(OPTION_FIELD_VISIBILITY, FieldVisibility.values(), input)); this.logicalTypeFactories = objects.mapProperty(String.class, Constants.LOGICAL_TYPE_FACTORY_TYPE.getConcreteClass()) .convention(DEFAULT_LOGICAL_TYPE_FACTORIES); this.customConversions = objects.listProperty(Constants.CONVERSION_TYPE.getConcreteClass()).convention(DEFAULT_CUSTOM_CONVERSIONS); this.resolver = new SchemaResolver(getProject(), getLogger()); }
Example #3
Source File: ServerExtension.java From curiostack with MIT License | 6 votes |
static ModifiableAutoDeployment create( String name, ObjectFactory objects, ServerExtension serverExtension) { var deployment = objects .newInstance(ModifiableAutoDeployment.class) .setName(name) .setNamespace(objects.property(String.class).value("default")) .setDeployment(objects.property(String.class)) .setAutoDeploy(objects.property(Boolean.class).value(false)); deployment .getDeployment() .set(serverExtension.getBaseName().map(baseName -> baseName + '-' + name)); return deployment; }
Example #4
Source File: CppPublicMacrosPlugin.java From native-samples with Apache License 2.0 | 6 votes |
private static Configuration createConfiguration(ConfigurationContainer configurations, ObjectFactory objectFactory) { return configurations.create("cppPublicMacros", new Action<Configuration>() { @Override public void execute(Configuration configuration) { configurations.all(new Action<Configuration>() { @Override public void execute(Configuration it) { if (it.getName().toLowerCase().endsWith("implementation")) { configuration.extendsFrom(it); } } }); configuration.setCanBeConsumed(false); configuration.setCanBeResolved(true); configuration.getAttributes().attribute(Usage.USAGE_ATTRIBUTE, objectFactory.named(Usage.class, "cpp-public-macros")); } }); }
Example #5
Source File: CppPublicMacrosPlugin.java From native-samples with Apache License 2.0 | 6 votes |
private static Configuration createElementsConfiguration(ConfigurationContainer configurations, ObjectFactory objectFactory) { return configurations.create("cppPublicMacrosElements", new Action<Configuration>() { @Override public void execute(Configuration configuration) { configurations.all(new Action<Configuration>() { @Override public void execute(Configuration it) { if (it.getName().toLowerCase().endsWith("implementation")) { configuration.extendsFrom(it); } } }); configuration.setCanBeConsumed(true); configuration.setCanBeResolved(false); configuration.getAttributes().attribute(Usage.USAGE_ATTRIBUTE, objectFactory.named(Usage.class, "cpp-public-macros")); } }); }
Example #6
Source File: GitPublishPush.java From gradle-git-publish with Apache License 2.0 | 6 votes |
@Inject public GitPublishPush(ObjectFactory objectFactory) { this.grgit = objectFactory.property(Grgit.class); this.branch = objectFactory.property(String.class); // always consider this task out of date this.getOutputs().upToDateWhen(t -> false); this.onlyIf(t -> { try { Grgit git = getGrgit().get(); BranchStatus status = git.getBranch().status(op -> { op.setName(getBranch().get()); }); return status.getAheadCount() > 0; } catch (IllegalStateException e) { // if we're not tracking anything yet (i.e. orphan) we need to push return true; } }); }
Example #7
Source File: AjcAction.java From gradle-plugins with MIT License | 5 votes |
@Inject public AjcAction(ObjectFactory objectFactory, JavaExecHandleFactory javaExecHandleFactory) { options = new AspectJCompileOptions(objectFactory); classpath = objectFactory.fileCollection(); additionalInpath = objectFactory.fileCollection(); enabled = objectFactory.property(Boolean.class).convention(true); this.javaExecHandleFactory = javaExecHandleFactory; }
Example #8
Source File: GitPublishReset.java From gradle-git-publish with Apache License 2.0 | 5 votes |
@Inject public GitPublishReset(ProjectLayout layout, ObjectFactory objectFactory) { this.grgit = objectFactory.property(Grgit.class); this.repoDirectory = getProject().getObjects().directoryProperty(); this.repoUri = objectFactory.property(String.class); this.referenceRepoUri = objectFactory.property(String.class); this.branch = objectFactory.property(String.class); // always consider this task out of date this.getOutputs().upToDateWhen(t -> false); }
Example #9
Source File: Jdk.java From crate with Apache License 2.0 | 5 votes |
Jdk(String name, Configuration configuration, ObjectFactory objectFactory) { this.name = name; this.configuration = configuration; this.vendor = objectFactory.property(String.class); this.version = objectFactory.property(String.class); this.arch = objectFactory.property(String.class); this.os = objectFactory.property(String.class); }
Example #10
Source File: DownloadWebDriver.java From zap-extensions with Apache License 2.0 | 5 votes |
@Inject public DownloadWebDriver(WorkerExecutor workerExecutor) { this.workerExecutor = workerExecutor; ObjectFactory objects = getProject().getObjects(); this.browser = objects.property(Browser.class); this.version = objects.property(String.class); this.os = objects.property(OS.class); this.arch = objects.property(Arch.class); this.outputFile = objects.fileProperty(); }
Example #11
Source File: JSassExtension.java From gradle-plugins with MIT License | 5 votes |
@Inject public JSassExtension(ObjectFactory objectFactory) { indent = objectFactory.property(String.class); indent.convention(" "); linefeed = objectFactory.property(String.class); linefeed.convention(System.lineSeparator()); omitSourceMapUrl = objectFactory.property(Boolean.class); omitSourceMapUrl.convention(false); outputStyle = objectFactory.property(OutputStyle.class); outputStyle.convention(OutputStyle.NESTED); precision = objectFactory.property(Integer.class); precision.convention(8); sourceComments = objectFactory.property(Boolean.class); sourceComments.convention(false); sourceMapContents = objectFactory.property(Boolean.class); sourceMapContents.convention(false); sourceMapEmbed = objectFactory.property(Boolean.class); sourceMapEmbed.convention(false); sourceMapEnabled = objectFactory.property(Boolean.class); sourceMapEnabled.convention(true); ExtraPropertiesExtension extraProperties = new DslObject(this).getExtensions().getExtraProperties(); for (OutputStyle value : OutputStyle.values()) { extraProperties.set(value.name(), value); } }
Example #12
Source File: DefaultAspectjSourceSet.java From gradle-plugins with MIT License | 5 votes |
public DefaultAspectjSourceSet(ObjectFactory objectFactory, SourceSet sourceSet) { super(sourceSet); String name = sourceSet.getName(); String displayName = ((DefaultSourceSet) sourceSet).getDisplayName(); aspectj = objectFactory.sourceDirectorySet("aspectj", displayName + " AspectJ source"); aspectj.getFilter().include("**/*.java", "**/*.aj"); allAspectj = objectFactory.sourceDirectorySet("all" + name, displayName + " AspectJ source"); allAspectj.source(aspectj); allAspectj.getFilter().include("**/*.aj"); }
Example #13
Source File: AspectJCompileOptions.java From gradle-plugins with MIT License | 5 votes |
@Inject public AspectJCompileOptions(ObjectFactory objectFactory) { inpath = objectFactory.fileCollection(); aspectpath = objectFactory.fileCollection(); outjar = objectFactory.fileProperty(); outxml = objectFactory.property(Boolean.class).convention(false); outxmlfile = objectFactory.property(String.class); sourceroots = objectFactory.fileCollection(); crossrefs = objectFactory.property(Boolean.class).convention(false); bootclasspath = objectFactory.fileCollection(); extdirs = objectFactory.fileCollection(); encoding = objectFactory.property(String.class); verbose = objectFactory.property(Boolean.class).convention(false); }
Example #14
Source File: WrappedNativeLibraryPlugin.java From native-samples with Apache License 2.0 | 5 votes |
public DefaultMainPublication(Provider<String> baseName, Usage apiUsage, Configuration api, ImmutableAttributesFactory immutableAttributesFactory, ObjectFactory objectFactory) { this.baseName = baseName; AttributeContainer publicationAttributes = immutableAttributesFactory.mutable(); publicationAttributes.attribute(Usage.USAGE_ATTRIBUTE, apiUsage); publicationAttributes.attribute(ArtifactAttributes.ARTIFACT_FORMAT, ZIP_TYPE); this.mainVariant = new MainLibraryVariant("api", apiUsage, api, publicationAttributes, objectFactory); }
Example #15
Source File: GithubExtension.java From gradle-plugins with MIT License | 5 votes |
@Inject public GithubExtension(ObjectFactory objectFactory) { slug = objectFactory.property(String.class); username = objectFactory.property(String.class); token = objectFactory.property(String.class); tag = objectFactory.property(String.class).convention("HEAD"); travis = objectFactory.property(Boolean.class); }
Example #16
Source File: CppPublicMacrosPlugin.java From native-samples with Apache License 2.0 | 5 votes |
private PublicMacrosVariantComponent(ObjectFactory objectFactory, String group, String name, String version, Configuration cppPublicMacrosElements) { this.objectFactory = objectFactory; this.group = group; this.name = name; this.version = version; this.cppPublicMacrosElements = cppPublicMacrosElements; }
Example #17
Source File: ContractVerifierExtension.java From spring-cloud-contract with Apache License 2.0 | 5 votes |
@Inject public ContractVerifierExtension(ProjectLayout layout, ObjectFactory objects) { this.testFramework = objects.property(TestFramework.class).convention(TestFramework.JUNIT5); this.testMode = objects.property(TestMode.class).convention(TestMode.MOCKMVC); this.basePackageForTests = objects.property(String.class); this.baseClassForTests = objects.property(String.class); this.nameSuffixForTests = objects.property(String.class); this.ruleClassForTests = objects.property(String.class); this.excludedFiles = objects.listProperty(String.class).convention(new ArrayList<>()); this.includedFiles = objects.listProperty(String.class).convention(new ArrayList<>()); this.ignoredFiles = objects.listProperty(String.class).convention(new ArrayList<>()); this.imports = objects.listProperty(String.class).convention(new ArrayList<>()); this.staticImports = objects.listProperty(String.class).convention(new ArrayList<>()); this.contractsDslDir = objects.directoryProperty().convention(layout.getProjectDirectory().dir("src/test/resources/contracts")); this.generatedTestSourcesDir = objects.directoryProperty().convention(layout.getBuildDirectory().dir("generated-test-sources/contracts")); this.generatedTestResourcesDir = objects.directoryProperty().convention(layout.getBuildDirectory().dir("generated-test-resources/contracts")); this.stubsOutputDir = objects.directoryProperty().convention(layout.getBuildDirectory().dir("stubs")); this.stubsSuffix = objects.property(String.class).convention("stubs"); this.assertJsonSize = objects.property(Boolean.class).convention(false); this.failOnNoContracts = objects.property(Boolean.class).convention(true); this.failOnInProgress = objects.property(Boolean.class).convention(true); this.contractRepository = objects.newInstance(ContractRepository.class); this.publishStubsToScm = objects.newInstance(PublishStubsToScm.class); this.contractDependency = objects.newInstance(Dependency.class); this.contractsPath = objects.property(String.class); this.contractsMode = objects.property(StubRunnerProperties.StubsMode.class).convention(StubRunnerProperties.StubsMode.CLASSPATH); this.packageWithBaseClasses = objects.property(String.class); this.baseClassMappings = objects.newInstance(BaseClassMapping.class); this.excludeBuildFolders = objects.property(Boolean.class).convention(false); this.contractsSnapshotCheckSkip = objects.property(Boolean.class).convention(false); this.deleteStubsAfterTest = objects.property(Boolean.class).convention(true); this.convertToYaml = objects.property(Boolean.class).convention(false); this.contractsProperties = objects.mapProperty(String.class, String.class).convention(new HashMap<>()); this.disableStubPublication = objects.property(Boolean.class).convention(false); this.sourceSet = objects.property(String.class); this.objects = objects; }
Example #18
Source File: ContractVerifierExtension.java From spring-cloud-contract with Apache License 2.0 | 5 votes |
@Inject public Dependency(ObjectFactory objects) { groupId = objects.property(String.class); artifactId = objects.property(String.class); version = objects.property(String.class); classifier = objects.property(String.class); stringNotation = objects.property(String.class); }
Example #19
Source File: AjcAction.java From gradle-plugins with MIT License | 5 votes |
@Inject public AjcAction(ObjectFactory objectFactory, JavaExecHandleFactory javaExecHandleFactory) { options = new AspectJCompileOptions(objectFactory); classpath = objectFactory.fileCollection(); additionalInpath = objectFactory.fileCollection(); enabled = objectFactory.property(Boolean.class).convention(true); this.javaExecHandleFactory = javaExecHandleFactory; }
Example #20
Source File: GithubExtension.java From gradle-plugins with MIT License | 5 votes |
@Inject public GithubExtension(ObjectFactory objectFactory) { slug = objectFactory.property(String.class); username = objectFactory.property(String.class); token = objectFactory.property(String.class); tag = objectFactory.property(String.class).convention("HEAD"); travis = objectFactory.property(Boolean.class); }
Example #21
Source File: AutotoolsExtension.java From native-samples with Apache License 2.0 | 5 votes |
@Inject public AutotoolsExtension(ObjectFactory objectFactory) { binary = objectFactory.property(String.class); includeDirectory = objectFactory.directoryProperty(); sourceDirectory = objectFactory.directoryProperty(); configureArguments = objectFactory.listProperty(String.class).empty(); makeArguments = objectFactory.listProperty(String.class).empty(); }
Example #22
Source File: JSassExtension.java From gradle-plugins with MIT License | 5 votes |
@Inject public JSassExtension(ObjectFactory objectFactory) { indent = objectFactory.property(String.class); indent.convention(" "); linefeed = objectFactory.property(String.class); linefeed.convention(System.lineSeparator()); omitSourceMapUrl = objectFactory.property(Boolean.class); omitSourceMapUrl.convention(false); outputStyle = objectFactory.property(OutputStyle.class); outputStyle.convention(OutputStyle.NESTED); precision = objectFactory.property(Integer.class); precision.convention(8); sourceComments = objectFactory.property(Boolean.class); sourceComments.convention(false); sourceMapContents = objectFactory.property(Boolean.class); sourceMapContents.convention(false); sourceMapEmbed = objectFactory.property(Boolean.class); sourceMapEmbed.convention(false); sourceMapEnabled = objectFactory.property(Boolean.class); sourceMapEnabled.convention(true); ExtraPropertiesExtension extraProperties = new DslObject(this).getExtensions().getExtraProperties(); for (OutputStyle value : OutputStyle.values()) { extraProperties.set(value.name(), value); } }
Example #23
Source File: CMakeExtension.java From native-samples with Apache License 2.0 | 5 votes |
@Inject public CMakeExtension(ProjectLayout projectLayout, ObjectFactory objectFactory) { binary = objectFactory.property(String.class); includeDirectory = objectFactory.directoryProperty(); projectDirectory = objectFactory.directoryProperty(); projectDirectory.set(projectLayout.getProjectDirectory()); includeDirectory.set(projectDirectory.dir("include")); }
Example #24
Source File: AutotoolsExtension.java From native-samples with Apache License 2.0 | 5 votes |
@Inject public AutotoolsExtension(ObjectFactory objectFactory) { binary = objectFactory.property(String.class); includeDirectory = objectFactory.directoryProperty(); sourceDirectory = objectFactory.directoryProperty(); configureArguments = objectFactory.listProperty(String.class).empty(); makeArguments = objectFactory.listProperty(String.class).empty(); }
Example #25
Source File: WrappedNativeLibraryPlugin.java From native-samples with Apache License 2.0 | 5 votes |
public DefaultMainPublication(Provider<String> baseName, Usage apiUsage, Configuration api, ImmutableAttributesFactory immutableAttributesFactory, ObjectFactory objectFactory) { this.baseName = baseName; AttributeContainer publicationAttributes = immutableAttributesFactory.mutable(); publicationAttributes.attribute(Usage.USAGE_ATTRIBUTE, apiUsage); publicationAttributes.attribute(ArtifactAttributes.ARTIFACT_FORMAT, ZIP_TYPE); this.mainVariant = new MainLibraryVariant("api", apiUsage, api, publicationAttributes, objectFactory); }
Example #26
Source File: CMakeExtension.java From native-samples with Apache License 2.0 | 5 votes |
@Inject public CMakeExtension(ProjectLayout projectLayout, ObjectFactory objectFactory) { binary = objectFactory.property(String.class); includeDirectory = objectFactory.directoryProperty(); projectDirectory = objectFactory.directoryProperty(); projectDirectory.set(projectLayout.getProjectDirectory()); includeDirectory.set(projectDirectory.dir("include")); }
Example #27
Source File: LaunchersTask.java From skara with GNU General Public License v2.0 | 5 votes |
@Inject public LaunchersTask(ObjectFactory factory) { toDir = factory.property(Path.class); os = factory.property(String.class); cpu = factory.property(String.class); launchers = factory.mapProperty(String.class, String.class); options = factory.listProperty(String.class); }
Example #28
Source File: AutotoolsExtension.java From native-samples with Apache License 2.0 | 5 votes |
@Inject public AutotoolsExtension(ObjectFactory objectFactory) { binary = objectFactory.property(String.class); includeDirectory = objectFactory.directoryProperty(); sourceDirectory = objectFactory.directoryProperty(); configureArguments = objectFactory.listProperty(String.class).empty(); makeArguments = objectFactory.listProperty(String.class).empty(); }
Example #29
Source File: WrappedNativeLibraryPlugin.java From native-samples with Apache License 2.0 | 5 votes |
public DefaultMainPublication(Provider<String> baseName, Usage apiUsage, Configuration api, ImmutableAttributesFactory immutableAttributesFactory, ObjectFactory objectFactory) { this.baseName = baseName; AttributeContainer publicationAttributes = immutableAttributesFactory.mutable(); publicationAttributes.attribute(Usage.USAGE_ATTRIBUTE, apiUsage); publicationAttributes.attribute(ArtifactAttributes.ARTIFACT_FORMAT, ZIP_TYPE); this.mainVariant = new MainLibraryVariant("api", apiUsage, api, publicationAttributes, objectFactory); }
Example #30
Source File: CMakeExtension.java From native-samples with Apache License 2.0 | 5 votes |
@Inject public CMakeExtension(ProjectLayout projectLayout, ObjectFactory objectFactory) { binary = objectFactory.property(String.class); includeDirectory = objectFactory.directoryProperty(); projectDirectory = objectFactory.directoryProperty(); projectDirectory.set(projectLayout.getProjectDirectory()); includeDirectory.set(projectDirectory.dir("include")); }