Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

3.0 KB
Raw Blame
plugins {
  id 'java'
  id 'maven-publish'
  id 'signing'
}

sourceSets {
  main {
    output.dir(layout.buildDirectory.dir("classes/main"), builtBy: "generateSources")
  }
}

base {
  archivesName = "openremote-${project.name}"
}

java {
  withJavadocJar()
  withSourcesJar()
}

publishing {
  publications {
    maven(MavenPublication) {
      group = "io.openremote.ui"
      artifactId = "openremote-${project.name}"
      from components.java
      pom {
        name = 'OpenRemote Manager UI'
        description = 'Provides the UI for the OpenRemote Manager'
        url = 'https://github.com/openremote/core'
        licenses {
          license {
            name = 'GNU Affero General Public License v3.0'
            url = 'https://www.gnu.org/licenses/agpl-3.0.en.html'
          }
        }
        developers {
          developer {
            id = 'developers'
            name = 'Developers'
            email = '[email protected]'
            organization = 'OpenRemote'
            organizationUrl = 'https://openremote.io'
          }
        }
        scm {
          connection = 'scm:git:git://github.com/openremote/core.git'
          developerConnection = 'scm:git:ssh://github.com:openremote/core.git'
          url = 'https://github.com/openremote/core/tree/main'
        }
      }
    }
  }

  repositories {
    maven {
      if (!version.endsWith('-LOCAL')) {
        credentials {
          username = findProperty("publishUsername")
          password = findProperty("publishPassword")
        }
      }
      url = version.endsWith('-LOCAL') ? layout.buildDirectory.dir('repo') : version.endsWith('-SNAPSHOT') ? findProperty("snapshotsRepoUrl") : findProperty("releasesRepoUrl")
    }
  }
}

signing {
  def signingKey = findProperty("signingKey")
  def signingPassword = findProperty("signingPassword")
  if (signingKey && signingPassword) {
    useInMemoryPgpKeys(signingKey, signingPassword)
    sign publishing.publications.maven
  }
}

tasks.register('npmBuild', Exec) {
  mustRunAfter npmClean
  dependsOn getYarnInstallTask()
  commandLine npmCommand("yarn"), "run", "build"
}

tasks.register('npmTest', Exec) {
  dependsOn ":ui:test:installTestDeps", ":ui:test:clean"
  commandLine npmCommand("yarn"), "run", "test"
  args((findProperty('args')?.toString()?.tokenize()) ?: [])
}

tasks.register('cleanDist') {
  dependsOn npmClean
}

tasks.register('generateSources', Copy) {
  dependsOn npmBuild
  from layout.buildDirectory.dir("dist")
  into layout.buildDirectory.dir("classes/main/org/openremote/web/${project.name}")
}

tasks.register('prepareUi') {
  dependsOn clean, npmPrepare
}

tasks.register('publishUi') {
  dependsOn clean, npmPublish
}

tasks.register('installDist', Copy) {
  dependsOn(npmBuild)
  mustRunAfter ":manager:installDist"
  from layout.buildDirectory.dir("dist")
  into project(':manager').layout.buildDirectory.dir("install/manager/web/${project.name}")
}

clean.dependsOn(cleanDist)
jar.dependsOn(generateSources)

gradle.startParameter.excludedTaskNames += ["${project.path}:test".toString()]