apply plugin: "base"
apply plugin: "ivy-publish"

group = "org.gradle.sample"
version = "1.0"

// tag::custom-artifact[]
def rpmFile = file("$buildDir/rpms/my-package.rpm")
def rpmArtifact = artifacts.add("archives", rpmFile) {
    type "rpm"
    builtBy "rpm"
}
// end::custom-artifact[]

task rpm() {
    outputs.file rpmFile
    doLast {
        // produce real RPM here
        rpmFile << "file contents"
    }
}

// tag::custom-artifact[]
publishing {
    publications {
        ivy(IvyPublication) {
            artifact rpmArtifact
        }
    }
// end::custom-artifact[]
    repositories {
        // change URLs to point to your repo, e.g. http://my.org/repo
        ivy {
            url "$buildDir/repo"
        }
    }
// tag::custom-artifact[]
}
// end::custom-artifact[]
