/////////////////////////////////////////////////// // // // Dependency Details // // // /////////////////////////////////////////////////// plugins { id "com.moowork.node" version "0.12" id "org.ajoberstar.grgit" version "1.5.1" } apply plugin: 'distribution' apply plugin: 'maven-publish' apply plugin: 'groovy' apply from: "$rootDir/gradle/utils/repository.gradle" apply from: "$rootDir/gradle/utils/loadPackageJson.gradle" import org.ajoberstar.grgit.Grgit def packageJson = loadPackageJson() /////////////////////////////////////////////////// // // // Project Details // // // /////////////////////////////////////////////////// allprojects { group = 'solutions.siren' version = packageJson.kibi_version } /////////////////////////////////////////////////// // // // NodeJS // // // /////////////////////////////////////////////////// node { // Version of node to use. version = packageJson.engines.node // Version of npm to use. npmVersion = packageJson.engines.npm // Base URL for fetching node distributions (change if you have a mirror). distBaseUrl = 'https://nodejs.org/dist' // If true, it will download node using above parameters. // If false, it will try to use globally installed node. download = true // Set the work directory for unpacking node workDir = file("${buildDir}/nodejs") // Set the work directory where node_modules should be located nodeModulesDir = file("${projectDir}") } /////////////////////////////////////////////////// // // // Main Tasks // // // /////////////////////////////////////////////////// // Clones the local repository to generate a source artifact. task cloneSources << { delete("${buildDir}/sources") Grgit.clone(dir: file("${buildDir}/sources"), uri: "file://${projectDir}") } def getBuildArgs() { if (project.version.endsWith("-SNAPSHOT")) { return ["run", "build", "--", "--release=false"] } return ["run", "build", "--", "--release=true"] } task npmBuildWithOpts(type: NpmTask) { args = getBuildArgs() } task build(dependsOn: [npmInstall, npm_run_test, npmBuildWithOpts]) npm_run_test.mustRunAfter npmInstall npmBuildWithOpts.mustRunAfter npm_run_test /////////////////////////////////////////////////// // // // Distributions // // // /////////////////////////////////////////////////// distributions { /** * Distribution for the asiicdoc source of the documentation */ srcDoc { baseName = 'investigate-doc' contents { from { "docs" } } } /** * Distribution for the investigate sources */ src { baseName = 'investigate-core' contents { from { "${buildDir}/sources" } } } } /////////////////////////////////////////////////// // // // Publishing // // // /////////////////////////////////////////////////// publishing { repositories getArtifactoryRepository() publications { /** * Core Kibi distribution */ coreDist(MavenPublication) { /** * Artifacts for each platform */ artifact(new File("${projectDir}/target", "investigate-${project.version}-darwin-x86_64.zip")) { classifier "darwin-x86_64" } artifact(new File("${projectDir}/target", "investigate-${project.version}-linux-x86_64.zip")) { classifier "linux-x86_64" } artifact(new File("${projectDir}/target", "investigate-${project.version}-windows-x86_64.zip")) { classifier "windows-x86_64" } /** * Source artifact */ artifact srcDistZip { dependsOn cloneSources classifier "sources" } groupId project.group artifactId "investigate-core" version project.version } /** * Source artifact for documentation */ srcDoc(MavenPublication) { artifact srcDocDistZip { classifier "sources" } groupId project.group artifactId "investigate-doc" version project.version } } }