|
1 | | -plugins { |
2 | | - id "com.gradle.plugin-publish" version "0.9.9" |
3 | | -} |
4 | | - |
5 | | -apply plugin: 'java' |
6 | | -apply plugin: 'maven' |
7 | | -apply plugin: 'findbugs' |
8 | | - |
9 | | -apply from: "${buildscript.sourceFile.parentFile}/scripts/javapreprocessor.gradle" |
10 | | - |
11 | | -group = 'de.inetsoftware' |
12 | | - |
13 | | -def LIB_GRADLE_VERSION = System.getenv('LIB_GRADLE_VERSION') ?: '4.10.2' // Gradle version for the wrapper |
14 | | -def buildVersion = '7' // build version |
15 | | -def baseVersion = '4.8' // Base Version to build, depends on gradle version. |
16 | | - |
17 | | -wrapper.gradleVersion = LIB_GRADLE_VERSION |
18 | | -def gVersion = VersionNumber.parse( gradle.gradleVersion ) |
19 | | -println 'Gradle version: ' + gVersion |
20 | | - |
21 | | -// Fetch version from script. |
22 | | -apply from: "${buildscript.sourceFile.parentFile}/scripts/SetupBuilderVersion.gradle" |
23 | | -version = setupBuilderVersion(buildVersion) |
24 | | -baseVersion += '.' + buildVersion |
25 | | -println 'SetupBuilder version: ' + version |
26 | | - |
27 | | -sourceCompatibility = 1.8 |
28 | | -compileJava.options.encoding = 'UTF-8' |
29 | | - |
30 | | -repositories { |
31 | | - jcenter() |
32 | | -} |
33 | | - |
34 | | -dependencies { |
35 | | - compile gradleApi() |
36 | | -} |
37 | | - |
38 | | -sourceSets { |
39 | | - main { |
40 | | - java { |
41 | | - srcDirs = ['src'] |
42 | | - if ( !version.equalsIgnoreCase(baseVersion) ) { |
43 | | - srcDirs = ["${buildDir}/preparedSrc-${gVersion}"] |
44 | | - } |
45 | | - } |
46 | | - resources { |
47 | | - srcDirs = ['src'] |
48 | | - exclude '**/*.java' |
49 | | - exclude '**/package.html' |
50 | | - } |
51 | | - } |
52 | | - test { |
53 | | - java { |
54 | | - srcDirs = ['src'] |
55 | | - if ( !version.equalsIgnoreCase(baseVersion) ) { |
56 | | - srcDirs = ["${buildDir}/preparedSrc-${gVersion}"] |
57 | | - } |
58 | | - } |
59 | | - } |
60 | | -} |
61 | | - |
62 | | -/* Configure for ClearReports Version and copy files if needed */ |
63 | | -if ( !version.equalsIgnoreCase(baseVersion) ) { |
64 | | - JPP.setJPPSources( "src", [ |
65 | | - "gradleVersion" : "${gVersion}", |
66 | | - "outputDirectory" : "${buildDir}/preparedSrc-${gVersion}" |
67 | | - ]); |
68 | | -} |
69 | | - |
70 | | -if( !System.getProperty("local") && file( '../BuildScripts/base.gradle' ).exists() ) { |
71 | | - apply from: '../BuildScripts/base.gradle' // for internal build system |
72 | | - preparePublish.dependsOn 'publishPluginJavaDocsJar' |
73 | | - preparePublish.dependsOn 'jar' |
74 | | - preparePublish.dependsOn 'publishPluginJar' |
75 | | - println "Uploading into internal Repository 'fileserver'" |
76 | | - |
77 | | - if ( System.getProperty("snapshot") ) { |
78 | | - version += '-SNAPSHOT' // setting version to snapshot |
79 | | - } |
80 | | -} else { |
81 | | - println "Uploading into local '../repo'" |
82 | | - version += System.getenv('DEPLOY') != null ?'':'-SNAPSHOT' // setting version to snapshot |
83 | | - uploadArchives { |
84 | | - repositories { |
85 | | - mavenDeployer { |
86 | | - repository(url: uri('../repo')) |
87 | | - } |
88 | | - } |
89 | | - } |
90 | | - |
91 | | - clean.doLast { |
92 | | - println "Cleaning local repository folder" |
93 | | - file('../repo').deleteDir() |
94 | | - } |
95 | | -} |
96 | | - |
97 | | -findbugs { |
98 | | - toolVersion = "3.0.1" |
99 | | - // Don't worry about test classes |
100 | | - sourceSets = [sourceSets.main] |
101 | | - excludeFilter file("${projectDir}/.findbugs.xml") |
102 | | - ignoreFailures = true |
103 | | - |
104 | | - tasks.withType(FindBugs) { |
105 | | - reports { |
106 | | - xml.enabled = false |
107 | | - html.enabled = true |
108 | | - } |
109 | | - } |
110 | | -} |
111 | | - |
112 | | -javadoc { |
113 | | - // Third party libs |
114 | | - exclude "**/image4j" |
115 | | - exclude "**/icns" |
116 | | -} |
117 | | - |
118 | | -pluginBundle { |
119 | | - website = 'https://github.com/i-net-software/SetupBuilder' |
120 | | - vcsUrl = 'https://github.com/i-net-software/SetupBuilder' |
121 | | - description = 'The Setup Builder is a plugin for Gradle which can create native setups for different platforms like Windows, Linux and OSX. The output is a *.msi, a *.deb, a *.rpm or a *.dmg file.' |
122 | | - tags = ['setup', 'installer', 'msi', 'dmg', 'deb', 'rpm', 'windows', 'linux', 'osx' ] |
123 | | - |
124 | | - plugins { |
125 | | - setupBuilderPlugin { |
126 | | - id = 'de.inetsoftware.setupbuilder' |
127 | | - displayName = 'Gradle Setup Builder plugin' |
128 | | - } |
129 | | - appBunderPlugin { |
130 | | - id = 'de.inetsoftware.appbundler' |
131 | | - displayName = 'Gradle Application Bundler plugin for OSX' |
132 | | - tags = ['app'] |
133 | | - } |
134 | | - } |
135 | | -} |
136 | | - |
137 | | -// see https://discuss.gradle.org/t/add-apikey-and-apisecret-to-pluginbundle-extension-for-plugin-publish-plugin/8636/3 |
138 | | -task setupPluginUpload { |
139 | | - |
140 | | - publishPlugins.dependsOn 'setupPluginUpload' |
141 | | - doLast { |
142 | | - def key=System.env.gradlePublishKey |
143 | | - def secret = System.env.gradlePublishSecret |
144 | | - |
145 | | - if( !key || !secret) |
146 | | - { |
147 | | - throw new RuntimeException("gradlePublishKey and/or gradlePublishSecret are not defined environment variables") |
148 | | - } |
149 | | - |
150 | | - System.properties.setProperty("gradle.publish.key", key) |
151 | | - System.properties.setProperty("gradle.publish.secret", secret) |
152 | | - } |
153 | | -} |
154 | | - |
155 | | -// Check for the current operating system to load the specific build task |
156 | | -import org.apache.tools.ant.taskdefs.condition.Os |
157 | | -def dependingTask = 'deb' |
158 | | -if (Os.isFamily(Os.FAMILY_MAC)) { |
159 | | - dependingTask = 'dmg' |
160 | | -} else if (Os.isFamily(Os.FAMILY_WINDOWS)) { |
161 | | - dependingTask = 'msi' |
162 | | -} |
163 | | - |
164 | | -// run the following task as a dependency to the "check"-task. |
165 | | -task runSetupBuilderTestTasks(type: GradleBuild) { |
166 | | - check.dependsOn runSetupBuilderTestTasks |
167 | | - buildFile = 'testBuilds/setupBuilder.gradle' |
168 | | - tasks = ['clean', dependingTask] |
169 | | -} |
170 | | - |
| 1 | +plugins { |
| 2 | + id "com.gradle.plugin-publish" version "0.9.9" |
| 3 | +} |
| 4 | + |
| 5 | +apply plugin: 'java' |
| 6 | +apply plugin: 'maven' |
| 7 | +apply plugin: 'findbugs' |
| 8 | + |
| 9 | +apply from: "${buildscript.sourceFile.parentFile}/scripts/javapreprocessor.gradle" |
| 10 | + |
| 11 | +group = 'de.inetsoftware' |
| 12 | + |
| 13 | +def LIB_GRADLE_VERSION = System.getenv('LIB_GRADLE_VERSION') ?: '4.10.2' // Gradle version for the wrapper |
| 14 | +def buildVersion = '7' // build version |
| 15 | +def baseVersion = '4.8' // Base Version to build, depends on gradle version. |
| 16 | + |
| 17 | +wrapper.gradleVersion = LIB_GRADLE_VERSION |
| 18 | +def gVersion = org.gradle.util.VersionNumber.parse( gradle.gradleVersion ) |
| 19 | +println 'Gradle version: ' + gVersion |
| 20 | + |
| 21 | +// Fetch version from script. |
| 22 | +apply from: "${buildscript.sourceFile.parentFile}/scripts/SetupBuilderVersion.gradle" |
| 23 | +version = setupBuilderVersion(buildVersion) |
| 24 | +baseVersion += '.' + buildVersion |
| 25 | +println 'SetupBuilder version: ' + version |
| 26 | + |
| 27 | +sourceCompatibility = 1.8 |
| 28 | +compileJava.options.encoding = 'UTF-8' |
| 29 | + |
| 30 | +repositories { |
| 31 | + jcenter() |
| 32 | +} |
| 33 | + |
| 34 | +dependencies { |
| 35 | + compile gradleApi() |
| 36 | +} |
| 37 | + |
| 38 | +sourceSets { |
| 39 | + main { |
| 40 | + java { |
| 41 | + srcDirs = ['src'] |
| 42 | + if ( !version.equalsIgnoreCase(baseVersion) ) { |
| 43 | + srcDirs = ["${buildDir}/preparedSrc-${gVersion}"] |
| 44 | + } |
| 45 | + } |
| 46 | + resources { |
| 47 | + srcDirs = ['src'] |
| 48 | + exclude '**/*.java' |
| 49 | + exclude '**/package.html' |
| 50 | + } |
| 51 | + } |
| 52 | + test { |
| 53 | + java { |
| 54 | + srcDirs = ['src'] |
| 55 | + if ( !version.equalsIgnoreCase(baseVersion) ) { |
| 56 | + srcDirs = ["${buildDir}/preparedSrc-${gVersion}"] |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | +} |
| 61 | + |
| 62 | +/* Configure for ClearReports Version and copy files if needed */ |
| 63 | +if ( !version.equalsIgnoreCase(baseVersion) ) { |
| 64 | + JPP.setJPPSources( "src", [ |
| 65 | + "gradleVersion" : "${gVersion}", |
| 66 | + "outputDirectory" : "${buildDir}/preparedSrc-${gVersion}" |
| 67 | + ]); |
| 68 | +} |
| 69 | + |
| 70 | +if( !System.getProperty("local") && file( '../BuildScripts/base.gradle' ).exists() ) { |
| 71 | + apply from: '../BuildScripts/base.gradle' // for internal build system |
| 72 | + preparePublish.dependsOn 'publishPluginJavaDocsJar' |
| 73 | + preparePublish.dependsOn 'jar' |
| 74 | + preparePublish.dependsOn 'publishPluginJar' |
| 75 | + println "Uploading into internal Repository 'fileserver'" |
| 76 | + |
| 77 | + if ( System.getProperty("snapshot") ) { |
| 78 | + version += '-SNAPSHOT' // setting version to snapshot |
| 79 | + } |
| 80 | +} else { |
| 81 | + println "Uploading into local '../repo'" |
| 82 | + version += System.getenv('DEPLOY') != null ?'':'-SNAPSHOT' // setting version to snapshot |
| 83 | + uploadArchives { |
| 84 | + repositories { |
| 85 | + mavenDeployer { |
| 86 | + repository(url: uri('../repo')) |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + clean.doLast { |
| 92 | + println "Cleaning local repository folder" |
| 93 | + file('../repo').deleteDir() |
| 94 | + } |
| 95 | +} |
| 96 | + |
| 97 | +findbugs { |
| 98 | + toolVersion = "3.0.1" |
| 99 | + // Don't worry about test classes |
| 100 | + sourceSets = [sourceSets.main] |
| 101 | + excludeFilter file("${projectDir}/.findbugs.xml") |
| 102 | + ignoreFailures = true |
| 103 | + |
| 104 | + tasks.withType(FindBugs) { |
| 105 | + reports { |
| 106 | + xml.enabled = false |
| 107 | + html.enabled = true |
| 108 | + } |
| 109 | + } |
| 110 | +} |
| 111 | + |
| 112 | +javadoc { |
| 113 | + // Third party libs |
| 114 | + exclude "**/image4j" |
| 115 | + exclude "**/icns" |
| 116 | +} |
| 117 | + |
| 118 | +pluginBundle { |
| 119 | + website = 'https://github.com/i-net-software/SetupBuilder' |
| 120 | + vcsUrl = 'https://github.com/i-net-software/SetupBuilder' |
| 121 | + description = 'The Setup Builder is a plugin for Gradle which can create native setups for different platforms like Windows, Linux and OSX. The output is a *.msi, a *.deb, a *.rpm or a *.dmg file.' |
| 122 | + tags = ['setup', 'installer', 'msi', 'dmg', 'deb', 'rpm', 'windows', 'linux', 'osx' ] |
| 123 | + |
| 124 | + plugins { |
| 125 | + setupBuilderPlugin { |
| 126 | + id = 'de.inetsoftware.setupbuilder' |
| 127 | + displayName = 'Gradle Setup Builder plugin' |
| 128 | + } |
| 129 | + appBunderPlugin { |
| 130 | + id = 'de.inetsoftware.appbundler' |
| 131 | + displayName = 'Gradle Application Bundler plugin for OSX' |
| 132 | + tags = ['app'] |
| 133 | + } |
| 134 | + } |
| 135 | +} |
| 136 | + |
| 137 | +// see https://discuss.gradle.org/t/add-apikey-and-apisecret-to-pluginbundle-extension-for-plugin-publish-plugin/8636/3 |
| 138 | +task setupPluginUpload { |
| 139 | + |
| 140 | + publishPlugins.dependsOn 'setupPluginUpload' |
| 141 | + doLast { |
| 142 | + def key=System.env.gradlePublishKey |
| 143 | + def secret = System.env.gradlePublishSecret |
| 144 | + |
| 145 | + if( !key || !secret) |
| 146 | + { |
| 147 | + throw new RuntimeException("gradlePublishKey and/or gradlePublishSecret are not defined environment variables") |
| 148 | + } |
| 149 | + |
| 150 | + System.properties.setProperty("gradle.publish.key", key) |
| 151 | + System.properties.setProperty("gradle.publish.secret", secret) |
| 152 | + } |
| 153 | +} |
| 154 | + |
| 155 | +// Check for the current operating system to load the specific build task |
| 156 | +import org.apache.tools.ant.taskdefs.condition.Os |
| 157 | +def dependingTask = 'deb' |
| 158 | +if (Os.isFamily(Os.FAMILY_MAC)) { |
| 159 | + dependingTask = 'dmg' |
| 160 | +} else if (Os.isFamily(Os.FAMILY_WINDOWS)) { |
| 161 | + dependingTask = 'msi' |
| 162 | +} |
| 163 | + |
| 164 | +// run the following task as a dependency to the "check"-task. |
| 165 | +task runSetupBuilderTestTasks(type: GradleBuild) { |
| 166 | + check.dependsOn runSetupBuilderTestTasks |
| 167 | + buildFile = 'testBuilds/setupBuilder.gradle' |
| 168 | + tasks = ['clean', dependingTask] |
| 169 | +} |
| 170 | + |
0 commit comments