Skip to content

Commit

Permalink
Add support for Summer '17 v40.0
Browse files Browse the repository at this point in the history
- Simplified retrieval of PermissionSets

Fixes #52
Fixes #51
  • Loading branch information
alan-morey committed Sep 7, 2017
1 parent d4d3f8e commit 355050b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ant-includes/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sf.maxPoll = 200
sf.batchSize = 20

# The version of the antlib jar in lib
sf.antlib.version = 39.0
sf.antlib.version = 40.0

# Use 'https://login.salesforce.com' for production or developer edition
# Use 'https://test.salesforce.com for sandbox.
Expand Down
49 changes: 21 additions & 28 deletions force-meta-backup.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,11 @@ class BulkMetadataManifestBuilder extends ManifestBuilder {
'AuraDefinitionBundle',
'AuthProvider',
'AutoResponseRules',
'BrandingSet',
'CallCenter',
'CampaignInfluenceModel',
'Certificate',
'ChatterExtensions',
'CleanDataService',
'Community',
'CommunityTemplateDefinition',
Expand Down Expand Up @@ -342,6 +344,9 @@ class BulkMetadataManifestBuilder extends ManifestBuilder {
'PlatformCachePartition',
'Portal',
'PostTemplate',
'ProfilePasswordPolicy',
'ProfileSessionSetting',
'PermissionSet',
'Queue',
'QuickAction',
'RemoteSiteSetting',
Expand Down Expand Up @@ -751,11 +756,6 @@ class ProfilesMetadataManifestBuilder extends ManifestBuilder {
'Layout'
]

static final PERMISSON_TYPES = [
'Profile',
'PermissionSet'
]

ProfilesMetadataManifestBuilder(ForceService forceService, config) {
super(forceService, config)
}
Expand Down Expand Up @@ -800,7 +800,7 @@ class ProfilesMetadataManifestBuilder extends ManifestBuilder {
fp.fullName
}

def WILDCARD_TYPES = [] + PERMISSON_TYPES;
def WILDCARD_TYPES = ['Profile']

if (type == 'Layout') {
// Note: Page Layout assignments require Layouts & RecordType to be retrieved with Profile
Expand Down Expand Up @@ -894,23 +894,18 @@ class XmlMergeTargetBuilder {
srcDir = "${config.buildDir}/profile-packages-metadata"
}

private getData() {
def data = [
profiles: new TreeSet(),
permissionsets: new TreeSet()
]
private getProfiles() {
def profiles = new TreeSet()

def dir = new File(srcDir)

dir.eachFileRecurse (FileType.FILES) { file ->
if (file.name ==~ /.+\.profile$/) {
data.profiles << file.name
} else if (file.name ==~ /.+\.permissionset/) {
data.permissionsets << file.name
profiles << file.name
}
}

data
profiles
}

private writeBuildXml() {
Expand All @@ -924,18 +919,16 @@ class XmlMergeTargetBuilder {
'import'(file: '../ant-includes/setup-target.xml')

target(name: targetName) {
data.each { type, filenames ->
def destDir = "$metadataDir/$type"
mkdir(dir: destDir)

parallel(threadCount: 4) {
filenames.each { filename ->
sequential {
echo "Xml Merging: $filename"
xmlmerge(dest: "$destDir/$filename", conf: 'xmlmerge.properties') {
fileset(dir: srcDir) {
include(name: "**/$filename")
}
def destDir = "$metadataDir/profiles"
mkdir(dir: destDir)

parallel(threadCount: 4) {
profiles.each { filename ->
sequential {
echo "Xml Merging: $filename"
xmlmerge(dest: "$destDir/$filename", conf: 'xmlmerge.properties') {
fileset(dir: srcDir) {
include(name: "**/$filename")
}
}
}
Expand Down Expand Up @@ -970,7 +963,7 @@ static void main(args) {
cli.with {
b longOpt: 'build-dir', args: 1, 'build directory'
h longOpt: 'help', 'usage information'
_ longOpt: 'build-xml-merge-target', 'Builds XML Merge target for Profile and PermissionSets XML files'
_ longOpt: 'build-xml-merge-target', 'Builds XML Merge target for Profile XML files'
}

def options = cli.parse(args)
Expand Down
Binary file not shown.

0 comments on commit 355050b

Please sign in to comment.