-
-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't require mapping file when promoting artifact (#740)
Signed-off-by: Alex Saveau <[email protected]>
- Loading branch information
1 parent
abddfe9
commit d3ad1f8
Showing
9 changed files
with
117 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...n/src/main/kotlin/com/github/triplet/gradle/play/tasks/internal/UploadArtifactTaskBase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.github.triplet.gradle.play.tasks.internal | ||
|
||
import com.android.build.gradle.api.ApplicationVariant | ||
import com.github.triplet.gradle.common.utils.orNull | ||
import com.github.triplet.gradle.play.PlayPublisherExtension | ||
import org.gradle.api.tasks.InputFile | ||
import org.gradle.api.tasks.Optional | ||
import org.gradle.api.tasks.PathSensitive | ||
import org.gradle.api.tasks.PathSensitivity | ||
import java.io.File | ||
|
||
internal abstract class UploadArtifactTaskBase( | ||
extension: PlayPublisherExtension, | ||
variant: ApplicationVariant | ||
) : PublishArtifactTaskBase(extension, variant) { | ||
@get:PathSensitive(PathSensitivity.RELATIVE) | ||
@get:Optional | ||
@get:InputFile | ||
internal val mappingFile: File? | ||
get() { | ||
val customDir = extension.config.artifactDir | ||
|
||
return if (customDir == null) { | ||
try { | ||
variant.mappingFileProvider.get().singleOrNull() | ||
} catch (e: NoSuchMethodError) { | ||
@Suppress("DEPRECATION") // TODO(#708): remove when 3.6 is the minimum | ||
variant.mappingFile?.orNull() | ||
} | ||
} else { | ||
customDir.listFiles().orEmpty().singleOrNull { it.name == "mapping.txt" } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
.../kotlin/com/github/triplet/gradle/play/tasks/internal/workers/UploadArtifactWorkerBase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.github.triplet.gradle.play.tasks.internal.workers | ||
|
||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.provider.MapProperty | ||
import org.gradle.api.provider.Property | ||
import java.io.File | ||
|
||
internal abstract class UploadArtifactWorkerBase<T : UploadArtifactWorkerBase.ArtifactUploadingParams> : | ||
PublishArtifactWorkerBase<T>() { | ||
protected fun findBestVersionCode(artifact: File): Long { | ||
var onTheFlyBuild = parameters.versionCodes.get()[artifact]?.toLong() | ||
if (onTheFlyBuild == null) { | ||
// Since we aren't building the supplied artifact, we have no way of knowing its | ||
// version code without opening it up. Since we don't want to do that, we instead | ||
// pretend like we know the version code even though we really don't. | ||
onTheFlyBuild = parameters.versionCodes.get().values.first().toLong() | ||
} | ||
return onTheFlyBuild | ||
} | ||
|
||
internal interface ArtifactUploadingParams : ArtifactPublishingParams { | ||
val variantName: Property<String> | ||
val versionCodes: MapProperty<File, Int> | ||
|
||
val mappingFile: RegularFileProperty // Optional | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters