Hacker News new | past | comments | ask | show | jobs | submit login

Yeah I mean it should be as basic as

    class MyApp extends AndroidApp {
        void main() {
            Document.write("hello world");
            Document.write("<button id=\"foo\">blah</button>");
        }
    }
javac it, adb sideload the .class file (or .jar file), and you should be done for the day. Unfortunately the bare minimum is way way way more complicated than this. Weird XML files, infestations of manifests (generate them automatically from 'ls' and 'grep' damnit), Gradle files (worst abomination of a build system ever), API levels (how about you just infer it from the functions I use? I shouldn't need to tell you), signing (ok fine but this should only be needed when uploading to an app store), zipaligning (wtf, this should be automatic, don't make me do that nonsense).



> Gradle files (worst abomination of a build system ever)

Ant? Maven?


Ugh. Why can't we just make javac [STAR].java work? Tarball the resulting .class files, make sure to have one called Main.class that is the entrypoint, GPG sign the tarball and you should be ready to distribute.

Yeah I know it doesn't work like this now, but the designers of the entire Java/Android ecosystem should have designed it to be that simple.

The moment you get any of these build systems involved you instantly lose all hopes of DRY coding. Excerpts from an Ant build.xml file:

    <target name="jar" depends="compile">
        <mkdir dir="jar" />
        <jar destfile="jar/HelloWorld.jar" basedir="classes">
            <manifest>
                <attribute name="Main-Class" 
                  value="antExample.HelloWorld" />
            </manifest>
        </jar>
    </target>
 
    <target name="run" depends="jar">
        <java jar="jar/HelloWorld.jar" fork="true" />
    </target>
I see "HelloWorld" repeated 3 times. MASSIVE fail. I'd rather no build system than deal with this level of repetitiveness. It's bad enough that Java requires the file name == class name which is already a case of repetition (that design decision is fine with me but then files should start with "class {" and not "class Foo {")


Maven is wonderful. It's all the best parts of npm or cargo, years before them. Just don't try to fight it - accept that there is a maven way of doing things that you will have to follow. If you need something to build before something else, put it in a separate module. If you absolutely need a custom build step, write a proper maven plugin for it. But 99% of the time your build definition can and should be just a list of dependencies and a couple of basic settings values.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: