/** * List of <code>classpath:META-INF/org/kuali/util/kuali-util/[filename].resources</code> where <code>[filename]</code> can contain an Ant-style pattern */ public static List<String> getPatternedClasspathResources(Project project, String filename) { return getPatternedClasspathResources(project.getGroupId(), project.getArtifactId(), filename); }
public static ImmutableProject copyOf(Project project) { if (project instanceof ImmutableProject) { return (ImmutableProject) project; } else { return new ImmutableProject(project.getGroupId(), project.getArtifactId(), project.getVersion(), project.getProperties()); } }
@Override public Properties configOverrideProperties() { Properties overrides = project.getProperties(); return overrides; }
protected Properties getFilterProperties(Project project) { String classpathPrefix = ProjectUtils.getClasspathPrefix(project.getGroupId(), project.getArtifactId()); Properties duplicate = PropertyUtils.duplicate(project.getProperties()); duplicate.setProperty(CLASSPATH_PREFIX_KEY, classpathPrefix); String location = getMetadataConfigFilePath(project, PROPS); Properties metadata = new Properties(); if (LocationUtils.exists(location)) { String encoding = ProjectUtils.getEncoding(project); metadata = PropertyUtils.load(location, encoding); } duplicate.putAll(metadata); return duplicate; }
public static void updateVersionWithRevision(Project project, String revision, String fullRevision, File checkout, CommandLineService cli) { Version version = getVersion(project.getVersion()); String newVersion = version.getTrimmed() + "-" + revision; ScmContext scm = MavenPropertiesToScmContextFunction.INSTANCE.apply(project.getProperties()); ExecRequest setVersion = getSetVersionRequest(checkout, newVersion); info(logger, "scm url -> %s", scm.getPushUrl()); if (scm.getLabel().isPresent()) { info(logger, "scm label -> %s", scm.getLabel().get()); } info(logger, "scm revision -> %s", fullRevision); info(logger, "old version -> %s", project.getVersion()); info(logger, "new version -> %s", newVersion); cli.execute(setVersion); }
@Override @Bean public PropertySource<?> propertySource() { DeployEnvironment deployEnv = deployEnvConfig.deployEnvironment(); // Generic jdbc locations List<Location> jdbcLocations = jdbc.jdbcPropertyLocations(); // Pull in configuration specific to this branch of Rice Location branchLoc = getOptionalLocation(RiceDeployProjectConstants.ID, "deploy.properties"); // Extract the group code String groupCode = project.getProperties().getProperty("project.groupId.code"); Assert.noBlanks(groupCode); // Pull in configuration specific to this Rice application Location appLoc = getOptionalLocation(DEPLOY, groupCode + "/" + project.getArtifactId() + ".properties"); // Pull in configuration specific to the environment we are deploying to Location envLoc = getOptionalLocation(DEPLOY, groupCode + "/" + deployEnv.getName() + ".properties"); // Combine them making sure Rice properties go in last List<Location> locations = new ArrayList<Location>(); locations.addAll(jdbcLocations); locations.addAll(getKualiDeployLocs()); locations.add(branchLoc); locations.add(appLoc); locations.add(envLoc); return PropertySourceUtils.getPropertySource(service, locations); }
@Override public String apply(Project project) { File checkout = getBasedir(project); SvnNativeClient svn = SvnNativeClient.builder().withWorkingDirectory(checkout).build(); Version version = getVersion(project.getVersion()); String revision = svn.getRevision(); List<String> tokens = newArrayList(); tokens.add("builds"); tokens.add(project.getArtifactId() + "-" + version.getMajor() + "." + version.getMinor()); tokens.add(version.getTrimmed()); tokens.add(getBuildDay() + "-r" + revision); return Joiner.on('/').join(tokens); }
@Bean public Location kualiDeployApplicationDefaults() { String path = kualiDeployGroupPrefix() + "/" + project.getArtifactId() + ".properties"; return new Location(path, kualiDeployEncoding(), true); }
/** * <code>META-INF/org/kuali/util</code> */ public static String getGroupPrefix(Project project) { return getGroupPrefix(project.getGroupId()); }
@Override protected Properties getOverrides() { return project.getProperties(); }
SvnNativeClient svn = SvnNativeClient.builder().withWorkingDirectory(checkout).withContext(context).build(); String revision = svn.getRevision(); Version version = getVersion(project.getVersion()); ScmContext scm = MavenPropertiesToScmContextFunction.INSTANCE.apply(project.getProperties()); File tagCheckoutDir = checkDeleteCreate(getCanonicalFile(getBuildDirectory(project), "checkout")); String src = scm.getPushUrl() + "@" + revision;
@Override public String apply(Project project) { File checkout = getBasedir(project); GitNativeClient git = GitNativeClient.builder().withWorkingDirectory(checkout).build(); Version version = getVersion(project.getVersion()); String revision = git.getRevision(); List<String> tokens = newArrayList(); tokens.add("builds"); tokens.add(project.getArtifactId()); tokens.add(version.getTrimmed()); tokens.add(getBuildDay() + "-" + displayableGitRevision(revision)); return Joiner.on('-').join(tokens); } }
@Bean public String kualiDeployGroupPrefix() { return ProjectUtils.getClasspathPrefix(project.getGroupId()); }
/** * <code>classpath:META-INF/org/kuali/util/kuali-util/[filename].resources</code> */ public static String getClasspathResource(Project project, String filename) { return getClasspathResource(project.getGroupId(), project.getArtifactId(), filename); }
@Override @Bean public PropertySource<?> propertySource() { return PropertySourceUtils.getPropertySource(project.getProperties()); }
GitNativeClient git = GitNativeClient.builder().withWorkingDirectory(checkout).withContext(context).build(); String revision = git.getRevision(); Version version = getVersion(project.getVersion()); ScmInfo scm = PropertiesToScmFunction.INSTANCE.apply(project.getProperties()); String originalBranch = git.getCurrentBranch(); String newVersion = version.getTrimmed() + "-" + getBuildDay() + "-" + displayableGitRevision(revision);
@Override public void process(Properties properties) { // Make sure we are configured correctly Assert.notNull(properties, "properties are null"); // Make sure groupId, artifactId, orgId, and orgCode are present validate(properties); // Fix the funk in KS groupId's (if its a KS project) fixKSGroupIds(properties); // Now that the groupId is fixed, it is safe to use the properties to get a project object Project p = ProjectUtils.getProject(properties); // Extract org info String orgId = properties.getProperty(MavenConstants.ORG_ID_KEY); String orgCode = properties.getProperty(MavenConstants.ORG_ID_CODE_KEY); // Figure out the group code (eg "rice", "student", "ole", etc) String groupCode = OrgUtils.getGroupCode(orgId, p.getGroupId()); // Setup some org and group paths based on user.home String userHome = System.getProperty("user.home"); String orgHome = userHome + FS + DOT + orgCode; String groupHome = orgHome + FS + groupCode; // Store the org and group paths properties.setProperty(PROJECT_GROUP_ID_PATH, Str.getPath(p.getGroupId())); properties.setProperty("project.orgId.home", orgHome); properties.setProperty("project.groupId.home", groupHome); properties.setProperty("project.home", groupHome); // Store the groupCode properties.setProperty("project.groupId.code", groupCode); // Add the current milliseconds value as a project property properties.setProperty("project.build.timestamp.millis", Long.toString(System.currentTimeMillis())); }
/** * <code>classpath:META-INF/org/kuali/util/kuali-util/[qualifier]/[filename].resources</code> where <code>[qualifier]</code>, <code>[location]</code>, and <type>[type]</type> * are optional */ public static String getClasspathResource(Project project, Optional<String> qualifier, Optional<MetaInfDataLocation> location, Optional<MetaInfDataType> type, String filename) { return getClasspathResource(project.getGroupId(), project.getArtifactId(), qualifier, location, type, filename); }
/** * Convenience method for extracting the value of the property <code>project.build.directory</code> */ public static File getBuildDirectory(Project project) { return new CanonicalFile(project.getProperties().getProperty(MavenConstants.BUILD_DIRECTORY_KEY)); }
@Override public DeployEnvironment deployEnvironment() { int sequence = env.getInteger(SEQUENCE_KEY); // No default value, they must supply "deploy.env" String defaultName = DEFAULT_ENV_PREFIX + sequence; String name = env.getString(NAME_KEY, defaultName); DnsContext dns = getDnsContext(name); return new DeployEnvironment(project.getGroupId(), sequence, name, dns); }