import groovy.json.JsonSlurper // used to parse package.json import groovy.json.JsonBuilder import groovy.json.JsonOutput def isWinOs = System.properties['os.name'].toLowerCase().contains('windows') apply plugin: 'com.android.library' def computeCompileSdkVersion () { if(project.hasProperty("compileSdk")) { return compileSdk } else { return 31 } } def computeBuildToolsVersion() { if(project.hasProperty("buildToolsVersion")) { return buildToolsVersion } else { return "32.0.0" } } def computeTargetSdkVersion() { if(project.hasProperty("targetSdk")) { return targetSdk } else { return 30 } } android { compileSdkVersion computeCompileSdkVersion() buildToolsVersion computeBuildToolsVersion() defaultConfig { minSdkVersion 17 targetSdkVersion computeTargetSdkVersion() versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { def androidXViewPagerVersion = "1.0.0" if (project.hasProperty("androidXViewPager")) { androidXViewPagerVersion = androidXViewPager println "\t + using android X library androidx.viewpager2:viewpager2:$androidXViewPagerVersion" } def androidXFragmentVersion = "1.4.1" if (project.hasProperty("androidXFragment")) { androidXFragmentVersion = androidXFragment outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.fragment:fragment:$androidXFragmentVersion" } def androidXTransitionVersion = "1.4.1" if (project.hasProperty("androidXTransition")) { androidXTransitionVersion = androidXTransition outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.transition:transition:$androidXTransitionVersion" } def androidXExifInterfaceVersion = "1.3.3" if (project.hasProperty("androidXExifInterface")) { androidXExifInterfaceVersion = androidXExifInterface outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.exifinterface:exifinterface:$androidXExifInterfaceVersion" } def androidXAppCompatVersion = "1.4.1" if (project.hasProperty("androidXAppCompat")) { androidXAppCompatVersion = androidXAppCompat outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.appcompat:appcompat:$androidXAppCompatVersion" } def androidXDocumentFileVersion = "1.0.1" if (project.hasProperty("androidXDocumentFile")) { androidXDocumentFileVersion = androidXDocumentFile outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.documentfile:documentfile:$androidXDocumentFileVersion" } implementation fileTree(include: ['*.jar'], dir: 'libs') println 'Using android X' // implementation 'androidx.viewpager:viewpager:' + androidxVersion implementation "androidx.viewpager2:viewpager2:$androidXViewPagerVersion" implementation "androidx.fragment:fragment:$androidXFragmentVersion" implementation "androidx.transition:transition:$androidXTransitionVersion" implementation "androidx.exifinterface:exifinterface:$androidXExifInterfaceVersion" implementation "androidx.appcompat:appcompat:$androidXAppCompatVersion" implementation "androidx.documentfile:documentfile:$androidXDocumentFileVersion" } task cleanBuildDir (type: Delete) { delete "../build/" } task copyAar { doLast { copy { from "build/outputs/aar/widgets-release.aar" into "../build/" } } } tasks.withType(JavaCompile) { options.deprecation = true } assemble.dependsOn(cleanBuildDir) copyAar.dependsOn(assemble) build.dependsOn(copyAar)