Artifact handing in native project

Hi All,

Trying to wrap my head around working with native projects and having publication features. I’ve managed to get the source building and now I want to be able to publish.

buildscript {
  repositories {
      maven {
          url "http://ld-onedrop.rdlund.qliktech.com/artifactory/remote-repos"
      }
   }
   dependencies {
       //classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
   classpath 'org.ajoberstar:grgit:1.1.0'
   }
}

apply plugin: 'cpp'
apply plugin: 'visual-studio'
apply plugin: 'distribution'


version '1.0'
group = 'com.qlik'

//Define the location of MFC as an extra property
ext {
	ATLMFCDIR = 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\atlmfc'
       // Open the Git repository in the current directory.
       git = org.ajoberstar.grgit.Grgit.open(file('.'))

 // Get commit id of HEAD.
 commit = git.head().id
}

//Make the commit id we are building visible on command line.
build.doLast {
    logger.quiet("Built commit: ${commit}")
}

distributions {
    release {
        baseName = project.name + '.release'
        contents {
            from { "${buildDir}/binaries/qidlExecutable/release" }
        }
    }

    debug {
            baseName = project.name + '.debug'
            contents {
                from { "${buildDir}/binaries/qidlExecutable/debug" }
            }
       }
}

model {
    components {
        qidl(NativeExecutableSpec) {      
 		    targetPlatform "x86"			
		    binaries.all {
			    cppCompiler.define '_CONSOLE'
			    cppCompiler.define 'WIN32'
			    cppCompiler.define '_UNICODE'
			    cppCompiler.define 'UNICODE'
			    cppCompiler.args '/Z7'
			
                 if (toolChain in VisualCpp && buildType == buildTypes.debug) {										
				     cppCompiler.define '_DEBUG'					
				     linker.args '/DEBUG', "/LIBPATH:$ATLMFCDIR\\lib"
			     } else if (toolChain in VisualCpp && buildType == buildTypes.release) {					
				     cppCompiler.define 'NDEBUG'					
				     linker.args '/RELEASE', "/LIBPATH:$ATLMFCDIR\\lib"
			     }
                 }
		sources {
                  cpp {                    
				     exportedHeaders {
                         srcDirs "$ATLMFCDIR\\include"
                     }				
     		     source {						
			include "*.cpp"
		    }
            }
        }			
    }
}

platforms {
	x86 {
                architecture "x86"
            }
	x64 {
		architecture "x86_64"
	}
}

buildTypes {
         debug
         release
    }
}

Question(s) are:

  1. How do I connect the releaseDistZip task with the build tasks i.e. task dependency to get the compile and link tasks run without specifying them?
  2. How do I finish the distribution configuration and connect the releaseDist… with the release build type and the same for debug?
  3. Finally does this look reasonable…first try here… :slight_smile:

Happy for any pointers!
Thanks in adv…
Patrik