private List<String> getClasspathFiles(GeneratorContext context) { List<String> classpathFiles = new ArrayList<String>(); try { ConfigurationProperty prop = context.getPropertyOracle().getConfigurationProperty("gdx.files.classpath"); for (String value : prop.getValues()) { classpathFiles.add(value); } } catch (BadPropertyValueException e) { // Ignore } return classpathFiles; }
private List<String> getClasspathFiles(GeneratorContext context) { List<String> classpathFiles = new ArrayList<String>(); try { ConfigurationProperty prop = context.getPropertyOracle().getConfigurationProperty("gdx.files.classpath"); for (String value : prop.getValues()) { classpathFiles.add(value); } } catch (BadPropertyValueException e) { // Ignore } return classpathFiles; }
private AssetFilter getAssetFilter (GeneratorContext context) { ConfigurationProperty assetFilterClassProperty = null; try { assetFilterClassProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetfilterclass"); } catch (BadPropertyValueException e) { return new DefaultAssetFilter(); } if (assetFilterClassProperty.getValues().size() == 0) { return new DefaultAssetFilter(); } String assetFilterClass = assetFilterClassProperty.getValues().get(0); if (assetFilterClass == null) return new DefaultAssetFilter(); try { return (AssetFilter)Class.forName(assetFilterClass).newInstance(); } catch (Exception e) { throw new RuntimeException("Couldn't instantiate custom AssetFilter '" + assetFilterClass + "', make sure the class is public and has a public default constructor", e); } }
private AssetFilter getAssetFilter (GeneratorContext context) { ConfigurationProperty assetFilterClassProperty = null; try { assetFilterClassProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetfilterclass"); } catch (BadPropertyValueException e) { return new DefaultAssetFilter(); } if (assetFilterClassProperty.getValues().size() == 0) { return new DefaultAssetFilter(); } String assetFilterClass = assetFilterClassProperty.getValues().get(0); if (assetFilterClass == null) return new DefaultAssetFilter(); try { return (AssetFilter)Class.forName(assetFilterClass).newInstance(); } catch (Exception e) { throw new RuntimeException("Couldn't instantiate custom AssetFilter '" + assetFilterClass + "', make sure the class is public and has a public default constructor", e); } }
private String getAssetPath (GeneratorContext context) { ConfigurationProperty assetPathProperty = null; try { assetPathProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetpath"); } catch (BadPropertyValueException e) { throw new RuntimeException( "No gdx.assetpath defined. Add <set-configuration-property name=\"gdx.assetpath\" value=\"relative/path/to/assets/\"/> to your GWT projects gwt.xml file"); } if (assetPathProperty.getValues().size() == 0) { throw new RuntimeException( "No gdx.assetpath defined. Add <set-configuration-property name=\"gdx.assetpath\" value=\"relative/path/to/assets/\"/> to your GWT projects gwt.xml file"); } String paths = assetPathProperty.getValues().get(0); if(paths == null) { throw new RuntimeException( "No gdx.assetpath defined. Add <set-configuration-property name=\"gdx.assetpath\" value=\"relative/path/to/assets/\"/> to your GWT projects gwt.xml file"); } else { ArrayList<String> existingPaths = new ArrayList<String>(); String[] tokens = paths.split(","); for(String token: tokens) { System.out.println(token); if(new FileWrapper(token).exists() || new FileWrapper("../" + token).exists()) { return token; } } throw new RuntimeException( "No valid gdx.assetpath defined. Fix <set-configuration-property name=\"gdx.assetpath\" value=\"relative/path/to/assets/\"/> in your GWT projects gwt.xml file"); } }
private String getAssetPath (GeneratorContext context) { ConfigurationProperty assetPathProperty = null; try { assetPathProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetpath"); } catch (BadPropertyValueException e) { throw new RuntimeException( "No gdx.assetpath defined. Add <set-configuration-property name=\"gdx.assetpath\" value=\"relative/path/to/assets/\"/> to your GWT projects gwt.xml file"); } if (assetPathProperty.getValues().size() == 0) { throw new RuntimeException( "No gdx.assetpath defined. Add <set-configuration-property name=\"gdx.assetpath\" value=\"relative/path/to/assets/\"/> to your GWT projects gwt.xml file"); } String paths = assetPathProperty.getValues().get(0); if(paths == null) { throw new RuntimeException( "No gdx.assetpath defined. Add <set-configuration-property name=\"gdx.assetpath\" value=\"relative/path/to/assets/\"/> to your GWT projects gwt.xml file"); } else { ArrayList<String> existingPaths = new ArrayList<String>(); String[] tokens = paths.split(","); for(String token: tokens) { System.out.println(token); if(new FileWrapper(token).exists() || new FileWrapper("../" + token).exists()) { return token; } } throw new RuntimeException( "No valid gdx.assetpath defined. Fix <set-configuration-property name=\"gdx.assetpath\" value=\"relative/path/to/assets/\"/> in your GWT projects gwt.xml file"); } }
private String getAssetOutputPath (GeneratorContext context) { ConfigurationProperty assetPathProperty = null; try { assetPathProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetoutputpath"); } catch (BadPropertyValueException e) { return null; } if (assetPathProperty.getValues().size() == 0) { return null; } String paths = assetPathProperty.getValues().get(0); if(paths == null) { return null; } else { ArrayList<String> existingPaths = new ArrayList<String>(); String[] tokens = paths.split(","); String path = null; for(String token: tokens) { if (new FileWrapper(token).exists() || new FileWrapper(token).mkdirs()) { path = token; } } if (path != null && !path.endsWith("/")){ path += "/"; } return path; } }
private String getAssetOutputPath (GeneratorContext context) { ConfigurationProperty assetPathProperty = null; try { assetPathProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetoutputpath"); } catch (BadPropertyValueException e) { return null; } if (assetPathProperty.getValues().size() == 0) { return null; } String paths = assetPathProperty.getValues().get(0); if(paths == null) { return null; } else { ArrayList<String> existingPaths = new ArrayList<String>(); String[] tokens = paths.split(","); String path = null; for(String token: tokens) { if (new FileWrapper(token).exists() || new FileWrapper(token).mkdirs()) { path = token; } } if (path != null && !path.endsWith("/")){ path += "/"; } return path; } }
ConfigurationProperty prop; keep |= !name.contains("."); prop = context.getPropertyOracle().getConfigurationProperty("gdx.reflect.include"); for (String s : prop.getValues()) keep |= name.contains(s); prop = context.getPropertyOracle().getConfigurationProperty("gdx.reflect.exclude"); for (String s : prop.getValues()) keep &= !name.equals(s);
ConfigurationProperty prop; keep |= !name.contains("."); prop = context.getPropertyOracle().getConfigurationProperty("gdx.reflect.include"); for (String s : prop.getValues()) keep |= name.contains(s); prop = context.getPropertyOracle().getConfigurationProperty("gdx.reflect.exclude"); for (String s : prop.getValues()) keep &= !name.equals(s);
ConfigurationProperty prop = context.getPropertyOracle().getConfigurationProperty("gdx.reflect.include"); for (String s : prop.getValues()) { JClassType type = typeOracle.findType(s);
ConfigurationProperty prop = context.getPropertyOracle().getConfigurationProperty("gdx.reflect.include"); for (String s : prop.getValues()) { JClassType type = typeOracle.findType(s);
ConfigurationPropertyMatcher(ResourceContext context, TreeLogger logger) { this.logger = logger; propertyOracle = context.getGeneratorContext().getPropertyOracle(); }
/** * Get the current locale string. * * @param logger * @param genContext * @return the current locale */ private static String getLocale(TreeLogger logger, GeneratorContext genContext) { String locale; try { PropertyOracle oracle = genContext.getPropertyOracle(); SelectionProperty prop = oracle.getSelectionProperty(logger, "locale"); locale = prop.getCurrentValue(); } catch (BadPropertyValueException e) { locale = null; } return locale; }
/** * Creates a cache key to be used with {@link ResourceContext#putCachedData}. * The key is based on the ClientBundle type, support for data URLs, and the * current locale. */ private String createCacheKey(ResourceContext context) { StringBuilder sb = new StringBuilder(); sb.append(context.getClientBundleType().getQualifiedSourceName()); sb.append(":").append(context.supportsDataUrls()); try { String locale = context.getGeneratorContext().getPropertyOracle().getSelectionProperty( TreeLogger.NULL, "locale").getCurrentValue(); // add the locale selection property as a permuation axis for our requirements context.getRequirements().addPermutationAxis("locale"); sb.append(locale); } catch (BadPropertyValueException e) { // OK, locale isn't defined } return sb.toString(); }
private boolean shouldUseJsonp(ResourceContext context, TreeLogger logger) { String useJsonpProp = null; try { ConfigurationProperty prop = context.getGeneratorContext() .getPropertyOracle().getConfigurationProperty(USE_JSONP); useJsonpProp = prop.getValues().get(0); // add this configuration property to our requirements context.getRequirements().addConfigurationProperty(USE_JSONP); } catch (BadPropertyValueException e) { logger.log(TreeLogger.ERROR, "Bad value for " + USE_JSONP, e); return false; } return Boolean.parseBoolean(useJsonpProp); }
private Set<String> getTrueConfigurationProperties(ResourceContext context, Set<String> configurationProperties, TreeLogger logger) throws UnableToCompleteException { Builder<String> setBuilder = ImmutableSet.builder(); PropertyOracle oracle = context.getGeneratorContext().getPropertyOracle(); for (String property : configurationProperties) { try { // TODO : only check configuration properties ? ConfigurationProperty confProp = oracle.getConfigurationProperty(property); if (!checkPropertyIsSingleValueAndBoolean(confProp, logger)) { throw new UnableToCompleteException(); } if ("true".equals(confProp.getValues().get(0))) { setBuilder.add(property); } } catch (BadPropertyValueException e1) { logger.log(Type.ERROR, "Unknown configuration property [" + property + "]"); throw new UnableToCompleteException(); } } return setBuilder.build(); }
private Set<String> getCurrentDeferredBindingProperties(ResourceContext context, List<String> permutationAxes, TreeLogger logger) throws UnableToCompleteException { Builder<String> setBuilder = ImmutableSet.builder(); PropertyOracle oracle = context.getGeneratorContext().getPropertyOracle(); for (String permutationAxis : permutationAxes) { String propValue; try { SelectionProperty selProp = oracle.getSelectionProperty(null, permutationAxis); propValue = selProp.getCurrentValue(); } catch (BadPropertyValueException e) { try { ConfigurationProperty confProp = oracle.getConfigurationProperty(permutationAxis); propValue = confProp.getValues().get(0); } catch (BadPropertyValueException e1) { logger.log(Type.ERROR, "Unknown configuration property [" + permutationAxis + "]"); throw new UnableToCompleteException(); } } if (propValue != null) { setBuilder.add(permutationAxis + ":" + propValue); } } return setBuilder.build(); }
context.getGeneratorContext().getPropertyOracle(), logger); if (gssOptions.isEnabled()) { gssEnabled = true; try { PropertyOracle propertyOracle = context.getGeneratorContext().getPropertyOracle(); ConfigurationProperty styleProp = propertyOracle.getConfigurationProperty(KEY_STYLE);
PropertyOracle propertyOracle = context.getGeneratorContext().getPropertyOracle();