Gradle source encoding handling for tests

已查看 135 次
跳至第一个未读帖子

Mark Hoffmann

未读,
2020年11月3日 04:33:142020/11/3
收件人 bndtool...@googlegroups.com
Hi all,

I currently migrated a project to bnd that uses cp1252 as source encoding.

As far I have read, gradle uses the default system encoding from the OS,
which is in that case also cp1252. So the build itself runs fine. But
the tests not. I experience "unmappable character for encoding UTF-8"
errors when compiling test sources.

I googled and found nothing that works:

- -Dfile.encoding=cp1252

- compileTestJava.option.encoding='cp1252'

- task.withType(Test) { systemProperty "file.encoding", "Cp1252" }

Am I doing sthg completely wrong or is there something special with the
bnd test tasks in that area, so that these properties have no effect?

Regards,

Mark

--
Mark Hoffmann
M.A. Dipl.-Betriebswirt (FH)
Geschäftsführer

Tel: +49 3641 384 910 0
Mobil: +49 175 701 2201
E-Mail: m.hof...@data-in-motion.biz
Web: www.datainmotion.de

Data In Motion Consulting GmbH
Kahlaische Straße 4
07745 Jena

Geschäftsführer
Mark Hoffmann
Jürgen Albert

Jena HRB 513025
Steuernummer 162/107/05779
USt-Id DE310002614


Mark Hoffmann

未读,
2020年11月3日 05:11:242020/11/3
收件人 bndtool...@googlegroups.com
Hi all,

I finally found a solution by placing the build.gradle in the test
project with:

tasks.withType(JavaCompile) {
    options.encoding = "cp152"

}

Maybe there is an more elegant place, to cover this setup for all projects?

Regards,

Mark

Am 03.11.20 um 10:33 schrieb Mark Hoffmann:

Peter Kriens

未读,
2020年11月3日 06:39:592020/11/3
收件人 via bndtools-users
My god, just convert the frigging files to plain ASCII? That is a one time task and this encoding will bite you forever in the future.

And since CP1252 is ASCII++, the number problems is probably quite minimal?

PK
> --
> You received this message because you are subscribed to the Google Groups "bndtools-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bndtools-users/fc9b86dd-d630-8082-e809-014b3bcd2904%40data-in-motion.biz.

Mark Hoffmann

未读,
2020年11月3日 06:51:552020/11/3
收件人 bndtool...@googlegroups.com
Hi Peter,

it will not bite me, but my customer. Thats the reason why its not my decision to do that.

It seems for now I have to live with this situation. 😐

Regards,

Mark Hoffmann 
M.A. Dipl.-Betriebswirt (FH) 
CEO/CTO 

Phone: +49 3641 384 910


Data In Motion Consulting GmbH 
Kahlaische Strasse 4 
07745 Jena 
Germany 

Geschäftsführer/CEO 
Mark Hoffmann 
Jürgen Albert 

Jena HRB 513025 
Steuernummer 162/107/05779 
USt-Id DE310002614


-------- Ursprüngliche Nachricht --------
Von: Peter Kriens <pkr...@gmail.com>
Datum: 03.11.20 12:39 (GMT+01:00)
An: via bndtools-users <bndtool...@googlegroups.com>
Betreff: Re: Gradle source encoding handling for tests

Peter Kriens

未读,
2020年11月3日 06:59:432020/11/3
收件人 via bndtools-users
Telling the customer they wrong is always the most fun part of the job of being a consultant :-) Especially when, like in this case, you're right. 

We recently talked about purity and hacks that make builds more complicated. This is a perfect example. It looks innocuous but with a few more of those you talk about serious problems down the line.

Kind regards,

Peter Kriens

Mark Hoffmann

未读,
2020年11月3日 07:23:592020/11/3
收件人 bndtool...@googlegroups.com
... beside the fact that you are right, this makes their new build not complicated compared to what they have now ...

Ray formed the term "Frankenbuild", which hits exactly the point. And encoding problems are only one construction area...

Cheers

Mark Hoffmann 
M.A. Dipl.-Betriebswirt (FH) 
CEO/CTO 

Phone: +49 3641 384 910


Data In Motion Consulting GmbH 
Kahlaische Strasse 4 
07745 Jena 
Germany 

Geschäftsführer/CEO 
Mark Hoffmann 
Jürgen Albert 

Jena HRB 513025 
Steuernummer 162/107/05779 
USt-Id DE310002614


-------- Ursprüngliche Nachricht --------
Von: Peter Kriens <peter....@aqute.biz>
Datum: 03.11.20 12:59 (GMT+01:00)
回复全部
回复作者
转发
0 个新帖子