Licensing/build.gradle

126 lines
3.1 KiB
Groovy
Raw Normal View History

import java.nio.file.Paths
2018-07-22 16:23:55 +02:00
import java.time.Instant
2018-06-30 23:22:05 +02:00
/*
* Copyright 2018 dorkbox, llc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
// load properties from custom location
def propsFile = Paths.get("${projectDir}/../../gradle.properties").toAbsolutePath().normalize().toFile()
println("Loading custom property data from: ${propsFile}")
def props = new Properties()
propsFile.withInputStream {props.load(it)}
props.each {key, val -> project.ext.set(key, val)}
// for plugin publishing
2018-06-30 23:22:05 +02:00
repositories {
maven { url "https://plugins.gradle.org/m2/" }
2018-06-30 23:22:05 +02:00
}
dependencies {
classpath "com.gradle.publish:plugin-publish-plugin:0.9.10"
}
}
2018-06-30 23:22:05 +02:00
plugins {
id 'java'
id 'java-gradle-plugin'
id "org.jetbrains.kotlin.jvm" version "1.2.60"
2018-06-30 23:22:05 +02:00
}
// for publishing the plugin to gradle
2018-06-30 23:22:05 +02:00
apply plugin: "com.gradle.plugin-publish"
project.description = 'License definitions and legal management plugin for the Gradle build system'
project.group = 'com.dorkbox'
2018-08-03 13:59:45 +02:00
project.version = '1.2.2'
2018-06-30 23:22:05 +02:00
project.ext.name = 'Gradle Licensing Plugin'
project.ext.id = 'Licensing'
project.ext.url = 'https://git.dorkbox.com/dorkbox/Licensing'
2018-06-30 23:43:31 +02:00
project.ext.tags = ['licensing', 'legal', 'notice', 'license', 'dependencies']
2018-06-30 23:22:05 +02:00
2018-06-30 23:22:05 +02:00
sourceSets {
main {
java {
setSrcDirs Collections.singletonList('src')
}
resources {
setSrcDirs Collections.singletonList('resources')
}
}
}
repositories {
jcenter()
}
dependencies {
compileOnly 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60'
2018-06-30 23:22:05 +02:00
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.incremental = true
}
2018-07-22 16:23:55 +02:00
tasks.withType(Jar) {
duplicatesStrategy DuplicatesStrategy.FAIL
2018-08-05 16:56:24 +02:00
// also include our license information
from('.') {
include 'LICENSE*'
}
2018-07-22 16:23:55 +02:00
manifest {
attributes['Implementation-Version'] = project.version
attributes['Build-Date'] = Instant.now().toString()
}
}
///////////////////////////////
////// Plugin Publishing + Release
///////////////////////////////
2018-06-30 23:22:05 +02:00
gradlePlugin {
plugins {
licensing {
2018-06-30 23:22:05 +02:00
id = "${project.group}.${project.ext.id}"
implementationClass = 'dorkbox.license.LicensePlugin'
}
}
}
pluginBundle {
2018-07-17 21:38:41 +02:00
website = project.ext.url
vcsUrl = project.ext.url
plugins {
licensing {
id = "${project.group}.${project.ext.id}"
displayName = project.ext.name
description = project.description
tags = project.ext.tags
version = project.version
}
}
}