Related
I am running clang-tidy for my project. Here are the relevant naming options from my .clang-tidy file:
- key: readability-identifier-naming.ClassMemberCase # e.g., int myClassMember_
value: camelBack
- key: readability-identifier-naming.ClassMemberSuffix # e.g., int myClassMember_
value: _
- key: readability-identifier-naming.GlobalConstantCase # e.g., int MyGlobalConstant (please don't make globals)
value: CamelCase
- key: readability-identifier-naming.IgnoreMainLikeFunctions # Doesn't apply clang checks to main() args
value: 1
- key: readability-identifier-naming.MacroDefinitionCase # e.g., #define MY_MACRO="PleaseDon'tUseMacrosAnywhere"
value: UPPER_CASE
- key: readability-identifier-naming.MacroDefinitionIgnoredRegexp
value: '^[A-Z]+(_[A-Z]+)*_$'
- key: readability-identifier-naming.MemberCase # e.g., int myMember_ = 42;
value: CamelCase
- key: readability-identifier-naming.MemberSuffix # e.g., int myMember_ = 42;
value: _
- key: readability-identifier-naming.ParameterCase # e.g., void MyFunction(int parameter, int anotherParam);
value: camelBack
- key: readability-identifier-naming.StaticConstantCase # e.g., static const std::string s_myStaticConstant = "I hope this works!"
value: camelBack
- key: readability-identifier-naming.StaticConstantPrefix # e.g., static const std::string s_myStaticConstant = "I hope this works!"
value: s_
- key: readability-identifier-naming.StaticVariableCase # e.g., static std::string s_myStaticVar = "I hope this works!"
value: camelBack
- key: readability-identifier-naming.StaticVariablePrefix # e.g., static std::string s_myStaticVar = "I hope this works!"
value: s_
- key: readability-identifier-naming.StructCase # e.g., struct MyStruct { ... };
value: CamelCase
- key: readability-identifier-naming.VariableCase # e.g., int myVariable = 10;
value: camelBack
Unfortunately, clang tidy turns my static class member variables into sMyVariable_ instead of s_myVariable_. It seems as if the options for class members are overriding the options for static variables:
warning: invalid case style for class member 's_myVariable_' [readability-identifier-naming]
int MyClass::s_myVariable_ = 1;
Is there any way to have the static naming rules prioritized over the member naming rules? Thanks!
Example code:
class MyClass{
static int s_myVariable_; // Clang-tidy doesn't like this
};
I had a hard time finding this in the documentation as well. It appears that static member variable readability-identifier-naming styles are defined with ClassMemberCase, ClassMemberPrefix, and ClassMemberSuffix.
For your desired formatting
class MyClass{
static int s_myVariable_; // Clang-tidy doesn't like this
};
the CheckOptions field of the .clang-tidy file would have the follwing key/values:
- { key: readability-identifier-naming.ClassMemberPrefix, value: s_ }
- { key: readability-identifier-naming.ClassMemberCase, value: camelBack }
- { key: readability-identifier-naming.ClassMemberSuffix, value: _ }
Expected Behavior
jacocoTestReport work
Current Behavior
jacocoTestReport SKIPPED
Context
I created a task whose type is Test, and jacocoTestReport depends on the task. When I ran the task, jacocoTestReport did not work and I got the following information
jacocoTestReport SKIPPED
I find if I use the task test directly, jacocoTestReport worked fine. It makes me confused
the following code caused the above issue
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath files ('Build\\Jars\\gradle-jboss-modules-1.0.jar')
//classpath "com.moowork.gradle:gradle-node-plugin:1.2.0"
classpath 'com.github.node-gradle:gradle-node-plugin:2.2.3'
classpath "gradle.plugin.com.srcclr:gradle:3.1.7"
}
}
plugins {
id 'com.jfrog.artifactory' version '4.11.0'
id 'org.sonarqube' version '2.7'
id "jacoco"
id "java"
}
if (project.hasProperty('srcclrtoken')) {
apply plugin: "com.srcclr.gradle"
srcclr {
apiToken = project.getProperty('srcclrtoken')
}
}
org.apache.tools.ant.DirectoryScanner.removeDefaultExclude("**/CVS")
org.apache.tools.ant.DirectoryScanner.removeDefaultExclude("**/CVS/**")
import static com.github.zhurlik.Ver.V_1_1
import org.apache.tools.ant.filters.ReplaceTokens
import org.apache.tools.ant.filters.*
import org.gradle.plugins.ide.eclipse.model.Facet.FacetType
import org.gradle.plugins.ide.eclipse.model.WbResource
import org.gradle.plugins.ide.eclipse.model.WbDependentModule
apply from: 'dependencies.gradle'
apply plugin: 'com.github.zhurlik.jbossmodules'
apply plugin: 'maven-publish'
buildDir = 'gradlebuild'
//identify the version of gradle to use for the wrapper
wrapper {
gradleVersion = '6.3'
}
//artifactoryPublish.skip = true
//initialize the dynamic global build props. "Static" props come from gradle.properties
ext {
doDeploy = project.hasProperty('do.deploy') ? project.getProperty('do.deploy').toBoolean() : false
appEnv = project.hasProperty('app.env') ? project.getProperty('app.env').toLowerCase() : dev
versionDate = getDate()
versionLabel = project.hasProperty('versionLabel') ? project.getProperty('versionLabel') : ''
buildNumber = project.hasProperty('buildNumber') ? project.getProperty('buildNumber') : 1
webProjects = webProjectNames.split(',')
: ''
def slashPosition = versionLabel.lastIndexOf('/')
if (slashPosition > -1)
currentVersion = versionLabel[slashPosition+1..versionLabel.size()-1]
else
currentVersion = 'test'
set('buildInfo.build.name', 'Trax ' + versionLabel.replace('/', '_') )
set('buildInfo.build.number', buildNumber)
}
def getDate() {
def date = new Date()
def formattedDate = date.format('MM/dd/yyyy - hh:mma (z)')
return formattedDate
}
//initialize the repositories used by each projects build to retrieve required dependencies
allprojects {
group = 'com.reged.trax'
version = currentVersion + '-' + buildNumber
status = 'Integration'
repositories {
maven {
url 'http://artifacts.reged.com/artifactory/trax-dev-gradle-local'
content {
includeGroup "tapestry"
}
}
mavenCentral() {
content {
excludeGroupByRegex "javax\\.jms.*"
excludeGroupByRegex "javax\\.sql.*"
}
}
maven {
url "https://repository.apache.org/content/repositories/snapshots/"
}
maven {
url "https://maven.repository.redhat.com/ga/"
}
flatDir{
dirs "Common/jars"
}
maven {
url "https://redisson.pro/repo/"
}
mavenCentral()
}
if (it.name.startsWith("TraxLegacy")){
configurations.all {
resolutionStrategy {
//force "commons-io:commons-io:2.4", "javax.activation:activation:1.1.1", "org.hibernate:hibernate-validator:4.0.0.GA"/*,"javax.validation:validation-api:1.0.0.GA"*/
//force "commons-io:commons-io:2.4", "javax.activation:activation:1.1.1", "org.hibernate:hibernate-validator:5.4.3.Final"/*,"javax.validation:validation-api:1.0.0.GA-redhat-3"*/
//failOnVersionConflict()
force "antlr:antlr:2.7.7",
"com.fasterxml.jackson.core:jackson-annotations:2.10.5",
"com.fasterxml.jackson.core:jackson-databind:2.10.5",
}
//force versions for all 3rd party library sub-dependencies
resolutionStrategy.eachDependency {
//TRAX-52850: fix 3rd party library security vulnerabilities
if (it.requested.group ==~ /com\.fasterxml\.jackson.*/) {
it.useVersion '2.10.5'
}
//TRAX-52853: fix 3rd party library security vulnerabilities
if (it.requested.group ==~ /org\.apache\.xmlgraphics.*/ && it.requested.name ==~ /batik.*/) {
it.useVersion '1.9.1'
}
}
exclude group: 'bcel'
exclude group: 'jboss', module: 'javassist'
exclude group: 'javassist', module: 'javassist'
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'commons-beanutils', module: 'commons-beanutils-core'
exclude group: 'org.apache.geronimo.specs', module: 'geronimo-jms_1.1_spec'
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
exclude group: 'jdom'
exclude module: 'xmlParserAPIs'
exclude group: 'org.jboss.spec.javax.transaction', module: 'jboss-transaction-api_1.1_spec'
exclude group: 'com.sun.xml.bind'
exclude group: 'c3p0'
}
} else {
configurations.all {
resolutionStrategy {
//force "commons-io:commons-io:2.4", "javax.activation:activation:1.1.1", "org.hibernate:hibernate-validator:4.0.0.GA"/*,"javax.validation:validation-api:1.0.0.GA"*/
//force "commons-io:commons-io:2.4", "javax.activation:activation:1.1.1", "org.hibernate:hibernate-validator:5.4.3.Final"/*,"javax.validation:validation-api:1.0.0.GA-redhat-3"*/
"org.javassist:javassist:3.18.2-GA",
"org.jboss.logging:jboss-logging:3.2.1.Final",
"org.slf4j:slf4j-api:1.7.26",
"org.springframework:spring-orm:$springframeworkVersion",
"org.springframework:spring-web:$springframeworkVersion",
"org.javassist:javassist:$javassistVersion"
}
//force versions for all 3rd party library sub-dependencies
resolutionStrategy.eachDependency {
//TRAX-52850: fix 3rd party library security vulnerabilities
if (it.requested.group ==~ /com\.fasterxml\.jackson.*/) {
it.useVersion '2.10.5'
}
//TRAX-52853: fix 3rd party library security vulnerabilities
if (it.requested.group ==~ /org\.apache\.xmlgraphics.*/ && it.requested.name ==~ /batik.*/) {
it.useVersion '1.9.1'
}
}
}
}
}
configure(subprojects.findAll {!(it.getPath().startsWith(":wpServices"))}) {currProj ->
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
if (!currProj.name.startsWith("TraxLegacy")){
sourceCompatibility = 1.11
targetCompatibility = 1.11
}
eclipse {
classpath {
downloadSources = true
downloadJavadoc = true
defaultOutputDir = file('target/classes')
file.whenMerged {
entries.each {
if (it in org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry && it.kind == 'src' && it.toString().contains('output')) {
if (it.entryAttributes['gradle_used_by_scope'] == 'test') {
it.entryAttributes['test'] = true
it.output = 'target/test-classes'
} else {
it.output = 'target/classes'
}
}
}
}
}
jdt {
if (!currProj.name.startsWith("TraxLegacy")){
sourceCompatibility = 1.11
targetCompatibility = 1.11
javaRuntimeName = "JavaSE-11"
}
}
wtp {
component {
sourceDirs -= file('src/test/java')
sourceDirs -= file('src/test/resources')
}
/*facet {
facet name: 'jst.java', version: '1.8'
file {
//removing default jst.java facet version which eclipse's gradle tooling (buildship plugin) insists on adding
whenMerged { w ->
facets.removeAll { it.name == 'jst.java' && it.version != "1.8" && it.type == FacetType.installed}
}
}
}*/
}
}
if (currProj.name != 'Common') {
task sourcesJar(type: Jar) {
exclude '*.zip'
}
java {
withSourcesJar()
}
}
sourceSets {
main {
java {
srcDirs=['src/main/java']
excludes=['**/rebel.xml', '.gitkeep']
}
resources {
srcDirs=['src/main/java','src/main/resources']
excludes=['**/rebel.xml']
}
}
}
test {
ignoreFailures = rootProject.ignoreFailureProp.toBoolean()
reports.html.enabled = true
reports.junitXml.enabled = false
systemProperties = System.getProperties()
}
dependencies {
if (project.hasProperty("${currProj.name}Dependencies")) {
rootProject."${currProj.name}Dependencies".each {
add(it.configuration, it.dependency, it.options)
}
}
}
rootProject.tasks["sonarqube"].dependsOn tasks.build
}
//set up war & deploy tasks for the web projects
configure(subprojects.findAll {it.name in webProjects}) { currentProject ->
//println "configuring ${currentProject.name}"
apply plugin: 'war'
apply plugin: 'distribution'
if (currentProject.name != 'TraxLegacyWeb') {
eclipse {
wtp {
component {
minusConfigurations << configurations.compile
}
}
}
}
configurations {antconf}
if (doDeploy) {
dependencies {
antconf('ant-contrib:ant-contrib:1.0b3'){transitive=false}
}
ClassLoader antClassLoader = org.apache.tools.ant.Project.class.classLoader
configurations.antconf.each { File f ->
antClassLoader.addURL(f.toURI().toURL())
}
}
tasks.withType(War) {
if (appEnv != dev) {
rootSpec.filesMatching(['version.properties','WEB-INF/app.properties']) {
filter ReplaceTokens, tokens: [
"version.num": buildNumber.toString(),
"version.date": versionDate,
"version.label": versionLabel
]
}
}
rootSpec.exclude("**/.gitkeep")
rootSpec.exclude("**/rebel.xml")
}
def appName = rootProject.property("${currentProject.getName()}.app.name").toString()
def jbossServerName = rootProject.property("${currentProject.getName()}.jboss.server.name")
war {
if (currentProject.name != 'TraxLegacyWeb') {
rootSpec.filesMatching('*.jar') { details ->
if (!(details.file.path =~ "AuditTraxClient.jar")) {
if (!(details.file.path =~ "jazzy-core.jar")){
details.exclude()
}
}
}
}
//archiveName rootProject.property("${currentProject.getName()}.app.name")+'.war'
archiveBaseName = rootProject.property("${currentProject.getName()}.app.name")
exclude('**/node_modules')
}
jar {
baseName rootProject.property("${currentProject.getName()}.app.name")
}
distZip {
archiveName "$appName[$version+$jbossServerName].zip"
}
distributions {
main {
baseName = appName
contents {
into '/'
from war
from (project(':Build').file('jonCLI')) {
include 'generic-jon-bundle-descriptor.xml'
filter(ReplaceTokens, tokens: [
'APP.ISNAMED':appName,
'ARCHIVE.TYPE':"war",
'APP.VERSION':project.version.toString(),
'Generic JON Bundle Descriptor':"JON Bundle Descriptor for ${appName}".toString()])
rename('generic-jon-bundle-descriptor.xml', 'deploy.xml')
}
}
}
}
clean {
delete "deploy"
delete "${project.projectDir}/src/main/webapp/qrunner/node_modules"
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.web
artifactId rootProject.property("${currentProject.getName()}.app.name")}}}}
configure(subprojects.findAll {!(it.name in ['Common','Build', 'RegedCommon', 'wpServices', 'wpConsoleLite', 'wpServicesCore', 'TraxLegacyWeb'])}) {
dependencies {
compileOnly project(path: ":RegedCommon", configuration: 'compileOnly')
testCompile project(path: ":RegedCommon", configuration: "testCompile")
testCompile project(':RegedCommon').sourceSets.test.output
}
}
jibxProjects.split(',').each { name ->
project(":$name") {
dependencies {
compileOnly (project(":Build")) { transitive = false }
["Bind", "Run", "Schema"].each {
compile libs."jibx${it}".dependency
}
compile libs.bcel.dependency
}
task doJibx(dependsOn: project(":Build").tasks.build) {
doLast {
ant.lifecycleLogLevel = "VERBOSE"
ant.taskdef(name: 'bind', classname: 'com.reged.ant.JibxCompile', classpath: configurations.compileClasspath.asPath)
//println configurations.compile.asPath + ";${sourceSets.main.output.classesDirs}"
ant.bind(verbose: 'false', classpath: configurations.compile.asPath + ";${sourceSets.main.java.outputDir}") {
fileset (dir: 'src/main/java/com/reged/model/xml/jibx/binding')
}
}
}
jar.dependsOn doJibx
}
}
//update the footer files
project(":RegedCommonUITap3") {
dependencies {
compile project(path: ":RegedCommon")
}
jar {
eachFile { copyDetails ->
if (copyDetails.path == 'com/reged/common/ui/components/Footer.html') {
filter(ReplaceTokens, tokens: [buildDate:versionDate,buildNum:buildNumber.toString(),buildLabel:versionLabel/*,"#feedbackLink#":"feedbackLink"*/])
}
}
}
}
project(":RegedCommonUITap5") {
dependencies {
compile project(path: ":RegedCommon")
compile project(":tapestry5-jquery-upload")
}
jar {
eachFile { copyDetails ->
if (copyDetails.path == 'com/reged/components/Footer.tml') {
filter(ReplaceTokens, tokens: [buildDate:versionDate,buildNum:buildNumber.toString(),buildLabel:versionLabel/*,"#feedbackLink#":"feedbackLink"*/])
}
}
}
}
tapestry3Projects.split(',').each { name ->
project(":$name") {
dependencies {
compile project(":RegedCommonUITap3")
}
}
}
tapestry5Projects.split(',').each { name ->
project(":$name") {
dependencies {
compile project(":RegedCommonUITap5")
project(":tapestry5-jquery-upload")
}
}
}
project(":HighchartsServerSideJar") {
dependencies {
compile project(path: ":RegedCommon")
}
}
angularProjects.split(',').each { name ->
project(":$name") {
//apply plugin: 'com.moowork.node'
apply plugin: "com.github.node-gradle.node"
clean {
//delete rootProject.file('.gradle/nodejs')
}
node {
version = '8.12.0'
download = true
distBaseUrl = 'http://artifacts.reged.com/artifactory/nodejs-dist-local/dist'
workDir = rootProject.file('.gradle/nodejs')
}
task angularBuild (type: NpmTask) {
args = ['run', 'build']
}
angularBuild.dependsOn(npm_install)
war.dependsOn(angularBuild)
}
}
def moduleProjects = subprojects.findAll {!(it.name in webProjects) && !(it.name in ['Common','Build','wpServices','wpConsoleLite','wpServicesCore'])}.collect{it.name}
configurations {
jdbc
buildProject
}
def projArts = []
dependencies {
jdbc project(path: ":Common", configuration: "jdbc")
['wsdl', 'ws-policy'].each{
jbossmodules ("org.apache.cxf:cxf-rt-$it:$cxfVersion") { transitive false}
}
jbossmodules 'org.apache.geronimo.bundles:commons-httpclient:3.1_2'
jbossmodules 'org.apache.neethi:neethi:3.0.3'
jbossmodules 'org.apache.ws.xmlschema:xmlschema-core:2.2.1'
jbossmodules 'javax.xml.bind:jaxb-api:2.3.1'
jbossmodules 'org.glassfish.jaxb:jaxb-runtime:2.3.1'
jbossmodules 'wsdl4j:wsdl4j:1.6.3'
//jbossmodules 'javax.servlet:jstl:1.0.6'
jbossmodules 'org.mozilla:rhino:1.7.7'
libs.each {
add('jbossmodules', it.value.dependency, it.value.options)
}
jbossmodules project(path: ":RegedCommon", configuration: "java8LoggerModule")
if (appEnv != dev) {
moduleProjects.each {
jbossmodules (project(":$it")) {transitive = false}
}
}
jbossmodules 'bsf:bsf:2.3.0'
buildProject project(':Build')
}
if (appEnv != ci) {
jbossrepos {
'regedlib.modules' {
version = V_1_1
}
}
modules {
reged {
moduleName = "regedlib"
resources = configurations.jbossmodules.findAll{!it.name.startsWith('validation-api') && !projArts.contains(it) && !it.name.startsWith('log4j-1') && !it.name.contains('java8LoggerModule')}.collect{it.name}
if (appEnv == dev) {
resourceFiles = [project(':Common').file('./target/classes').absolutePath, project(':Common').file('./target/classes/Workpoint').absolutePath]
resourceFiles += moduleProjects.collect{file("$it/target/classes").absolutePath}
} else {
resourceFiles = ['../../classes', '../../classes/Workpoint']
}
dependencies = [
[name: "javax.api", export: "true"],
[name: "javax.activation.api", export: "true"],
[name: "javax.annotation.api", export: "true"],
[name: "javax.mail.api", export: "true"],
[name: "javax.resource.api", export: "true"],
[name: "javax.servlet.api", export: "true"],
[name: "javax.servlet.jsp.api", export: "true"],
[name: "javax.servlet.jstl.api", export: "true"],
[name: "javax.ejb.api", export: "true"],
[name: "javax.jms.api", export: "true"],
[name: "javax.jws.api", export: "true"],
[name: "javax.validation.api", export: "true"],
[name: "javax.xml.ws.api", export: "true"],
[name: "sun.jdk", export: "true"],
[name: "org.jboss.vfs", export: "true"],
[name: "org.jboss.logmanager", export: "true"],
[name: "org.apache.log4j", export: "true"],
[name: "org.picketbox", export: "true"],
[name: "org.jboss.jboss-transaction-spi", export: "true"],
}
regedJDK8 {
moduleName = "regedlib.java8"
if (appEnv == dev) {
resourceFiles = [project(':Common').file('./target/classes').absolutePath]
} else {
resourceFiles = ['../../../classes']
}
}
inet {
moduleName = "com.inet"
resources = ["Merlia.jar"]
dependencies = [
[name: "javax.api", export: "true"],
[name: "javax.transaction.api", export: "true"]
]
configuration = configurations.jdbc
}
postgres {
moduleName = "org.postgres"
resources = ["postgresql-9.4.1209.jar"]
dependencies = [
[name: "javax.api", export: "true"],
[name: "javax.transaction.api", export: "true"]
]
configuration = configurations.jdbc
}
datadirect {
moduleName = "com.datadirect"
resources = ["greenplum.jar"]
dependencies = [
[name: "javax.api", export: "true"],
[name: "javax.transaction.api", export: "true"]
]
configuration = configurations.jdbc
}
microsoft {
moduleName = 'com.microsoft'
resources = ['sqljdbc4.jar']
dependencies = [
[name: "javax.api", export: "true"],
[name: "javax.transaction.api", export: "true"]
]
configuration = configurations.jdbc
}
java8LoggerMoudle {
moduleName = "java8.logger"
resources = ["RegedCommon-${currentVersion}-${buildNumber}-java8LoggerModule.jar","spring-core-${springframeworkVersion}.jar","slf4j-api-1.7.26.jar", "log4j-slf4j-impl-2.17.1.jar"
,"log4j-core-2.17.1.jar", "log4j-api-2.17.1.jar", "jackson-dataformat-xml-2.10.5.jar", "jackson-core-2.10.5.jar","jackson-databind-2.10.5.jar","jackson-annotations-2.10.5.jar"]
if (appEnv == dev) {
resourceFiles = [project(':Common').file('./target/classes').absolutePath]
} else {
resourceFiles = ['../../../classes']
}
dependencies = [
[name: "org.picketbox", export: "true"],
[name: "org.jboss.logmanager", export: "true"],
[name: "org.apache.log4j", export: "true"],
[name: "javax.resource.api", export: "true"]
]
}
}
makeModules.outputs.upToDateWhen { false }
}
if (doDeploy) {
if (appEnv == ci)
build.finalizedBy makeModules
}
gradle.useLogger(new TimestampEventLogger())
class TimestampEventLogger implements TaskExecutionListener {
def timestamp = 0L
public void beforeExecute(Task task) {
println "> $task.project.name:$task.name start"
timestamp = System.currentTimeMillis()
}
public void afterExecute(Task task, TaskState state) {
def elapsed=(System.currentTimeMillis()-timestamp)/1000F
println "> $task.project.name:$task.name [$elapsed]"
}
}
evaluationDependsOn(':Build')
if (appEnv != ci) {
afterEvaluate {
distributions {
main {
baseName = 'Trax'
contents {
into ('/') {
subprojects {
if (it.name in webProjects) {
from project(it.path).distZip
}
}
from tasks['regedlib.modulesDistZip']
from (project(':').file('CCMS')) {
include 'ccms/**/*.*'
include 'perlLib/*.pm'
filesMatching('**/version.properties') {
filter ReplaceTokens, tokens: [
"version.num": buildNumber.toString(),
"version.date": versionDate,
"version.label": versionLabel
]
}
}
}
into ("/database/999_APP_VERSION/DataScripts") {
from project(":Build").file('templates')
include 'AppVersionUpdateTemplate.sql'
rename('AppVersionUpdateTemplate.sql', "AppVersionUpdate_${version}.sql")
filter(ReplaceTokens, tokens: ['app.version':version])
}
}
}
source {
baseName = 'Trax'
contents {
into ('/') {
from subprojects.findAll {!(it.getPath().startsWith(":wpServices")) && it.name != 'Common'}.sourcesJar
from (project(':').file('CCMS')) {
include 'ccms/**/*.*'
include 'perlLib/*.pm'
filesMatching('**/version.properties') {
filter ReplaceTokens, tokens: [
"version.num": buildNumber.toString(),
"version.date": versionDate,
"version.label": versionLabel
]
}
}
}
into ('/Common') {
from ('Common/src/main/resources') {
filesMatching('**/regedcommon.properties') {
filter {String line ->
line.replaceAll("(?i)(.*password=).*", "\$1")
.replaceAll("(?i)(jboss.passphrase=).*", "\$1")
.replaceAll("(?i)(tapesty.serialization.hmac.key=).*", "\$1")
.replaceAll("(?i)(jboss.algorithm=).*", "\$1")
}
}
}
}
}
}
}
sourceDistZip {
archiveClassifier = "src"
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact "$buildDir/distributions/regedlib.modules-${version}.tgz"
artifactId 'regedlib.modules'
}
}
}
artifactory {
contextUrl = artifactoryContextUrl
publish {
repository {
repoKey = artifactoryRepoKey // The Artifactory repository key to publish to
username = artifactoryUsername // The publisher user name
password = artifactoryPassword // The publisher password
}
defaults {
publications('mavenJava')
publishArtifacts = true
publishPom = true
}
}
}
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
// Include the results from the 'test' task in all subprojects
//reportOn subprojects*.test
reportOn subprojects.findAll {!(it.getPath().startsWith(":wpServices"))}.test
}
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacoco {
toolVersion = "0.8.5"
reportsDir = file("${project.buildDir}/reports/jacoco/jacoco")
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
csv.enabled false
xml.destination file("${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml")
html.destination file("${project.buildDir}/reports/jacoco/test/html")
}
dependsOn tasks.build
}
sonarqube {
properties {
property "sonar.java.codeCoveragePlugin", "jacoco"
property "sonar.junit.reportPaths", "${project.buildDir}/reports/jacoco/test"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.projectName", "TRAX"
// property "sonar.jacoco.reportsPaths", "${project.buildDir}/reports/jacoco/test"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}
tasks.sonarqube.dependsOn test
I am trying to write a rust script that parses a C++ file, finds all extern C declared functions and prints them out.
To that effect I have this first attempt:
use clang::*;
use clap::{Arg, App};
fn main()
{
let matches = App::new("Shared C++ API parser")
.version("0.0.1")
.author("Makogan")
.about("Parse a cpp file that exposes functions to be loaded at runtime from \
A shared object (.so/.dll).")
.arg(Arg::with_name("file")
.short('f')
.long("file")
.takes_value(true)
.help("The cpp file that will be parsed")
.required(true))
.get_matches();
let cpp_file = matches.value_of("file").unwrap();
println!("The file passed is: {}", cpp_file);
let clang = Clang::new().unwrap();
let index = Index::new(&clang, false, false);
let tu = index.parser(cpp_file).parse().unwrap();
let funcs = tu.get_entity().get_children().into_iter().filter(
|e| {
e.get_kind() == EntityKind::FunctionDecl
}).collect::<Vec<_>>();
for func_ in funcs
{
let type_ = func_.get_type().unwrap();
let size = type_.get_sizeof().unwrap();
println!("func: {:?} (size: {} bytes)", func_.get_display_name().unwrap(), size);
}
}
I am giving it a true cpp file with lots of functions, this is one such declared funciton:
void DrawOffScreen(
void* vk_data_ptr,
const NECore::RenderRequest& render_request,
const NECore::UniformBufferDataContainer& uniform_container);
When I give it a very very simple file I stil don't get an output
extern "C"
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
void InitializeRendering(void* window, bool use_vsync)
{
}
}
If I comment out the extern C part I do get the correct output. It seems that when the defientiion is inside an extern C block clang thinks the funciton is undeclared:
Some(Entity { kind: UnexposedDecl, display_name: None, location: Some(SourceLocation { file: Some(File { path: "/path/dummy.cpp" }), line: 1, column: 8, offset: 7 }) })
What do I do?
UnexposedDecl is actually not the function definition, but the extern 'C' itself.
If you print all items recursively, you will see what the tree actually looks like:
fn print_rec(entity: Entity, depth: usize) {
for _ in 0..depth {
print!(" ");
}
println!("{:?}", entity);
for child in entity.get_children() {
print_rec(child, depth + 1);
}
}
fn main() {
// ...
print_rec(tu.get_entity(), 0);
}
Entity { kind: TranslationUnit, display_name: Some("simple.cpp"), location: None }
Entity { kind: UnexposedDecl, display_name: None, location: Some(SourceLocation { file: Some(File { path: "simple.cpp" }), line: 1, column: 8, offset: 7 }) }
Entity { kind: FunctionDecl, display_name: Some("InitializeRendering(void *, bool)"), location: Some(SourceLocation { file: Some(File { path: "simple.cpp" }), line: 7, column: 6, offset: 105 }) }
Entity { kind: ParmDecl, display_name: Some("window"), location: Some(SourceLocation { file: Some(File { path: "simple.cpp" }), line: 7, column: 32, offset: 131 }) }
Entity { kind: ParmDecl, display_name: Some("use_vsync"), location: Some(SourceLocation { file: Some(File { path: "simple.cpp" }), line: 7, column: 45, offset: 144 }) }
Entity { kind: CompoundStmt, display_name: None, location: Some(SourceLocation { file: Some(File { path: "simple.cpp" }), line: 8, column: 1, offset: 155 }) }
So your actual problem is that you only iterate over the topmost level of the tree, and don't recurse into the segments.
To iterate recursively, use visit_children() instead of get_children():
use clang::*;
use clap::{App, Arg};
fn main() {
let matches = App::new("Shared C++ API parser")
.version("0.0.1")
.author("Makogan")
.about(
"Parse a cpp file that exposes functions to be loaded at runtime from \
a shared object (.so/.dll).",
)
.arg(
Arg::with_name("file")
.short('f')
.long("file")
.takes_value(true)
.help("The cpp file that will be parsed")
.required(true),
)
.get_matches();
let cpp_file = matches.value_of("file").unwrap();
println!("The file passed is: {}", cpp_file);
let clang = Clang::new().unwrap();
let index = Index::new(&clang, false, false);
let tu = index.parser(cpp_file).parse().unwrap();
let mut funcs = vec![];
tu.get_entity().visit_children(|e, _| {
if e.get_kind() == EntityKind::FunctionDecl {
funcs.push(e);
EntityVisitResult::Continue
} else {
EntityVisitResult::Recurse
}
});
for func_ in funcs {
let type_ = func_.get_type().unwrap();
let size = type_.get_sizeof().unwrap();
println!(
"func: {:?} (size: {} bytes)",
func_.get_display_name().unwrap(),
size
);
}
}
The file passed is: simple.cpp
func: "InitializeRendering(void *, bool)" (size: 1 bytes)
This error occasionally occurs on "cdk watch" and disappears when I destroy and redeploy the stack. All the global and per lambda variables are strings for sure. The table name is not declared explicitly but generated from the id..(maybe this is the cause of the issue?)
export class MyStack extends Stack {
constructor(app: App, id: string, props: MyStackProps) {
super(app, id);
const isProd = props.deploymentEnv;
const stackName = Stack.of(this).stackName;
const PRIMARY_KEY = 'reportId';
const dynamoTable = new Table(this, `MyTable-${stackName}`, {
partitionKey: {
name: PRIMARY_KEY,
type: AttributeType.STRING,
},
stream: StreamViewType.NEW_IMAGE,
removalPolicy: isProd ? RemovalPolicy.RETAIN : RemovalPolicy.DESTROY,
});
// Default props for lambda functions
const nodeJsFunctionProps: NodejsFunctionProps = {
bundling: {
externalModules: [
'aws-sdk', // Use the 'aws-sdk' available in the Lambda runtime
'#sparticuz/chrome-aws-lambda',
],
},
depsLockFilePath: join(__dirname, '../package-lock.json'),
environment: {
PRIMARY_KEY: PRIMARY_KEY,
TABLE_NAME: dynamoTable.tableName,
},
runtime: Runtime.NODEJS_16_X,
};
In the lambda file, I'm getting the variables this way:
const TABLE_NAME = process.env.TABLE_NAME ?? '';
The error:
failed: InvalidParameterType: Expected params.Environment.Variables['TABLE_NAME'] to
be a string
I have a weird scenario here.
The following line in my Pulumi typescript code always fails the first time:
const redisCache = new gcp.redis.Instance("my-redis-cache", {
name: "my-metadata-cache",
tier: "BASIC",
memorySizeGb: 1,
authorizedNetwork: pulumi.interpolate`projects/someprojectid/global/networks/default`,
connectMode: "PRIVATE_SERVICE_ACCESS",
redisVersion: "REDIS_6_X",
displayName: "My Metadata Cache",
project: someprojectid,
}, defaultResourceOptions);
**
error: 1 error occurred:
* Error waiting to create Instance: Error waiting for Creating Instance: Error code 13, message: an internal error has occurred
**
Strangely, when I again run pulumi up, it succeeds. Has anyone else faced this before? Any clues?
Ok this turned out to be a case of working with a beast of a code. Once I started isolating the issue, things became clearer. For those who stumble across this one, here is a full working code.
import * as pulumi from "#pulumi/pulumi";
import * as gcp from "#pulumi/gcp";
export interface CacheComponentResourceArgs {
projectId : pulumi.Input<string>;
projectNumber: pulumi.Input<string>;
}
export class CacheComponentResource extends pulumi.ComponentResource {
constructor(name: string, resourceArgs: CacheComponentResourceArgs, opts?: pulumi.ResourceOptions) {
const inputs: pulumi.Inputs = {
options: opts,
};
super("ekahaa:abstracta:Cache", name, inputs, opts);
const serviceNetworkingAccessService = new gcp.projects.Service("service-nw-" + name , {
disableDependentServices: true,
project: resourceArgs.projectId,
service: "servicenetworking.googleapis.com",
}, {
parent : this
});
const redisService = new gcp.projects.Service("redis-service-" + name, {
disableDependentServices: true,
project: resourceArgs.projectId,
service: "redis.googleapis.com",
}, {
parent : this
});
const defaultGlobalAddress = new gcp.compute.GlobalAddress("default-ip-range-" + name, {
name: "default-ip-range",
purpose: "VPC_PEERING",
prefixLength: 16,
project: resourceArgs.projectId,
addressType: "INTERNAL",
network: pulumi.interpolate`projects/${resourceArgs.projectId}/global/networks/default`
}, {
parent : this,
dependsOn: [ redisService]
});
const privateServiceConnection = new gcp.servicenetworking.Connection("servicenetworking-" + name, {
service: "servicenetworking.googleapis.com",
network: pulumi.interpolate`projects/${resourceArgs.projectId}/global/networks/default`,
reservedPeeringRanges: [defaultGlobalAddress.name],
}, {
parent : this,
dependsOn: [ defaultGlobalAddress]
});
const iamBindingRedis2 = new gcp.projects.IAMBinding("iamredis2-" + name, {
members: [
pulumi.interpolate`serviceAccount:service-${resourceArgs.projectNumber}#service-networking.iam.gserviceaccount.com`
],
role: "roles/servicenetworking.serviceAgent",
project: resourceArgs.projectId
}, {
parent : this,
dependsOn: [privateServiceConnection]
});
const redisCache = new gcp.redis.Instance(name, {
name: name,
tier: "BASIC",
memorySizeGb: 1,
authorizedNetwork: pulumi.interpolate`projects/${resourceArgs.projectId}/global/networks/default`,
connectMode: "PRIVATE_SERVICE_ACCESS",
redisVersion: "REDIS_6_X",
displayName: "Abstracta Metadata Cache",
project: resourceArgs.projectId,
}, {
parent : this,
dependsOn : [redisService,serviceNetworkingAccessService,iamBindingRedis2]
});
this.registerOutputs({
redisCache : redisCache
});
}
}
let suffix = "20211018-002";
let org_name = `org-redis-demo-${suffix}`;
let projectId = `redis-demo-${suffix}` ;
const myGcpProject = new gcp.organizations.Project('ab-' + org_name, {
orgId: gcpOrgId,
projectId: projectId,
billingAccount: billingAccountId,
name: 'ab-' + org_name,
});
const myGcpProjectIAM = new gcp.projects.IAMBinding("iam-001", {
members: [
"user:vikram.vasudevan#ekahaa.com",
],
role: "roles/owner",
project: myGcpProject.projectId
});
const cacheComponentResource = new CacheComponentResource("my-cache", {
projectId : myGcpProject.projectId,
projectNumber : myGcpProject.number
}, {
dependsOn : [myGcpProjectIAM]
});