Android application in Frege & Frege Android

278 views
Skip to first unread message

Cody Goodman

unread,
Oct 6, 2015, 11:15:36 PM10/6/15
to Frege Programming Language
I've been trying to figure out how exactly to create a working android application with Frege. I think that I need to find a way to compile the Frege code to java class files, then "dex" them somehow, and erase excess method calls with proguard. I'm not really sure how to do any of this and was wondering if anyone could provide any guidance.

I found these wrappers/bindings:

https://github.com/trilogysci/FregeAndroid

This looks cool and it seems like I could make a purely frege android application using these, but alas I'm completely lost as to how to start using them.

Thanks in advance for any help.

Ingo W.

unread,
Oct 7, 2015, 2:28:12 AM10/7/15
to Frege Programming Language
Hi,

this sounds awesome, and I'd really appreciate if there would be some success. For, this question comes up any other month and there is no canonical answer yet.

Perhaps it would help if the people having done a bit here and a bit there would work together and coordinate their efforts.

The use of pro guard is described in the FAQ article of the wiki. There is also a recipe for making a Frege compiler that produces Java6 code. It is probable that this recipe doesn't work anymore, but it is certainly possible to make it work again. I stand ready to answer technical questions regarding this.


Patrick Pelletier

unread,
Sep 12, 2016, 9:06:33 PM9/12/16
to frege-program...@googlegroups.com
On 10/6/15 11:28 PM, Ingo W. wrote:
> There is also a recipe for making a Frege compiler that produces Java6 code. It is probable that this recipe doesn't work anymore, but it is certainly possible to make it work again. I stand ready to answer technical questions regarding this.

I thought I'd give this a try and see how far I could get. I used
3.23.888 as a starting point, because I thought that might be more
stable than master. Here is what I've done so far:

https://github.com/ppelleti/frege/tree/3.23.888-java6

There were some easy changes to Runtime.java6, but I've gotten stuck on
Concurrent.java6. I stubbed out executorService() and
setFregeExecutorService(), but apparently this isn't good enough. I now
get:

Looks good .... let us try to make the tools and library ...
grep -v ForkJoin frege/StandardLibrary.fr >save/StandardLibrary.fr
java "-Dfrege.javac=internal" -Xmx1g -Xss4m -Dfrege.javac="javac -source
1.6 -target 1.6" -jar fregec6.jar -d build6 -nocp -fp build6 -make \
frege/StandardTools.fr save/StandardLibrary.fr
Exception in thread "main" java.lang.NullPointerException
at
frege.java.util.Concurrent$TExecutorService$5.eval(Concurrent.java:534)
at
frege.java.util.Concurrent$TExecutorService$5.eval(Concurrent.java:531)
at frege.runtime.Fun1$1.eval(Fun1.java:63)
at frege.runtime.Delayed.call(Delayed.java:200)
at frege.runtime.Delayed.forced(Delayed.java:257)
at frege.compiler.Main$1Fasync$28181$1$1$2.eval(Main.java:7038)
at frege.compiler.Main$1Fasync$28181$1$1$2.eval(Main.java:7035)
at frege.runtime.Fun1$1.eval(Fun1.java:63)
at frege.runtime.Delayed.call(Delayed.java:198)
at frege.runtime.Delayed.forced(Delayed.java:267)
at frege.compiler.Main$1Fasync$28181$1$1.eval(Main.java:7066)
at frege.compiler.Main$1Fasync$28181$1$1.eval(Main.java:6990)
at frege.runtime.Fun1$1.eval(Fun1.java:63)
at frege.runtime.Delayed.call(Delayed.java:200)
at frege.runtime.Delayed.forced(Delayed.java:257)
at frege.prelude.PreludeBase$TST$1.eval(PreludeBase.java:12446)
at frege.runtime.Fun1$1.eval(Fun1.java:63)
at frege.runtime.Delayed.call(Delayed.java:200)
at frege.runtime.Delayed.forced(Delayed.java:267)
at frege.compiler.Main$39$2.eval(Main.java:7447)
at frege.compiler.Main$39$2.eval(Main.java:7444)
at frege.runtime.Fun1$1.eval(Fun1.java:63)
at frege.runtime.Delayed.call(Delayed.java:198)
at frege.runtime.Delayed.forced(Delayed.java:267)
at frege.compiler.Main$41$2.eval(Main.java:8287)
at frege.compiler.Main$41$2.eval(Main.java:8176)
at frege.runtime.Fun1$1.eval(Fun1.java:63)
at frege.runtime.Delayed.call(Delayed.java:198)
at frege.runtime.Delayed.forced(Delayed.java:267)
at frege.compiler.Main$42.eval(Main.java:8433)
at frege.runtime.Fun1$1.eval(Fun1.java:63)
at frege.runtime.Delayed.call(Delayed.java:198)
at frege.runtime.Runtime.runMain(Runtime.java:236)
at frege.compiler.Main.main(Main.java:9411)
make: *** [fregec6.jar] Error 1

So it appears that the compiler itself needs executorService() in order
to run. Any thoughts on how I should go about fixing this?

Thanks,

--Patrick


Patrick Pelletier

unread,
Sep 13, 2016, 3:06:46 AM9/13/16
to frege-program...@googlegroups.com
Never mind, I think I've been approaching it wrong. ExecutorService was
never the problem with Java 6, it was ForkJoinPool.

However, Android has ForkJoinPool starting in API level 21:

https://developer.android.com/reference/java/util/concurrent/ForkJoinPool.html

So, perhaps the Java 6 version of Frege is no longer needed for
Android. I will try to see if I can make some progress under that
assumption.

--Patrick


Andreas Ländle

unread,
Sep 13, 2016, 3:49:23 AM9/13/16
to Frege Programming Language, co...@funwithsoftware.org
Hi,
I can confirm that frege works under Android in conjunction with JDK7 and newer Android API Levels - at least I didn't face any problems ;-)
Currently I'm trying to use JDK8 with the new Android Jack Compiler - but I'm struggling with all the unicode (e.g. greek letters) identifiers not supported with Jack.
So I'm trying to build a latin-only version of the fregec.jar... seems to be more complicated than I've expected ;-(
Br,
Andreas

Andreas Ländle

unread,
Sep 13, 2016, 9:30:47 AM9/13/16
to Frege Programming Language, co...@funwithsoftware.org
Just to share some intermediate results - if someone is interested. If you apply the attached patches you'll should be able to create a fregec.jar - and if you extract all the java sources from it (e.g. with "7z x fregec.jar -r *.java -x!Awt.java -x!Swing.java -x!frege\compiler\* -x!frege\tools\* -x!Modules.java -x!Processes.java -x!frege\ide\* -x!frege\test\*" or a similar tool) you could at least compile with jack without any "invalid character" error.

Unfortunately it sill fails...

Error:Gradle: Execution failed for task ':app:transformJackWithJackForDebug'.
> com.android.sched.scheduler.RunnerProcessException: Error during 'TypeLegalizer' runner on 'public java.lang.Object frege.data.JSON$1Let$26446$-frege_prelude_PreludeBase$TList_string$8750_int_arg$3_frege_prelude_PreludeBase$TList_arg$4_LambdaImpl0.call()': Unexpected error during visit: com.android.jack.ir.ast.JMethodCall at "Unknown source info"

Likely a bug in the jack compiler, since we gave it valid java sources; but this might be a good start for anybody that wants a frege package only containing ascii identifiers (for whatever reason).

Br, Andreas
0002-Ascii-laters-but-jack-still-fails.patch
0001-Now-we-have-latin-type-parameters.patch

Patrick Pelletier

unread,
Sep 13, 2016, 10:51:47 AM9/13/16
to frege-program...@googlegroups.com
On 9/13/16 12:49 AM, 'Andreas Ländle' via Frege Programming Language wrote:
> I can confirm that frege works under Android in conjunction with JDK7
> and newer Android API Levels - at least I didn't face any problems ;-)

What do you use to build your app? I know there's a Gradle plugin for
Android, and a Gradle plugin for Frege, but I'm not sure how to combine
them.

--Patrick


Ingo W.

unread,
Sep 13, 2016, 1:21:11 PM9/13/16
to Frege Programming Language, co...@funwithsoftware.org
Hi Andreas,

good to know that Java6 will not be needed anymore.

Regarding the Unicode characters .... I'm a bit surprised that there still should be a tool that doesn't handle them.
However, one gets similar errors with the javac compiler, since it assumes the "system default encoding" UNLESS you tell via the -encoding option what you have.

Please note also that the javac8 compiler may prodcue bad code that fails the verifier. This is why I recommend to use javac9 with the -target 1.8 option.

Best regards, Ingo

Andreas Ländle

unread,
Sep 13, 2016, 2:32:46 PM9/13/16
to frege-program...@googlegroups.com
Hi Patrick,
first I started with the frege gradle plugin (and I've split the project into a java library containing the frege part and an android project) - but I found that to inflexible, especially if you want to have more control over the compiler; so I started to use a simple javaExec for the compilation.

Hope this snippet gives you an idea...

clean{
    delete 'src/frege'
}

project.afterEvaluate {
    extensions.compileFrege = {
        mkdir 'src/frege'
        description = 'Compile Frege to Java'
        fileTree(dir: 'src/main/frege', include: '**/*.fr').each { file ->
            javaexec {
                configurations.compile.resolve().each {
                    //println it.toString()
                    classpath += files(it.toString())
                }
                main = 'frege.compiler.Main'
                args '-inline', '-d', 'src/frege', '-make', '-sp', 'src/main/frege', "src/main/frege/$file.name"
            }
        }
        delete fileTree('src/frege') {
            include '**/*.java'
        }
    }

    //compileDebugJavaWithJavac.doFirst { compileFrege() }
    //compileReleaseJavaWithJavac.doFirst { compileFrege() }
    compileDebugJavaWithJack.doFirst { compileFrege() }
    compileReleaseJavaWithJack.doFirst { compileFrege() }
}

Br,

Andreas



--Patrick


--
You received this message because you are subscribed to a topic in the Google Groups "Frege Programming Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/frege-programming-language/iIJeAwlf8UM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to frege-programming-language+unsubsc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andreas Ländle

unread,
Sep 13, 2016, 2:58:55 PM9/13/16
to Frege Programming Language, co...@funwithsoftware.org
Hi Ingo,

I know, its hard to believe - but take a look at https://code.google.com/p/android/issues/detail?id=218892

Or simply try to add a line like

int α = 42;

to your java source code and compile with jack. I'm pretty sure you will face a 'error: illegal character' message ;-(

Regarding your tip - I always used jdk9 to build frege itself; but after that I've extracted the sources and gave them to jack - this is where I'm struggling now (first with the encoding, but now with the 'Error during 'TypeLegalizer' runner..' exception). As it seems all java compilers are buggy ;-)

Br,

Andreas

Patrick Pelletier

unread,
Sep 15, 2016, 8:08:36 PM9/15/16
to frege-program...@googlegroups.com
On 9/13/16 11:32 AM, 'Andreas Ländle' via Frege Programming Language wrote:
> first I started with the frege gradle plugin (and I've split the
> project into a java library containing the frege part and an android
> project) - but I found that to inflexible, especially if you want to
> have more control over the compiler; so I started to use a simple
> javaExec for the compilation.
>
> Hope this snippet gives you an idea...

Thanks! That was very helpful, and I've got it partially working.
Unfortunately, I know very little about gradle or proguard, so I've run
into some problems.

The first problem was that although it uses '**/*.fr', it seems that
compileFrege() only works for frege files which are directly in
src/main/frege. If the frege files are in subdirectories of
src/main/frege, it finds them, but then tries to look for them in
src/main/frege, and doesn't find them. I worked around this problem for
now by just putting my frege file directly in src/main/frege.

The next problem was that there were too many method references:

Dex: The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at
https://developer.android.com/tools/building/multidex.html
trouble writing output: Too many method references: 110550; max is
65536.
Too many classes to fit in one dex file.

I tried to solve this problem by using Proguard to remove unneeded
classes. I added:

minifyEnabled true
proguardFile getDefaultProguardFile('proguard-android.txt')

but now I get pages and pages of Proguard errors, with the summary at
the end being:

Note: there were 7 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Warning: there were 636 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can
suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 1742 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning: there were 20 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Warning: Exception while processing task java.io.IOException: Please
correct the above warnings first.
:transformClassesAndResourcesWithProguardForDebug FAILED

I'm not sure where to proceed from here. I looked at the information
about Proguard in the Frege FAQ on the wiki, but I wasn't sure how to
apply that information to the gradle build system.

I've attached my build.gradle.

Thanks for any suggestions,

--Patrick

build.gradle

Patrick Pelletier

unread,
Sep 16, 2016, 1:46:16 AM9/16/16
to frege-program...@googlegroups.com
On 9/15/16 5:08 PM, Patrick Pelletier wrote:
> The first problem was that although it uses '**/*.fr', it seems that
> compileFrege() only works for frege files which are directly in
> src/main/frege. If the frege files are in subdirectories of
> src/main/frege, it finds them, but then tries to look for them in
> src/main/frege, and doesn't find them. I worked around this problem
> for now by just putting my frege file directly in src/main/frege.

That workaround turned out not to work, because my Frege class isn't in
a package, so there's no way to import it from Java code.

> The next problem was that there were too many method references:
>
> Dex: The number of method references in a .dex file cannot exceed 64K.
> Learn how to resolve this issue at
> https://developer.android.com/tools/building/multidex.html
> trouble writing output: Too many method references: 110550; max is
> 65536.
> Too many classes to fit in one dex file.

Using multidex worked to solve this problem. However, it means I'm
putting lots of unnecessary code on the phone, including the whole Frege
compiler!

--Patrick


Patrick Pelletier

unread,
Sep 16, 2016, 8:08:05 PM9/16/16
to frege-program...@googlegroups.com
On 9/15/16 10:45 PM, Patrick Pelletier wrote:
> On 9/15/16 5:08 PM, Patrick Pelletier wrote:
>> The first problem was that although it uses '**/*.fr', it seems that
>> compileFrege() only works for frege files which are directly in
>> src/main/frege. If the frege files are in subdirectories of
>> src/main/frege, it finds them, but then tries to look for them in
>> src/main/frege, and doesn't find them. I worked around this problem
>> for now by just putting my frege file directly in src/main/frege.
>
> That workaround turned out not to work, because my Frege class isn't
> in a package, so there's no way to import it from Java code.

I fixed that problem by using $file.path instead of $file.name.

However, I'm still unable to import my Frege class from my Java code,
and I don't understand why.

I'm not quite sure how it's supposed to know that the Frege-generated
Java files are in src/frege, so I tried adding:

sourceSets {
main {
java.srcDirs.add 'src/frege'
}
}

but that didn't seem to do anything.

I have my code at https://github.com/ppelleti/frege-on-android

If anyone has thoughts on what's going wrong, I'd really appreciate it!
Thanks!

--Patrick


Patrick Pelletier

unread,
Sep 17, 2016, 6:07:07 PM9/17/16
to frege-program...@googlegroups.com
On 9/16/16 5:07 PM, Patrick Pelletier wrote:
> I'm not quite sure how it's supposed to know that the Frege-generated
> Java files are in src/frege, so I tried adding:
>
> sourceSets {
> main {
> java.srcDirs.add 'src/frege'
> }
> }
>
> but that didn't seem to do anything.

Well, this was me not understanding Gradle/Groovy. It turns out the
correct incantation was:

sourceSets {
main {
java.srcDirs += 'src/frege'
}
}

With this change, it worked! I now have a successful example of an
Android app that calls Frege code. It is available at this point in my
repository:

https://github.com/ppelleti/frege-on-android/tree/3e4685f078cdce3f8b704b779d0b05e72d6cffe6

However, I didn't want to leave it there. I wanted my Frege code to be
able to call the Android API. So, I took a look at the FregeAndroid
repository:

https://github.com/trilogysci/FregeAndroid
http://permalink.gmane.org/gmane.comp.lang.frege.general/177

It doesn't have any build instructions, so I just added it as a
submodule of my repository, and added code to my build.gradle to build
FregeAndroid along with my own Frege code:

project.afterEvaluate {
extensions.compileFrege = {
mkdir 'src/frege'
description = 'Compile Frege to Java'
def tree = fileTree(dir: 'FregeAndroid/src', include: '**/*.fr')
tree += fileTree(dir: 'src/main/frege', include: '**/*.fr')
tree.each { file ->
javaexec {
configurations.compile.resolve().each {
//println it.toString()
classpath += files(it.toString())
}
main = 'frege.compiler.Main'
args '-inline', '-d', 'src/frege', '-make', '-sp',
'src/main/frege', "$file.path"
}
}
// delete fileTree('src/frege') {
// include '**/*.java'
// }
}

Although I'm still sketchy on Groovy, I think this is doing what I want,
in terms of trying to build the FregeAndroid files. However, the files
don't actually build. I get:

:compileDebugJavaWithJavac
E
/Users/ppelleti/programming/android/example/FregeAndroid/src/frege/android/animation/TimeInterpolator.fr:4:
`android.animation.TimeInterpolator` is not a known java class
Android.animation.TimeInterpolator: build failed because of compilation
errors.
Build failed.
runtime 2.801 wallclock seconds.
:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

So, I think the problem is that the Frege compiler isn't seeing the
Android API classes. I guess I need to somehow put the Android API on
the Frege compiler's classpath? I'll look into this, but I wanted to
post what I have so far, in case anyone has any ideas:

https://github.com/ppelleti/frege-on-android/tree/f92becc38c23129ea0e424909e96354fb8ceea2e

Thanks,

--Patrick


Ingo W.

unread,
Sep 22, 2016, 5:53:36 PM9/22/16
to Frege Programming Language, co...@funwithsoftware.org
Patrick,

that looks weird.

As if you imported module X in module X itself?
Could you quote the first 5 lines of TimeInterpolator.fr?

Regards, Ingo

Patrick Pelletier

unread,
Sep 23, 2016, 2:38:45 AM9/23/16
to frege-program...@googlegroups.com
On 9/22/16 2:53 PM, Ingo W. wrote:
> that looks weird.
>
> As if you imported module X in module X itself?
> Could you quote the first 5 lines of TimeInterpolator.fr?

Sure, the entire TimeInterpolator.fr is:

package frege.android.animation.TimeInterpolator where


data TimeInterpolator = pure native android.animation.TimeInterpolator where


pure native getInterpolation :: TimeInterpolator -> Float -> Float
{- -}

It's just the one from the FregeAndroid repository:

https://github.com/trilogysci/FregeAndroid/blob/master/src/frege/android/animation/TimeInterpolator.fr

(Sadly, that repository has no information about how to build it.)

--Patrick

P. S. For anyone else following this conversation, Ingo and I are also
having part of the conversation on Stack Overflow:

https://stackoverflow.com/questions/39583032/how-can-i-get-the-frege-compiler-to-see-android-api-classes-when-using-gradle


Ingo W.

unread,
Sep 23, 2016, 3:12:35 AM9/23/16
to Frege Programming Language, co...@funwithsoftware.org
Ok, in this case, it is the android library class that is missing.
So, it is a class path issue.

Ingo W.

unread,
Sep 23, 2016, 4:06:05 AM9/23/16
to Frege Programming Language, co...@funwithsoftware.org
By the way, you really don't need a separate build for those wrapper modules.
Just include the directory where they are living in the sourcepath, and then compile your own files with the -make option.
The frege compiler will then compile the modules you really need (that is, import directly or indirectly) before the ones that import them.
In addition, it won't compile already compiled, but not changed modules again each time.


Patrick Pelletier

unread,
Sep 23, 2016, 4:18:42 AM9/23/16
to frege-program...@googlegroups.com
On 9/23/16 12:12 AM, Ingo W. wrote:
> Ok, in this case, it is the android library class that is missing.
> So, it is a class path issue.

However, that error ("`android.animation.TimeInterpolator` is not a
known java class") is no longer the error I'm getting. (I've tried so
many things that I'm starting to get confused about what failures I was
getting when.)

Also, I'm going to try to move the Stack Overflow discussion back over
here, because Stack Overflow is starting to complain about having
discussions in the comments.

On Stack Overflow, Ingo wrote:

> That should be ok, since only module names are resolved against the
sp. But are you sure it must be|src/frege|rather
than|src/|or|src/frege/main|? This would imply you
have|src/frege/frege/android/database/Cursor.fr|

You're right, making the sp absolute didn't fix anything.

However, "src/frege" is the -d option, not the -sp option. According to
the compiler manpage, -d is the destination directory where the Java
files are written. The choice of "src/frege" for the output is
unchanged from the snippet I got from Andreas Ländle earlier in this thread.

I have Frege source code in two different places:

"FregeAndroid/src" because I've included the FregeAndroid repository
(where the bindings live) as the submodule "FregeAndroid" under my own
repository. (And "src" is where the Frege source lives in that repository.)

"src/main/frege" because that is where my own Frege source (that uses
the binding) is located.

The code I currently am using in my build.gradle is:

project.afterEvaluate {
extensions.compileFrege = {
mkdir 'src/frege'
description = 'Compile Frege to Java'
['FregeAndroid/src', 'src/main/frege'].each { sp ->
def spAbs = (new File(sp)).getAbsolutePath()
def tree = fileTree(dir: sp, include: '**/*.fr')
tree.each { file ->
javaexec {
configurations.compile.resolve().each {
classpath += files(it.toString())
}
main = 'frege.compiler.Main'
def a = ['-inline', '-d', 'src/frege', '-make',
'-fp',
'/Users/ppelleti/Library/Android/sdk/platforms/android-21/android.jar',
'-sp', spAbs, file.path]
println 'Frege compiler args: "' + a.join(' ') + '"'
args (*a)
}
}
}

so it is doing "FregeAndroid/src" first, and then "src/main/frege" second.

The full build.gradle is here:

https://github.com/ppelleti/frege-on-android/blob/b6ba18a142147fa0c0eb4e2e34f5ebe9871f4aee/build.gradle

and the full build output is here:

https://github.com/ppelleti/frege-on-android/blob/b6ba18a142147fa0c0eb4e2e34f5ebe9871f4aee/README.md

Although I've also edited my Stack Overflow question to include a
snippet of the latest build output.

--Patrick


Patrick Pelletier

unread,
Sep 23, 2016, 4:32:28 AM9/23/16
to frege-program...@googlegroups.com
On 9/23/16 1:06 AM, Ingo W. wrote:
> Just include the directory where they are living in the sourcepath,
> and then compile your own files with the -make option.
> The frege compiler will then compile the modules you really need (that
> is, import directly or indirectly) before the ones that import them.

In that case, I think I can radically simplify the code in build.gradle to:

project.afterEvaluate {
extensions.compileFrege = {
mkdir 'src/frege'
description = 'Compile Frege to Java'
javaexec {
configurations.compile.resolve().each {
classpath += files(it.toString())
}
main = 'frege.compiler.Main'
def a = ['-inline', '-d', 'src/frege', '-make', '-fp',
'/Users/ppelleti/Library/Android/sdk/platforms/android-21/android.jar',
'-sp', 'FregeAndroid/src:src/main/frege',
'src/main/frege/org/funwithsoftware/frege_example/FregeCode.fr']
println 'Frege compiler args: "' + a.join(' ') + '"'
args (*a)
}

However, that still results in a similar failure:

:compileDebugJavaWithJavac
Frege compiler args: "-inline -d src/frege -make -fp
/Users/ppelleti/Library/Android/sdk/platforms/android-21/android.jar -sp
FregeAndroid/src:src/main/frege
src/main/frege/org/funwithsoftware/frege_example/FregeCode.fr"
Android.os.Bundle: build failed because module is not on class path
Android.text.Editable: build failed because module is not on class path
Android.view.DragEvent: build failed because module is not on class path
etc.

--Patrick


Ingo W.

unread,
Sep 23, 2016, 8:35:07 AM9/23/16
to Frege Programming Language, co...@funwithsoftware.org
So, there is

FregeAndroid/src/frege/android/os/Bundle.fr


and the module name is either 

frege.android.os.Bundle


or

Android.os.Bundle

(Note that, even when you develop in Windows, case does matter in module names.)

I'd really like to see the output of the following shell script:

cd FregeAndroid/src
find . -type f -name '*.fr' -exec egrep 'module|package' {} /dev/null ';'

Patrick Pelletier

unread,
Sep 23, 2016, 3:27:43 PM9/23/16
to frege-program...@googlegroups.com
On 9/23/16 5:35 AM, Ingo W. wrote:
> I'd really like to see the output of the following shell script:
>
> cd FregeAndroid/src
> find . -type f -name '*.fr' -exec egrep 'module|package' {} /dev/null ';'

Here it is, as an attachment.

--Patrick

modules.txt

Ingo W.

unread,
Sep 23, 2016, 5:37:44 PM9/23/16
to Frege Programming Language, co...@funwithsoftware.org
Looks good.
This should indeed compile the wrappers.
Can you add -v to the compiler options. Hopefully we can see a bit more then.
Oh, and make sure the destination directory src/frege is empty before you run it.

Patrick Pelletier

unread,
Sep 23, 2016, 9:39:53 PM9/23/16
to frege-program...@googlegroups.com
On 9/23/16 2:37 PM, Ingo W. wrote:
> Can you add -v to the compiler options. Hopefully we can see a bit more
> then.

Sure, here is the build output with -v.

--Patrick

build-results.txt

Patrick Pelletier

unread,
Sep 24, 2016, 1:49:54 AM9/24/16
to frege-program...@googlegroups.com
On 9/23/16 6:39 PM, Patrick Pelletier wrote:
> Sure, here is the build output with -v.

Sorry I didn't figure this out sooner! It looks like the modules it
didn't find...

Android.view.ActionMode: build failed because module is not on class path
Android.view.DragEvent: build failed because module is not on class path
Android.text.Spannable: build failed because module is not on class path
Android.text.Editable: build failed because module is not on class path
Android.text.TextUtils: build failed because module is not on class path
Android.content.res.Resources: build failed because module is not on
class path
Android.os.Bundle: build failed because module is not on class path
Android.os.UserHandle: build failed because module is not on class path
Android.graphics.Typeface: build failed because module is not on class path
Android.widget.Scroller: build failed because module is not on class path
Android.graphics.Bitmap: build failed because module is not on class path
Android.net.Uri: build failed because module is not on class path
Android.graphics.PorterDuff: build failed because module is not on class
path
Java.io.File: build failed because module is not on class path
Android.content.BroadcastReceiver: build failed because module is not on
class path
Java.lang.Runnable: build failed because module is not on class path
Java.io.IOException: build failed because module is not on class path
Android.graphics.Canvas: build failed because module is not on class path
Android.graphics.ColorFilter: build failed because module is not on
class path
Android.graphics.Region: build failed because module is not on class path
Java.lang.Thread: build failed because module is not on class path
Android.view.KeyCharacterMap: build failed because module is not on
class path
Android.util.DisplayMetrics: build failed because module is not on class
path
Android.os.Message: build failed because module is not on class path

...are indeed not present in the FregeAndroid repo:

https://github.com/trilogysci/FregeAndroid

So I guess this just means that FregeAndroid is not usable in its
current form? Sorry I've wasted everyone's time on this!

--Patrick


Andreas Ländle

unread,
Sep 30, 2016, 2:46:49 AM9/30/16
to Frege Programming Language, co...@funwithsoftware.org
Btw, I've send the frege java sources to the android project for further investigation on the jack compiler misbehavior - https://code.google.com/p/android/issues/detail?id=211164
Frege seems to be an excellent project to verify the correctness of java compilers ;-)

Barry Burd

unread,
Oct 1, 2016, 5:02:16 PM10/1/16
to Frege Programming Language, co...@funwithsoftware.org
Andreas,
You say that Frege works with JDK7. Can you post explicit instructions describing what you did? I'd really like to get it working for myself.
Thanks.
  --Barry

Andreas Ländle

unread,
Oct 7, 2016, 1:11:51 AM10/7/16
to Frege Programming Language, co...@funwithsoftware.org
Hi Barry,
unfortunately I have no sample project that I could publish. But maybe we could support you if you give us more details about the things you are struggling with?
Br,
Andreas

Patrick Pelletier

unread,
Oct 8, 2016, 12:27:14 AM10/8/16
to frege-program...@googlegroups.com
I've published a complete, working sample project here:

https://github.com/ppelleti/frege-on-android

based on the build.gradle snippet that Andreas sent out earlier. I
wasn't able to call the Android API from Frege, because the FregeAndroid
wrapper turns out to be missing files. But I can call Frege code from
the Java code in an Android app just fine.

--Patrick
> --
> You received this message because you are subscribed to the Google
> Groups "Frege Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
> frege-programming-l...@googlegroups.com
> <mailto:frege-programming-l...@googlegroups.com>.

Michael Chavinda

unread,
Nov 27, 2016, 1:18:54 PM11/27/16
to Frege Programming Language, co...@funwithsoftware.org
Building on the work done by Patrick I've managed to get an app working only in Frege. I'll keep working on it to help integrate it into the Android system at large and eventually make a plugin.

Reply all
Reply to author
Forward
0 new messages