Browse Source

chore: add jdee config

main
Distopico Vegan 6 years ago
parent
commit
4714988900
4 changed files with 157 additions and 7 deletions
  1. +1
    -0
      .gitignore
  2. +6
    -6
      app/build.gradle
  3. +0
    -1
      build.gradle
  4. +150
    -0
      jdee.gradle

+ 1
- 0
.gitignore View File

@ -33,6 +33,7 @@ proguard/
# IDE and OS files # IDE and OS files
.idea/ .idea/
*.iml *.iml
*.el
.DS_Store .DS_Store
.externalNativeBuild .externalNativeBuild

+ 6
- 6
app/build.gradle View File

@ -1,5 +1,5 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'changelog'
apply from: "${rootDir}/jdee.gradle"
android { android {
compileSdkVersion 28 compileSdkVersion 28
@ -51,10 +51,6 @@ android {
} }
} }
changelog {
versionNum "v$android.defaultConfig.versionName"
}
repositories { repositories {
google() google()
jcenter() jcenter()
@ -63,6 +59,10 @@ repositories {
} }
} }
configurations {
implementationDeps.extendsFrom implementation
}
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
@ -120,5 +120,5 @@ dependencies {
implementation "org.sufficientlysecure:openpgp-api:$openpgp_version" implementation "org.sufficientlysecure:openpgp-api:$openpgp_version"
// https://android.googlesource.com/platform/frameworks/opt/colorpicker // https://android.googlesource.com/platform/frameworks/opt/colorpicker
implementation project(path: ':colorpicker')
implementation project(path: ':colorpicker', configuration: 'default')
} }

+ 0
- 1
build.gradle View File

@ -7,7 +7,6 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.github.marcpoppleton:git-changelog:0.1.3'
} }
} }


+ 150
- 0
jdee.gradle View File

@ -0,0 +1,150 @@
//
// Gradle task that creates the JDEE project file to andorid
//
import static groovy.io.FileType.FILES
def jarFiles = { project ->
def folder = new File("${project.buildDir}/intermediates")
def files = []
if( folder.exists() ) {
// if exist look for jars
folder.eachFileRecurse(FILES) {
if(it.name.endsWith('.jar')) {
files << it.getAbsolutePath()
}
}
}
files
}
def getImplementation = { project ->
def files = []
def transforms = []
// get dependencies jars
project.configurations.implementationDeps.each { dep ->
if(dep.name.endsWith('.jar')) {
files << dep.getAbsolutePath()
} else {
// get jar from aar
def cacheFolder = new File("${System.getProperty('user.home')}/.gradle/caches")
if( cacheFolder.exists() ) {
cacheFolder.eachFileRecurse(FILES) {
if(!transforms.contains(dep.name) && it.path.contains(dep.name) &&
it.name.endsWith('.jar')) {
transforms << dep.name
files << it.getAbsolutePath()
}
}
}
}
}
files
}
def generatedDirs = { project ->
def folder = new File("${project.buildDir}/generated")
def dirs = []
if( folder.exists() ) {
folder.eachDirRecurse { dir ->
if (!(dir ==~ /.*generated\/res\/.*/)) {
dirs << dir
}
}
}
dirs
}
def prj = { project ->
"(jdee-project-file-version" (["1.0"])
"(jdee-set-variables" {
"'(jdee-compile-option-directory" (["${project.buildDir}"])
"'(jdee-junit-working-directory" ([])
"'(jdee-compile-option-source" {
"'(" (["default", "${project.targetCompatibility}"])
}
"'(jdee-compile-option-target" {
"'(" (["default", "${project.sourceCompatibility}"])
}
"'(jdee-sourcepath" {
"'(" (
["${project.projectDir}/src/androidTest/java"]
+ project.android.sourceSets.main.java.srcDirs
+ android.sourceSets.test.java.srcDirs
+ project.android.sourceSets.test.java.srcDirs
+ project.android.sourceSets.main.assets.srcDirs
+ project.android.sourceSets.main.renderscript.srcDirs
+ project.android.sourceSets.main.res.srcDirs
+ project.android.sourceSets.main.aidl.srcDirs
+ project.android.sourceSets.main.jniLibs.srcDirs
+ project.android.sourceSets.main.resources.srcDirs
+ (([] as Set) + generatedDirs(project))
)
}
"'(jdee-global-classpath" {
"'(" (
["${project.buildDir}/intermediates/classes/debug",
"${project.buildDir}/intermediates/classes/test/debug"]
+ android.getBootClasspath()
+ configurations.archives.allArtifacts.getFiles()
+ project.compileDebugJavaWithJavac.destinationDir
+ project.compileReleaseJavaWithJavac.destinationDir
+ (([] as Set) + project.configurations.compile.getFiles()
+ project.configurations.testCompile.getFiles()
+ getImplementation(project)
+ jarFiles(project)
))
}
}
}
projects {
task("jdee") {
doLast {
def output = new File(project.projectDir, "prj.el").newPrintWriter()
output.print ';;\n'
output.print ';; This is a generated file.\n'
output.print ';; To recreate, run "`gradlew jdee` or `gradlew assemble jdee`".\n'
output.print ';;\n'
try {
prj.delegate = new NodeBuilder() {
def lev = 0
def write = { Object file ->
output.print '\n' + ''.padRight(lev, ' ') + "\"${file}\"".tr('\\', '/')
}
Object createNode(Object name) {
output.print '\n' + ''.padRight(lev++, ' ') + name
return name
}
Object createNode(Object name, Object value) {
createNode(name)
value.each write
return name
}
void nodeCompleted(Object parent, Object child) {
output.print ")"
lev--
}
}
prj(project)
output.close()
} finally {
output.flush()
}
}
}
}

Loading…
Cancel
Save