@@ -172,6 +172,82 @@ object Full {
172
172
def apply (prefix : String , suffix : String ): Full = new Full (prefix, suffix)
173
173
}
174
174
175
+ /**
176
+ * Similar to Binary except that if the binary version is 3
177
+ * (or if it is of the form 3.0.0-x) it uses 2.13 instead.
178
+ * For example, if `prefix = "foo_"` and `suffix = "_bar"` and the binary version is "3",
179
+ * the module is cross-versioned with "foo_2.13_bar".
180
+ */
181
+ final class For3Use2_13 private (val prefix : String , val suffix : String )
182
+ extends sbt.librarymanagement.CrossVersion ()
183
+ with Serializable {
184
+
185
+ private def this () = this (" " , " " )
186
+
187
+ override def equals (o : Any ): Boolean = o match {
188
+ case x : For3Use2_13 => (this .prefix == x.prefix) && (this .suffix == x.suffix)
189
+ case _ => false
190
+ }
191
+ override def hashCode : Int = {
192
+ 37 * (37 * (37 * (17 + " sbt.librarymanagement.For3Use2_13" .## ) + prefix.## ) + suffix.## )
193
+ }
194
+ override def toString : String = {
195
+ " For3Use2_13(" + prefix + " , " + suffix + " )"
196
+ }
197
+ private [this ] def copy (prefix : String = prefix, suffix : String = suffix): For3Use2_13 = {
198
+ new For3Use2_13 (prefix, suffix)
199
+ }
200
+ def withPrefix (prefix : String ): For3Use2_13 = {
201
+ copy(prefix = prefix)
202
+ }
203
+ def withSuffix (suffix : String ): For3Use2_13 = {
204
+ copy(suffix = suffix)
205
+ }
206
+ }
207
+ object For3Use2_13 {
208
+
209
+ def apply (): For3Use2_13 = new For3Use2_13 ()
210
+ def apply (prefix : String , suffix : String ): For3Use2_13 = new For3Use2_13 (prefix, suffix)
211
+ }
212
+
213
+ /**
214
+ * Similar to Binary except that if the binary version is 2.13
215
+ * it uses 3 instead.
216
+ * For example, if `prefix = "foo_"` and `suffix = "_bar"` and the binary version is "2.13",
217
+ * the module is cross-versioned with "foo_3_bar".
218
+ */
219
+ final class For2_13Use3 private (val prefix : String , val suffix : String )
220
+ extends sbt.librarymanagement.CrossVersion ()
221
+ with Serializable {
222
+
223
+ private def this () = this (" " , " " )
224
+
225
+ override def equals (o : Any ): Boolean = o match {
226
+ case x : For2_13Use3 => (this .prefix == x.prefix) && (this .suffix == x.suffix)
227
+ case _ => false
228
+ }
229
+ override def hashCode : Int = {
230
+ 37 * (37 * (37 * (17 + " sbt.librarymanagement.For3Use2_13" .## ) + prefix.## ) + suffix.## )
231
+ }
232
+ override def toString : String = {
233
+ " For3Use2_13(" + prefix + " , " + suffix + " )"
234
+ }
235
+ private [this ] def copy (prefix : String = prefix, suffix : String = suffix): For2_13Use3 = {
236
+ new For2_13Use3 (prefix, suffix)
237
+ }
238
+ def withPrefix (prefix : String ): For2_13Use3 = {
239
+ copy(prefix = prefix)
240
+ }
241
+ def withSuffix (suffix : String ): For2_13Use3 = {
242
+ copy(suffix = suffix)
243
+ }
244
+ }
245
+ object For2_13Use3 {
246
+
247
+ def apply (): For2_13Use3 = new For2_13Use3 ()
248
+ def apply (prefix : String , suffix : String ): For2_13Use3 = new For2_13Use3 (prefix, suffix)
249
+ }
250
+
175
251
trait DisabledFormats { self : sjsonnew.BasicJsonProtocol =>
176
252
implicit lazy val DisabledFormat : JsonFormat [sbt.librarymanagement.Disabled ] =
177
253
new JsonFormat [sbt.librarymanagement.Disabled ] {
@@ -324,22 +400,80 @@ trait FullFormats { self: sjsonnew.BasicJsonProtocol =>
324
400
}
325
401
}
326
402
403
+ trait For3Use2_13Formats { self : sjsonnew.BasicJsonProtocol =>
404
+ implicit lazy val For3Use2_13Format : JsonFormat [sbt.librarymanagement.For3Use2_13 ] =
405
+ new JsonFormat [sbt.librarymanagement.For3Use2_13 ] {
406
+ override def read [J ](
407
+ jsOpt : Option [J ],
408
+ unbuilder : Unbuilder [J ]
409
+ ): sbt.librarymanagement.For3Use2_13 = {
410
+ jsOpt match {
411
+ case Some (js) =>
412
+ unbuilder.beginObject(js)
413
+ val prefix = unbuilder.readField[String ](" prefix" )
414
+ val suffix = unbuilder.readField[String ](" suffix" )
415
+ unbuilder.endObject()
416
+ sbt.librarymanagement.For3Use2_13 (prefix, suffix)
417
+ case None =>
418
+ deserializationError(" Expected JsObject but found None" )
419
+ }
420
+ }
421
+ override def write [J ](obj : sbt.librarymanagement.For3Use2_13 , builder : Builder [J ]): Unit = {
422
+ builder.beginObject()
423
+ builder.addField(" prefix" , obj.prefix)
424
+ builder.addField(" suffix" , obj.suffix)
425
+ builder.endObject()
426
+ }
427
+ }
428
+ }
429
+
430
+ trait For2_13Use3Formats { self : sjsonnew.BasicJsonProtocol =>
431
+ implicit lazy val For2_13Use3Format : JsonFormat [sbt.librarymanagement.For2_13Use3 ] =
432
+ new JsonFormat [sbt.librarymanagement.For2_13Use3 ] {
433
+ override def read [J ](
434
+ jsOpt : Option [J ],
435
+ unbuilder : Unbuilder [J ]
436
+ ): sbt.librarymanagement.For2_13Use3 = {
437
+ jsOpt match {
438
+ case Some (js) =>
439
+ unbuilder.beginObject(js)
440
+ val prefix = unbuilder.readField[String ](" prefix" )
441
+ val suffix = unbuilder.readField[String ](" suffix" )
442
+ unbuilder.endObject()
443
+ sbt.librarymanagement.For2_13Use3 (prefix, suffix)
444
+ case None =>
445
+ deserializationError(" Expected JsObject but found None" )
446
+ }
447
+ }
448
+ override def write [J ](obj : sbt.librarymanagement.For2_13Use3 , builder : Builder [J ]): Unit = {
449
+ builder.beginObject()
450
+ builder.addField(" prefix" , obj.prefix)
451
+ builder.addField(" suffix" , obj.suffix)
452
+ builder.endObject()
453
+ }
454
+ }
455
+ }
456
+
327
457
trait CrossVersionFormats {
328
458
self : sjsonnew.BasicJsonProtocol
329
459
with sbt.librarymanagement.DisabledFormats
330
460
with sbt.librarymanagement.BinaryFormats
331
461
with sbt.librarymanagement.ConstantFormats
332
462
with sbt.librarymanagement.PatchFormats
333
- with sbt.librarymanagement.FullFormats =>
463
+ with sbt.librarymanagement.FullFormats
464
+ with sbt.librarymanagement.For3Use2_13Formats
465
+ with sbt.librarymanagement.For2_13Use3Formats =>
334
466
implicit lazy val CrossVersionFormat : JsonFormat [CrossVersion ] = {
335
- val format = flatUnionFormat6 [
467
+ val format = flatUnionFormat8 [
336
468
CrossVersion ,
337
469
Disabled ,
338
470
Disabled .type ,
339
471
Binary ,
340
472
Constant ,
341
473
Patch ,
342
- Full
474
+ Full ,
475
+ For3Use2_13 ,
476
+ For2_13Use3
343
477
](" type" )
344
478
// This is a hand-crafted formatter to avoid Disabled$ showing up in JSON
345
479
new JsonFormat [CrossVersion ] {
0 commit comments