Closed MattSturgeon closed 11 months ago
Hmm makes total sense.
What I can do is, keep setArtifact, and then add a second one that takes in a string/enum matching the platform.
So for example:
setArtifact(jar) // Used for all Platforms
setArtifact("modrinth", jar) // Only uploaded to modrinth
setArtifact(Platform.Modrinth, jar) // Only uploaded to modrinth
Would something like that work?
That'd be perfect. (Merry christmas btw :santa: ).
How would it behave if setArtifact(jar)
is used in tandem with setArtifact(__, jar)
? Would the first invocation set the "default" and the second then overwrite the specified platform?
Oh yeah, it's christmas lol. Merry christmas.
If there is no specific override for a platform, it will use the global one. If no global one, and no platform one is found, it will throw an error.
So for example:
setArtifact(jar) // Global
setArtifact("modrinth", modrinthJar) // Modrinth task will use this artifact
Then GitHub/Curseforge will use global, and modrinth will use the modrinth jar
Implemented with 2.0.2
Configuration:
setArtifact(jar) // Global Artifact
setPlatformArtifact("modrinth", modrinthJar) // Override for Modrinth.
setPlatformArtifact("curseforge", curseJar) // Override for Curse
setPlatformArtifact(Platform.GitHub, githubJar) // Override GitHub jar
or Kotlin
artifact.set(tasks.jar) // Global Artifact
setPlatformArtifact("modrinth", tasks.modrinthJar) // Override for Modrinth.
setPlatformArtifact("curseforge", tasks.curseJar) // Override for Curse
setPlatformArtifact(Platform.GitHub, tasks.githubJar) // Override GitHub jar
If setPlatformArtifact is not called for a platform, artifact will be used. If neither is set, an error will be thrown
Wonderful, thank you!
You're welcome. Do let me know if you have any questions or need anything else :)
For example, Freecam produces a "normal" build as well as a "modrinth" build, as some options need to be restricted to comply with their ToS.
Could
artifact
be replaced with aNamedDomainObjectContainer
,MapProperty
, or similar?The existing API could be maintained by having a
setArtifact()
input that assigns the given artifact to all (recognized) entries.