Other Support for Eclipse development tools will end this year.

Discussion in 'Libraries developers questions' started by corwin42, Jun 26, 2015.

  1. corwin42

    corwin42 Expert Licensed User

  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Maybe its time to learn how to make libs in Android Studio.
    As long as there is quickfix and auto complete should be fine.
     
    DonManfred, corwin42 and NJDude like this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    B4A doesn't use these features.
     
  4. corwin42

    corwin42 Expert Licensed User

    Will the B4A Doclet work with Android Studio to create the libraries XML files? I think I will have to make some tests.

    Ok, then I hope B4A is not affected by the end of the eclipse support for some time. Thats good news.

    The question is if it is possible to create libraries in Android Studio as simple as with Eclipse.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    I need to further investigate it. Note that you can use SLC to easily create a library from any Java code.

    The Doclet tool is a standard Java feature.
     
    DonManfred likes this.
  6. thedesolatesoul

    thedesolatesoul Expert Licensed User

    SLC or LGenerator can generate the lib jar and XML from the source.
    The extra thing in Eclipse was the GUI which allowed you to select which classes to export.
    The other interesting thing will be the move to aar and how to use them in AS.
     
    NJDude likes this.
  7. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Been trying for a while now.
    Generating a jar and javadocs seem easy, but i cant find how to specify a custom doclet.
    I have to say Android Studio is quite impressive, the layout designer, the build system, the integration.
     
    NJDude likes this.
  8. cimperia

    cimperia Active Member Licensed User

    I have been using Android Studio and it's possible to extract jar files (out of aar) and generate the correct xml file using B4A DOCLET. Here the code I used for generating the xml file, it's far from being perfect, but it works (in my environment) and could give you guys a headstart. It won't work as is as it has some dependencies on creating a jar etc... but the interesting bit is how to set the doclet options to generate the xml.

    Code:
    //------------------------ JAVADOC Processing ------------------------------------------------------
    configurations {
      BADoclet
    }

    dependencies {
      def BALibs = "C:/Program Files (x86)/Anywhere Software/Basic4android/Libraries/"

      BADoclet (fileTree(dir: "$
    BALibs",includes: ["**/Core.jar", "**/B4AShared.jar"]))
      BADoclet (fileTree(dir: "../build/libs/RangeSeekBar.jar"))
    }

    task javadoc(type: Javadoc, dependsOn: [makeJars] ) {
      def docXML = file("../javadoc/RangeSeekBar.xml")
      def BADocletPath = file("C:/Users/Claude/Desktop/SimpleLibraryCompiler/Doclet/")
      def javadocDir = file("../javadoc/")

      doFirst {
         if (file(docXML).exists()) {
         docXML.delete()
         println("Deleted doc file: " + docXML.name)
        }
      }

      source = android.sourceSets.main.java.srcDirs
      classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
      classpath += configurations.BADoclet

      destinationDir = javadocDir
      println("Destination Dir:" + destinationDir)
      options.doclet("BADoclet")
      options.docletpath = BADocletPath.listFiles().asType(List)
      options.addStringOption("B4atarget", "$
    docXML")
      options.addStringOption("B4aignore""com.yahoo")
      options.setMemberLevel(JavadocMemberLevel.PUBLIC)

      doLast {
        def s = docXML.text.replaceAll(
    "<type>T</type>","<type>double</type>")
        s = s.replaceAll(
    "<version>1.0</version>","<version>1.01</version>")
        docXML.text = s

        copy {
          from docXML
          into BASharedLibrary
        
    }

        copy {
          from outJar
          into BASharedLibrary
        }

        println ("**** Remember to refresh your libraries ****")
      }

      failOnError true
    }
     
    Last edited: Jun 28, 2015
    icefairy333, Erel and thedesolatesoul like this.
  9. thedesolatesoul

    thedesolatesoul Expert Licensed User

    This is the Gradle script?
    Pretty insane you got this to work, thanks a lot man.
    The doLast part seems to be doing some weird hack at the end, but still this is pretty cool.
    It seems the idea is to setup the 'options' object which is doing everything.
    I'll try it I havent really touched gradle but it looks extremely cool in what it can do.
     
    NJDude likes this.
  10. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Just tried adding command line:
    [​IMG]
    Seems that it works. Although unlike Eclipse you cannot select the classes you want to export. (Well you can define the scope).
     
    cimperia and NJDude like this.
  11. cimperia

    cimperia Active Member Licensed User

    The 3 first lines of the doLast are just some editing of the XML files that I needed to do and was really specific to that particular project. I should have removed them from the posted code.

    The 2 copy commands in doLast, copy the xml and jar files to my BA4 shared library

    Gradle is very powerful once you know how to use it, but I hasten to add that I am no expert as I've been learning it by reading the doc :)
     
    Last edited: Jun 29, 2015
    thedesolatesoul likes this.
  12. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Well that is the best way to learn it. And currently you seem to be the only expert about it here on the forums. From what I'm seeing I'll throw out my batch files and use Gradle.
     
  13. lonleystar

    lonleystar Well-Known Member Licensed User


    Hi I tried with this code but I get an error [
    task javadoc(type: Javadoc, dependsOn: [makeJars] )] some help?
     
Loading...