2016-01-08 14:31:04 -05:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
|
|
|
|
android {
|
2019-09-09 16:15:24 -04:00
|
|
|
compileSdkVersion 28
|
|
|
|
buildToolsVersion "28.0.3"
|
2016-01-08 14:31:04 -05:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "org.scratchjr.android"
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-09 16:15:24 -04:00
|
|
|
flavorDimensions 'scratchjrversion'
|
2016-01-08 14:31:04 -05:00
|
|
|
productFlavors {
|
|
|
|
free {
|
2019-09-09 16:15:24 -04:00
|
|
|
dimension = 'scratchjrversion'
|
2016-01-08 14:31:04 -05:00
|
|
|
applicationId "org.scratchjr.androidfree"
|
2018-04-04 12:47:32 -04:00
|
|
|
minSdkVersion 19
|
2019-09-09 16:15:24 -04:00
|
|
|
targetSdkVersion 28
|
2016-03-01 15:00:10 -05:00
|
|
|
versionCode 21
|
2016-02-03 15:00:55 -05:00
|
|
|
versionName "1.2.0"
|
2016-01-08 14:31:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2019-09-09 16:15:24 -04:00
|
|
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
|
|
implementation 'com.google.android.gms:play-services-location:17.0.0'
|
|
|
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
|
|
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
|
2016-01-08 14:31:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
def appModuleRootFolder = '.'
|
|
|
|
def srcDir = 'src'
|
|
|
|
def googleServicesJson = 'google-services.json'
|
|
|
|
def commonHome = '../../..'
|
|
|
|
def html5Assets = 'src/main/assets/HTML5'
|
|
|
|
|
|
|
|
task switchToFree(type: Copy) {
|
|
|
|
def buildType = 'free'
|
|
|
|
from "${commonHome}/editions/${buildType}/src"
|
|
|
|
into html5Assets
|
|
|
|
}
|
|
|
|
|
|
|
|
task switchToFreeGA(type: Copy) {
|
|
|
|
def buildType = 'free'
|
|
|
|
from "${commonHome}/editions/${buildType}/android-resources"
|
|
|
|
include "$googleServicesJson"
|
|
|
|
into "$appModuleRootFolder"
|
|
|
|
}
|
|
|
|
|
2016-02-03 14:11:08 -05:00
|
|
|
task generateWebpackBundle(type: Exec) {
|
|
|
|
workingDir '../../../bin'
|
|
|
|
commandLine './bundle-compile.sh'
|
|
|
|
}
|
|
|
|
|
2016-01-08 14:31:04 -05:00
|
|
|
class GenerateScratchJrPNGsTask extends DefaultTask {
|
|
|
|
File commonHome = project.file("../../..")
|
|
|
|
File binDir = project.file("${commonHome}/bin")
|
|
|
|
|
|
|
|
@OutputDirectory
|
|
|
|
File generatedAssets = project.file("src/main/assets")
|
|
|
|
File generatedHtml5Assets = project.file("${generatedAssets}/HTML5")
|
|
|
|
File pngLibrary = project.file("${generatedHtml5Assets}/pnglibrary")
|
|
|
|
File svgLibrary = project.file("${generatedHtml5Assets}/svglibrary")
|
|
|
|
|
|
|
|
@TaskAction
|
|
|
|
def go() {
|
|
|
|
pngLibrary.mkdirs()
|
|
|
|
ant.exec(executable: "${binDir}/convert-svg-to-png.py",
|
|
|
|
failOnError: true)
|
|
|
|
{
|
|
|
|
arg(value: "-i ${svgLibrary}/")
|
|
|
|
arg(value: "-o ${pngLibrary}/")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class CleanScratchJrResourcesTask extends DefaultTask {
|
|
|
|
File generatedAssets = project.file('src/main/assets')
|
|
|
|
|
|
|
|
@TaskAction
|
|
|
|
def go() {
|
|
|
|
generatedAssets.deleteDir()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task generateScratchJrPNGs(type: GenerateScratchJrPNGsTask)
|
|
|
|
task cleanScratchJrResources(type: CleanScratchJrResourcesTask)
|
2019-09-09 16:15:24 -04:00
|
|
|
assemble.dependsOn switchToFree
|
2016-01-08 14:31:04 -05:00
|
|
|
|
|
|
|
afterEvaluate {
|
2016-02-03 14:11:08 -05:00
|
|
|
preBuild.dependsOn generateWebpackBundle
|
2016-01-08 14:31:04 -05:00
|
|
|
processFreeDebugGoogleServices.dependsOn switchToFreeGA
|
|
|
|
processFreeReleaseGoogleServices.dependsOn switchToFreeGA
|
|
|
|
|
|
|
|
generateFreeReleaseResources.dependsOn generateScratchJrPNGs
|
|
|
|
generateFreeDebugResources.dependsOn generateScratchJrPNGs
|
|
|
|
generateScratchJrPNGs.mustRunAfter switchToFree
|
|
|
|
}
|
|
|
|
|
|
|
|
clean.dependsOn('cleanScratchJrResources')
|
2018-10-01 13:45:15 -04:00
|
|
|
|
|
|
|
apply plugin: 'com.google.gms.google-services'
|