Skip to content

Commit cc68197

Browse files
committed
Updated Gradle implementation
- Removed custom Gradle models - Added standalone tests for Gradle - Separated meta-build to generate files under mill-build
1 parent a824500 commit cc68197

File tree

74 files changed

+1568
-1861
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1568
-1861
lines changed

example/migrating/javalib/4-gradle-complete/build.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
> git remote add -f origin https://github.com/komamitsu/fluency.git
77
> git checkout 2.7.3 # multi-module Java project that requires Java 16+
88

9-
> ./mill init --base-module FluencyModule --jvm-id 16
9+
> ./mill init
1010
converting Gradle build
1111
...
1212
init completed, run "mill resolve _" to list available tasks

example/migrating/javalib/5-gradle-incomplete/build.mill

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44

55
> git init .
66
> git remote add -f origin https://github.com/mockito/mockito.git
7-
> git checkout v5.15.2 # multi-module Java project that requires Java 17+
7+
> git checkout v5.19.0 # multi-module Java project that requires Java 17+
88

9-
> ./mill init --base-module MockitoModule --jvm-id 17 # init ignores custom dependency configurations
9+
> ./mill init # imported modules are not fully functional
1010
converting Gradle build
11-
ignoring errorprone dependency (com.google.errorprone,error_prone_core,2.23.0)
1211
init completed, run "mill resolve _" to list available tasks
1312

14-
> ./mill __.compile # compilation error can be by fixed by using the Mill plugin for ErrorProne
15-
error: plug-in not found: ErrorProne
13+
> ./mill mockito-core.compile # requires manual tweaking to support Java modules
14+
error: ...module not found: net.bytebuddy
1615
*/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package mill.integration
2+
3+
import mill.testkit.GitRepoIntegrationTestSuite
4+
import utest.*
5+
6+
object MillInitEhcache3Tests extends GitRepoIntegrationTestSuite {
7+
8+
// gradle 7.2
9+
// custom dependency configurations
10+
// dependencies with version constraints
11+
// custom layout
12+
// custom repository
13+
// bom dependencies
14+
// modules with pom packaging
15+
// Junit4
16+
def gitRepoUrl = "[email protected]:ehcache/ehcache3.git"
17+
def gitRepoBranch = "v3.10.8"
18+
19+
def tests = Tests {
20+
test - integrationTest { tester =>
21+
import tester.*
22+
23+
// https://docs.gradle.org/current/userguide/compatibility.html#java_runtime
24+
os.write(workspacePath / ".mill-jvm-version", "11")
25+
26+
eval("init", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
27+
eval(("resolve", "_"), stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
28+
eval("ehcache-api.compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
29+
eval("ehcache-api.test", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
30+
31+
// custom dependency configurations not supported
32+
eval("ehcache-xml.compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> false
33+
}
34+
}
35+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package mill.integration
2+
3+
import mill.testkit.GitRepoIntegrationTestSuite
4+
import utest.*
5+
6+
object MillInitFastCsvTests extends GitRepoIntegrationTestSuite {
7+
8+
// gradle 9.0.0-rc-1
9+
// Junit5
10+
// uses ErrorProne
11+
def gitRepoUrl = "[email protected]:osiegmar/FastCSV.git"
12+
def gitRepoBranch = "v4.0.0"
13+
14+
def tests = Tests {
15+
test - integrationTest { tester =>
16+
import tester.*
17+
18+
// from tasks.compileJava.options.release
19+
os.write(workspacePath / ".mill-jvm-version", "17")
20+
21+
eval("init", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
22+
eval(("resolve", "_"), stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
23+
eval("lib.compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
24+
eval("lib.publishLocal", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
25+
26+
// requires support for Java modules
27+
eval("example.compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> false
28+
29+
// junit-platform-launcher version is set implicitly (tasks.test.useJunitPlatform())
30+
// https://docs.gradle.org/8.14.3/userguide/upgrading_version_8.html#test_framework_implementation_dependencies
31+
eval("lib.test.compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> false
32+
}
33+
}
34+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package mill.integration
2+
3+
import mill.testkit.GitRepoIntegrationTestSuite
4+
import utest.*
5+
6+
object MillInitJCommanderTests extends GitRepoIntegrationTestSuite {
7+
8+
// gradle 8.9
9+
// single module
10+
// testng 7.0.0
11+
def gitRepoUrl = "[email protected]:cbeust/jcommander.git"
12+
def gitRepoBranch = "2.0"
13+
14+
def tests = Tests {
15+
test - integrationTest { tester =>
16+
import tester.*
17+
18+
os.write(workspacePath / ".mill-jvm-version", "11")
19+
20+
eval("init", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
21+
eval(("resolve", "_"), stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
22+
eval("compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
23+
eval("publishLocal", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
24+
25+
// annotations defined in main-module cannot be used in test-module?
26+
eval("test.compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> false
27+
}
28+
}
29+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package mill.integration
2+
3+
import mill.testkit.GitRepoIntegrationTestSuite
4+
import utest.*
5+
6+
object MillInitMicroconfigTests extends GitRepoIntegrationTestSuite {
7+
8+
// gradle 8.10.1
9+
// uses spring-boot-dependencies BOM
10+
// Junit5
11+
def gitRepoUrl = "[email protected]:microconfig/microconfig.git"
12+
def gitRepoBranch = "v4.9.5"
13+
14+
def tests = Tests {
15+
test - integrationTest { tester =>
16+
import tester.*
17+
18+
eval(("init", "-u"), stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
19+
eval(("resolve", "_"), stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
20+
eval("__.compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
21+
eval("__.publishLocal", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
22+
eval("__.test", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
23+
}
24+
}
25+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package mill.integration
2+
3+
import mill.testkit.GitRepoIntegrationTestSuite
4+
import utest.*
5+
6+
object MillInitMockitoTests extends GitRepoIntegrationTestSuite {
7+
8+
// gradle 8.14.2
9+
// contains BOM module
10+
def gitRepoUrl = "[email protected]:mockito/mockito.git"
11+
def gitRepoBranch = "v5.19.0"
12+
13+
def tests = Tests {
14+
test - integrationTest { tester =>
15+
import tester.*
16+
17+
eval("init", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
18+
eval(("resolve", "_"), stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
19+
20+
// requires support for Java modules
21+
eval("mockito-core.compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> false
22+
}
23+
}
24+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package mill.integration
2+
3+
import mill.testkit.GitRepoIntegrationTestSuite
4+
import utest.*
5+
6+
object MillInitPCollectionsTests extends GitRepoIntegrationTestSuite {
7+
8+
// gradle 8.14.3
9+
// single module
10+
// Junit5
11+
def gitRepoUrl = "[email protected]:hrldcpr/pcollections.git"
12+
def gitRepoBranch = "v5.0.0"
13+
14+
def tests = Tests {
15+
test - integrationTest { tester =>
16+
import tester.*
17+
18+
eval("init", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
19+
eval(("resolve", "_"), stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
20+
21+
// requires non-LTS JDK9
22+
eval("compile", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> false
23+
}
24+
}
25+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package mill.integration
2+
3+
import mill.testkit.GitRepoIntegrationTestSuite
4+
import utest.*
5+
6+
object MillInitSpotbugsTests extends GitRepoIntegrationTestSuite {
7+
8+
// gradle 9.0.0
9+
// custom dependency configurations
10+
// dependencies with version constraints
11+
// custom layout
12+
// Junit5
13+
def gitRepoUrl = "[email protected]:spotbugs/spotbugs.git"
14+
def gitRepoBranch = "4.9.4"
15+
16+
def tests = Tests {
17+
test - integrationTest { tester =>
18+
import tester.*
19+
20+
eval("init", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
21+
eval(("resolve", "_"), stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> true
22+
eval(
23+
"spotbugs-annotations.compile",
24+
stdout = os.Inherit,
25+
stderr = os.Inherit
26+
).isSuccess ==> true
27+
eval(
28+
"spotbugs-annotations.publishLocal",
29+
stdout = os.Inherit,
30+
stderr = os.Inherit
31+
).isSuccess ==> true
32+
33+
// missing sources from custom layout
34+
eval("spotbugs-tests.test", stdout = os.Inherit, stderr = os.Inherit).isSuccess ==> false
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)