@@ -79,13 +79,7 @@ trait MiMaChecks extends Mima {
7979 )
8080}
8181
82- trait OsLibModule
83- extends CrossScalaModule
84- with PublishModule
85- with AcyclicModule
86- with SafeDeps
87- with PlatformScalaModule { outer =>
88-
82+ trait OsLibPublishModule extends PublishModule {
8983 def publishVersion = VcsVersion.vcsState().format()
9084 def pomSettings = PomSettings(
9185 description = artifactName(),
@@ -100,6 +94,14 @@ trait OsLibModule
10094 Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")
10195 )
10296 )
97+ }
98+
99+ trait OsLibModule
100+ extends OsLibPublishModule
101+ with CrossScalaModule
102+ with AcyclicModule
103+ with SafeDeps
104+ with PlatformScalaModule { outer =>
103105
104106 trait OsLibTestModule extends ScalaModule with TestModule.Utest with SafeDeps {
105107 def ivyDeps = Agg(Deps.utest, Deps.sourcecode)
@@ -170,7 +172,7 @@ object os extends Module {
170172
171173 object jvm extends Cross[OsJvmModule](scalaVersions)
172174 trait OsJvmModule extends OsModule with MiMaChecks {
173- def moduleDeps = super.moduleDeps ++ Seq(os.zip.jvm() )
175+ def moduleDeps = super.moduleDeps ++ Seq(os.zip)
174176
175177 object test extends ScalaTests with OsLibTestModule {
176178 override def ivyDeps = T { super.ivyDeps() ++ Agg(Deps.expecty) }
@@ -197,13 +199,7 @@ object os extends Module {
197199 object nohometest extends ScalaTests with OsLibTestModule
198200 }
199201
200- object zip extends Module {
201- object jvm extends Cross[OsZipJvmModule](scalaVersions)
202- trait OsZipJvmModule extends OsLibModule
203-
204- val pkg = "os.shaded_org_apache_tools_zip"
205- val zipSrc = millSourcePath / "src" / "os/shaded_org_apache_tools_zip"
206-
202+ object zip extends JavaModule with OsLibPublishModule {
207203 def apacheAntZipOriginalSource: T[PathRef] = Task(persistent = true) {
208204 if (!_root_.os.exists(Task.dest / "unzipped")) {
209205 val antVersion = Deps.ant.version
@@ -233,11 +229,10 @@ object os extends Module {
233229 * To avoid classpath conflicts, the dependency is shaded and compiled from source. Only the `org.apache.tools.zip`
234230 * package, not the entire Ant codebase, is needed. This only adds < 100kb to Os-Lib jar size.
235231 */
236- def apacheAntZipSource: T[PathRef] = Task {
237- _root_.os.walk.stream(zipSrc)
238- .filter(_.ext == "java")
239- .filter(_.last != "PermissionUtils.java")
240- .foreach(_root_.os.remove(_))
232+ def generatedSources = T {
233+ val pkg = "os.shaded_org_apache_tools_zip"
234+ val zipSrc = T.dest / "os/shaded_org_apache_tools_zip"
235+ _root_.os.makeDir.all(zipSrc)
241236
242237 // Move from "package org.apache.tools.zip" to "package os.shaded_org_apache_tools_zip"
243238 // Make all classes package private (private [os]) by removing any `public` access modifier
@@ -249,7 +244,7 @@ object os extends Module {
249244 _root_.os.write(zipSrc / p.last, content)
250245 }
251246
252- PathRef(zipSrc )
247+ Seq( PathRef(T.dest) )
253248 }
254249 }
255250
0 commit comments