1- apply plugin : ' application'
1+ plugins {
2+ id ' java'
3+ id ' com.mendix.gradle.publish-module-plugin' version ' 1.12'
4+ id ' net.researchgate.release' version ' 2.8.1'
5+ }
26
37import org.gradle.api.internal.file.copy.CopySpecInternal
48
5- sourceCompatibility = ' 1.8 '
9+ sourceCompatibility = ' 11 '
610[compileJava, compileTestJava]* . options* . encoding = ' UTF-8'
711
8- repositories {
9- mavenCentral()
12+ project. ext {
13+ mendixPublicApiVersion = ' 9.0.5'
14+ userLibDir = ' userlib'
1015}
1116
1217configurations. all {
1318 transitive = false
1419}
1520
21+ mxMarketplace {
22+ moduleName = " AuditTrail"
23+ moduleLicense = " Apache V2"
24+ appNumber = 138
25+ appName = " Audittrail"
26+ appDirectory = " ."
27+ versionPathPrefix = " __Version " // the path prefix within the module to the version folder
28+ }
29+
30+ repositories {
31+ maven {
32+ url ' https://nexus.rnd.mendix.com/repository/repo1-proxy/'
33+ }
34+ maven {
35+ url ' https://nexus.rnd.mendix.com/repository/maven-hosted/'
36+ }
37+ }
38+
39+
1640dependencies {
17- // TEST_CRM
18- compile group : ' org.hamcrest' , name : ' hamcrest' , version : ' 2.2'
41+ testImplementation(
42+ [group : ' com.mendix' , name : ' public-api' , version : " $mendixPublicApiVersion " ],
43+
44+ // TEST_CRM
45+ [group : ' org.hamcrest' , name : ' hamcrest' , version : ' 2.2' ],
1946
20- // UnitTesting
21- compile group : ' junit' , name : ' junit' , version : ' 4.11'
22- compile group : ' commons-io' , name : ' commons-io' , version : ' 2.3'
23- compile group : ' org.apache.httpcomponents' , name : ' httpcore-osgi' , version : ' 4.4.1'
24- compile group : ' org.apache.httpcomponents' , name : ' httpclient-osgi' , version : ' 4.4.1'
47+ // UnitTesting
48+ [group : ' junit' , name : ' junit' , version : ' 4.13.1' ],
49+ [group : ' commons-io' , name : ' commons-io' , version : ' 2.11.0' ],
50+ [group : ' org.apache.commons' , name : ' commons-lang3' , version : ' 3.12.0' ],
51+ [group : ' org.apache.httpcomponents.core5' , name : ' httpcore5' , version : ' 5.0.3' ],
52+ [group : ' org.apache.httpcomponents.client5' , name : ' httpclient5' , version : ' 5.0.3' ]
53+ )
2554
26- // UnitTesting and ObjectHandling
27- compile group : ' org.apache.commons' , name : ' commons-lang3' , version : ' 3.1'
55+ compileOnly([group : ' com.mendix' , name : ' public-api' , version : " $mendixPublicApiVersion " ])
2856}
2957
30- task copyToUserlib ( type : Copy ) {
58+ task copyAllToUserlib ( type : Copy ) {
3159 from configurations. testCompileClasspath
32- into ' userlib'
33- rename ' commons-io-2.3.jar' , ' org.apache.commons.io-2.3.0.jar'
34- rename ' commons-lang3-3.1.jar' , ' org.apache.commons.lang3.jar'
35- rename ' http(.*)-osgi-(.*)' , ' org.apache.httpcomponents.http$1_$2'
60+ into userLibDir
61+ }
62+
63+ task copyRuntimeToUserlib (type : Copy ) {
64+ from configurations. runtimeClasspath
65+ into userLibDir
66+ eachFile { fileCopyDetails -> new File (destinationDir, " ${ fileCopyDetails.name} .${ project.name} .RequiredLib" ). write ' ' }
3667}
68+
69+ clean {
70+ delete " $userLibDir "
71+ }
72+
73+ task prepareMpk {
74+ dependsOn ' clean'
75+ dependsOn ' copyRuntimeToUserlib'
76+
77+ tasks. findByName(' copyRuntimeToUserlib' ). mustRunAfter ' clean'
78+ }
79+
80+ task prepareTest {
81+ dependsOn ' clean'
82+ dependsOn ' copyAllToUserlib'
83+
84+ tasks. findByName(' copyAllToUserlib' ). mustRunAfter ' clean'
85+ }
86+
87+ test {
88+ exclude ' unittesting/*'
89+ }
90+
91+ release {
92+ tagTemplate = ' $name-$version'
93+ }
94+
95+ task afterReleaseBuildTask {
96+ dependsOn ' prepareMpk'
97+ dependsOn ' prepareTest'
98+ dependsOn ' test'
99+ dependsOn ' publishModuleToMarketplace'
100+
101+ tasks. findByName(' prepareTest' ). mustRunAfter ' prepareMpk'
102+ tasks. findByName(' test' ). mustRunAfter ' prepareTest'
103+ tasks. findByName(' publishModuleToMarketplace' ). mustRunAfter ' test'
104+ }
105+
106+ exportModule. dependsOn prepareMpk
107+ mxBuild. dependsOn prepareTest
108+ afterReleaseBuild. dependsOn afterReleaseBuildTask
0 commit comments