Skip to content

Commit

Permalink
Add combiner
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 committed Aug 22, 2024
1 parent 2e4d354 commit 6ed7c2f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
68 changes: 68 additions & 0 deletions combiner/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

apply plugin: 'maven-publish'

def fileFinder = new FileNameFinder()

def allFiles = files(fileFinder.getFileNames(new File(projectDir).absolutePath, '**/build-cmake/install/*.zip'))

def pubVersion = file(fileFinder.getFileNames(new File(projectDir).absolutePath, '**/build-cmake/install/version.txt').first()).text.trim()

println pubVersion

String regex = "([_M_]*)_GROUP_([^\\.]+)_ID_([^\\.]+)_CLS([^\\.]*)."
Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);

def groups = [:]

for (File it : allFiles) {
Matcher matcher = pattern.matcher(it.name);

if (!matcher.find()) {
continue
}

def groupId = matcher.group(2)
def artifactId = matcher.group(3)
def classifier = matcher.group(4)

if (!classifier.empty) {
classifier = classifier.substring(1)
}

def group = groups[groupId]
if (group == null) {
group = [:]
groups[groupId] = group
}

def id = group[artifactId]
if (id == null) {
id = []
group[artifactId] = id
}

id << new Tuple(classifier, it)
}

publishing {
publications {
groups.each { key, value->
value.each { key2, value2->
"${key}${key2}"(MavenPublication) {
value2.each { t->
artifact (t.get(1)) {
if (!t.get(0).empty) {
classifier = t.get(0)
}
}
}
groupId = key.replace('_', '.')
artifactId = key2
version = pubVersion
}
}
}
}
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ include 'epilogue-processor'
include 'epilogue-runtime'
include 'thirdparty:googletest'
include 'thirdparty:imgui_suite'
include 'combiner'

buildCache {
def cred = {
Expand Down

0 comments on commit 6ed7c2f

Please sign in to comment.