org.gradle.api.Project.property()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(190)

本文整理了Java中org.gradle.api.Project.property()方法的一些代码示例,展示了Project.property()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.property()方法的具体详情如下:
包路径:org.gradle.api.Project
类名称:Project
方法名:property

Project.property介绍

暂无

代码示例

代码示例来源:origin: uber/okbuck

public static TargetCache getTargetCache(Project project) {
 String targetCacheKey = getCacheKey(project, TARGET_CACHE);
 TargetCache targetCache = (TargetCache) project.property(targetCacheKey);
 if (targetCache == null) {
  throw new RuntimeException(
    "Target cache external property '" + targetCacheKey + "' is not set.");
 }
 return targetCache;
}

代码示例来源:origin: uber/okbuck

public static Map<String, Scope> getScopeCache(Project project) {
 String scopeCacheKey = getCacheKey(project, SCOPE_CACHE);
 Map<String, Scope> scopeCache = (Map<String, Scope>) project.property(scopeCacheKey);
 if (scopeCache == null) {
  throw new RuntimeException(
    "Scope cache external property '" + scopeCacheKey + "' is not set.");
 }
 return scopeCache;
}

代码示例来源:origin: linkedin/rest.li

public static String findCompatLevel(Project project, String propertyName)
 {
  if (project.hasProperty(propertyName))
  {
   String compatLevel = project.property(propertyName).toString().toUpperCase();

   if (compatLevel.equals("OFF"))
   {
    return "IGNORE";
   }
   else
   {
    return compatLevel;
   }
  }
  else
  {
   if (propertyName.equals(SNAPSHOT_COMPAT_REQUIREMENT))
   {
    // backwards compatible by default.
    return "BACKWARDS";
   }
   else
   {
    // off by default
    return "OFF";
   }
  }
 }
}

代码示例来源:origin: diffplug/spotless

rootApplyTask.setDescription(APPLY_DESCRIPTION);
String filePatterns;
if (project.hasProperty(FILES_PROPERTY) && project.property(FILES_PROPERTY) instanceof String) {
  filePatterns = (String) project.property(FILES_PROPERTY);
} else {

代码示例来源:origin: gradle.plugin.com.github.gradle-guides/gradle-site-plugin

public SitePluginExtension(Project project) {
  outputDir = project.property(File.class);
  websiteUrl = project.property(String.class);
  vcsUrl = project.property(String.class);
}

代码示例来源:origin: gradle.plugin.com.enonic.xp/xp-gradle-plugin

public XpExtension( final Project project )
{
  this.project = project;
  this.version = this.project.property( String.class );
  this.homeDir = this.project.property( File.class );
  this.installDir = this.project.property( File.class );
}

代码示例来源:origin: gradle.plugin.com.greensopinion.gradle-android-eclipse/gradle-android-eclipse

private EclipseModel eclipseModel(Project project) {
    try {
      return (EclipseModel) project.property("eclipse");
    } catch (MissingPropertyException e) {
      throw new RuntimeException(
          "Cannot find 'eclipse' property.\nEnsure that the following is in your project: \n\napply plugin: 'eclipse'\n\n",
          e);
    }
  }
}

代码示例来源:origin: gradle.plugin.com.greensopinion.gradle-android-eclipse/gradle-android-eclipse

private Object compileSdkVersion() {
    Object android = project.property("android");
    try {
      return android.getClass().getMethod("getCompileSdkVersion").invoke(android);
    } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
        | SecurityException e) {
      throw new RuntimeException("Cannot get 'compileSdkVersion' property of 'android'.", e);
    }
  }
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

/**
 * Handlers missing properties by returning the {@link Project} property with the given {@code name}.
 *
 * @param name the name of the property
 * @return the value of the project property
 */
public Object propertyMissing(String name) {
  return this.container.getProject().property(name);
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

@Override
public String getProperty(String name) {
  if (this.project.hasProperty(name)) {
    Object property = this.project.property(name);
    if (property != null) {
      return property.toString();
    }
  }
  return null;
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

/**
 * Handlers missing properties by returning the {@link Project} property with the given {@code name}.
 *
 * @param name the name of the property
 * @return the value of the project property
 */
public Object propertyMissing(String name) {
  return this.container.getProject().property(name);
}

代码示例来源:origin: gradle.plugin.com.google.cloud.tools/minikube-gradle-plugin

public MinikubeExtension(Project project, CommandExecutorFactory commandExecutorFactory) {
 minikube = project.property(String.class);
 setMinikube("minikube");
 this.commandExecutorFactory = commandExecutorFactory;
}

代码示例来源:origin: gradle.plugin.com.github.pivotalservices/ya-cf-app-gradle-plugin

/**
 * Get a property value from the Project properties.
 *
 * @param propertyName name of property
 * @return value of property, @{link java.util.Optional#empty} if not available.
 */
public Optional<Integer> getIntegerPropertyFromProject(String propertyName) {
  if (this.project.hasProperty(propertyName)) {
    return Optional.of((Integer) this.project.property(propertyName));
  }
  return Optional.empty();
}

代码示例来源:origin: gradle.plugin.com.github.pivotalservices/ya-cf-app-gradle-plugin

public Optional<List<String>> getListPropertyFromProject(String propertyName) {
  if (this.project.hasProperty(propertyName)) {
    return Optional.of(Strings.split((String) this.project.property(propertyName)));
  }
  return Optional.empty();
}

代码示例来源:origin: gradle.plugin.org.hibernate.build/database-profile-plugin

private static File resolveCustomProfileDirectory(Project project) {
  Object localDirectoryProperty = System.getProperty( CUSTOM_DATABASES_DIRECTORY_KEY );
  if ( project.hasProperty( CUSTOM_DATABASES_DIRECTORY_KEY ) ) {
    localDirectoryProperty = project.property( CUSTOM_DATABASES_DIRECTORY_KEY );
  }
  if ( localDirectoryProperty != null ) {
    return project.file( localDirectoryProperty );
  }
  return null;
}

代码示例来源:origin: com.android.tools.build/gradle-core

@Nullable
private static Integer getInteger(@NonNull Project project, String propertyName) {
  if (project.hasProperty(propertyName)) {
    try {
      return Integer.parseInt(project.property(propertyName).toString());
    } catch (NumberFormatException e) {
      throw new RuntimeException("Property " + propertyName + " needs to be an integer.");
    }
  }
  return null;
}

代码示例来源:origin: gradle.plugin.com.github.gradle-guides/gradle-site-plugin

public SiteGenerate() {
  this.projectDescriptor = getProject().property(ProjectDescriptor.class);
  this.outputDir = getProject().property(File.class);
  customData = new CustomData(getProject());
}

代码示例来源:origin: MinecraftForge/ForgeGradle

LiteModJson(Project project, String minecraftVersion, String revision)
{
  this.project = project;
  this.mcversion = this.minecraftVersion = minecraftVersion;
  this.revision = revision;
  this.name = project.getName();
  this.displayName = project.hasProperty("displayName") ? project.property("displayName").toString() : project.getDescription();
  this.version = project.getVersion().toString();
}

代码示例来源:origin: gradle.plugin.com.enonic.xp/xp-gradle-plugin

public DeployTask()
{
  setGroup( "Application" );
  setDescription( "Deploy application to XP_HOME directory." );
  dependsOn( getProject().getTasks().getByName( "build" ) );
  this.homeDir = getProject().property( File.class );
}

代码示例来源:origin: gradle.plugin.org.avaje.boot/boot-gradle-plugin

private String getMainClassNameProperty() {
  if (getProject().hasProperty("mainClassName")) {
    return (String) getProject().property("mainClassName");
  }
  ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) getProject()
      .getExtensions().getByName("ext");
  if (extraProperties.has("mainClassName")) {
    return (String) extraProperties.get("mainClassName");
  }
  return null;
}

相关文章