-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: split big sdk/build.gradle to several applied gradle sripts * chore: upload all outputs and reports on benchmark failure * ci: move timeout restoriction to step level and reduce it to 20 * debug: enable artifact upload for success bench * fix: ignore HCaptchaWebViewHelperTest.benchmarkWebViewLoad benchmark
- Loading branch information
Showing
5 changed files
with
72 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
android.libraryVariants.all { variant -> | ||
def packageName = android.namespace | ||
def variantName = variant.name.capitalize() | ||
def outputDir = file("${project.buildDir}/generated/source/hcaptcha/${variant.name}/${packageName.replaceAll('\\.', '/')}") | ||
def generateTask = project.task("generate${variantName}JavaClassFromStaticHtml") { | ||
group 'Generate' | ||
description "Generate HTML java class" | ||
|
||
doFirst { | ||
def outputJavaClass = file("$outputDir/HCaptchaHtml.java") | ||
def template = file("$projectDir/src/main/html/HCaptchaHtml.java.tml").text | ||
def html = file("$projectDir/src/main/html/hcaptcha.html") | ||
.readLines() | ||
.stream() | ||
.map({l -> "\"${l.replaceAll('"', '\\\\"')}\\n\""}) | ||
.collect(java.util.stream.Collectors.joining("\n${' ' * 16}+ ")) | ||
|
||
def engine = new groovy.text.SimpleTemplateEngine() | ||
def src = engine.createTemplate(template).make([ | ||
"htmlContent": html, | ||
"packageName": packageName | ||
]) | ||
|
||
outputDir.mkdirs() | ||
outputJavaClass.write(src.toString()) | ||
} | ||
} | ||
|
||
// preBuild.dependsOn generateTask | ||
variant.registerJavaGeneratingTask(generateTask, outputDir) | ||
} |
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,28 @@ | ||
android.libraryVariants.all { variant -> | ||
def variantName = variant.name.capitalize() | ||
project.task("report${variantName}AarSize") { | ||
group 'Help' | ||
description "Report ${variant.name} AAR size" | ||
dependsOn variant.packageLibraryProvider | ||
|
||
doFirst { | ||
var aarPath = variant.packageLibraryProvider.get().archiveFile.get().getAsFile() | ||
long aarSizeKb = aarPath.length() / 1024 | ||
println("File ${aarPath} is ${aarSizeKb}Kbyte") | ||
} | ||
} | ||
|
||
project.tasks.findByName("check").dependsOn(project.task("check${variantName}AarSize") { | ||
group 'Verification' | ||
description "Checks ${variant.name} AAR size doesn't exceed ${project.ext}Kb" | ||
dependsOn variant.packageLibraryProvider | ||
|
||
doFirst { | ||
var aarFile = variant.packageLibraryProvider.get().archiveFile.get().getAsFile() | ||
long aarSizeKb = aarFile.length() / 1024 | ||
if (aarSizeKb > maxAarSizeKb) { | ||
throw new GradleException("${aarPath} size exceeded! ${aarSizeKb}Kbyte > ${MAX_AAR_SIZE_KB}Kbyte") | ||
} | ||
} | ||
}) | ||
} |
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